From c07c6ec04ffbc825629775579877da10c44fd70d Mon Sep 17 00:00:00 2001 From: "Brian R. Bondy" Date: Wed, 7 Feb 2018 15:52:35 -0500 Subject: [PATCH] One RegisterProfilePrefs to rule them all One RegisterProfilePrefs to find them one RegisterProfilePrefs to bring them all And in the darkness bind them --- browser/BUILD.gn | 2 ++ browser/brave_profile_prefs.cc | 19 +++++++++++++++++++ browser/brave_profile_prefs.h | 18 ++++++++++++++++++ ...hrome-browser-prefs-browser_prefs.cc.patch | 6 +++--- 4 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 browser/brave_profile_prefs.cc create mode 100644 browser/brave_profile_prefs.h diff --git a/browser/BUILD.gn b/browser/BUILD.gn index 6778e002d0ed..18ba1c631b29 100644 --- a/browser/BUILD.gn +++ b/browser/BUILD.gn @@ -8,6 +8,8 @@ source_set("browser_process") { "brave_browser_process_impl.h", "brave_tab_helpers.cc", "brave_tab_helpers.h", + "brave_profile_prefs.cc", + "brave_profile_prefs.h" ] deps = [ diff --git a/browser/brave_profile_prefs.cc b/browser/brave_profile_prefs.cc new file mode 100644 index 000000000000..6cfbcd21d2dd --- /dev/null +++ b/browser/brave_profile_prefs.cc @@ -0,0 +1,19 @@ +/* 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/. */ + +#include "brave/browser/brave_profile_prefs.h" + +#include "brave/components/brave_shields/browser/brave_shields_web_contents_observer.h" +#include "components/pref_registry/pref_registry_syncable.h" + + +namespace brave { + +void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { + brave_shields::BraveShieldsWebContentsObserver::RegisterProfilePrefs(registry); +} + +} // namespace brave + + diff --git a/browser/brave_profile_prefs.h b/browser/brave_profile_prefs.h new file mode 100644 index 000000000000..ea0c2781bd98 --- /dev/null +++ b/browser/brave_profile_prefs.h @@ -0,0 +1,18 @@ +/* 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/. */ + +#ifndef BRAVE_BROWSER_BRAVE_BRAVE_PROFILE_PREFS_H_ +#define BRAVE_BROWSER_BRAVE_BRAVE_PROFILE_PREFS_H_ + +namespace user_prefs { +class PrefRegistrySyncable; +} + +namespace brave { + +void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); + +} // namespace brave + +#endif // BRAVE_BROWSER_BRAVE_BRAVE_PROFILE_PREFS_H_ diff --git a/patches/chrome-browser-prefs-browser_prefs.cc.patch b/patches/chrome-browser-prefs-browser_prefs.cc.patch index 95e13c94542d..12ba1a383c13 100644 --- a/patches/chrome-browser-prefs-browser_prefs.cc.patch +++ b/patches/chrome-browser-prefs-browser_prefs.cc.patch @@ -1,12 +1,12 @@ diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc -index 90b5ed12f2785e73700866e8027f99849f030129..de023f0485e6c472f935f6c75869684172e2942b 100644 +index 90b5ed12f2785e73700866e8027f99849f030129..187009cd17f7b3f8f3b00e50638f8c5151837091 100644 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc @@ -8,6 +8,7 @@ #include "base/metrics/histogram_macros.h" #include "base/trace_event/trace_event.h" -+#include "brave/components/brave_shields/browser/brave_shields_web_contents_observer.h" ++#include "brave/browser/brave_profile_prefs.h" #include "build/build_config.h" #include "chrome/browser/about_flags.h" #include "chrome/browser/accessibility/invert_bubble_prefs.h" @@ -14,7 +14,7 @@ index 90b5ed12f2785e73700866e8027f99849f030129..de023f0485e6c472f935f6c758696841 SCOPED_UMA_HISTOGRAM_TIMER("Settings.RegisterProfilePrefsTime"); // User prefs. Please keep this list alphabetized. autofill::AutofillManager::RegisterProfilePrefs(registry); -+ brave_shields::BraveShieldsWebContentsObserver::RegisterProfilePrefs(registry); ++ brave::RegisterProfilePrefs(registry); browsing_data::prefs::RegisterBrowserUserPrefs(registry); certificate_transparency::CTPolicyManager::RegisterPrefs(registry); ChromeContentBrowserClient::RegisterProfilePrefs(registry);