0

Move backup_util and bundle_locations to base/apple

Bug: 1444927
Change-Id: I1249c06632a27e7c2f403d543f04a815f08bdb00
Include-Ci-Only-Tests: true
Validate-Test-Flakiness: skip
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4525355
Commit-Queue: Avi Drissman <avi@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Owners-Override: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1143395}
This commit is contained in:
Avi Drissman
2023-05-12 18:05:44 +00:00
committed by Chromium LUCI CQ
parent c306ea8ec8
commit d4f0708352
107 changed files with 319 additions and 316 deletions
base
chrome
components
autofill
component_updater
crash
cronet
favicon
history
optimization_guide
password_manager
safe_browsing
core
translate
content
google_apis
gpu
command_buffer
config
ios
remoting/host
services/service_manager/public/cpp/service_executable
sql
ui

@ -2075,14 +2075,14 @@ component("base") {
if (is_apple) {
allow_circular_includes_from = [ ":base_arc" ]
sources += [
"apple/backup_util.h",
"apple/backup_util.mm",
"apple/bridging.h",
"apple/bundle_locations.h",
"apple/bundle_locations.mm",
"file_version_info_mac.h",
"file_version_info_mac.mm",
"files/file_util_mac.mm",
"mac/backup_util.h",
"mac/backup_util.mm",
"mac/bundle_locations.h",
"mac/bundle_locations.mm",
"mac/call_with_eh_frame.cc",
"mac/call_with_eh_frame.h",
"mac/call_with_eh_frame_asm.S",
@ -3593,8 +3593,8 @@ test("base_unittests") {
sources += [
"allocator/partition_allocator/shim/allocator_interception_mac_unittest.mm",
"allocator/partition_allocator/shim/malloc_zone_functions_mac_unittest.cc",
"apple/backup_util_unittest.mm",
"enterprise_util_mac_unittest.mm",
"mac/backup_util_unittest.mm",
"mac/bind_objc_block_unittest.mm",
"mac/call_with_eh_frame_unittest.mm",
"mac/dispatch_source_mach_unittest.cc",
@ -3756,7 +3756,7 @@ test("base_unittests") {
sources += [
# Pull in specific Mac files for iOS.
"mac/backup_util_unittest.mm",
"apple/backup_util_unittest.mm",
"mac/bind_objc_block_unittest.mm",
"mac/foundation_util_unittest.mm",
"mac/scoped_nsobject_unittest.mm",

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BASE_MAC_BACKUP_UTIL_H_
#define BASE_MAC_BACKUP_UTIL_H_
#ifndef BASE_APPLE_BACKUP_UTIL_H_
#define BASE_APPLE_BACKUP_UTIL_H_
#include "base/base_export.h"
@ -11,7 +11,7 @@ namespace base {
class FilePath;
}
namespace base::mac {
namespace base::apple {
// Returns true if the file or directory at `file_path` is excluded from
// OS-managed backups.
@ -26,6 +26,6 @@ BASE_EXPORT bool SetBackupExclusion(const FilePath& file_path);
// occurs.
BASE_EXPORT bool ClearBackupExclusion(const FilePath& file_path);
} // namespace base::mac
} // namespace base::apple
#endif // BASE_MAC_BACKUP_UTIL_H_
#endif // BASE_APPLE_BACKUP_UTIL_H_

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/mac/backup_util.h"
#include "base/apple/backup_util.h"
#import <Foundation/Foundation.h>
@ -12,13 +12,13 @@
#include "base/strings/sys_string_conversions.h"
#include "base/threading/scoped_blocking_call.h"
namespace base::mac {
namespace base::apple {
bool GetBackupExclusion(const FilePath& file_path) {
base::ScopedBlockingCall scoped_blocking_call(FROM_HERE,
base::BlockingType::MAY_BLOCK);
NSURL* file_url = FilePathToNSURL(file_path);
NSURL* file_url = mac::FilePathToNSURL(file_path);
DCHECK([file_url checkPromisedItemIsReachableAndReturnError:nil]);
NSError* error = nil;
@ -40,7 +40,7 @@ bool SetBackupState(const FilePath& file_path, bool excluded) {
base::ScopedBlockingCall scoped_blocking_call(FROM_HERE,
base::BlockingType::MAY_BLOCK);
NSURL* file_url = FilePathToNSURL(file_path);
NSURL* file_url = mac::FilePathToNSURL(file_path);
DCHECK([file_url checkPromisedItemIsReachableAndReturnError:nil]);
NSError* error = nil;
@ -61,4 +61,4 @@ bool ClearBackupExclusion(const FilePath& file_path) {
return SetBackupState(file_path, false);
}
} // namespace base::mac
} // namespace base::apple

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/mac/backup_util.h"
#include "base/apple/backup_util.h"
#include <stddef.h>
#include <stdint.h>
@ -17,7 +17,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
namespace base::mac {
namespace base::apple {
namespace {
@ -45,7 +45,7 @@ TEST_F(BackupUtilTest, TestExcludeFileFromBackups_NotByPath) {
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
FilePath excluded_file_path = temp_dir_.GetPath().Append("excluded");
base::ScopedCFTypeRef<CFURLRef> excluded_url =
base::mac::FilePathToCFURL(excluded_file_path);
mac::FilePathToCFURL(excluded_file_path);
constexpr char placeholder_data[] = "All your base are belong to us!";
ASSERT_EQ(checked_cast<int>(std::size(placeholder_data)),
@ -67,4 +67,4 @@ TEST_F(BackupUtilTest, TestExcludeFileFromBackups_NotByPath) {
} // namespace
} // namespace base::mac
} // namespace base::apple

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BASE_MAC_BUNDLE_LOCATIONS_H_
#define BASE_MAC_BUNDLE_LOCATIONS_H_
#ifndef BASE_APPLE_BUNDLE_LOCATIONS_H_
#define BASE_APPLE_BUNDLE_LOCATIONS_H_
#include "base/base_export.h"
#include "base/files/file_path.h"
@ -16,7 +16,7 @@ namespace base {
class FilePath;
}
namespace base::mac {
namespace base::apple {
// This file provides several functions to explicitly request the various
// component bundles of Chrome. Please use these methods rather than calling
@ -63,6 +63,6 @@ BASE_EXPORT void SetOverrideOuterBundle(NSBundle* bundle);
BASE_EXPORT void SetOverrideFrameworkBundle(NSBundle* bundle);
#endif // __OBJC__
} // namespace base::mac
} // namespace base::apple
#endif // BASE_MAC_BUNDLE_LOCATIONS_H_
#endif // BASE_APPLE_BUNDLE_LOCATIONS_H_

@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/mac/bundle_locations.h"
#include "base/apple/bundle_locations.h"
#include "base/check.h"
#include "base/mac/foundation_util.h"
#include "base/strings/sys_string_conversions.h"
namespace base::mac {
namespace base::apple {
// NSBundle isn't threadsafe, all functions in this file must be called on the
// main thread.
@ -24,12 +24,13 @@ NSURL* MainBundleURL() {
}
FilePath MainBundlePath() {
return NSStringToFilePath(MainBundle().bundlePath);
return mac::NSStringToFilePath(MainBundle().bundlePath);
}
NSBundle* OuterBundle() {
if (g_override_outer_bundle)
if (g_override_outer_bundle) {
return g_override_outer_bundle;
}
return NSBundle.mainBundle;
}
@ -38,17 +39,18 @@ NSURL* OuterBundleURL() {
}
FilePath OuterBundlePath() {
return NSStringToFilePath(OuterBundle().bundlePath);
return mac::NSStringToFilePath(OuterBundle().bundlePath);
}
NSBundle* FrameworkBundle() {
if (g_override_framework_bundle)
if (g_override_framework_bundle) {
return g_override_framework_bundle;
}
return NSBundle.mainBundle;
}
FilePath FrameworkBundlePath() {
return NSStringToFilePath(FrameworkBundle().bundlePath);
return mac::NSStringToFilePath(FrameworkBundle().bundlePath);
}
static void AssignOverrideBundle(NSBundle* new_bundle,
@ -63,7 +65,7 @@ static void AssignOverridePath(const FilePath& file_path,
NSBundle** override_bundle) {
NSBundle* new_bundle = nil;
if (!file_path.empty()) {
new_bundle = [NSBundle bundleWithURL:base::mac::FilePathToNSURL(file_path)];
new_bundle = [NSBundle bundleWithURL:mac::FilePathToNSURL(file_path)];
CHECK(new_bundle) << "Failed to load the bundle at " << file_path.value();
}
AssignOverrideBundle(new_bundle, override_bundle);
@ -85,4 +87,4 @@ void SetOverrideFrameworkBundlePath(const FilePath& file_path) {
AssignOverridePath(file_path, &g_override_framework_bundle);
}
} // namespace base::mac
} // namespace base::apple

@ -10,11 +10,11 @@
#include <mach-o/dyld.h>
#include <stdint.h>
#include "base/apple/bundle_locations.h"
#include "base/base_paths.h"
#include "base/check_op.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "base/notreached.h"
#include "base/path_service.h"
@ -123,11 +123,11 @@ bool PathProviderMac(int key, base::FilePath* result) {
return PathService::Get(base::DIR_MODULE, result);
}
#if BUILDFLAG(IS_IOS_MACCATALYST)
*result = base::mac::MainBundlePath()
*result = base::apple::MainBundlePath()
.Append(FILE_PATH_LITERAL("Contents"))
.Append(FILE_PATH_LITERAL("Resources"));
#else
*result = base::mac::FrameworkBundlePath().Append(
*result = base::apple::FrameworkBundlePath().Append(
FILE_PATH_LITERAL("Resources"));
#endif // BUILDFLAG(IS_IOS_MACCATALYST)
return true;

@ -6,8 +6,8 @@
#import <Foundation/Foundation.h>
#include "base/apple/bundle_locations.h"
#include "base/files/file_path.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "base/strings/sys_string_conversions.h"
#include "build/build_config.h"
@ -21,7 +21,7 @@ FileVersionInfoMac::~FileVersionInfoMac() {}
// static
std::unique_ptr<FileVersionInfo>
FileVersionInfo::CreateFileVersionInfoForCurrentModule() {
return CreateFileVersionInfo(base::mac::FrameworkBundlePath());
return CreateFileVersionInfo(base::apple::FrameworkBundlePath());
}
// static

@ -10,8 +10,8 @@
#include <string>
#include "base/apple/bundle_locations.h"
#include "base/logging.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "base/mac/mac_logging.h"
#include "base/mac/scoped_authorizationref.h"
@ -60,8 +60,8 @@ ScopedAuthorizationRef GetAuthorizationRightsWithPrompt(
// product_logo_32.png is used instead of app.icns because Authorization
// Services can't deal with .icns files.
NSString* icon_path =
[base::mac::FrameworkBundle() pathForResource:@"product_logo_32"
ofType:@"png"];
[base::apple::FrameworkBundle() pathForResource:@"product_logo_32"
ofType:@"png"];
const char* icon_path_c = [icon_path fileSystemRepresentation];
size_t icon_path_length = icon_path_c ? strlen(icon_path_c) : 0;

@ -10,9 +10,9 @@
#include <vector>
#include "base/apple/bundle_locations.h"
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/mac_logging.h"
#include "base/notreached.h"
#include "base/numerics/checked_math.h"
@ -55,7 +55,7 @@ bool UncachedAmIBundled() {
return g_override_am_i_bundled_value;
// Yes, this is cheap.
return [[base::mac::OuterBundle() bundlePath] hasSuffix:@".app"];
return [[base::apple::OuterBundle() bundlePath] hasSuffix:@".app"];
#endif
}
@ -94,12 +94,12 @@ bool IsBackgroundOnlyProcess() {
// This function really does want to examine NSBundle's idea of the main
// bundle dictionary. It needs to look at the actual running .app's
// Info.plist to access its LSUIElement property.
NSDictionary* info_dictionary = [base::mac::MainBundle() infoDictionary];
NSDictionary* info_dictionary = [base::apple::MainBundle() infoDictionary];
return [info_dictionary[@"LSUIElement"] boolValue] != NO;
}
FilePath PathForFrameworkBundleResource(const char* resource_name) {
NSBundle* bundle = base::mac::FrameworkBundle();
NSBundle* bundle = base::apple::FrameworkBundle();
NSURL* resource_url = [bundle URLForResource:@(resource_name)
withExtension:nil];
return NSURLToFilePath(resource_url);

@ -15,9 +15,9 @@
#include <sys/utsname.h>
#include <sys/xattr.h>
#include "base/apple/bundle_locations.h"
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "base/mac/mac_logging.h"
#include "base/mac/scoped_aedesc.h"
@ -96,7 +96,7 @@ class LoginItemsFileList {
}
ScopedCFTypeRef<LSSharedFileListItemRef> GetLoginItemForMainApp() {
NSURL* url = [NSURL fileURLWithPath:[base::mac::MainBundle() bundlePath]];
NSURL* url = [NSURL fileURLWithPath:[base::apple::MainBundle() bundlePath]];
return GetLoginItemForApp(url);
}

@ -13,10 +13,10 @@ class FilePath;
// |user_data_dir| parameter. If no policy is set the parameter is not changed.
void CheckUserDataDirPolicy(base::FilePath* user_data_dir);
// Sets the app bundle (base::mac::FrameworkBundle()) to the framework's bundle,
// and sets the base bundle ID (base::mac::BaseBundleID()) to the proper value
// based on the running application. The base bundle ID is the outer browser
// application's bundle ID even when running in a non-browser (helper)
// Sets the app bundle (base::apple::FrameworkBundle()) to the framework's
// bundle, and sets the base bundle ID (base::mac::BaseBundleID()) to the proper
// value based on the running application. The base bundle ID is the outer
// browser application's bundle ID even when running in a non-browser (helper)
// process.
void SetUpBundleOverrides();

@ -8,9 +8,9 @@
#include <string>
#import "base/apple/bundle_locations.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
#import "base/mac/bundle_locations.h"
#import "base/mac/foundation_util.h"
#include "base/path_service.h"
#include "base/strings/string_util.h"
@ -22,7 +22,8 @@
void SetUpBundleOverrides() {
@autoreleasepool {
base::mac::SetOverrideFrameworkBundlePath(chrome::GetFrameworkBundlePath());
base::apple::SetOverrideFrameworkBundlePath(
chrome::GetFrameworkBundlePath());
NSBundle* base_bundle = chrome::OuterAppBundle();
base::mac::SetBaseBundleID([[base_bundle bundleIdentifier] UTF8String]);

@ -9,12 +9,12 @@
#include <utility>
#include "base/apple/bundle_locations.h"
#include "base/base_switches.h"
#include "base/command_line.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/hash/md5.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "base/mac/launch_application.h"
#include "base/mac/mac_util.h"
@ -215,7 +215,7 @@ bool AppShimController::FindOrLaunchChrome() {
}
// Otherwise, launch Chrome.
base::FilePath chrome_bundle_path = base::mac::OuterBundlePath();
base::FilePath chrome_bundle_path = base::apple::OuterBundlePath();
LOG(INFO) << "Launching " << chrome_bundle_path.value();
base::CommandLine browser_command_line(base::CommandLine::NO_PROGRAM);
browser_command_line.AppendSwitchPath(switches::kUserDataDir,
@ -280,7 +280,7 @@ AppShimController::FindChromeFromSingletonLock(
// Check the process' bundle id. As above, the specified pid could have been
// reused by some other process.
NSString* expected_bundle_id = [base::mac::OuterBundle() bundleIdentifier];
NSString* expected_bundle_id = [base::apple::OuterBundle() bundleIdentifier];
NSString* lock_bundle_id = [process_from_lock bundleIdentifier];
if (![expected_bundle_id isEqualToString:lock_bundle_id]) {
LOG(WARNING) << "Singleton lock pid " << pid

@ -11,6 +11,7 @@
#include <vector>
#include "base/allocator/early_zone_registration_mac.h"
#include "base/apple/bundle_locations.h"
#include "base/at_exit.h"
#include "base/base_switches.h"
#include "base/check.h"
@ -19,7 +20,6 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/mac_logging.h"
#include "base/message_loop/message_pump_type.h"
#include "base/run_loop.h"
@ -80,9 +80,9 @@ int APP_SHIM_ENTRY_POINT_NAME(const app_mode::ChromeAppModeInfo* info) {
chrome::RegisterPathProvider();
// Set bundle paths. This loads the bundles.
base::mac::SetOverrideOuterBundlePath(
base::apple::SetOverrideOuterBundlePath(
base::FilePath(info->chrome_outer_bundle_path));
base::mac::SetOverrideFrameworkBundlePath(
base::apple::SetOverrideFrameworkBundlePath(
base::FilePath(info->chrome_framework_path));
// Note that `info->user_data_dir` for shims contains the app data path,
@ -96,12 +96,12 @@ int APP_SHIM_ENTRY_POINT_NAME(const app_mode::ChromeAppModeInfo* info) {
// Calculate the preferred locale used by Chrome. We can't use
// l10n_util::OverrideLocaleWithCocoaLocale() because it calls
// [base::mac::OuterBundle() preferredLocalizations] which gets
// [base::apple::OuterBundle() preferredLocalizations] which gets
// localizations from the bundle of the running app (i.e. it is equivalent
// to [[NSBundle mainBundle] preferredLocalizations]) instead of the target
// bundle.
NSArray* preferred_languages = [NSLocale preferredLanguages];
NSArray* supported_languages = [base::mac::OuterBundle() localizations];
NSArray* supported_languages = [base::apple::OuterBundle() localizations];
std::string preferred_localization;
for (NSString* language in preferred_languages) {
// We must convert the "-" separator to "_" to be compatible with

@ -11,6 +11,7 @@
#include <utility>
#include "apps/app_lifetime_monitor_factory.h"
#include "base/apple/bundle_locations.h"
#include "base/barrier_closure.h"
#include "base/debug/dump_without_crashing.h"
#include "base/feature_list.h"
@ -20,7 +21,6 @@
#include "base/functional/callback_helpers.h"
#include "base/hash/sha1.h"
#include "base/logging.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "base/mac/mac_logging.h"
#include "base/memory/raw_ptr.h"
@ -110,7 +110,7 @@ CreateAppShimRequirement() {
// validating. We are only interested in discovering if the framework bundle
// is code-signed, and if so what the designated requirement is.
base::ScopedCFTypeRef<CFURLRef> framework_url =
base::mac::FilePathToCFURL(base::mac::FrameworkBundlePath());
base::mac::FilePathToCFURL(base::apple::FrameworkBundlePath());
base::ScopedCFTypeRef<SecStaticCodeRef> framework_code;
OSStatus status = SecStaticCodeCreateWithPath(
framework_url, kSecCSDefaultFlags, framework_code.InitializeInto());

@ -6,10 +6,10 @@
#import <Cocoa/Cocoa.h>
#include "base/apple/bundle_locations.h"
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/mac/bundle_locations.h"
#import "base/mac/foundation_util.h"
#include "base/mac/mac_util.h"
#include "base/mac/scoped_nsobject.h"

@ -23,7 +23,7 @@
#include "third_party/sqlite/sqlite3.h"
#if BUILDFLAG(IS_MAC)
#include "base/mac/backup_util.h"
#include "base/apple/backup_util.h"
#endif
namespace extensions {
@ -87,7 +87,7 @@ void ActivityDatabase::Init(const base::FilePath& db_name) {
#if BUILDFLAG(IS_MAC)
// Exclude the database from backups.
base::mac::SetBackupExclusion(db_name);
base::apple::SetBackupExclusion(db_name);
#endif
if (!delegate_->InitDatabase(&db_))

@ -11,8 +11,8 @@
#include <tuple>
#include "base/apple/bundle_locations.h"
#include "base/logging.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "base/mac/launchd.h"
#include "base/mac/scoped_cftyperef.h"
@ -190,7 +190,7 @@ ChromeInDockStatus ChromeIsInTheDock() {
return ChromeInDockFailure;
}
NSString* launch_path = [base::mac::OuterBundle() bundlePath];
NSString* launch_path = [base::apple::OuterBundle() bundlePath];
return [PersistentAppPaths(persistent_apps) containsObject:launch_path]
? ChromeInDockTrue

@ -19,12 +19,12 @@
#include <algorithm>
#include "base/apple/bundle_locations.h"
#include "base/auto_reset.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/mac/authorization_util.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "base/mac/mac_logging.h"
#include "base/mac/mac_util.h"
@ -437,7 +437,7 @@ void ShowErrorDialog() {
DiskImageStatus IsAppRunningFromReadOnlyDiskImage(
std::string* dmg_bsd_device_name) {
return IsPathOnReadOnlyDiskImage(
base::mac::OuterBundle().bundlePath.fileSystemRepresentation,
base::apple::OuterBundle().bundlePath.fileSystemRepresentation,
dmg_bsd_device_name);
}
@ -469,7 +469,7 @@ bool MaybeInstallFromDiskImage() {
return false;
}
NSString* source_path = base::mac::OuterBundle().bundlePath;
NSString* source_path = base::apple::OuterBundle().bundlePath;
NSString* application_name = source_path.lastPathComponent;
NSString* target_path =
[application_directory stringByAppendingPathComponent:application_name];
@ -481,8 +481,8 @@ bool MaybeInstallFromDiskImage() {
}
NSURL* installer_url =
[base::mac::FrameworkBundle() URLForResource:@"install"
withExtension:@"sh"];
[base::apple::FrameworkBundle() URLForResource:@"install"
withExtension:@"sh"];
if (!installer_url) {
VLOG(1) << "Could not locate install.sh";
return false;

@ -12,12 +12,12 @@
#include <vector>
#include "base/apple/bridging.h"
#include "base/apple/bundle_locations.h"
#include "base/file_version_info.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/mac/authorization_util.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "base/mac/mac_logging.h"
#include "base/memory/ref_counted.h"
@ -277,12 +277,12 @@ NSString* const kVersionKey = @"KSVersion";
}
- (NSDictionary*)infoDictionary {
// Use base::mac::OuterBundle() to get the Chrome app's own bundle identifier
// and path, not the framework's. For auto-update, the application is
// what's significant here: it's used to locate the outermost part of the
// Use base::apple::OuterBundle() to get the Chrome app's own bundle
// identifier and path, not the framework's. For auto-update, the application
// is what's significant here: it's used to locate the outermost part of the
// application for the existence checker and other operations that need to
// see the entire application bundle.
return base::mac::OuterBundle().infoDictionary;
return base::apple::OuterBundle().infoDictionary;
}
- (NSString*)productID {
@ -302,7 +302,7 @@ NSString* const kVersionKey = @"KSVersion";
}
- (void)loadParameters {
NSBundle* appBundle = base::mac::OuterBundle();
NSBundle* appBundle = base::apple::OuterBundle();
NSDictionary* infoDictionary = self.infoDictionary;
NSString* productID =
@ -437,8 +437,8 @@ NSString* const kVersionKey = @"KSVersion";
}
// Load the KeystoneRegistration framework bundle if present. It lives
// inside the framework, so use base::mac::FrameworkBundle();
NSString* ksrPath = [base::mac::FrameworkBundle().privateFrameworksPath
// inside the framework, so use base::apple::FrameworkBundle();
NSString* ksrPath = [base::apple::FrameworkBundle().privateFrameworksPath
stringByAppendingPathComponent:@"KeystoneRegistration.framework"];
NSBundle* ksrBundle = [NSBundle bundleWithPath:ksrPath];
[ksrBundle load];
@ -883,8 +883,8 @@ NSString* const kVersionKey = @"KSVersion";
// authenticating, may actually result in different ownership being applied
// to files and directories.
NSFileManager* fileManager = NSFileManager.defaultManager;
NSString* executablePath = base::mac::OuterBundle().executablePath;
NSString* frameworkPath = base::mac::FrameworkBundle().bundlePath;
NSString* executablePath = base::apple::OuterBundle().executablePath;
NSString* frameworkPath = base::apple::FrameworkBundle().bundlePath;
return ![fileManager isWritableFileAtPath:_appPath] ||
![fileManager isWritableFileAtPath:executablePath] ||
![fileManager isWritableFileAtPath:frameworkPath];
@ -961,10 +961,9 @@ NSString* const kVersionKey = @"KSVersion";
// preflight now does, and then the preflight script can be removed instead.
// However, preflight operation (and promotion) should only be asynchronous if
// the synchronous parameter is NO.
NSString* preflightPath =
[base::mac::FrameworkBundle()
pathForResource:@"keystone_promote_preflight"
ofType:@"sh"];
NSString* preflightPath = [base::apple::FrameworkBundle()
pathForResource:@"keystone_promote_preflight"
ofType:@"sh"];
const char* preflightPathC = preflightPath.fileSystemRepresentation;
// This is typically a once per machine operation, so it is not worth caching
@ -1076,7 +1075,7 @@ NSString* const kVersionKey = @"KSVersion";
// thread to run the tool.
DCHECK(NSThread.isMainThread);
NSString* toolPath = [base::mac::FrameworkBundle()
NSString* toolPath = [base::apple::FrameworkBundle()
pathForResource:@"keystone_promote_postflight"
ofType:@"sh"];

@ -18,11 +18,11 @@
#include <string>
#include <vector>
#include "base/apple/bundle_locations.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_file.h"
#include "base/logging.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/launch_application.h"
#include "base/mac/mac_logging.h"
#include "base/mac/scoped_nsobject.h"
@ -116,7 +116,7 @@ bool RelaunchAppWithHelper(const std::string& helper,
// The first item of `args` is the path to the executable, but launch APIs
// require the path to the bundle. Rather than try to derive the bundle path
// from the executable path, substitute in the bundle path.
relaunch_args.push_back(base::mac::OuterBundlePath().value());
relaunch_args.push_back(base::apple::OuterBundlePath().value());
for (size_t i = 1; i < args.size(); ++i) {
// Strip any PSN arguments, as they apply to a specific process.
if (args[i].compare(0, strlen(kPSNArg), kPSNArg) != 0 &&

@ -8,8 +8,8 @@
#import <Foundation/Foundation.h>
#include <Security/Authorization.h>
#include "base/apple/bundle_locations.h"
#include "base/mac/authorization_util.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "base/mac/mac_logging.h"
#include "base/mac/scoped_authorizationref.h"
@ -24,7 +24,7 @@ NSString* UserAuthenticationRightName() {
// The authentication right name is of the form
// `org.chromium.Chromium.access-passwords` or
// `com.google.Chrome.access-passwords`.
return [[base::mac::MainBundle() bundleIdentifier]
return [[base::apple::MainBundle() bundleIdentifier]
stringByAppendingString:@".access-passwords"];
}

@ -9,9 +9,9 @@
#include <memory>
#include <utility>
#include "base/apple/bundle_locations.h"
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/mac/bundle_locations.h"
#include "chrome/browser/safe_browsing/incident_reporting/binary_integrity_incident.h"
#include "chrome/browser/safe_browsing/incident_reporting/incident_receiver.h"
#include "chrome/browser/safe_browsing/signature_evaluator_mac.h"
@ -113,9 +113,9 @@ std::vector<PathAndRequirement> GetCriticalPathsAndRequirements() {
// clang-format on
critical_binaries.push_back(
PathAndRequirement(base::mac::OuterBundlePath(), requirement));
PathAndRequirement(base::apple::OuterBundlePath(), requirement));
critical_binaries.push_back(
PathAndRequirement(base::mac::FrameworkBundlePath(), requirement));
PathAndRequirement(base::apple::FrameworkBundlePath(), requirement));
return critical_binaries;
}

@ -9,10 +9,10 @@
#include <memory>
#include "base/apple/bundle_locations.h"
#include "base/files/file.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "base/mac/scoped_cftyperef.h"
#include "base/path_service.h"
@ -87,9 +87,9 @@ TEST_F(BinaryIntegrityAnalyzerMacTest, GetCriticalPathsAndRequirements) {
"certificate leaf[field.1.2.840.113635.100.6.1.13] and "
"certificate leaf[subject.OU] = EQHXZ8M8AV";
paths_and_requirements_expected.push_back(
PathAndRequirement(base::mac::OuterBundlePath(), expected_req));
PathAndRequirement(base::apple::OuterBundlePath(), expected_req));
paths_and_requirements_expected.push_back(
PathAndRequirement(base::mac::FrameworkBundlePath(), expected_req));
PathAndRequirement(base::apple::FrameworkBundlePath(), expected_req));
std::vector<PathAndRequirement> paths_and_requirements =
GetCriticalPathsAndRequirements();

@ -7,7 +7,7 @@
#include <AppKit/AppKit.h>
#include <UniformTypeIdentifiers/UniformTypeIdentifiers.h>
#include "base/mac/bundle_locations.h"
#include "base/apple/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "base/mac/mac_util.h"
#include "base/mac/scoped_cftyperef.h"
@ -43,7 +43,7 @@ bool SetAsDefaultBrowser() {
if (@available(macOS 12, *)) {
// We really do want the outer bundle here, not the main bundle since
// setting a shortcut to Chrome as the default browser doesn't make sense.
NSURL* app_bundle = base::mac::OuterBundleURL();
NSURL* app_bundle = base::apple::OuterBundleURL();
if (!app_bundle) {
return false;
}
@ -67,7 +67,7 @@ bool SetAsDefaultBrowser() {
// We really do want the outer bundle here, not the main bundle since
// setting a shortcut to Chrome as the default browser doesn't make sense.
CFStringRef identifier =
base::mac::NSToCFCast(base::mac::OuterBundle().bundleIdentifier);
base::mac::NSToCFCast(base::apple::OuterBundle().bundleIdentifier);
if (!identifier) {
return false;
}
@ -116,7 +116,7 @@ bool SetAsDefaultClientForScheme(const std::string& scheme) {
if (@available(macOS 12, *)) {
// We really do want the main bundle here since it makes sense to set an
// app shortcut as a default scheme handler.
NSURL* app_bundle = base::mac::MainBundleURL();
NSURL* app_bundle = base::apple::MainBundleURL();
if (!app_bundle) {
return false;
}
@ -134,7 +134,7 @@ bool SetAsDefaultClientForScheme(const std::string& scheme) {
} else {
// We really do want the main bundle here since it makes sense to set an
// app shortcut as a default scheme handler.
NSString* identifier = base::mac::MainBundle().bundleIdentifier;
NSString* identifier = base::apple::MainBundle().bundleIdentifier;
if (!identifier) {
return false;
}
@ -208,7 +208,7 @@ bool CanApplicationHandleURL(const base::FilePath& app_path, const GURL& url) {
DefaultWebClientState GetDefaultBrowser() {
// We really do want the outer bundle here, since this we want to know the
// status of the main Chrome bundle and not a shortcut.
NSString* my_identifier = base::mac::OuterBundle().bundleIdentifier;
NSString* my_identifier = base::apple::OuterBundle().bundleIdentifier;
if (!my_identifier) {
return UNKNOWN_DEFAULT;
}
@ -257,7 +257,7 @@ DefaultWebClientState IsDefaultClientForScheme(const std::string& scheme) {
// We really do want the main bundle here since it makes sense to set an
// app shortcut as a default scheme handler.
NSString* my_identifier = base::mac::MainBundle().bundleIdentifier;
NSString* my_identifier = base::apple::MainBundle().bundleIdentifier;
if (!my_identifier) {
return UNKNOWN_DEFAULT;
}

@ -6,8 +6,8 @@
#include <stdint.h>
#include "base/apple/bundle_locations.h"
#include "base/check_op.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/scoped_nsobject.h"
#include "content/public/browser/browser_thread.h"
#include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h"
@ -63,7 +63,7 @@ constexpr int64_t kUpdateFrequencyMs = 200;
- (void)drawRect:(NSRect)dirtyRect {
// Not -[NSApplication applicationIconImage]; that fails to return a pasted
// custom icon.
NSString* appPath = [base::mac::MainBundle() bundlePath];
NSString* appPath = [base::apple::MainBundle() bundlePath];
NSImage* appIcon = [[NSWorkspace sharedWorkspace] iconForFile:appPath];
[appIcon drawInRect:[self bounds]
fromRect:NSZeroRect

@ -4,10 +4,10 @@
#import "chrome/browser/ui/cocoa/first_run_dialog_cocoa.h"
#include "base/apple/bundle_locations.h"
#include "base/command_line.h"
#include "base/compiler_specific.h"
#include "base/functional/bind.h"
#include "base/mac/bundle_locations.h"
#import "base/mac/scoped_nsobject.h"
#include "base/memory/ref_counted.h"
#include "base/run_loop.h"

@ -9,8 +9,8 @@
#include <algorithm>
#include <vector>
#include "base/apple/bundle_locations.h"
#include "base/feature_list.h"
#include "base/mac/bundle_locations.h"
#include "base/strings/sys_string_conversions.h"
#include "build/buildflag.h"
#include "chrome/browser/browser_process.h"

@ -4,7 +4,7 @@
#import "chrome/browser/ui/cocoa/test/cocoa_test_helper.h"
#include "base/mac/bundle_locations.h"
#include "base/apple/bundle_locations.h"
#include "base/path_service.h"
#include "chrome/common/chrome_constants.h"
@ -23,5 +23,5 @@ void CocoaTest::BootstrapCocoa() {
base::FilePath path;
base::PathService::Get(base::DIR_EXE, &path);
path = path.Append(chrome::kFrameworkName);
base::mac::SetOverrideFrameworkBundlePath(path);
base::apple::SetOverrideFrameworkBundlePath(path);
}

@ -6,7 +6,7 @@
#include <string>
#include "base/mac/bundle_locations.h"
#include "base/apple/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "base/strings/strcat.h"
#include "chrome/browser/google/google_brand.h"
@ -19,7 +19,7 @@ namespace {
std::string GetTag() {
std::string contents;
base::ReadFileToString(
base::mac::OuterBundlePath().Append(".want_full_installer"), &contents);
base::apple::OuterBundlePath().Append(".want_full_installer"), &contents);
return base::StrCat(
{chrome::GetChannelName(chrome::WithExtendedStable(true)),
contents == version_info::GetVersionNumber() ? "-full" : ""});
@ -37,6 +37,6 @@ updater::RegistrationRequest BrowserUpdaterClient::GetRegistrationRequest() {
google_brand::GetBrand(&req.brand_code);
req.version = base::Version(version_info::GetVersionNumber());
req.ap = GetTag();
req.existence_checker_path = base::mac::OuterBundlePath();
req.existence_checker_path = base::apple::OuterBundlePath();
return req;
}

@ -12,6 +12,7 @@
#include <sys/stat.h>
#include <unistd.h>
#include "base/apple/bundle_locations.h"
#include "base/command_line.h"
#include "base/files/file_enumerator.h"
#include "base/files/file_path.h"
@ -20,7 +21,6 @@
#include "base/functional/callback.h"
#include "base/logging.h"
#include "base/mac/authorization_util.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "base/mac/scoped_authorizationref.h"
#include "base/memory/scoped_refptr.h"
@ -54,7 +54,7 @@ base::FilePath GetUpdaterExecutablePath() {
}
bool BundleOwnedByUser(uid_t user_uid) {
const base::FilePath path = base::mac::OuterBundlePath();
const base::FilePath path = base::apple::OuterBundlePath();
base::stat_wrapper_t stat_info = {};
if (base::File::Lstat(path.value().c_str(), &stat_info) != 0) {
VPLOG(2) << "Failed to get information on path " << path.value();
@ -169,7 +169,7 @@ void InstallUpdaterAndRegisterBrowser(base::OnceClosure complete) {
// BRANDING.app/Contents/Frameworks/BRANDING.framework/Versions/V/
// Helpers/Updater.app/Contents/MacOS/Updater
const base::FilePath updater_executable_path =
base::mac::FrameworkBundlePath()
base::apple::FrameworkBundlePath()
.Append(FILE_PATH_LITERAL("Helpers"))
.Append(GetUpdaterExecutablePath());
@ -199,7 +199,7 @@ void InstallUpdaterAndRegisterBrowser(base::OnceClosure complete) {
} // namespace
std::string CurrentlyInstalledVersion() {
base::FilePath outer_bundle = base::mac::OuterBundlePath();
base::FilePath outer_bundle = base::apple::OuterBundlePath();
base::FilePath plist_path =
outer_bundle.Append("Contents").Append("Info.plist");
NSDictionary* info_plist = [NSDictionary

@ -6,10 +6,10 @@
#import <Foundation/Foundation.h>
#include "base/apple/bundle_locations.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/logging.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "base/mac/scoped_nsobject.h"
#include "base/memory/scoped_refptr.h"
@ -70,7 +70,7 @@ void BrowserUpdaterHelperClientMac::SetupSystemUpdater(
[[xpc_connection_ remoteObjectProxyWithErrorHandler:errorHandler]
setupSystemUpdaterWithBrowserPath:base::mac::FilePathToNSString(
base::mac::OuterBundlePath())
base::apple::OuterBundlePath())
reply:reply];
}

@ -22,14 +22,14 @@
#include "chrome/browser/upgrade_detector/installed_version_monitor.h"
#if BUILDFLAG(IS_MAC)
#include "base/mac/bundle_locations.h"
#include "base/apple/bundle_locations.h"
#endif
namespace {
base::FilePath GetDefaultMonitorLocation() {
#if BUILDFLAG(IS_MAC)
return base::mac::OuterBundlePath();
return base::apple::OuterBundlePath();
#else
return base::PathService::CheckedGet(base::DIR_EXE);
#endif

@ -13,6 +13,7 @@
#include <string>
#include <utility>
#include "base/apple/bundle_locations.h"
#include "base/base_switches.h"
#include "base/check_is_test.h"
#include "base/command_line.h"
@ -25,7 +26,6 @@
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/logging.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
#import "base/mac/launch_application.h"
#include "base/mac/mac_util.h"
@ -382,15 +382,15 @@ base::CommandLine BuildCommandLineForShimLaunch() {
app_mode::kLaunchedByChromeProcessId,
base::NumberToString(base::GetCurrentProcId()));
command_line.AppendSwitchPath(app_mode::kLaunchedByChromeBundlePath,
base::mac::MainBundlePath());
base::apple::MainBundlePath());
// When running unbundled (e.g, when running browser_tests), the path
// returned by base::mac::FrameworkBundlePath will not include the version.
// returned by base::apple::FrameworkBundlePath will not include the version.
// Manually append it.
// https://crbug.com/1286681
const base::FilePath framework_bundle_path =
base::mac::AmIBundled() ? base::mac::FrameworkBundlePath()
: base::mac::FrameworkBundlePath()
base::mac::AmIBundled() ? base::apple::FrameworkBundlePath()
: base::apple::FrameworkBundlePath()
.Append("Versions")
.Append(version_info::GetVersionNumber());
command_line.AppendSwitchPath(app_mode::kLaunchedByChromeFrameworkBundlePath,
@ -1129,7 +1129,8 @@ bool WebAppShortcutCreator::BuildShortcut(
return false;
}
const base::FilePath framework_bundle_path = base::mac::FrameworkBundlePath();
const base::FilePath framework_bundle_path =
base::apple::FrameworkBundlePath();
const base::FilePath executable_path =
framework_bundle_path.Append("Helpers").Append("app_mode_loader");

@ -8,8 +8,8 @@
#include <tuple>
#include "base/apple/bundle_locations.h"
#include "base/check.h"
#include "base/mac/bundle_locations.h"
#include "base/no_destructor.h"
#include "base/strings/sys_string_conversions.h"
#include "build/branding_buildflags.h"
@ -68,7 +68,7 @@ ChannelState ParseChannelId(NSString* channel) {
ChannelState DetermineChannelState() {
// Use the main Chrome application bundle and not the framework bundle.
// Keystone keys don't live in the framework.
NSBundle* bundle = base::mac::OuterBundle();
NSBundle* bundle = base::apple::OuterBundle();
if (![bundle objectForInfoDictionaryKey:@"KSProductID"]) {
// This build is not Keystone-enabled; it can't have a channel.
@ -103,7 +103,7 @@ bool SideBySideCapable() {
static const bool capable = [] {
// Use the main Chrome application bundle and not the framework bundle.
// Keystone keys don't live in the framework.
NSBundle* bundle = base::mac::OuterBundle();
NSBundle* bundle = base::apple::OuterBundle();
if (![bundle objectForInfoDictionaryKey:@"KSProductID"]) {
// This build is not Keystone-enabled, and without a channel assume it is
// side-by-side capable.

@ -29,7 +29,7 @@
#endif
#if BUILDFLAG(IS_MAC)
#include "base/mac/bundle_locations.h"
#include "base/apple/bundle_locations.h"
#include "base/mac/foundation_util.h"
#endif
@ -236,7 +236,7 @@ bool PathProvider(int key, base::FilePath* result) {
#endif
case chrome::DIR_RESOURCES:
#if BUILDFLAG(IS_MAC)
cur = base::mac::FrameworkBundlePath();
cur = base::apple::FrameworkBundlePath();
cur = cur.Append(FILE_PATH_LITERAL("Resources"));
#else
if (!base::PathService::Get(base::DIR_ASSETS, &cur))
@ -337,7 +337,7 @@ bool PathProvider(int key, base::FilePath* result) {
case chrome::FILE_RESOURCES_PACK: // Falls through.
case chrome::FILE_DEV_UI_RESOURCES_PACK:
#if BUILDFLAG(IS_MAC)
cur = base::mac::FrameworkBundlePath();
cur = base::apple::FrameworkBundlePath();
cur = cur.Append(FILE_PATH_LITERAL("Resources"))
.Append(FILE_PATH_LITERAL("resources.pak"));
#elif BUILDFLAG(IS_ANDROID)
@ -475,7 +475,7 @@ bool PathProvider(int key, base::FilePath* result) {
return false;
#else
#if BUILDFLAG(IS_MAC)
cur = base::mac::FrameworkBundlePath();
cur = base::apple::FrameworkBundlePath();
cur = cur.Append(FILE_PATH_LITERAL("Default Apps"));
#else
if (!base::PathService::Get(base::DIR_MODULE, &cur))

@ -84,7 +84,7 @@ std::string ProductDirName() {
// in the main app's bundle because it will be set differently on the canary
// channel, and the autoupdate system dictates that there can be no
// differences between channels within the versioned directory. This would
// normally use base::mac::FrameworkBundle(), but that references the
// normally use base::apple::FrameworkBundle(), but that references the
// framework bundle within the versioned directory. Ordinarily, the profile
// should not be accessed from non-browser processes, but those processes do
// attempt to get the profile directory, so direct them to look in the outer

@ -16,7 +16,7 @@
#include "chrome/common/chrome_version.h"
#if BUILDFLAG(IS_MAC)
#include "base/mac/bundle_locations.h"
#include "base/apple/bundle_locations.h"
#endif
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
@ -75,7 +75,7 @@ void AddCdmHostFilePaths(
#elif BUILDFLAG(IS_MAC)
base::FilePath framework_dir = base::mac::FrameworkBundlePath();
base::FilePath framework_dir = base::apple::FrameworkBundlePath();
base::FilePath chrome_framework_path =
framework_dir.Append(chrome::kFrameworkExecutableName);
// The signature file lives inside

@ -9,8 +9,8 @@
#include <utility>
#include <vector>
#include "base/apple/bundle_locations.h"
#include "base/barrier_closure.h"
#include "base/mac/bundle_locations.h"
#include "base/run_loop.h"
#include "base/strings/sys_string_conversions.h"
#include "base/test/bind.h"

@ -8,7 +8,7 @@
#include <utility>
#include <vector>
#include "base/mac/bundle_locations.h"
#include "base/apple/bundle_locations.h"
#include "base/run_loop.h"
#include "base/strings/sys_string_conversions.h"
#include "base/test/bind.h"
@ -488,7 +488,7 @@ TEST_F(MacNotificationServiceUNTest, LogsMetricsForAlerts) {
if (@available(macOS 10.14, *)) {
base::HistogramTester histogram_tester;
id mainBundleMock =
[OCMockObject partialMockForObject:base::mac::MainBundle()];
[OCMockObject partialMockForObject:base::apple::MainBundle()];
// Mock the alert style to "alert" and verify we log the correct metrics.
[[[mainBundleMock stub]
@ -513,7 +513,7 @@ TEST_F(MacNotificationServiceUNTest, LogsMetricsForBanners) {
if (@available(macOS 10.14, *)) {
base::HistogramTester histogram_tester;
id mainBundleMock =
[OCMockObject partialMockForObject:base::mac::MainBundle()];
[OCMockObject partialMockForObject:base::apple::MainBundle()];
// Mock the alert style to "banner" and verify we log the correct metrics.
[[[mainBundleMock stub]

@ -6,7 +6,7 @@
#import <Foundation/Foundation.h>
#include "base/mac/bundle_locations.h"
#include "base/apple/bundle_locations.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/strcat.h"
@ -17,7 +17,7 @@
namespace mac_notifications {
bool IsAppBundleAlertStyle() {
NSDictionary* infoDictionary = [base::mac::MainBundle() infoDictionary];
NSDictionary* infoDictionary = [base::apple::MainBundle() infoDictionary];
NSString* alertStyle = infoDictionary[@"NSUserNotificationAlertStyle"];
return [alertStyle isEqualToString:@"alert"];
}

@ -45,7 +45,7 @@
#include "ui/base/test/ui_controls.h"
#if BUILDFLAG(IS_MAC)
#include "base/mac/bundle_locations.h"
#include "base/apple/bundle_locations.h"
#include "chrome/browser/chrome_browser_application_mac.h"
#endif // BUILDFLAG(IS_MAC)
@ -254,7 +254,7 @@ int LaunchChromeTests(size_t parallel_jobs,
base::FilePath path;
CHECK(base::PathService::Get(base::DIR_EXE, &path));
path = path.Append(chrome::kFrameworkName);
base::mac::SetOverrideFrameworkBundlePath(path);
base::apple::SetOverrideFrameworkBundlePath(path);
#endif
#if BUILDFLAG(IS_WIN)

@ -40,7 +40,7 @@
#endif // BUILDFLAG(IS_CHROMEOS_LACROS)
#if BUILDFLAG(IS_MAC)
#include "base/mac/bundle_locations.h"
#include "base/apple/bundle_locations.h"
#include "base/mac/scoped_nsautorelease_pool.h"
#include "chrome/browser/chrome_browser_application_mac.h"
#endif
@ -107,7 +107,7 @@ void ChromeTestSuite::Initialize() {
base::FilePath path;
base::PathService::Get(base::DIR_EXE, &path);
path = path.Append(chrome::kFrameworkName);
base::mac::SetOverrideFrameworkBundlePath(path);
base::apple::SetOverrideFrameworkBundlePath(path);
#endif
#if BUILDFLAG(IS_CHROMEOS_LACROS)
@ -132,7 +132,7 @@ void ChromeTestSuite::Initialize() {
void ChromeTestSuite::Shutdown() {
#if BUILDFLAG(IS_MAC)
base::mac::SetOverrideFrameworkBundlePath({});
base::apple::SetOverrideFrameworkBundlePath({});
#endif
content::ContentTestSuiteBase::Shutdown();

@ -7,13 +7,13 @@
#include <string>
#include <vector>
#include "base/apple/bundle_locations.h"
#include "base/command_line.h"
#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/functional/callback.h"
#include "base/logging.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "base/process/launch.h"
#include "base/process/process.h"
@ -114,7 +114,7 @@ bool CopyKeystoneBundle(UpdaterScope scope) {
// The Keystone Bundle is in
// GoogleUpdater.app/Contents/Helpers/GoogleSoftwareUpdate.bundle.
base::FilePath keystone_bundle_path =
base::mac::OuterBundlePath()
base::apple::OuterBundlePath()
.Append(FILE_PATH_LITERAL("Contents"))
.Append(FILE_PATH_LITERAL("Helpers"))
.Append(FILE_PATH_LITERAL(KEYSTONE_NAME ".bundle"));

@ -9,13 +9,13 @@
#include <sys/stat.h>
#include <unistd.h>
#include "base/apple/bundle_locations.h"
#include "base/at_exit.h"
#include "base/command_line.h"
#include "base/debug/dump_without_crashing.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "base/path_service.h"
#include "base/process/launch.h"
@ -86,7 +86,7 @@ bool CopyBundle(UpdaterScope scope) {
}
}
if (!CopyDir(base::mac::OuterBundlePath(), *versioned_install_dir,
if (!CopyDir(base::apple::OuterBundlePath(), *versioned_install_dir,
scope == UpdaterScope::kSystem)) {
LOG(ERROR) << "Copying app to '" << versioned_install_dir->value().c_str()
<< "' failed";

@ -4,7 +4,7 @@
#import "components/autofill/ios/browser/autofill_agent.h"
#include "base/mac/bundle_locations.h"
#include "base/apple/bundle_locations.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/utf_string_conversions.h"
#import "base/test/ios/wait_util.h"

@ -40,7 +40,7 @@
#include "third_party/abseil-cpp/absl/types/optional.h"
#if BUILDFLAG(IS_APPLE)
#include "base/mac/backup_util.h"
#include "base/apple/backup_util.h"
#endif
namespace component_updater {
@ -173,7 +173,7 @@ Result ComponentInstaller::InstallHelper(const base::FilePath& unpack_path,
#if BUILDFLAG(IS_APPLE)
// Since components can be large and can be re-downloaded when needed, they
// are excluded from backups.
base::mac::SetBackupExclusion(local_install_path);
base::apple::SetBackupExclusion(local_install_path);
#endif
const Result result =

@ -7,7 +7,7 @@
#include <vector>
#include "base/apple/bridging.h"
#include "base/mac/bundle_locations.h"
#include "base/apple/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "base/strings/sys_string_conversions.h"
#include "build/branding_buildflags.h"
@ -32,7 +32,7 @@ const std::map<std::string, std::string>& GetProcessSimpleAnnotations() {
static std::map<std::string, std::string> annotations = []() -> auto {
std::map<std::string, std::string> process_annotations;
@autoreleasepool {
NSBundle* outer_bundle = base::mac::OuterBundle();
NSBundle* outer_bundle = base::apple::OuterBundle();
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
process_annotations["prod"] = "Chrome_iOS";
#else
@ -56,7 +56,7 @@ const std::map<std::string, std::string>& GetProcessSimpleAnnotations() {
channel = @"developer";
process_annotations["channel"] = base::SysNSStringToUTF8(channel);
NSString* version =
base::mac::ObjCCast<NSString>([base::mac::FrameworkBundle()
base::mac::ObjCCast<NSString>([base::apple::FrameworkBundle()
objectForInfoDictionaryKey:@"CFBundleVersion"]);
process_annotations["ver"] = base::SysNSStringToUTF8(version);
process_annotations["plat"] = std::string("iOS");

@ -13,9 +13,9 @@
#include <vector>
#include "base/apple/bridging.h"
#include "base/apple/bundle_locations.h"
#include "base/check.h"
#include "base/files/file_path.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_piece.h"
@ -42,7 +42,7 @@ std::map<std::string, std::string> GetProcessSimpleAnnotations() {
static std::map<std::string, std::string> annotations = []() -> auto {
std::map<std::string, std::string> process_annotations;
@autoreleasepool {
NSBundle* outer_bundle = base::mac::OuterBundle();
NSBundle* outer_bundle = base::apple::OuterBundle();
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
process_annotations["prod"] = "Chrome_Mac";
#else
@ -83,7 +83,7 @@ std::map<std::string, std::string> GetProcessSimpleAnnotations() {
}
NSString* version =
base::mac::ObjCCast<NSString>([base::mac::FrameworkBundle()
base::mac::ObjCCast<NSString>([base::apple::FrameworkBundle()
objectForInfoDictionaryKey:@"CFBundleShortVersionString"]);
process_annotations["ver"] = base::SysNSStringToUTF8(version);
@ -147,7 +147,7 @@ bool PlatformCrashpadInitialization(
if (initial_client) {
@autoreleasepool {
base::FilePath framework_bundle_path = base::mac::FrameworkBundlePath();
base::FilePath framework_bundle_path = base::apple::FrameworkBundlePath();
base::FilePath handler_path =
framework_bundle_path.Append("Helpers").Append(
"chrome_crashpad_handler");

@ -7,9 +7,9 @@
#include <memory>
#include <vector>
#include "base/apple/bundle_locations.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/mac/bundle_locations.h"
#include "base/strings/sys_string_conversions.h"
#include "base/synchronization/lock.h"
#import "base/task/single_thread_task_runner.h"

@ -32,7 +32,7 @@
#include "url/origin.h"
#if BUILDFLAG(IS_APPLE)
#include "base/mac/backup_util.h"
#include "base/apple/backup_util.h"
#endif
namespace favicon {
@ -1049,7 +1049,7 @@ sql::InitStatus FaviconDatabase::InitImpl(const base::FilePath& db_name) {
#if BUILDFLAG(IS_APPLE)
// Exclude the favicons file from backups.
base::mac::SetBackupExclusion(db_name);
base::apple::SetBackupExclusion(db_name);
#endif
// thumbnails table has been obsolete for a long time, remove any detritus.

@ -29,7 +29,7 @@
#include "sql/transaction.h"
#if BUILDFLAG(IS_APPLE)
#include "base/mac/backup_util.h"
#include "base/apple/backup_util.h"
#endif
namespace history {
@ -117,7 +117,7 @@ sql::InitStatus HistoryDatabase::Init(const base::FilePath& history_name) {
#if BUILDFLAG(IS_APPLE)
// Exclude the history file from backups.
base::mac::SetBackupExclusion(history_name);
base::apple::SetBackupExclusion(history_name);
#endif
// Prime the cache.

@ -16,7 +16,7 @@
#include "components/optimization_guide/proto/page_entities_model_metadata.pb.h"
#if BUILDFLAG(IS_MAC)
#include "base/mac/bundle_locations.h"
#include "base/apple/bundle_locations.h"
#include "base/mac/foundation_util.h"
#endif
@ -87,7 +87,7 @@ EntityAnnotatorNativeLibrary::Create(bool should_provide_filter_path) {
#if !BUILDFLAG(IS_ANDROID)
#if BUILDFLAG(IS_MAC)
if (base::mac::AmIBundled()) {
base_dir = base::mac::FrameworkBundlePath().Append("Libraries");
base_dir = base::apple::FrameworkBundlePath().Append("Libraries");
} else {
#endif // BUILDFLAG(IS_MAC)
if (!base::PathService::Get(base::DIR_MODULE, &base_dir)) {

@ -6,7 +6,7 @@
#include <stddef.h>
#include "base/mac/bundle_locations.h"
#include "base/apple/bundle_locations.h"
#include "base/strings/sys_string_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/ios/wait_util.h"

@ -21,7 +21,7 @@
#include "components/safe_browsing/core/common/proto/webui.pb.h"
#if BUILDFLAG(IS_APPLE)
#include "base/mac/backup_util.h"
#include "base/apple/backup_util.h"
#endif
using base::TimeTicks;
@ -111,7 +111,7 @@ void V4Database::CreateOnTaskRunner(
}
#if BUILDFLAG(IS_APPLE)
base::mac::SetBackupExclusion(base_path);
base::apple::SetBackupExclusion(base_path);
#endif
std::unique_ptr<StoreMap> store_map = std::make_unique<StoreMap>();

@ -6,9 +6,9 @@
#import <Foundation/Foundation.h>
#include "base/apple/bundle_locations.h"
#include "base/check.h"
#import "base/logging.h"
#include "base/mac/bundle_locations.h"
#include "base/strings/stringprintf.h"
#import "base/strings/sys_string_conversions.h"
#import "base/strings/utf_string_conversions.h"
@ -25,8 +25,8 @@ namespace {
NSString* GetPageScript(NSString* script_file_name) {
DCHECK(script_file_name);
NSString* path =
[base::mac::FrameworkBundle() pathForResource:script_file_name
ofType:@"js"];
[base::apple::FrameworkBundle() pathForResource:script_file_name
ofType:@"js"];
DCHECK(path) << "Script file not found: "
<< base::SysNSStringToUTF8(script_file_name) << ".js";
NSError* error = nil;

@ -6,11 +6,11 @@
#include <unistd.h>
#include "base/apple/bundle_locations.h"
#include "base/check.h"
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/files/file_util.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "base/mac/mac_util.h"
#include "base/no_destructor.h"
@ -104,11 +104,11 @@ void SetupCommonSandboxParameters(
sandbox::policy::kParamDisableSandboxDenialLogging, !enable_logging));
std::string bundle_path =
sandbox::policy::GetCanonicalPath(base::mac::MainBundlePath()).value();
sandbox::policy::GetCanonicalPath(base::apple::MainBundlePath()).value();
CHECK(compiler->SetParameter(sandbox::policy::kParamBundlePath, bundle_path));
std::string bundle_id = base::mac::BaseBundleID();
DCHECK(!bundle_id.empty()) << "base::mac::OuterBundle is unset";
DCHECK(!bundle_id.empty()) << "base::apple::OuterBundle is unset";
CHECK(compiler->SetParameter(sandbox::policy::kParamBundleId, bundle_id));
CHECK(compiler->SetParameter(sandbox::policy::kParamBrowserPid,
@ -124,7 +124,7 @@ void SetupCommonSandboxParameters(
#if defined(COMPONENT_BUILD)
// For component builds, allow access to one directory level higher, where
// the dylibs live.
base::FilePath component_path = base::mac::MainBundlePath().Append("..");
base::FilePath component_path = base::apple::MainBundlePath().Append("..");
std::string component_path_canonical =
sandbox::policy::GetCanonicalPath(component_path).value();
CHECK(compiler->SetParameter(sandbox::policy::kParamComponentPath,
@ -182,7 +182,7 @@ void SetupPPAPISandboxParameters(
SetupCommonSandboxParameters(compiler, command_line);
base::FilePath bundle_path =
sandbox::policy::GetCanonicalPath(base::mac::MainBundlePath());
sandbox::policy::GetCanonicalPath(base::apple::MainBundlePath());
const std::string param_base_name = "PPAPI_PATH_";
int index = 0;

@ -9,7 +9,7 @@
#include "build/build_config.h"
#if BUILDFLAG(IS_MAC)
#include "base/mac/bundle_locations.h"
#include "base/apple/bundle_locations.h"
#endif
namespace content {

@ -13,9 +13,9 @@
#include <sys/types.h>
#include <unistd.h>
#include "base/apple/bundle_locations.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/mac_util.h"
#include "base/process/kill.h"
#include "base/system/sys_info.h"
@ -57,7 +57,7 @@ void SetParametersForTest(sandbox::SandboxCompiler* compiler,
base::NumberToString(os_version)));
std::string bundle_path =
sandbox::policy::GetCanonicalPath(base::mac::MainBundlePath()).value();
sandbox::policy::GetCanonicalPath(base::apple::MainBundlePath()).value();
CHECK(compiler->SetParameter(sandbox::policy::kParamBundlePath, bundle_path));
CHECK(compiler->SetParameter(sandbox::policy::kParamBundleId,
@ -139,7 +139,7 @@ MULTIPROCESS_TEST_MAIN(SandboxProfileProcess) {
CHECK_NE(BOOTSTRAP_SUCCESS, status);
// Read bundle contents.
base::FilePath bundle_path = base::mac::MainBundlePath();
base::FilePath bundle_path = base::apple::MainBundlePath();
struct stat st;
CHECK_NE(-1, stat(bundle_path.value().c_str(), &st));

@ -9,10 +9,10 @@ namespace base {
class FilePath;
}
// Sets up base::mac::FrameworkBundle.
// Sets up base::apple::FrameworkBundle.
void OverrideFrameworkBundlePath();
// Set up base::mac::OuterBundle.
// Set up base::apple::OuterBundle.
void OverrideOuterBundlePath();
// Sets up the CHILD_PROCESS_EXE path to properly point to the helper app.

@ -4,8 +4,8 @@
#include "content/shell/app/paths_mac.h"
#include "base/apple/bundle_locations.h"
#include "base/base_paths.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "base/path_service.h"
#include "content/public/common/content_paths.h"
@ -52,17 +52,17 @@ void OverrideFrameworkBundlePath() {
base::FilePath helper_path =
GetFrameworksPath().Append("Content Shell Framework.framework");
base::mac::SetOverrideFrameworkBundlePath(helper_path);
base::apple::SetOverrideFrameworkBundlePath(helper_path);
}
void OverrideOuterBundlePath() {
base::FilePath path = GetContentsPath().DirName();
base::mac::SetOverrideOuterBundlePath(path);
base::apple::SetOverrideOuterBundlePath(path);
}
void OverrideChildProcessPath() {
base::FilePath helper_path = base::mac::FrameworkBundlePath()
base::FilePath helper_path = base::apple::FrameworkBundlePath()
.Append("Helpers")
.Append("Content Shell Helper.app")
.Append("Contents")
@ -85,8 +85,8 @@ void OverrideSourceRootPath() {
base::FilePath GetResourcesPakFilePath() {
NSString* pak_path =
[base::mac::FrameworkBundle() pathForResource:@"content_shell"
ofType:@"pak"];
[base::apple::FrameworkBundle() pathForResource:@"content_shell"
ofType:@"pak"];
return base::FilePath([pak_path fileSystemRepresentation]);
}

@ -6,10 +6,10 @@
#include <unistd.h>
#include "base/apple/bundle_locations.h"
#include "base/check.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "base/strings/sys_string_conversions.h"
#include "content/public/common/content_switches.h"
@ -62,7 +62,7 @@ void EnsureCorrectResolutionSettings() {
}
void OverrideBundleID() {
NSBundle* bundle = base::mac::OuterBundle();
NSBundle* bundle = base::apple::OuterBundle();
base::mac::SetBaseBundleID(
base::SysNSStringToUTF8([bundle bundleIdentifier]).c_str());
}

@ -6,7 +6,7 @@
#import <Cocoa/Cocoa.h>
#include "base/mac/bundle_locations.h"
#include "base/apple/bundle_locations.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."

@ -19,7 +19,7 @@
#include "ui/display/display.h"
#if BUILDFLAG(IS_MAC)
#include "base/mac/bundle_locations.h"
#include "base/apple/bundle_locations.h"
#include "base/mac/foundation_util.h"
#endif
@ -113,7 +113,7 @@ static base::FilePath GetBuildDirectory() {
if (base::mac::AmIBundled()) {
// If this is a bundled Content Shell.app, go up one from the outer bundle
// directory.
return base::mac::OuterBundlePath().DirName();
return base::apple::OuterBundlePath().DirName();
}
#endif

@ -6,7 +6,7 @@
#import <Foundation/Foundation.h>
#include "base/mac/bundle_locations.h"
#include "base/apple/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "base/strings/sys_string_conversions.h"
@ -19,7 +19,7 @@ namespace google_apis {
std::string GetAPIKeyFromInfoPlist(const std::string& key_name) {
NSString* keyName = base::SysUTF8ToNSString(key_name);
NSString* keyValue = base::mac::ObjCCast<NSString>(
[base::mac::FrameworkBundle() objectForInfoDictionaryKey:keyName]);
[base::apple::FrameworkBundle() objectForInfoDictionaryKey:keyName]);
return base::SysNSStringToUTF8(keyValue);
}

@ -12,7 +12,7 @@
#include "google_apis/google_api_keys_unittest.h"
#include "base/mac/bundle_locations.h"
#include "base/apple/bundle_locations.h"
#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "google_apis/gaia/gaia_switches.h"
@ -89,13 +89,13 @@ TEST_F(GoogleAPIKeysTest, OverrideSomeKeysUsingInfoPlist) {
[[[mock_bundle stub] andReturn:@"plist-ID_MAIN"]
objectForInfoDictionaryKey:@"GOOGLE_CLIENT_ID_MAIN"];
[[[mock_bundle stub] andReturn:nil] objectForInfoDictionaryKey:[OCMArg any]];
base::mac::SetOverrideFrameworkBundle(mock_bundle);
base::apple::SetOverrideFrameworkBundle(mock_bundle);
EXPECT_TRUE(testcase::HasAPIKeyConfigured());
EXPECT_TRUE(testcase::HasOAuthClientConfigured());
// Once the keys have been configured, the bundle isn't used anymore.
base::mac::SetOverrideFrameworkBundle(nil);
base::apple::SetOverrideFrameworkBundle(nil);
std::string api_key = testcase::g_api_key_cache.Get().api_key();
std::string id_main =

@ -13,7 +13,7 @@
#include "gpu/config/gpu_preferences.h"
#if BUILDFLAG(IS_MAC)
#include "base/mac/bundle_locations.h"
#include "base/apple/bundle_locations.h"
#include "base/mac/foundation_util.h"
#endif
@ -27,7 +27,7 @@ std::unique_ptr<DawnInstance> DawnInstance::Create(
base::FilePath module_path;
#if BUILDFLAG(IS_MAC)
if (base::mac::AmIBundled()) {
dawn_search_path = base::mac::FrameworkBundlePath()
dawn_search_path = base::apple::FrameworkBundlePath()
.Append("Libraries")
.AsEndingWithSeparator()
.MaybeAsASCII();

@ -42,7 +42,7 @@
#include "ui/gl/init/gl_factory.h"
#if BUILDFLAG(IS_MAC)
#include "base/mac/bundle_locations.h"
#include "base/apple/bundle_locations.h"
#include "base/mac/foundation_util.h"
#endif
@ -654,7 +654,7 @@ void CollectDawnInfo(const gpu::GpuPreferences& gpu_preferences,
base::FilePath module_path;
#if BUILDFLAG(IS_MAC)
if (base::mac::AmIBundled()) {
dawn_search_path = base::mac::FrameworkBundlePath()
dawn_search_path = base::apple::FrameworkBundlePath()
.Append("Libraries")
.AsEndingWithSeparator()
.MaybeAsASCII();

@ -4,12 +4,12 @@
#import "ios/chrome/app/dump_documents_statistics.h"
#import "base/apple/backup_util.h"
#import "base/files/file.h"
#import "base/files/file_enumerator.h"
#import "base/files/file_path.h"
#import "base/files/file_util.h"
#import "base/json/json_writer.h"
#import "base/mac/backup_util.h"
#import "base/mac/foundation_util.h"
#import "base/strings/stringprintf.h"
#import "base/strings/sys_string_conversions.h"
@ -70,7 +70,7 @@ base::Value::Dict CollectFileStatistics(base::FilePath root) {
statistics.Set("created", TimeToLocalString(info.creation_time));
statistics.Set("modified", TimeToLocalString(info.last_modified));
statistics.Set("excludedFromBackups", base::mac::GetBackupExclusion(root));
statistics.Set("excludedFromBackups", base::apple::GetBackupExclusion(root));
return statistics;
}

@ -6,10 +6,10 @@
#import <memory>
#import "base/apple/bundle_locations.h"
#import "base/feature_list.h"
#import "base/functional/callback.h"
#import "base/ios/ios_util.h"
#import "base/mac/bundle_locations.h"
#import "base/mac/foundation_util.h"
#import "base/metrics/histogram_functions.h"
#import "base/metrics/histogram_macros.h"
@ -424,7 +424,7 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
- (void)startUpBrowserBackgroundInitialization {
DCHECK(self.appState.initStage > InitStageSafeMode);
NSBundle* baseBundle = base::mac::OuterBundle();
NSBundle* baseBundle = base::apple::OuterBundle();
base::mac::SetBaseBundleID(
base::SysNSStringToUTF8([baseBundle bundleIdentifier]).c_str());
@ -433,7 +433,7 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
[RegisterExperimentalSettings
registerExperimentalSettingsWithUserDefaults:[NSUserDefaults
standardUserDefaults]
bundle:base::mac::
bundle:base::apple::
FrameworkBundle()];
// Register all clients before calling any web code.

@ -6,8 +6,8 @@
#import <ostream>
#import "base/apple/bundle_locations.h"
#import "base/check.h"
#import "base/mac/bundle_locations.h"
#import "base/notreached.h"
#import "base/strings/sys_string_conversions.h"

@ -6,10 +6,10 @@
#import <utility>
#import "base/apple/backup_util.h"
#import "base/check.h"
#import "base/files/file_path.h"
#import "base/files/file_util.h"
#import "base/mac/backup_util.h"
#import "base/task/sequenced_task_runner.h"
#import "base/threading/thread_restrictions.h"
#import "components/bookmarks/browser/bookmark_model.h"
@ -67,7 +67,7 @@ bool EnsureBrowserStateDirectoriesCreated(const base::FilePath& path,
// stash state directory cannot easily be done at that point.
if (!base::PathExists(otr_path) && !base::CreateDirectory(otr_path))
return false;
base::mac::SetBackupExclusion(otr_path);
base::apple::SetBackupExclusion(otr_path);
if (!base::PathExists(cache_path) && !base::CreateDirectory(cache_path))
return false;
return true;

@ -6,12 +6,12 @@
#import <Foundation/Foundation.h>
#import "base/apple/backup_util.h"
#import "base/base64url.h"
#import "base/files/file_util.h"
#import "base/files/important_file_writer.h"
#import "base/hash/sha1.h"
#import "base/ios/device_util.h"
#import "base/mac/backup_util.h"
#import "base/mac/foundation_util.h"
#import "base/path_service.h"
#import "base/strings/string_util.h"
@ -65,7 +65,7 @@ bool StoreDMTokenInDirAppDataDir(const std::string& token,
return false;
}
base::mac::SetBackupExclusion(token_file_path);
base::apple::SetBackupExclusion(token_file_path);
return true;
}

@ -6,7 +6,7 @@
#import <Foundation/Foundation.h>
#import "base/mac/backup_util.h"
#import "base/apple/backup_util.h"
#import "base/mac/foundation_util.h"
#import "base/metrics/histogram_functions.h"
#import "base/path_service.h"
@ -167,12 +167,12 @@ void PolicyWatcherBrowserAgent::UpdateAppContainerBackupExclusion() {
if (backup_allowed) {
base::ThreadPool::PostTask(
FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE},
base::BindOnce(base::IgnoreResult(&base::mac::ClearBackupExclusion),
base::BindOnce(base::IgnoreResult(&base::apple::ClearBackupExclusion),
std::move(storage_dir)));
} else {
base::ThreadPool::PostTask(
FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE},
base::BindOnce(base::IgnoreResult(&base::mac::SetBackupExclusion),
base::BindOnce(base::IgnoreResult(&base::apple::SetBackupExclusion),
std::move(storage_dir)));
}
}

@ -4,7 +4,7 @@
#import "ios/chrome/browser/policy/policy_watcher_browser_agent.h"
#import "base/mac/backup_util.h"
#import "base/apple/backup_util.h"
#import "base/mac/foundation_util.h"
#import "base/path_service.h"
#import "base/test/ios/wait_util.h"
@ -482,19 +482,19 @@ TEST_F(PolicyWatcherBrowserAgentTest, BackupPreventionChanged) {
base::FilePath storage_dir = base::mac::GetUserLibraryPath();
// Ensure that backups are allowed initially.
ASSERT_TRUE(base::mac::ClearBackupExclusion(storage_dir));
ASSERT_TRUE(base::apple::ClearBackupExclusion(storage_dir));
// Disallow backups.
browser_->GetBrowserState()->GetPrefs()->SetBoolean(
prefs::kAllowChromeDataInBackups, false);
task_environment_.RunUntilIdle();
EXPECT_TRUE(base::mac::GetBackupExclusion(storage_dir));
EXPECT_TRUE(base::apple::GetBackupExclusion(storage_dir));
// Allow backups.
browser_->GetBrowserState()->GetPrefs()->SetBoolean(
prefs::kAllowChromeDataInBackups, true);
task_environment_.RunUntilIdle();
EXPECT_FALSE(base::mac::GetBackupExclusion(storage_dir));
EXPECT_FALSE(base::apple::GetBackupExclusion(storage_dir));
}
// Tests that disabling the backup-allowed preference marks the app container
@ -503,7 +503,7 @@ TEST_F(PolicyWatcherBrowserAgentTest, BackupDisallowedAtColdStart) {
base::FilePath storage_dir = base::mac::GetUserLibraryPath();
// Ensure that backups are allowed initially.
ASSERT_TRUE(base::mac::ClearBackupExclusion(storage_dir));
ASSERT_TRUE(base::apple::ClearBackupExclusion(storage_dir));
// Disallow backups
browser_->GetBrowserState()->GetPrefs()->SetBoolean(
@ -512,7 +512,7 @@ TEST_F(PolicyWatcherBrowserAgentTest, BackupDisallowedAtColdStart) {
id mockHandler = OCMProtocolMock(@protocol(PolicyChangeCommands));
agent_->Initialize(mockHandler);
task_environment_.RunUntilIdle();
EXPECT_TRUE(base::mac::GetBackupExclusion(storage_dir));
EXPECT_TRUE(base::apple::GetBackupExclusion(storage_dir));
}
// Tests that enabling the backup-allowed preference marks the app container
@ -521,7 +521,7 @@ TEST_F(PolicyWatcherBrowserAgentTest, BackupAllowedAtColdStart) {
base::FilePath storage_dir = base::mac::GetUserLibraryPath();
// Ensure that backups are disallowed initially.
ASSERT_TRUE(base::mac::SetBackupExclusion(storage_dir));
ASSERT_TRUE(base::apple::SetBackupExclusion(storage_dir));
// Allow backups
browser_->GetBrowserState()->GetPrefs()->SetBoolean(
@ -530,5 +530,5 @@ TEST_F(PolicyWatcherBrowserAgentTest, BackupAllowedAtColdStart) {
id mockHandler = OCMProtocolMock(@protocol(PolicyChangeCommands));
agent_->Initialize(mockHandler);
task_environment_.RunUntilIdle();
EXPECT_FALSE(base::mac::GetBackupExclusion(storage_dir));
EXPECT_FALSE(base::apple::GetBackupExclusion(storage_dir));
}

@ -4,7 +4,7 @@
#import "ios/chrome/browser/policy/reporting/browser_report_generator_ios.h"
#import "base/mac/bundle_locations.h"
#import "base/apple/bundle_locations.h"
#import "base/mac/foundation_util.h"
#import "base/strings/sys_string_conversions.h"
#import "components/policy/proto/device_management_backend.pb.h"
@ -26,7 +26,7 @@ BrowserReportGeneratorIOS::BrowserReportGeneratorIOS() = default;
BrowserReportGeneratorIOS::~BrowserReportGeneratorIOS() = default;
std::string BrowserReportGeneratorIOS::GetExecutablePath() {
NSBundle* baseBundle = base::mac::OuterBundle();
NSBundle* baseBundle = base::apple::OuterBundle();
return base::SysNSStringToUTF8([baseBundle bundleIdentifier]);
}

@ -4,7 +4,7 @@
#import "ios/chrome/browser/shared/ui/util/terms_util.h"
#import "base/mac/bundle_locations.h"
#import "base/apple/bundle_locations.h"
#import "base/mac/foundation_util.h"
#import "base/strings/sys_string_conversions.h"
#import "ios/chrome/browser/shared/model/application_context/application_context.h"
@ -32,7 +32,7 @@ std::string FindFileInResource(const std::string& base_name,
const std::string& language,
const std::string& ext) {
std::string resource_file(base_name + "_" + language);
BOOL exists = [base::mac::FrameworkBundle()
BOOL exists = [base::apple::FrameworkBundle()
URLForResource:base::SysUTF8ToNSString(resource_file)
withExtension:base::SysUTF8ToNSString(ext)] != nil;
return exists ? resource_file + "." + ext : std::string();

@ -9,6 +9,7 @@
#import <set>
#import "base/apple/backup_util.h"
#import "base/base_paths.h"
#import "base/containers/contains.h"
#import "base/files/file_enumerator.h"
@ -17,7 +18,6 @@
#import "base/functional/bind.h"
#import "base/ios/crb_protocol_observers.h"
#import "base/logging.h"
#import "base/mac/backup_util.h"
#import "base/metrics/histogram_functions.h"
#import "base/path_service.h"
#import "base/sequence_checker.h"
@ -219,7 +219,7 @@ void ConvertAndSaveGreyImage(NSString* snapshot_id,
base::FilePath image_path = ImagePath(snapshot_id, IMAGE_TYPE_GREYSCALE,
image_scale, cache_directory);
WriteImageToDisk(grey_image, image_path);
base::mac::SetBackupExclusion(image_path);
base::apple::SetBackupExclusion(image_path);
}
void DeleteImageWithSnapshotID(const base::FilePath& cache_directory,

@ -6,7 +6,7 @@
#import "ios/chrome/browser/ui/browser_view/browser_view_controller+delegates.h"
#import "ios/chrome/browser/ui/browser_view/browser_view_controller+private.h"
#import "base/mac/bundle_locations.h"
#import "base/apple/bundle_locations.h"
#import "base/mac/foundation_util.h"
#import "base/strings/sys_string_conversions.h"
#import "base/task/sequenced_task_runner.h"
@ -424,7 +424,7 @@ enum HeaderBehaviour {
(KeyCommandsProvider*)keyCommandsProvider
dependencies:(BrowserViewControllerDependencies)
dependencies {
self = [super initWithNibName:nil bundle:base::mac::FrameworkBundle()];
self = [super initWithNibName:nil bundle:base::apple::FrameworkBundle()];
if (self) {
_browserContainerViewController = browserContainerViewController;
_keyCommandsProvider = keyCommandsProvider;
@ -1304,7 +1304,7 @@ enum HeaderBehaviour {
self.hideStatusBar = YES;
// Load view from Launch Screen and add it to window.
NSBundle* mainBundle = base::mac::FrameworkBundle();
NSBundle* mainBundle = base::apple::FrameworkBundle();
NSArray* topObjects = [mainBundle loadNibNamed:@"LaunchScreen"
owner:self
options:nil];

@ -4,9 +4,9 @@
#import "ios/chrome/browser/ui/find_bar/find_bar_controller_ios.h"
#import "base/apple/bundle_locations.h"
#import "base/format_macros.h"
#import "base/i18n/rtl.h"
#import "base/mac/bundle_locations.h"
#import "base/mac/foundation_util.h"
#import "base/strings/sys_string_conversions.h"
#import "components/strings/grit/components_strings.h"

@ -6,7 +6,7 @@
#import <WebKit/WebKit.h>
#import "base/mac/bundle_locations.h"
#import "base/apple/bundle_locations.h"
#import "base/strings/sys_string_conversions.h"
#import "components/strings/grit/components_strings.h"
#import "ios/chrome/browser/shared/coordinator/alert/alert_coordinator.h"

@ -4,8 +4,8 @@
#import "ios/chrome/browser/ui/main/incognito_blocker_scene_agent.h"
#import "base/apple/bundle_locations.h"
#import "base/ios/ios_util.h"
#import "base/mac/bundle_locations.h"
#import "base/mac/foundation_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
@ -104,7 +104,7 @@
}
- (UIViewController*)loadLaunchScreenControllerFromBundle {
NSBundle* mainBundle = base::mac::FrameworkBundle();
NSBundle* mainBundle = base::apple::FrameworkBundle();
NSArray* topObjects = [mainBundle loadNibNamed:@"LaunchScreen"
owner:self
options:nil];

@ -4,7 +4,7 @@
#import "ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_coordinator.h"
#import "base/mac/bundle_locations.h"
#import "base/apple/bundle_locations.h"
#import "base/mac/foundation_util.h"
#import "base/metrics/histogram_functions.h"
#import "base/metrics/user_metrics.h"

@ -8,9 +8,9 @@
#import <memory>
#import <vector>
#import "base/apple/bundle_locations.h"
#import "base/i18n/rtl.h"
#import "base/ios/ios_util.h"
#import "base/mac/bundle_locations.h"
#import "base/mac/foundation_util.h"
#import "base/metrics/histogram_functions.h"
#import "base/metrics/user_metrics.h"

@ -6,7 +6,7 @@
#import <Foundation/Foundation.h>
#import "base/mac/bundle_locations.h"
#import "base/apple/bundle_locations.h"
#import "base/memory/ref_counted_memory.h"
#import "base/strings/sys_string_conversions.h"
#import "ios/chrome/browser/shared/model/browser_state/chrome_browser_state.h"
@ -62,7 +62,7 @@ void TermsUIHTMLSource::StartDataRequest(
web::URLDataSourceIOS::GotDataCallback callback) {
NSString* terms_of_service_path =
base::SysUTF8ToNSString(GetTermsOfServicePath());
NSString* bundle_path = [base::mac::FrameworkBundle() bundlePath];
NSString* bundle_path = [base::apple::FrameworkBundle() bundlePath];
NSString* full_path =
[bundle_path stringByAppendingPathComponent:terms_of_service_path];
DCHECK(full_path);

@ -4,7 +4,7 @@
#import "ios/chrome/browser/ui/whats_new/data_source/whats_new_data_source.h"
#import "base/mac/bundle_locations.h"
#import "base/apple/bundle_locations.h"
#import "base/mac/foundation_util.h"
#import "base/notreached.h"
#import "base/strings/string_util.h"
@ -240,7 +240,7 @@ WhatsNewItem* ConstructWhatsNewItem(NSDictionary* entry) {
}
NSString* WhatsNewFilePath() {
NSString* bundle_path = [base::mac::FrameworkBundle() bundlePath];
NSString* bundle_path = [base::apple::FrameworkBundle() bundlePath];
NSString* entries_file_path =
[bundle_path stringByAppendingPathComponent:kfileName];
return entries_file_path;

@ -8,7 +8,7 @@
#import <set>
#import <utility>
#import "base/mac/bundle_locations.h"
#import "base/apple/bundle_locations.h"
#import "base/mac/foundation_util.h"
#import "base/scoped_observation.h"
#import "base/strings/sys_string_conversions.h"

@ -6,8 +6,8 @@
#import <Foundation/Foundation.h>
#import "base/apple/bundle_locations.h"
#import "base/containers/contains.h"
#import "base/mac/bundle_locations.h"
#import "base/mac/foundation_util.h"
#import "base/mac/scoped_cftyperef.h"
#import "base/strings/string_split.h"

@ -9,8 +9,8 @@
#import <memory>
#import <utility>
#import "base/apple/bundle_locations.h"
#import "base/format_macros.h"
#import "base/mac/bundle_locations.h"
#import "base/mac/foundation_util.h"
#import "base/strings/stringprintf.h"
#import "base/strings/utf_string_conversions.h"

@ -4,12 +4,12 @@
#import "ios/chrome/browser/web/chrome_web_client.h"
#import "base/apple/bundle_locations.h"
#import "base/command_line.h"
#import "base/feature_list.h"
#import "base/files/file_util.h"
#import "base/ios/ios_util.h"
#import "base/ios/ns_error_util.h"
#import "base/mac/bundle_locations.h"
#import "base/metrics/histogram_functions.h"
#import "base/no_destructor.h"
#import "base/strings/stringprintf.h"

@ -7,7 +7,7 @@
#import <Foundation/Foundation.h>
#import <dispatch/dispatch.h>
#import "base/mac/bundle_locations.h"
#import "base/apple/bundle_locations.h"
#import "base/strings/sys_string_conversions.h"
#import "build/branding_buildflags.h"
#import "components/version_info/version_info.h"
@ -61,7 +61,7 @@ version_info::Channel GetChannel() {
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
static dispatch_once_t channel_dispatch_token;
dispatch_once(&channel_dispatch_token, ^{
NSBundle* bundle = base::mac::OuterBundle();
NSBundle* bundle = base::apple::OuterBundle();
// Only Keystone-enabled build can have a channel.
if (![bundle objectForInfoDictionaryKey:@"KSProductID"])

@ -4,9 +4,9 @@
#import "ios/web/js_messaging/page_script_util.h"
#import "base/apple/bundle_locations.h"
#import "base/files/file_path.h"
#import "base/files/file_util.h"
#import "base/mac/bundle_locations.h"
#import "base/strings/sys_string_conversions.h"
#import "ios/web/public/browser_state.h"
#import "ios/web/public/web_client.h"
@ -20,8 +20,8 @@ namespace web {
NSString* GetPageScript(NSString* script_file_name) {
DCHECK(script_file_name);
NSString* path =
[base::mac::FrameworkBundle() pathForResource:script_file_name
ofType:@"js"];
[base::apple::FrameworkBundle() pathForResource:script_file_name
ofType:@"js"];
DCHECK(path) << "Script file not found: "
<< base::SysNSStringToUTF8(script_file_name) << ".js";
NSError* error = nil;

@ -9,12 +9,12 @@
#import <memory>
#import <utility>
#import "base/apple/bundle_locations.h"
#import "base/debug/dump_without_crashing.h"
#import "base/functional/bind.h"
#import "base/functional/callback.h"
#import "base/ios/ios_util.h"
#import "base/logging.h"
#import "base/mac/bundle_locations.h"
#import "base/memory/ptr_util.h"
#import "base/metrics/histogram_macros.h"
#import "base/numerics/checked_math.h"

@ -6,8 +6,8 @@
#import <algorithm>
#import "base/apple/bundle_locations.h"
#import "base/json/json_writer.h"
#import "base/mac/bundle_locations.h"
#import "base/metrics/field_trial_params.h"
#import "base/strings/escape.h"
#import "base/strings/string_util.h"
@ -79,8 +79,8 @@ bool URLNeedsUserAgentType(const GURL& url) {
GURL GetRestoreSessionBaseUrl() {
std::string restore_session_resource_path = base::SysNSStringToUTF8(
[base::mac::FrameworkBundle() pathForResource:@"restore_session"
ofType:@"html"]);
[base::apple::FrameworkBundle() pathForResource:@"restore_session"
ofType:@"html"]);
GURL::Replacements replacements;
replacements.SetSchemeStr(url::kFileScheme);
replacements.SetPathStr(restore_session_resource_path);

@ -6,7 +6,7 @@
#import <WebKit/WebKit.h>
#import "base/mac/bundle_locations.h"
#import "base/apple/bundle_locations.h"
#import "base/strings/sys_string_conversions.h"
#import "base/test/ios/wait_util.h"
#import "ios/web/js_messaging/java_script_feature_manager.h"

@ -4,21 +4,21 @@
#import "ios/web_view/internal/web_view_web_client.h"
#include <dispatch/dispatch.h>
#import <dispatch/dispatch.h>
#include "base/check.h"
#include "base/functional/bind.h"
#import "base/apple/bundle_locations.h"
#import "base/check.h"
#import "base/functional/bind.h"
#import "base/ios/ns_error_util.h"
#include "base/mac/bundle_locations.h"
#include "base/strings/sys_string_conversions.h"
#include "components/autofill/ios/browser/autofill_java_script_feature.h"
#import "base/strings/sys_string_conversions.h"
#import "components/autofill/ios/browser/autofill_java_script_feature.h"
#import "components/autofill/ios/browser/suggestion_controller_java_script_feature.h"
#import "components/autofill/ios/form_util/form_handlers_java_script_feature.h"
#import "components/language/ios/browser/language_detection_java_script_feature.h"
#import "components/password_manager/ios/password_manager_java_script_feature.h"
#import "components/security_interstitials/core/unsafe_resource.h"
#include "components/ssl_errors/error_info.h"
#include "components/strings/grit/components_strings.h"
#import "components/ssl_errors/error_info.h"
#import "components/strings/grit/components_strings.h"
#import "components/translate/ios/browser/translate_java_script_feature.h"
#import "ios/components/security_interstitials/https_only_mode/feature.h"
#import "ios/components/security_interstitials/ios_security_interstitial_java_script_feature.h"
@ -26,28 +26,28 @@
#import "ios/components/security_interstitials/lookalikes/lookalike_url_error.h"
#import "ios/components/security_interstitials/safe_browsing/safe_browsing_error.h"
#import "ios/components/security_interstitials/safe_browsing/safe_browsing_unsafe_resource_container.h"
#include "ios/components/webui/web_ui_url_constants.h"
#include "ios/web/common/user_agent.h"
#import "ios/components/webui/web_ui_url_constants.h"
#import "ios/web/common/user_agent.h"
#import "ios/web/public/navigation/navigation_manager.h"
#include "ios/web/public/security/ssl_status.h"
#include "ios/web/public/thread/web_task_traits.h"
#include "ios/web/public/thread/web_thread.h"
#import "ios/web/public/security/ssl_status.h"
#import "ios/web/public/thread/web_task_traits.h"
#import "ios/web/public/thread/web_thread.h"
#import "ios/web_view/internal/cwv_lookalike_url_handler_internal.h"
#import "ios/web_view/internal/cwv_ssl_error_handler_internal.h"
#import "ios/web_view/internal/cwv_ssl_status_internal.h"
#import "ios/web_view/internal/cwv_ssl_util.h"
#import "ios/web_view/internal/cwv_web_view_internal.h"
#import "ios/web_view/internal/safe_browsing/cwv_unsafe_url_handler_internal.h"
#include "ios/web_view/internal/web_view_browser_state.h"
#import "ios/web_view/internal/web_view_browser_state.h"
#import "ios/web_view/internal/web_view_early_page_script_provider.h"
#import "ios/web_view/internal/web_view_message_handler_java_script_feature.h"
#import "ios/web_view/internal/web_view_web_main_parts.h"
#import "ios/web_view/public/cwv_navigation_delegate.h"
#import "ios/web_view/public/cwv_web_view.h"
#import "net/base/mac/url_conversions.h"
#include "net/cert/cert_status_flags.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#import "net/cert/cert_status_flags.h"
#import "ui/base/l10n/l10n_util.h"
#import "ui/base/resource/resource_bundle.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."

@ -4,9 +4,9 @@
#import "ios/web_view/internal/web_view_web_main_delegate.h"
#import "base/apple/bundle_locations.h"
#include "base/base_paths.h"
#include "base/logging.h"
#import "base/mac/bundle_locations.h"
#include "components/component_updater/component_updater_paths.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
@ -27,7 +27,7 @@ WebViewWebMainDelegate::WebViewWebMainDelegate() {}
WebViewWebMainDelegate::~WebViewWebMainDelegate() = default;
void WebViewWebMainDelegate::BasicStartupComplete() {
base::mac::SetOverrideFrameworkBundle(
base::apple::SetOverrideFrameworkBundle(
[NSBundle bundleForClass:[CWVBundleLocator class]]);
// Sets up logging so logging levels can be controlled.

@ -6,9 +6,9 @@
#include <dlfcn.h>
#include "base/apple/bundle_locations.h"
#include "base/check.h"
#include "base/files/file_path.h"
#include "base/mac/bundle_locations.h"
#include "ui/base/l10n/l10n_util_mac.h"
#include "ui/base/resource/resource_bundle.h"
@ -26,7 +26,7 @@ bool LoadResources(const std::string& pref_locale) {
// DirName() calls strip "Contents/MacOS/<binary>" from the path.
base::FilePath path =
base::FilePath(info.dli_fname).DirName().DirName().DirName();
base::mac::SetOverrideFrameworkBundlePath(path);
base::apple::SetOverrideFrameworkBundlePath(path);
// Override the locale with the value from Cocoa.
if (pref_locale.empty()) {

@ -23,7 +23,7 @@
#include "services/service_manager/public/mojom/service.mojom.h"
#if BUILDFLAG(IS_MAC)
#include "base/mac/bundle_locations.h"
#include "base/apple/bundle_locations.h"
#endif
#if BUILDFLAG(IS_WIN)

Some files were not shown because too many files have changed in this diff Show More