diff options
author | sdefresne <sdefresne@chromium.org> | 2015-12-01 04:38:08 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-01 12:39:27 +0000 |
commit | 8593e643d96aa5540f5ef9a80c3eed4aa61394d4 (patch) | |
tree | 49a68a70776fef79c96c9aa4ba6026c9faed3fff /components | |
parent | ae249eb8d7d39470ee31d4e17564860f4157e2b7 (diff) | |
download | chromium_src-8593e643d96aa5540f5ef9a80c3eed4aa61394d4.zip chromium_src-8593e643d96aa5540f5ef9a80c3eed4aa61394d4.tar.gz chromium_src-8593e643d96aa5540f5ef9a80c3eed4aa61394d4.tar.bz2 |
Move registration of kEnabledLabsExperiments pref to flags_ui component.
In order to share the registration of prefs::kEnabledLabsExperiments,
move it to flags_ui component, in PrefServiceFlagsStorage which happens
to be the sole user of that preference.
BUG=551954
Review URL: https://codereview.chromium.org/1482963002
Cr-Commit-Position: refs/heads/master@{#362398}
Diffstat (limited to 'components')
-rw-r--r-- | components/flags_ui.gypi | 1 | ||||
-rw-r--r-- | components/flags_ui/BUILD.gn | 1 | ||||
-rw-r--r-- | components/flags_ui/DEPS | 1 | ||||
-rw-r--r-- | components/flags_ui/pref_service_flags_storage.cc | 15 | ||||
-rw-r--r-- | components/flags_ui/pref_service_flags_storage.h | 16 |
5 files changed, 33 insertions, 1 deletions
diff --git a/components/flags_ui.gypi b/components/flags_ui.gypi index b5292cd..f4c6275 100644 --- a/components/flags_ui.gypi +++ b/components/flags_ui.gypi @@ -17,6 +17,7 @@ '../components/components_strings.gyp:components_strings', '../ui/base/ui_base.gyp:ui_base', 'flags_ui_switches', + 'pref_registry', ], 'sources': [ # Note: sources list duplicated in GN build. diff --git a/components/flags_ui/BUILD.gn b/components/flags_ui/BUILD.gn index 3125261..8669902 100644 --- a/components/flags_ui/BUILD.gn +++ b/components/flags_ui/BUILD.gn @@ -22,6 +22,7 @@ source_set("flags_ui") { ":switches", "//base", "//base:prefs", + "//components/pref_registry", "//components/strings", "//ui/base", ] diff --git a/components/flags_ui/DEPS b/components/flags_ui/DEPS index 112ca0e..e7e9488 100644 --- a/components/flags_ui/DEPS +++ b/components/flags_ui/DEPS @@ -1,4 +1,5 @@ include_rules = [ + "+components/pref_registry", "+grit/components_strings.h", "+ui/base", ] diff --git a/components/flags_ui/pref_service_flags_storage.cc b/components/flags_ui/pref_service_flags_storage.cc index 544f0dd..758070d 100644 --- a/components/flags_ui/pref_service_flags_storage.cc +++ b/components/flags_ui/pref_service_flags_storage.cc @@ -4,10 +4,12 @@ #include "components/flags_ui/pref_service_flags_storage.h" +#include "base/prefs/pref_registry_simple.h" #include "base/prefs/pref_service.h" #include "base/prefs/scoped_user_pref_update.h" #include "base/values.h" #include "components/flags_ui/flags_ui_pref_names.h" +#include "components/pref_registry/pref_registry_syncable.h" namespace flags_ui { @@ -45,4 +47,17 @@ bool PrefServiceFlagsStorage::SetFlags(const std::set<std::string>& flags) { return true; } +// static +void PrefServiceFlagsStorage::RegisterPrefs(PrefRegistrySimple* registry) { + registry->RegisterListPref(prefs::kEnabledLabsExperiments); +} + +#if defined(OS_CHROMEOS) +// static +void PrefServiceFlagsStorage::RegisterProfilePrefs( + user_prefs::PrefRegistrySyncable* registry) { + registry->RegisterListPref(prefs::kEnabledLabsExperiments); +} +#endif // defined(OS_CHROMEOS) + } // namespace flags_ui diff --git a/components/flags_ui/pref_service_flags_storage.h b/components/flags_ui/pref_service_flags_storage.h index a559f8c..b230ac1 100644 --- a/components/flags_ui/pref_service_flags_storage.h +++ b/components/flags_ui/pref_service_flags_storage.h @@ -5,10 +5,16 @@ #ifndef COMPONENTS_FLAGS_UI_PREF_SERVICE_FLAGS_STORAGE_H_ #define COMPONENTS_FLAGS_UI_PREF_SERVICE_FLAGS_STORAGE_H_ -#include "base/compiler_specific.h" +#include "base/macros.h" +#include "build/build_config.h" #include "components/flags_ui/flags_storage.h" class PrefService; +class PrefRegistrySimple; + +namespace user_prefs { +class PrefRegistrySyncable; +} namespace flags_ui { @@ -22,8 +28,16 @@ class PrefServiceFlagsStorage : public FlagsStorage { std::set<std::string> GetFlags() override; bool SetFlags(const std::set<std::string>& flags) override; + static void RegisterPrefs(PrefRegistrySimple* registry); + +#if defined(OS_CHROMEOS) + static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); +#endif // defined(OS_CHROMEOS) + private: PrefService* prefs_; + + DISALLOW_COPY_AND_ASSIGN(PrefServiceFlagsStorage); }; } // namespace flags_ui |