From cf9cd47adf37e270c2ed4010085574327578141e Mon Sep 17 00:00:00 2001 From: bridiver Date: Mon, 21 Oct 2019 10:55:23 -0700 Subject: [PATCH 1/2] Fixes our use of GOOGLE_CHROME_BUILD Fixes brave/brave-browser#6496 Fixes brave/brave-browser#6497 In places we reused GOOGLE_CHROME_BUILD by defining it in particular files (either via chromium_src or by patching). GOOGLE_CHROME_BUILD is being phased out in favor of BUILDFLAG(GOOGLE_CHROME_BRANDING). This fix updates our uses where the transition has already occurred. Chromium changes: Overall issue tracker: https://bugs.chromium.org/p/chromium/issues/detail?id=961769&can=2&q=961769 Some specific changes: https://chromium.googlesource.com/chromium/src/+/0cc7112944131e379a141d8734a77cb50b97e1d5 commit 0cc7112944131e379a141d8734a77cb50b97e1d5 Author: Nico Weber Date: Mon Jul 29 17:30:40 2019 +0000 Add BUILDFLAG(GOOGLE_CHROME_BRANDING) and start using it in a few places. Also fix the definition of CHROMIUM_BRANDING; putting a negated condition there doesn't work. Thanks to Yngve Petterson for pointing that out. No behavior change. Bug: 961769 https://chromium.googlesource.com/chromium/src/+/356b304474c643e8064db763b97101100597bddd commit 356b304474c643e8064db763b97101100597bddd Author: Nico Weber Date: Fri Aug 23 15:30:41 2019 +0000 Remove all references to GOOGLE_CHROME_BUILD in components/ Bug: 961769 --- .../brave_component_updater_configurator.cc | 4 ---- .../updater/brave_update_client_config.cc | 4 ---- .../chrome/common/media/cdm_host_file_path.cc | 6 +++--- .../metrics/metrics_service_accessor.cc | 18 +++++++++++------- ...taller-util-google_update_settings.cc.patch | 17 ++++------------- 5 files changed, 18 insertions(+), 31 deletions(-) diff --git a/browser/component_updater/brave_component_updater_configurator.cc b/browser/component_updater/brave_component_updater_configurator.cc index c5ad96586064..529343445492 100644 --- a/browser/component_updater/brave_component_updater_configurator.cc +++ b/browser/component_updater/brave_component_updater_configurator.cc @@ -185,11 +185,7 @@ BraveConfigurator::GetProtocolHandlerFactory() const { update_client::RecoveryCRXElevator BraveConfigurator::GetRecoveryCRXElevator() const { -#if defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN) - return base::BindOnce(&RunRecoveryCRXElevated); -#else return {}; -#endif } } // namespace component_updater diff --git a/browser/extensions/updater/brave_update_client_config.cc b/browser/extensions/updater/brave_update_client_config.cc index 022a8104b552..3453be2edc85 100644 --- a/browser/extensions/updater/brave_update_client_config.cc +++ b/browser/extensions/updater/brave_update_client_config.cc @@ -243,11 +243,7 @@ BraveUpdateClientConfig::GetProtocolHandlerFactory() const { update_client::RecoveryCRXElevator BraveUpdateClientConfig::GetRecoveryCRXElevator() const { -#if defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN) - return base::BindOnce(&RunRecoveryCRXElevated); -#else return {}; -#endif } BraveUpdateClientConfig::~BraveUpdateClientConfig() {} 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 6375a75475d8..ef475220df87 100644 --- a/chromium_src/chrome/common/media/cdm_host_file_path.cc +++ b/chromium_src/chrome/common/media/cdm_host_file_path.cc @@ -10,18 +10,18 @@ #include "base/logging.h" #include "base/path_service.h" #include "base/stl_util.h" +#include "build/branding_buildflags.h" #include "build/build_config.h" #include "chrome/common/chrome_version.h" #if defined(OS_MACOSX) #include "base/mac/bundle_locations.h" -#include "chrome/common/buildflags.h" #include "chrome/common/chrome_constants.h" #endif // All above headers copied from original cdm_host_file_path.cc are included // to prevent below GOOGLE_CHROEM_BUILD affect them. -#define GOOGLE_CHROME_BUILD +#undef BUILDFLAG_INTERNAL_GOOGLE_CHROME_BRANDING +#define BUILDFLAG_INTERNAL_GOOGLE_CHROME_BRANDING() (1) #include "../../../../../chrome/common/media/cdm_host_file_path.cc" // NOLINT -#undef GOOGLE_CHROME_BUILD diff --git a/chromium_src/components/metrics/metrics_service_accessor.cc b/chromium_src/components/metrics/metrics_service_accessor.cc index 3404634e5960..e5ad100dad5d 100644 --- a/chromium_src/components/metrics/metrics_service_accessor.cc +++ b/chromium_src/components/metrics/metrics_service_accessor.cc @@ -2,12 +2,16 @@ * 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/. */ -#if defined(BRAVE_CHROMIUM_BUILD) -#define GOOGLE_CHROME_BUILD -#endif +#include "components/metrics/metrics_service_accessor.h" -#include "../../../../components/metrics/metrics_service_accessor.cc" +#include "base/base_switches.h" +#include "base/command_line.h" +#include "build/branding_buildflags.h" +#include "components/metrics/metrics_pref_names.h" +#include "components/metrics/metrics_service.h" +#include "components/prefs/pref_service.h" +#include "components/variations/hashing.h" -#if defined(BRAVE_CHROMIUM_BUILD) -#undef GOOGLE_CHROME_BUILD -#endif +#undef BUILDFLAG_INTERNAL_GOOGLE_CHROME_BRANDING +#define BUILDFLAG_INTERNAL_GOOGLE_CHROME_BRANDING() (1) +#include "../../../../components/metrics/metrics_service_accessor.cc" diff --git a/patches/chrome-installer-util-google_update_settings.cc.patch b/patches/chrome-installer-util-google_update_settings.cc.patch index 377789372114..0e5383c246f8 100644 --- a/patches/chrome-installer-util-google_update_settings.cc.patch +++ b/patches/chrome-installer-util-google_update_settings.cc.patch @@ -1,5 +1,5 @@ diff --git a/chrome/installer/util/google_update_settings.cc b/chrome/installer/util/google_update_settings.cc -index 441ed6d50d5cb4edcd665665fca7887f034ff6a0..709c7e5e24518902ae86ab1ef819dd9d86239d1a 100644 +index 441ed6d50d5cb4edcd665665fca7887f034ff6a0..54a22d11c380ee31e12440900cf2a365781fe8d9 100644 --- a/chrome/installer/util/google_update_settings.cc +++ b/chrome/installer/util/google_update_settings.cc @@ -29,7 +29,11 @@ using base::win::RegKey; @@ -14,23 +14,14 @@ index 441ed6d50d5cb4edcd665665fca7887f034ff6a0..709c7e5e24518902ae86ab1ef819dd9d const wchar_t GoogleUpdateSettings::kUpdatePolicyValue[] = L"UpdateDefault"; const wchar_t GoogleUpdateSettings::kDownloadPreferencePolicyValue[] = L"DownloadPreference"; -@@ -41,6 +45,11 @@ const wchar_t GoogleUpdateSettings::kCheckPeriodOverrideMinutes[] = +@@ -41,6 +45,10 @@ const wchar_t GoogleUpdateSettings::kCheckPeriodOverrideMinutes[] = const int GoogleUpdateSettings::kCheckPeriodOverrideMinutesMax = 60 * 24 * 7 * 6; -+ +#if defined(BRAVE_CHROMIUM_BUILD) && defined(OFFICIAL_BUILD) -+#define GOOGLE_CHROME_BUILD ++#undef BUILDFLAG_INTERNAL_GOOGLE_CHROME_BRANDING ++#define BUILDFLAG_INTERNAL_GOOGLE_CHROME_BRANDING() (1) +#endif -+ const GoogleUpdateSettings::UpdatePolicy GoogleUpdateSettings::kDefaultUpdatePolicy = #if BUILDFLAG(GOOGLE_CHROME_BRANDING) -@@ -836,3 +845,7 @@ bool GoogleUpdateSettings::ReadExperimentLabels( - - return result == ERROR_SUCCESS; - } -+ -+#if defined(BRAVE_CHROMIUM_BUILD) && defined(OFFICIAL_BUILD) -+#undef GOOGLE_CHROME_BUILD -+#endif From f041122976113a21c83678ef3f195b1c1f5e7052 Mon Sep 17 00:00:00 2001 From: Brian Clifton Date: Mon, 21 Oct 2019 17:02:53 -0700 Subject: [PATCH 2/2] lint fix --- chromium_src/components/metrics/metrics_service_accessor.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/chromium_src/components/metrics/metrics_service_accessor.cc b/chromium_src/components/metrics/metrics_service_accessor.cc index e5ad100dad5d..c2b9115f545d 100644 --- a/chromium_src/components/metrics/metrics_service_accessor.cc +++ b/chromium_src/components/metrics/metrics_service_accessor.cc @@ -1,4 +1,5 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public +/* Copyright (c) 2019 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/. */