From 1df125402bfc62b353d1e89a07683204b482f797 Mon Sep 17 00:00:00 2001 From: Claudio DeSouza Date: Wed, 24 May 2023 14:58:47 +0100 Subject: [PATCH] Upstream moving mac code to apple path/namespace Chromium change: https://chromium.googlesource.com/chromium/src/+/d4f07083522bf569bf0cc44f0d83f798aac1f146 commit d4f07083522bf569bf0cc44f0d83f798aac1f146 Author: Avi Drissman Date: Fri May 12 18:05:44 2023 +0000 Move backup_util and bundle_locations to base/apple Bug: 1444927 --- browser/brave_shell_integration_mac.mm | 4 ++-- browser/mac/sparkle_glue.mm | 11 ++++++----- chromium_src/chrome/browser/shell_integration_mac.mm | 2 +- chromium_src/chrome/common/channel_info_mac.mm | 11 ++++++----- .../chrome/common/media/cdm_host_file_path.cc | 2 +- .../ikev2/mac/brave_vpn_ras_connection_api_mac.mm | 2 +- ios/app/brave_core_main.mm | 8 ++++---- ios/app/brave_main_delegate.mm | 6 +++--- 8 files changed, 24 insertions(+), 22 deletions(-) diff --git a/browser/brave_shell_integration_mac.mm b/browser/brave_shell_integration_mac.mm index a23bab6b258..9d0f100c437 100644 --- a/browser/brave_shell_integration_mac.mm +++ b/browser/brave_shell_integration_mac.mm @@ -5,13 +5,13 @@ #include "brave/browser/brave_shell_integration_mac.h" -#include "base/mac/bundle_locations.h" +#include "base/apple/bundle_locations.h" #include "chrome/browser/mac/dock.h" namespace shell_integration::mac { void AddIconToDock(base::OnceCallback result_callback) { - dock::AddIcon([base::mac::MainBundle() bundlePath], nullptr); + dock::AddIcon([base::apple::MainBundle() bundlePath], nullptr); std::move(result_callback) .Run(dock::ChromeIsInTheDock() == dock::ChromeInDockTrue); diff --git a/browser/mac/sparkle_glue.mm b/browser/mac/sparkle_glue.mm index 15b7e1ed3a5..85d4700b3ef 100644 --- a/browser/mac/sparkle_glue.mm +++ b/browser/mac/sparkle_glue.mm @@ -1,6 +1,7 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public +/* Copyright (c) 2023 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ + * You can obtain one at https://mozilla.org/MPL/2.0/. */ #import "brave/browser/mac/sparkle_glue.h" @@ -8,8 +9,8 @@ #include #include +#include "base/apple/bundle_locations.h" #include "base/command_line.h" -#include "base/mac/bundle_locations.h" #include "base/mac/foundation_util.h" #import "base/mac/scoped_nsautorelease_pool.h" #import "base/mac/scoped_nsobject.h" @@ -156,7 +157,7 @@ class PerformBridge : public base::RefCountedThreadSafe { DCHECK(!su_updater_); NSString* sparkle_path = - [[base::mac::FrameworkBundle() privateFrameworksPath] + [[base::apple::FrameworkBundle() privateFrameworksPath] stringByAppendingPathComponent:@"Sparkle.framework"]; DCHECK(sparkle_path); @@ -285,7 +286,7 @@ class PerformBridge : public base::RefCountedThreadSafe { } - (void)loadParameters { - NSBundle* appBundle = base::mac::OuterBundle(); + NSBundle* appBundle = base::apple::OuterBundle(); NSString* appPath = [appBundle bundlePath]; if (!appPath) { // If parameters required for sparkle are missing, don't use it. diff --git a/chromium_src/chrome/browser/shell_integration_mac.mm b/chromium_src/chrome/browser/shell_integration_mac.mm index 05d2fd2856e..6a094770e1a 100644 --- a/chromium_src/chrome/browser/shell_integration_mac.mm +++ b/chromium_src/chrome/browser/shell_integration_mac.mm @@ -5,7 +5,7 @@ #include "chrome/browser/shell_integration.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" diff --git a/chromium_src/chrome/common/channel_info_mac.mm b/chromium_src/chrome/common/channel_info_mac.mm index 3f2a87dbe0d..a2fe50f1162 100644 --- a/chromium_src/chrome/common/channel_info_mac.mm +++ b/chromium_src/chrome/common/channel_info_mac.mm @@ -1,6 +1,7 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. +/* Copyright (c) 2023 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at https://mozilla.org/MPL/2.0/. */ #include "chrome/common/channel_info.h" @@ -8,7 +9,7 @@ #include -#include "base/mac/bundle_locations.h" +#include "base/apple/bundle_locations.h" #include "base/no_destructor.h" #include "base/strings/sys_string_conversions.h" #include "components/version_info/version_info.h" @@ -20,7 +21,7 @@ std::string GetChannelName(WithExtendedStable with_extended_stable) { static const base::NoDestructor channel([] { // 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(); NSString* channel = [bundle objectForInfoDictionaryKey:@"KSChannelID"]; diff --git a/chromium_src/chrome/common/media/cdm_host_file_path.cc b/chromium_src/chrome/common/media/cdm_host_file_path.cc index 7096aecaebf..aedb630f21b 100644 --- a/chromium_src/chrome/common/media/cdm_host_file_path.cc +++ b/chromium_src/chrome/common/media/cdm_host_file_path.cc @@ -15,7 +15,7 @@ #include "chrome/common/chrome_version.h" #if BUILDFLAG(IS_MAC) -#include "base/mac/bundle_locations.h" +#include "base/apple/bundle_locations.h" #include "chrome/common/chrome_constants.h" #endif diff --git a/components/brave_vpn/browser/connection/ikev2/mac/brave_vpn_ras_connection_api_mac.mm b/components/brave_vpn/browser/connection/ikev2/mac/brave_vpn_ras_connection_api_mac.mm index 37a083a5cff..f9ae25b818d 100644 --- a/components/brave_vpn/browser/connection/ikev2/mac/brave_vpn_ras_connection_api_mac.mm +++ b/components/brave_vpn/browser/connection/ikev2/mac/brave_vpn_ras_connection_api_mac.mm @@ -11,9 +11,9 @@ #include #include +#include "base/apple/bundle_locations.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/mac/scoped_cftyperef.h" #include "base/notreached.h" diff --git a/ios/app/brave_core_main.mm b/ios/app/brave_core_main.mm index 849a1fec14c..b534b126ea1 100644 --- a/ios/app/brave_core_main.mm +++ b/ios/app/brave_core_main.mm @@ -8,11 +8,11 @@ #import #import +#include "base/apple/bundle_locations.h" #include "base/compiler_specific.h" #include "base/files/file_path.h" #include "base/i18n/icu_util.h" #include "base/logging.h" -#include "base/mac/bundle_locations.h" #include "base/mac/foundation_util.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_refptr.h" @@ -151,7 +151,7 @@ const BraveCoreLogSeverity BraveCoreLogSeverityVerbose = ios::DIR_USER_DATA, ios::DIR_USER_DATA, ios::DIR_USER_DATA); } - NSBundle* baseBundle = base::mac::OuterBundle(); + NSBundle* baseBundle = base::apple::OuterBundle(); base::mac::SetBaseBundleID( base::SysNSStringToUTF8([baseBundle bundleIdentifier]).c_str()); @@ -492,8 +492,8 @@ static bool CustomLogHandler(int severity, + (bool)initializeICUForTesting { base::FilePath path; base::PathService::Get(base::DIR_MODULE, &path); - base::mac::SetOverrideFrameworkBundlePath(path); - base::mac::SetOverrideOuterBundlePath(path); + base::apple::SetOverrideFrameworkBundlePath(path); + base::apple::SetOverrideOuterBundlePath(path); return base::i18n::InitializeICU(); } diff --git a/ios/app/brave_main_delegate.mm b/ios/app/brave_main_delegate.mm index a41e666688b..36c6797af34 100644 --- a/ios/app/brave_main_delegate.mm +++ b/ios/app/brave_main_delegate.mm @@ -5,11 +5,11 @@ #include "brave/ios/app/brave_main_delegate.h" +#include "base/apple/bundle_locations.h" #include "base/base_paths.h" #include "base/base_switches.h" #include "base/command_line.h" #include "base/files/file_path.h" -#include "base/mac/bundle_locations.h" #include "base/path_service.h" #include "brave/components/brave_component_updater/browser/brave_component.h" #include "brave/components/brave_component_updater/browser/features.h" @@ -44,8 +44,8 @@ std::string GetUpdateURLHost() { BraveMainDelegate::BraveMainDelegate() { base::FilePath path; base::PathService::Get(base::DIR_MODULE, &path); - base::mac::SetOverrideFrameworkBundlePath(path); - base::mac::SetOverrideOuterBundlePath(path); + base::apple::SetOverrideFrameworkBundlePath(path); + base::apple::SetOverrideOuterBundlePath(path); } BraveMainDelegate::~BraveMainDelegate() {}