diff options
155 files changed, 374 insertions, 181 deletions
diff --git a/base/prefs/pref_service.cc b/base/prefs/pref_service.cc index b1f4f3f..3b0e2cb 100644 --- a/base/prefs/pref_service.cc +++ b/base/prefs/pref_service.cc @@ -21,8 +21,6 @@ #include "base/value_conversions.h" #include "build/build_config.h" -using content::BrowserContext; - namespace { class ReadErrorHandler : public PersistentPrefStore::ReadErrorDelegate { diff --git a/base/prefs/pref_service.h b/base/prefs/pref_service.h index 9ba78be..d88dc91 100644 --- a/base/prefs/pref_service.h +++ b/base/prefs/pref_service.h @@ -36,10 +36,6 @@ namespace base { class FilePath; } -namespace content { -class BrowserContext; -} - namespace subtle { class PrefMemberBase; class ScopedUserPrefUpdateBase; @@ -355,10 +351,4 @@ class BASE_PREFS_EXPORT PrefService : public base::NonThreadSafe { DISALLOW_COPY_AND_ASSIGN(PrefService); }; -// Retrieves a PrefService for the given context. -// -// TODO(joi): This doesn't really belong here, since it references a -// content type; probably best to get rid of it completely. -PrefService* PrefServiceFromBrowserContext(content::BrowserContext* context); - #endif // BASE_PREFS_PREF_SERVICE_H_ diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS index e5103c5..d5c27cc 100644 --- a/chrome/browser/DEPS +++ b/chrome/browser/DEPS @@ -7,6 +7,7 @@ include_rules = [ "+chromeos", "+components/auto_login_parser", "+components/navigation_interception", + "+components/user_prefs", "+components/visitedlink/browser", "+components/web_contents_delegate_android", "+content/public/browser", diff --git a/chrome/browser/accessibility/invert_bubble_prefs.cc b/chrome/browser/accessibility/invert_bubble_prefs.cc index 8c94e5f..fe3873a 100644 --- a/chrome/browser/accessibility/invert_bubble_prefs.cc +++ b/chrome/browser/accessibility/invert_bubble_prefs.cc @@ -4,8 +4,8 @@ #include "chrome/browser/accessibility/invert_bubble_prefs.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" namespace chrome { diff --git a/chrome/browser/autofill/DEPS b/chrome/browser/autofill/DEPS index 07d13b9..e5a94c0 100644 --- a/chrome/browser/autofill/DEPS +++ b/chrome/browser/autofill/DEPS @@ -11,8 +11,6 @@ include_rules = [ # Components-like DEPS above go here. "+third_party/libphonenumber", # For phone number i18n. - "+chrome/browser/prefs", - # TODO(joi): May be able to remove this if PKS is moved to c/b/api. "!chrome/browser/profiles/profile_keyed_service.h", diff --git a/chrome/browser/autofill/autocomplete_history_manager.cc b/chrome/browser/autofill/autocomplete_history_manager.cc index 437d14d..7ab4702 100644 --- a/chrome/browser/autofill/autocomplete_history_manager.cc +++ b/chrome/browser/autofill/autocomplete_history_manager.cc @@ -15,6 +15,7 @@ #include "chrome/common/autofill_messages.h" #include "chrome/common/form_data.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/user_prefs.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" @@ -115,8 +116,9 @@ AutocompleteHistoryManager::AutocompleteHistoryManager( pending_query_handle_(0), query_id_(0), external_delegate_(NULL) { - autofill_enabled_.Init(prefs::kAutofillEnabled, - PrefServiceFromBrowserContext(browser_context_)); + autofill_enabled_.Init( + prefs::kAutofillEnabled, + components::UserPrefs::Get(browser_context_)); } AutocompleteHistoryManager::~AutocompleteHistoryManager() { diff --git a/chrome/browser/autofill/autofill_common_test.cc b/chrome/browser/autofill/autofill_common_test.cc index 0d371e8..581db88 100644 --- a/chrome/browser/autofill/autofill_common_test.cc +++ b/chrome/browser/autofill/autofill_common_test.cc @@ -12,6 +12,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/common/form_field_data.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/user_prefs.h" namespace autofill_test { @@ -83,7 +84,7 @@ void DisableSystemServices(Profile* profile) { // Disable auxiliary profiles for unit testing. These reach out to system // services on the Mac. if (profile) { - PrefServiceFromBrowserContext(profile)->SetBoolean( + components::UserPrefs::Get(profile)->SetBoolean( prefs::kAutofillAuxiliaryProfilesEnabled, false); } } diff --git a/chrome/browser/autofill/autofill_download.cc b/chrome/browser/autofill/autofill_download.cc index ebb0074..394ca7f 100644 --- a/chrome/browser/autofill/autofill_download.cc +++ b/chrome/browser/autofill/autofill_download.cc @@ -18,6 +18,7 @@ #include "chrome/browser/autofill/autofill_xml_parser.h" #include "chrome/browser/autofill/form_structure.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/user_prefs.h" #include "content/public/browser/browser_context.h" #include "googleurl/src/gurl.h" #include "net/base/load_flags.h" @@ -70,8 +71,7 @@ AutofillDownloadManager::AutofillDownloadManager(BrowserContext* context, negative_upload_rate_(0), fetcher_id_for_unittest_(0) { DCHECK(observer_); - PrefService* preferences = - PrefServiceFromBrowserContext(browser_context_); + PrefService* preferences = components::UserPrefs::Get(browser_context_); positive_upload_rate_ = preferences->GetDouble(prefs::kAutofillPositiveUploadRate); negative_upload_rate_ = @@ -160,8 +160,7 @@ void AutofillDownloadManager::SetPositiveUploadRate(double rate) { positive_upload_rate_ = rate; DCHECK_GE(rate, 0.0); DCHECK_LE(rate, 1.0); - PrefService* preferences = PrefServiceFromBrowserContext( - browser_context_); + PrefService* preferences = components::UserPrefs::Get(browser_context_); preferences->SetDouble(prefs::kAutofillPositiveUploadRate, rate); } @@ -171,8 +170,7 @@ void AutofillDownloadManager::SetNegativeUploadRate(double rate) { negative_upload_rate_ = rate; DCHECK_GE(rate, 0.0); DCHECK_LE(rate, 1.0); - PrefService* preferences = PrefServiceFromBrowserContext( - browser_context_); + PrefService* preferences = components::UserPrefs::Get(browser_context_); preferences->SetDouble(prefs::kAutofillNegativeUploadRate, rate); } diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc index eedeb9c..8747671 100644 --- a/chrome/browser/autofill/autofill_manager.cc +++ b/chrome/browser/autofill/autofill_manager.cc @@ -40,7 +40,6 @@ #include "chrome/browser/autofill/personal_data_manager_factory.h" #include "chrome/browser/autofill/phone_number.h" #include "chrome/browser/autofill/phone_number_i18n.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/common/autofill_messages.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" @@ -50,6 +49,7 @@ #include "chrome/common/password_form_fill_data.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" diff --git a/chrome/browser/autofill/autofill_manager_unittest.cc b/chrome/browser/autofill/autofill_manager_unittest.cc index b730e49..bafbf04 100644 --- a/chrome/browser/autofill/autofill_manager_unittest.cc +++ b/chrome/browser/autofill/autofill_manager_unittest.cc @@ -38,6 +38,7 @@ #include "chrome/common/pref_names.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "chrome/test/base/testing_profile.h" +#include "components/user_prefs/user_prefs.h" #include "content/public/browser/web_contents.h" #include "content/public/common/ssl_status.h" #include "content/public/test/mock_render_process_host.h" @@ -1808,7 +1809,7 @@ TEST_F(AutofillManagerTest, FillAddressForm) { // Test that we correctly fill an address form from an auxiliary profile. TEST_F(AutofillManagerTest, FillAddressFormFromAuxiliaryProfile) { personal_data_.ClearAutofillProfiles(); - PrefService* prefs = PrefServiceFromBrowserContext(profile()); + PrefService* prefs = components::UserPrefs::Get(profile()); prefs->SetBoolean(prefs::kAutofillAuxiliaryProfilesEnabled, true); personal_data_.CreateTestAuxiliaryProfiles(); @@ -2702,7 +2703,7 @@ TEST_F(AutofillManagerTest, FormSubmittedWithDefaultValues) { // Checks that resetting the auxiliary profile enabled preference does the right // thing on all platforms. TEST_F(AutofillManagerTest, AuxiliaryProfilesReset) { - PrefService* prefs = PrefServiceFromBrowserContext(profile()); + PrefService* prefs = components::UserPrefs::Get(profile()); #if defined(OS_MACOSX) // Auxiliary profiles is implemented on Mac only. It enables Mac Address // Book integration. @@ -3003,7 +3004,7 @@ TEST_F(AutofillManagerTest, UpdatePasswordSyncState) { web_contents(), PasswordManagerDelegateImpl::FromWebContents(web_contents())); - PrefService* prefs = PrefServiceFromBrowserContext(profile()); + PrefService* prefs = components::UserPrefs::Get(profile()); // Allow this test to control what should get synced. prefs->SetBoolean(prefs::kSyncKeepEverythingSynced, false); @@ -3061,7 +3062,7 @@ TEST_F(IncognitoAutofillManagerTest, UpdatePasswordSyncStateIncognito) { web_contents(), PasswordManagerDelegateImpl::FromWebContents(web_contents())); - PrefService* prefs = PrefServiceFromBrowserContext(profile()); + PrefService* prefs = components::UserPrefs::Get(profile()); // Allow this test to control what should get synced. prefs->SetBoolean(prefs::kSyncKeepEverythingSynced, false); @@ -3081,7 +3082,7 @@ TEST_F(AutofillManagerTest, UpdatePasswordGenerationState) { web_contents(), PasswordManagerDelegateImpl::FromWebContents(web_contents())); - PrefService* prefs = PrefServiceFromBrowserContext(profile()); + PrefService* prefs = components::UserPrefs::Get(profile()); // Always set password sync enabled so we can test the behavior of password // generation. diff --git a/chrome/browser/autofill/personal_data_manager.cc b/chrome/browser/autofill/personal_data_manager.cc index 685e82d..5a93341 100644 --- a/chrome/browser/autofill/personal_data_manager.cc +++ b/chrome/browser/autofill/personal_data_manager.cc @@ -26,6 +26,7 @@ #include "chrome/browser/autofill/validation.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/user_prefs.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/notification_source.h" @@ -517,7 +518,7 @@ bool PersonalDataManager::IsDataLoaded() const { } const std::vector<AutofillProfile*>& PersonalDataManager::GetProfiles() { - if (!PrefServiceFromBrowserContext(browser_context_)->GetBoolean( + if (!components::UserPrefs::Get(browser_context_)->GetBoolean( prefs::kAutofillAuxiliaryProfilesEnabled)) { return web_profiles(); } @@ -664,7 +665,7 @@ void PersonalDataManager::GetCreditCardSuggestions( } bool PersonalDataManager::IsAutofillEnabled() const { - return PrefServiceFromBrowserContext(browser_context_)->GetBoolean( + return components::UserPrefs::Get(browser_context_)->GetBoolean( prefs::kAutofillEnabled); } diff --git a/chrome/browser/background/background_contents_service_factory.cc b/chrome/browser/background/background_contents_service_factory.cc index 525563a..172ecfe 100644 --- a/chrome/browser/background/background_contents_service_factory.cc +++ b/chrome/browser/background/background_contents_service_factory.cc @@ -7,10 +7,10 @@ #include "base/command_line.h" #include "base/prefs/pref_service.h" #include "chrome/browser/background/background_contents_service.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_dependency_manager.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" // static BackgroundContentsService* BackgroundContentsServiceFactory::GetForProfile( diff --git a/chrome/browser/bookmarks/bookmark_expanded_state_tracker.cc b/chrome/browser/bookmarks/bookmark_expanded_state_tracker.cc index 251cdf0..5c1d712 100644 --- a/chrome/browser/bookmarks/bookmark_expanded_state_tracker.cc +++ b/chrome/browser/bookmarks/bookmark_expanded_state_tracker.cc @@ -10,6 +10,7 @@ #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_model_factory.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/user_prefs.h" BookmarkExpandedStateTracker::BookmarkExpandedStateTracker( content::BrowserContext* browser_context, @@ -32,7 +33,7 @@ BookmarkExpandedStateTracker::GetExpandedNodes() { if (!bookmark_model_->IsLoaded()) return nodes; - PrefService* prefs = PrefServiceFromBrowserContext(browser_context_); + PrefService* prefs = components::UserPrefs::Get(browser_context_); if (!prefs) return nodes; @@ -88,7 +89,7 @@ void BookmarkExpandedStateTracker::BookmarkNodeRemoved( } void BookmarkExpandedStateTracker::UpdatePrefs(const Nodes& nodes) { - PrefService* prefs = PrefServiceFromBrowserContext(browser_context_); + PrefService* prefs = components::UserPrefs::Get(browser_context_); if (!prefs) return; diff --git a/chrome/browser/bookmarks/bookmark_model_factory.cc b/chrome/browser/bookmarks/bookmark_model_factory.cc index 20d4f3f..b8d23a9 100644 --- a/chrome/browser/bookmarks/bookmark_model_factory.cc +++ b/chrome/browser/bookmarks/bookmark_model_factory.cc @@ -7,10 +7,10 @@ #include "base/memory/singleton.h" #include "base/values.h" #include "chrome/browser/bookmarks/bookmark_model.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_dependency_manager.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" // static BookmarkModel* BookmarkModelFactory::GetForProfile(Profile* profile) { diff --git a/chrome/browser/bookmarks/bookmark_prompt_prefs.cc b/chrome/browser/bookmarks/bookmark_prompt_prefs.cc index 2cbab7c..c57e9a0 100644 --- a/chrome/browser/bookmarks/bookmark_prompt_prefs.cc +++ b/chrome/browser/bookmarks/bookmark_prompt_prefs.cc @@ -5,8 +5,8 @@ #include "chrome/browser/bookmarks/bookmark_prompt_prefs.h" #include "base/prefs/pref_service.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" BookmarkPromptPrefs::BookmarkPromptPrefs(PrefService* user_prefs) : prefs_(user_prefs) { diff --git a/chrome/browser/bookmarks/bookmark_utils.cc b/chrome/browser/bookmarks/bookmark_utils.cc index 5f35ce6..a7c88c9 100644 --- a/chrome/browser/bookmarks/bookmark_utils.cc +++ b/chrome/browser/bookmarks/bookmark_utils.cc @@ -19,9 +19,10 @@ #include "chrome/browser/bookmarks/bookmark_model_factory.h" #include "chrome/browser/bookmarks/bookmark_node_data.h" #include "chrome/browser/history/query_parser.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" +#include "components/user_prefs/user_prefs.h" #include "content/public/browser/user_metrics.h" #include "net/base/net_util.h" #include "ui/base/dragdrop/drag_drop_types.h" @@ -134,7 +135,7 @@ int PreferredDropOperation(int source_operations, int operations) { int BookmarkDragOperation(content::BrowserContext* browser_context, const BookmarkNode* node) { - PrefService* prefs = PrefServiceFromBrowserContext(browser_context); + PrefService* prefs = components::UserPrefs::Get(browser_context); int move = ui::DragDropTypes::DRAG_MOVE; if (!prefs->GetBoolean(prefs::kEditBookmarksEnabled)) diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index df7068a..1a47b40 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -50,7 +50,6 @@ #include "chrome/browser/notifications/desktop_notification_service_factory.h" #include "chrome/browser/platform_util.h" #include "chrome/browser/plugins/plugin_info_message_filter.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/prerender/prerender_manager.h" #include "chrome/browser/prerender/prerender_manager_factory.h" @@ -91,6 +90,7 @@ #include "chrome/common/pref_names.h" #include "chrome/common/render_messages.h" #include "chrome/common/url_constants.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/browser_child_process_host.h" #include "content/public/browser/browser_main_parts.h" #include "content/public/browser/browser_ppapi_host.h" diff --git a/chrome/browser/chrome_to_mobile_service.cc b/chrome/browser/chrome_to_mobile_service.cc index 3f98026..4d5504f 100644 --- a/chrome/browser/chrome_to_mobile_service.cc +++ b/chrome/browser/chrome_to_mobile_service.cc @@ -15,7 +15,6 @@ #include "base/utf_string_conversions.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/chrome_to_mobile_service_factory.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/printing/cloud_print/cloud_print_url.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/signin/token_service.h" @@ -34,6 +33,7 @@ #include "chrome/common/extensions/feature_switch.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" diff --git a/chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc b/chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc index 559e5be..2416f7a 100644 --- a/chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc +++ b/chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc @@ -20,6 +20,7 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_profile.h" +#include "components/user_prefs/user_prefs.h" #include "testing/gtest/include/gtest/gtest.h" namespace chromeos { @@ -66,7 +67,7 @@ Profile* profile() { } PrefService* prefs() { - return PrefServiceFromBrowserContext(profile()); + return components::UserPrefs::Get(profile()); } void EnableScreenManagnifierToPref(bool enabled) { diff --git a/chrome/browser/chromeos/language_preferences.cc b/chrome/browser/chromeos/language_preferences.cc index 9e3144f..9767397 100644 --- a/chrome/browser/chromeos/language_preferences.cc +++ b/chrome/browser/chromeos/language_preferences.cc @@ -5,8 +5,8 @@ #include "base/basictypes.h" #include "base/prefs/pref_registry_simple.h" #include "chrome/browser/chromeos/language_preferences.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "grit/generated_resources.h" namespace chromeos { diff --git a/chrome/browser/chromeos/language_preferences.h b/chrome/browser/chromeos/language_preferences.h index abde39f..c816a65 100644 --- a/chrome/browser/chromeos/language_preferences.h +++ b/chrome/browser/chromeos/language_preferences.h @@ -7,7 +7,7 @@ #include <stddef.h> // For size_t -#include "chrome/browser/prefs/pref_registry_syncable.h" +#include "components/user_prefs/pref_registry_syncable.h" class PrefRegistrySimple; diff --git a/chrome/browser/chromeos/login/oauth2_login_manager.cc b/chrome/browser/chromeos/login/oauth2_login_manager.cc index a7e8d3a..46a40b5 100644 --- a/chrome/browser/chromeos/login/oauth2_login_manager.cc +++ b/chrome/browser/chromeos/login/oauth2_login_manager.cc @@ -11,13 +11,13 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/chromeos/login/user_manager.h" #include "chrome/browser/policy/browser_policy_connector.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/signin/token_service.h" #include "chrome/browser/signin/token_service_factory.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/notification_service.h" #include "google_apis/gaia/gaia_constants.h" #include "net/url_request/url_request_context_getter.h" diff --git a/chrome/browser/chromeos/preferences.cc b/chrome/browser/chromeos/preferences.cc index 688842f..2e1b505 100644 --- a/chrome/browser/chromeos/preferences.cc +++ b/chrome/browser/chromeos/preferences.cc @@ -27,7 +27,6 @@ #include "chrome/browser/chromeos/system/input_device_settings.h" #include "chrome/browser/chromeos/system/statistics_provider.h" #include "chrome/browser/download/download_util.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/pref_service_syncable.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/common/chrome_notification_types.h" @@ -35,6 +34,7 @@ #include "chrome/common/pref_names.h" #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/power_policy_controller.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "googleurl/src/gurl.h" #include "third_party/icu/public/i18n/unicode/timezone.h" #include "ui/base/events/event_constants.h" diff --git a/chrome/browser/chromeos/proxy_config_service_impl.cc b/chrome/browser/chromeos/proxy_config_service_impl.cc index 752ebdf..913bbd8 100644 --- a/chrome/browser/chromeos/proxy_config_service_impl.cc +++ b/chrome/browser/chromeos/proxy_config_service_impl.cc @@ -17,13 +17,13 @@ #include "chrome/browser/chromeos/settings/cros_settings.h" #include "chrome/browser/chromeos/settings/cros_settings_names.h" #include "chrome/browser/policy/proto/chrome_device_policy.pb.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/proxy_config_dictionary.h" #include "chrome/browser/prefs/proxy_prefs.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "chromeos/network/onc/onc_constants.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/notification_service.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" diff --git a/chrome/browser/content_settings/content_settings_default_provider.cc b/chrome/browser/content_settings/content_settings_default_provider.cc index a5aee05..67a5f9d 100644 --- a/chrome/browser/content_settings/content_settings_default_provider.cc +++ b/chrome/browser/content_settings/content_settings_default_provider.cc @@ -14,12 +14,12 @@ #include "base/prefs/pref_service.h" #include "chrome/browser/content_settings/content_settings_rule.h" #include "chrome/browser/content_settings/content_settings_utils.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/content_settings.h" #include "chrome/common/content_settings_pattern.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" diff --git a/chrome/browser/content_settings/content_settings_policy_provider.cc b/chrome/browser/content_settings/content_settings_policy_provider.cc index a405897..b112db0 100644 --- a/chrome/browser/content_settings/content_settings_policy_provider.cc +++ b/chrome/browser/content_settings/content_settings_policy_provider.cc @@ -12,10 +12,10 @@ #include "base/values.h" #include "chrome/browser/content_settings/content_settings_rule.h" #include "chrome/browser/content_settings/content_settings_utils.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/content_settings_pattern.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" diff --git a/chrome/browser/content_settings/content_settings_pref_provider.cc b/chrome/browser/content_settings/content_settings_pref_provider.cc index 6f9183b..a92315e 100644 --- a/chrome/browser/content_settings/content_settings_pref_provider.cc +++ b/chrome/browser/content_settings/content_settings_pref_provider.cc @@ -16,13 +16,13 @@ #include "chrome/browser/content_settings/content_settings_rule.h" #include "chrome/browser/content_settings/content_settings_utils.h" #include "chrome/browser/content_settings/host_content_settings_map.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/content_settings.h" #include "chrome/common/content_settings_pattern.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" diff --git a/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc b/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc index b4e0331..d6d6be7 100644 --- a/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc +++ b/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc @@ -18,7 +18,6 @@ #include "chrome/browser/content_settings/content_settings_mock_observer.h" #include "chrome/browser/content_settings/content_settings_utils.h" #include "chrome/browser/prefs/browser_prefs.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/pref_service_mock_builder.h" #include "chrome/browser/prefs/pref_service_syncable.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" @@ -27,6 +26,7 @@ #include "chrome/common/url_constants.h" #include "chrome/test/base/testing_pref_service_syncable.h" #include "chrome/test/base/testing_profile.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/test/test_browser_thread.h" #include "googleurl/src/gurl.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/content_settings/cookie_settings.cc b/chrome/browser/content_settings/cookie_settings.cc index b13d432..e34a56e 100644 --- a/chrome/browser/content_settings/cookie_settings.cc +++ b/chrome/browser/content_settings/cookie_settings.cc @@ -8,7 +8,6 @@ #include "base/prefs/pref_service.h" #include "chrome/browser/content_settings/content_settings_utils.h" #include "chrome/browser/content_settings/host_content_settings_map.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_dependency_manager.h" #include "chrome/browser/profiles/profile_keyed_service.h" @@ -16,6 +15,7 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/content_settings_pattern.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" diff --git a/chrome/browser/content_settings/host_content_settings_map.cc b/chrome/browser/content_settings/host_content_settings_map.cc index 77a5247..14c251d 100644 --- a/chrome/browser/content_settings/host_content_settings_map.cc +++ b/chrome/browser/content_settings/host_content_settings_map.cc @@ -23,12 +23,12 @@ #include "chrome/browser/content_settings/content_settings_rule.h" #include "chrome/browser/content_settings/content_settings_utils.h" #include "chrome/browser/extensions/extension_service.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/content_settings_pattern.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" diff --git a/chrome/browser/custom_handlers/protocol_handler_registry.cc b/chrome/browser/custom_handlers/protocol_handler_registry.cc index 3be1184..0a1913d 100644 --- a/chrome/browser/custom_handlers/protocol_handler_registry.cc +++ b/chrome/browser/custom_handlers/protocol_handler_registry.cc @@ -12,12 +12,12 @@ #include "base/prefs/pref_service.h" #include "chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.h" #include "chrome/browser/net/chrome_url_request_context.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile_io_data.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/custom_handlers/protocol_handler.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/child_process_security_policy.h" #include "grit/generated_resources.h" #include "net/base/network_delegate.h" diff --git a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc index 283d66b..31ffb9e 100644 --- a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc +++ b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc @@ -10,12 +10,12 @@ #include "base/message_loop.h" #include "base/synchronization/waitable_event.h" #include "base/utf_string_conversions.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/pref_service_syncable.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/custom_handlers/protocol_handler.h" #include "chrome/test/base/testing_browser_process.h" #include "chrome/test/base/testing_profile.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_source.h" diff --git a/chrome/browser/devtools/devtools_window.cc b/chrome/browser/devtools/devtools_window.cc index b313155..9c71df9 100644 --- a/chrome/browser/devtools/devtools_window.cc +++ b/chrome/browser/devtools/devtools_window.cc @@ -17,7 +17,6 @@ #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_system.h" #include "chrome/browser/file_select_helper.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/pref_service_syncable.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/profiles/profile.h" @@ -37,6 +36,7 @@ #include "chrome/common/pref_names.h" #include "chrome/common/render_messages.h" #include "chrome/common/url_constants.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/child_process_security_policy.h" #include "content/public/browser/devtools_agent_host.h" #include "content/public/browser/devtools_client_host.h" diff --git a/chrome/browser/download/chrome_download_manager_delegate.cc b/chrome/browser/download/chrome_download_manager_delegate.cc index f22aa6f..c3946d4 100644 --- a/chrome/browser/download/chrome_download_manager_delegate.cc +++ b/chrome/browser/download/chrome_download_manager_delegate.cc @@ -36,7 +36,6 @@ #include "chrome/browser/history/history_service.h" #include "chrome/browser/history/history_service_factory.h" #include "chrome/browser/platform_util.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/safe_browsing/safe_browsing_service.h" #include "chrome/browser/ui/browser.h" @@ -46,6 +45,7 @@ #include "chrome/common/extensions/feature_switch.h" #include "chrome/common/extensions/user_script.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/download_item.h" #include "content/public/browser/download_manager.h" #include "content/public/browser/notification_source.h" diff --git a/chrome/browser/download/download_prefs.cc b/chrome/browser/download/download_prefs.cc index e777df1..6f3b3ae 100644 --- a/chrome/browser/download/download_prefs.cc +++ b/chrome/browser/download/download_prefs.cc @@ -21,10 +21,10 @@ #include "chrome/browser/download/download_service.h" #include "chrome/browser/download/download_service_factory.h" #include "chrome/browser/download/download_util.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/download_manager.h" #include "content/public/browser/save_page_type.h" diff --git a/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc b/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc index 71ad989..8cf5192 100644 --- a/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc +++ b/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc @@ -24,6 +24,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/view_type_utils.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/user_prefs.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_view.h" @@ -502,7 +503,7 @@ bool BookmarkManagerPrivateGetSubtreeFunction::RunImpl() { } bool BookmarkManagerPrivateCanEditFunction::RunImpl() { - PrefService* prefs = PrefServiceFromBrowserContext(profile_); + PrefService* prefs = components::UserPrefs::Get(profile_); SetResult(new base::FundamentalValue( prefs->GetBoolean(prefs::kEditBookmarksEnabled))); return true; diff --git a/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_apitest.cc b/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_apitest.cc index d81ab41..dcf29f5 100644 --- a/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_apitest.cc +++ b/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_apitest.cc @@ -14,6 +14,7 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/ui_test_utils.h" +#include "components/user_prefs/user_prefs.h" // Times out on win asan, http://crbug.com/166026 #if defined(OS_WIN) && defined(ADDRESS_SANITIZER) @@ -44,7 +45,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, BookmarkManagerEditDisabled) { model->AddURL(bar, 1, ASCIIToUTF16("AAA"), GURL("http://aaa.example.com")); model->AddURL(folder, 0, ASCIIToUTF16("BBB"), GURL("http://bbb.example.com")); - PrefService* prefs = PrefServiceFromBrowserContext(profile); + PrefService* prefs = components::UserPrefs::Get(profile); prefs->SetBoolean(prefs::kEditBookmarksEnabled, false); ASSERT_TRUE(RunComponentExtensionTest("bookmark_manager/edit_disabled")) diff --git a/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc b/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc index 3c501f3..64e7da5 100644 --- a/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc +++ b/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc @@ -39,6 +39,7 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/extensions/api/bookmarks.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/user_prefs.h" #include "content/public/browser/notification_service.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" @@ -116,7 +117,7 @@ bool BookmarksFunction::GetBookmarkIdAsInt64(const std::string& id_string, } bool BookmarksFunction::EditBookmarksEnabled() { - PrefService* prefs = PrefServiceFromBrowserContext(profile_); + PrefService* prefs = components::UserPrefs::Get(profile_); if (prefs->GetBoolean(prefs::kEditBookmarksEnabled)) return true; error_ = keys::kEditBookmarksDisabled; @@ -431,7 +432,7 @@ bool BookmarksSearchFunction::RunImpl() { bookmarks::Search::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); - PrefService* prefs = PrefServiceFromBrowserContext(profile_); + PrefService* prefs = components::UserPrefs::Get(profile_); std::string lang = prefs->GetString(prefs::kAcceptLanguages); std::vector<const BookmarkNode*> nodes; bookmark_utils::GetBookmarksContainingText( diff --git a/chrome/browser/extensions/api/commands/command_service.cc b/chrome/browser/extensions/api/commands/command_service.cc index cec171c..d996bb3 100644 --- a/chrome/browser/extensions/api/commands/command_service.cc +++ b/chrome/browser/extensions/api/commands/command_service.cc @@ -12,12 +12,12 @@ #include "chrome/browser/extensions/extension_keybinding_registry.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_system.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/api/commands/commands_handler.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_service.h" diff --git a/chrome/browser/extensions/api/tabs/tabs_api.cc b/chrome/browser/extensions/api/tabs/tabs_api.cc index ea1949a..2a4e565 100644 --- a/chrome/browser/extensions/api/tabs/tabs_api.cc +++ b/chrome/browser/extensions/api/tabs/tabs_api.cc @@ -33,7 +33,6 @@ #include "chrome/browser/extensions/window_controller.h" #include "chrome/browser/extensions/window_controller_list.h" #include "chrome/browser/prefs/incognito_mode_prefs.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/translate/translate_tab_helper.h" #include "chrome/browser/ui/browser.h" @@ -65,6 +64,7 @@ #include "chrome/common/extensions/user_script.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_details.h" diff --git a/chrome/browser/extensions/component_loader.cc b/chrome/browser/extensions/component_loader.cc index 6af173b..485c421 100644 --- a/chrome/browser/extensions/component_loader.cc +++ b/chrome/browser/extensions/component_loader.cc @@ -12,7 +12,6 @@ #include "base/prefs/pref_service.h" #include "base/prefs/public/pref_change_registrar.h" #include "chrome/browser/extensions/extension_service.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" @@ -21,6 +20,7 @@ #include "chrome/common/extensions/extension_file_util.h" #include "chrome/common/extensions/extension_manifest_constants.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" #include "grit/browser_resources.h" diff --git a/chrome/browser/extensions/component_loader_unittest.cc b/chrome/browser/extensions/component_loader_unittest.cc index f3de989..fe69e04 100644 --- a/chrome/browser/extensions/component_loader_unittest.cc +++ b/chrome/browser/extensions/component_loader_unittest.cc @@ -10,13 +10,13 @@ #include "base/path_service.h" #include "base/prefs/pref_registry_simple.h" #include "chrome/browser/extensions/test_extension_service.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/extensions/background_info.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_set.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_pref_service_syncable.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "testing/gtest/include/gtest/gtest.h" using extensions::Extension; diff --git a/chrome/browser/extensions/default_apps.cc b/chrome/browser/extensions/default_apps.cc index 4bc5278..ee124b4 100644 --- a/chrome/browser/extensions/default_apps.cc +++ b/chrome/browser/extensions/default_apps.cc @@ -6,7 +6,7 @@ #include "base/command_line.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" +#include "components/user_prefs/pref_registry_syncable.h" #if !defined(OS_ANDROID) #include "chrome/browser/first_run/first_run.h" #endif diff --git a/chrome/browser/extensions/extension_prefs.cc b/chrome/browser/extensions/extension_prefs.cc index 76aacd3..a8337ac 100644 --- a/chrome/browser/extensions/extension_prefs.cc +++ b/chrome/browser/extensions/extension_prefs.cc @@ -16,7 +16,6 @@ #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" #include "chrome/browser/extensions/extension_pref_store.h" #include "chrome/browser/extensions/extension_sorting.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/ui/host_desktop.h" #include "chrome/common/chrome_notification_types.h" @@ -28,6 +27,7 @@ #include "chrome/common/extensions/permissions/permissions_info.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/notification_service.h" #include "extensions/common/url_pattern.h" #include "grit/generated_resources.h" diff --git a/chrome/browser/extensions/extension_prefs_unittest.cc b/chrome/browser/extensions/extension_prefs_unittest.cc index 3dd373d..b522880 100644 --- a/chrome/browser/extensions/extension_prefs_unittest.cc +++ b/chrome/browser/extensions/extension_prefs_unittest.cc @@ -15,13 +15,13 @@ #include "base/values.h" #include "chrome/browser/extensions/extension_pref_value_map.h" #include "chrome/browser/extensions/extension_prefs.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/pref_service_syncable.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/extensions/extension_manifest_constants.h" #include "chrome/common/extensions/permissions/permission_set.h" #include "chrome/common/extensions/permissions/permissions_info.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" #include "content/public/test/mock_notification_observer.h" diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc index 401bf11..ad6816a 100644 --- a/chrome/browser/extensions/extension_service_unittest.cc +++ b/chrome/browser/extensions/extension_service_unittest.cc @@ -55,7 +55,6 @@ #include "chrome/browser/extensions/unpacked_installer.h" #include "chrome/browser/extensions/updater/extension_updater.h" #include "chrome/browser/prefs/browser_prefs.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/pref_service_mock_builder.h" #include "chrome/browser/prefs/pref_service_syncable.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" @@ -75,6 +74,7 @@ #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" #include "chrome/test/base/testing_profile.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/dom_storage_context.h" #include "content/public/browser/gpu_data_manager.h" #include "content/public/browser/indexed_db_context.h" diff --git a/chrome/browser/extensions/extension_web_ui.cc b/chrome/browser/extensions/extension_web_ui.cc index ee83f66..0812e73 100644 --- a/chrome/browser/extensions/extension_web_ui.cc +++ b/chrome/browser/extensions/extension_web_ui.cc @@ -16,7 +16,6 @@ #include "chrome/browser/extensions/extension_tab_util.h" #include "chrome/browser/extensions/image_loader.h" #include "chrome/browser/favicon/favicon_util.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_switches.h" @@ -26,6 +25,7 @@ #include "chrome/common/extensions/extension_icon_set.h" #include "chrome/common/extensions/extension_resource.h" #include "chrome/common/url_constants.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_ui.h" diff --git a/chrome/browser/extensions/platform_app_browsertest.cc b/chrome/browser/extensions/platform_app_browsertest.cc index 256388d..4cfeeb1 100644 --- a/chrome/browser/extensions/platform_app_browsertest.cc +++ b/chrome/browser/extensions/platform_app_browsertest.cc @@ -20,7 +20,6 @@ #include "chrome/browser/extensions/platform_app_browsertest_util.h" #include "chrome/browser/extensions/platform_app_launcher.h" #include "chrome/browser/extensions/shell_window_registry.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/tab_contents/render_view_context_menu.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/extensions/application_launch.h" @@ -31,6 +30,7 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/common/url_constants.h" #include "chrome/test/base/ui_test_utils.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/devtools_agent_host.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_widget_host_view.h" diff --git a/chrome/browser/extensions/test_extension_prefs.cc b/chrome/browser/extensions/test_extension_prefs.cc index 2d9a3f6..d469559 100644 --- a/chrome/browser/extensions/test_extension_prefs.cc +++ b/chrome/browser/extensions/test_extension_prefs.cc @@ -19,11 +19,11 @@ #include "chrome/browser/extensions/extension_pref_store.h" #include "chrome/browser/extensions/extension_pref_value_map.h" #include "chrome/browser/extensions/extension_prefs.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/pref_service_mock_builder.h" #include "chrome/browser/prefs/pref_service_syncable.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_manifest_constants.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/browser_thread.h" #include "sync/api/string_ordinal.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/first_run/first_run.cc b/chrome/browser/first_run/first_run.cc index b2e65b6..bada01d 100644 --- a/chrome/browser/first_run/first_run.cc +++ b/chrome/browser/first_run/first_run.cc @@ -28,7 +28,6 @@ #include "chrome/browser/importer/importer_list.h" #include "chrome/browser/importer/importer_progress_dialog.h" #include "chrome/browser/importer/importer_progress_observer.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/process_singleton.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/search_engines/template_url_service.h" @@ -50,6 +49,7 @@ #include "chrome/installer/util/master_preferences.h" #include "chrome/installer/util/master_preferences_constants.h" #include "chrome/installer/util/util_constants.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" #include "content/public/browser/user_metrics.h" diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context_factory.cc b/chrome/browser/geolocation/chrome_geolocation_permission_context_factory.cc index 1cab5df..3c61d15 100644 --- a/chrome/browser/geolocation/chrome_geolocation_permission_context_factory.cc +++ b/chrome/browser/geolocation/chrome_geolocation_permission_context_factory.cc @@ -4,9 +4,9 @@ #include "chrome/browser/geolocation/chrome_geolocation_permission_context_factory.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile_dependency_manager.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #if defined(OS_ANDROID) #include "chrome/browser/geolocation/chrome_geolocation_permission_context_android.h" #else diff --git a/chrome/browser/google/google_url_tracker_factory.cc b/chrome/browser/google/google_url_tracker_factory.cc index 750ecb9..f1590ec 100644 --- a/chrome/browser/google/google_url_tracker_factory.cc +++ b/chrome/browser/google/google_url_tracker_factory.cc @@ -7,9 +7,9 @@ #include "base/prefs/pref_service.h" #include "chrome/browser/google/google_url_tracker.h" #include "chrome/browser/google/google_url_tracker_navigation_helper_impl.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile_dependency_manager.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" // static diff --git a/chrome/browser/managed_mode/managed_mode_browsertest.cc b/chrome/browser/managed_mode/managed_mode_browsertest.cc index fcf162c..6d899b3 100644 --- a/chrome/browser/managed_mode/managed_mode_browsertest.cc +++ b/chrome/browser/managed_mode/managed_mode_browsertest.cc @@ -13,7 +13,6 @@ #include "chrome/browser/managed_mode/managed_mode_interstitial.h" #include "chrome/browser/managed_mode/managed_user_service.h" #include "chrome/browser/managed_mode/managed_user_service_factory.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_navigator.h" @@ -24,6 +23,7 @@ #include "chrome/common/pref_names.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/interstitial_page.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/navigation_entry.h" diff --git a/chrome/browser/managed_mode/managed_user_service.cc b/chrome/browser/managed_mode/managed_user_service.cc index 76d4dbc..41a09ef 100644 --- a/chrome/browser/managed_mode/managed_user_service.cc +++ b/chrome/browser/managed_mode/managed_user_service.cc @@ -10,12 +10,12 @@ #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_system.h" #include "chrome/browser/managed_mode/managed_mode_site_list.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension_set.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/browser_thread.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" diff --git a/chrome/browser/media/media_capture_devices_dispatcher.cc b/chrome/browser/media/media_capture_devices_dispatcher.cc index b08b643..5c22384 100644 --- a/chrome/browser/media/media_capture_devices_dispatcher.cc +++ b/chrome/browser/media/media_capture_devices_dispatcher.cc @@ -7,10 +7,10 @@ #include "base/prefs/pref_service.h" #include "chrome/browser/media/audio_stream_indicator.h" #include "chrome/browser/media/media_stream_capture_indicator.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/media_devices_monitor.h" #include "content/public/common/media_stream_request.h" diff --git a/chrome/browser/media/media_stream_devices_controller.cc b/chrome/browser/media/media_stream_devices_controller.cc index d4f382f..42afab5 100644 --- a/chrome/browser/media/media_stream_devices_controller.cc +++ b/chrome/browser/media/media_stream_devices_controller.cc @@ -13,13 +13,13 @@ #include "chrome/browser/extensions/api/tab_capture/tab_capture_registry.h" #include "chrome/browser/extensions/api/tab_capture/tab_capture_registry_factory.h" #include "chrome/browser/media/media_capture_devices_dispatcher.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/content_settings.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/browser_thread.h" #include "content/public/common/media_stream_request.h" diff --git a/chrome/browser/media_galleries/media_galleries_preferences.cc b/chrome/browser/media_galleries/media_galleries_preferences.cc index fc5188a..2a035bf 100644 --- a/chrome/browser/media_galleries/media_galleries_preferences.cc +++ b/chrome/browser/media_galleries/media_galleries_preferences.cc @@ -15,7 +15,6 @@ #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_system.h" #include "chrome/browser/media_galleries/media_file_system_registry.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/storage_monitor/media_storage_util.h" @@ -24,6 +23,7 @@ #include "chrome/common/extensions/permissions/api_permission.h" #include "chrome/common/extensions/permissions/media_galleries_permission.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" namespace chrome { diff --git a/chrome/browser/media_galleries/media_galleries_preferences_factory.cc b/chrome/browser/media_galleries/media_galleries_preferences_factory.cc index 347aebe..5de9773 100644 --- a/chrome/browser/media_galleries/media_galleries_preferences_factory.cc +++ b/chrome/browser/media_galleries/media_galleries_preferences_factory.cc @@ -5,8 +5,8 @@ #include "chrome/browser/media_galleries/media_galleries_preferences_factory.h" #include "chrome/browser/media_galleries/media_galleries_preferences.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile_dependency_manager.h" +#include "components/user_prefs/pref_registry_syncable.h" // static chrome::MediaGalleriesPreferences* diff --git a/chrome/browser/net/http_server_properties_manager.cc b/chrome/browser/net/http_server_properties_manager.cc index f06f7c2..7796e6c 100644 --- a/chrome/browser/net/http_server_properties_manager.cc +++ b/chrome/browser/net/http_server_properties_manager.cc @@ -10,9 +10,9 @@ #include "base/stringprintf.h" #include "base/strings/string_number_conversions.h" #include "base/values.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" diff --git a/chrome/browser/net/net_pref_observer.cc b/chrome/browser/net/net_pref_observer.cc index 65d94da..0a7103c 100644 --- a/chrome/browser/net/net_pref_observer.cc +++ b/chrome/browser/net/net_pref_observer.cc @@ -6,10 +6,10 @@ #include "base/prefs/pref_service.h" #include "chrome/browser/net/predictor.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prerender/prerender_manager.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/browser_thread.h" #include "net/http/http_stream_factory.h" diff --git a/chrome/browser/net/predictor.cc b/chrome/browser/net/predictor.cc index d0fac36..0e3bbd8 100644 --- a/chrome/browser/net/predictor.cc +++ b/chrome/browser/net/predictor.cc @@ -24,11 +24,11 @@ #include "base/values.h" #include "chrome/browser/io_thread.h" #include "chrome/browser/net/preconnect.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/prefs/session_startup_pref.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/browser_thread.h" #include "net/base/address_list.h" #include "net/base/completion_callback.h" diff --git a/chrome/browser/net/pref_proxy_config_tracker_impl.cc b/chrome/browser/net/pref_proxy_config_tracker_impl.cc index 17ba22c..d596213 100644 --- a/chrome/browser/net/pref_proxy_config_tracker_impl.cc +++ b/chrome/browser/net/pref_proxy_config_tracker_impl.cc @@ -8,10 +8,10 @@ #include "base/prefs/pref_registry_simple.h" #include "base/prefs/pref_service.h" #include "base/values.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/proxy_config_dictionary.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" diff --git a/chrome/browser/notifications/desktop_notification_service.cc b/chrome/browser/notifications/desktop_notification_service.cc index 36fcaec..ccfe8b5 100644 --- a/chrome/browser/notifications/desktop_notification_service.cc +++ b/chrome/browser/notifications/desktop_notification_service.cc @@ -19,7 +19,6 @@ #include "chrome/browser/notifications/notification.h" #include "chrome/browser/notifications/notification_object_proxy.h" #include "chrome/browser/notifications/notification_ui_manager.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" @@ -28,6 +27,7 @@ #include "chrome/common/content_settings_pattern.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/render_view_host.h" diff --git a/chrome/browser/password_manager/password_manager.cc b/chrome/browser/password_manager/password_manager.cc index d6c0008a..8868fd6 100644 --- a/chrome/browser/password_manager/password_manager.cc +++ b/chrome/browser/password_manager/password_manager.cc @@ -11,10 +11,10 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/password_manager/password_form_manager.h" #include "chrome/browser/password_manager/password_manager_delegate.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/autofill_messages.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/user_metrics.h" #include "content/public/browser/web_contents.h" #include "content/public/common/frame_navigate_params.h" diff --git a/chrome/browser/password_manager/password_store_factory.cc b/chrome/browser/password_manager/password_store_factory.cc index 0df883c..b24656c 100644 --- a/chrome/browser/password_manager/password_store_factory.cc +++ b/chrome/browser/password_manager/password_store_factory.cc @@ -10,13 +10,13 @@ #include "chrome/browser/password_manager/login_database.h" #include "chrome/browser/password_manager/password_store.h" #include "chrome/browser/password_manager/password_store_default.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile_dependency_manager.h" #include "chrome/browser/webdata/web_data_service.h" #include "chrome/browser/webdata/web_data_service_factory.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #if defined(OS_WIN) #include "chrome/browser/password_manager/password_store_win.h" diff --git a/chrome/browser/password_manager/password_store_x.cc b/chrome/browser/password_manager/password_store_x.cc index f0fd998..ee67e42 100644 --- a/chrome/browser/password_manager/password_store_x.cc +++ b/chrome/browser/password_manager/password_store_x.cc @@ -13,9 +13,9 @@ #include "base/prefs/pref_service.h" #include "base/stl_util.h" #include "chrome/browser/password_manager/password_store_change.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" diff --git a/chrome/browser/pepper_flash_settings_manager.cc b/chrome/browser/pepper_flash_settings_manager.cc index 8da7276..c5ec93b 100644 --- a/chrome/browser/pepper_flash_settings_manager.cc +++ b/chrome/browser/pepper_flash_settings_manager.cc @@ -14,9 +14,9 @@ #include "base/sequenced_task_runner_helpers.h" #include "base/utf_string_conversions.h" #include "chrome/browser/plugins/plugin_prefs.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/pepper_flash_settings_helper.h" diff --git a/chrome/browser/plugins/plugin_prefs_factory.cc b/chrome/browser/plugins/plugin_prefs_factory.cc index 188cb74..32b543c 100644 --- a/chrome/browser/plugins/plugin_prefs_factory.cc +++ b/chrome/browser/plugins/plugin_prefs_factory.cc @@ -7,12 +7,12 @@ #include "base/path_service.h" #include "base/prefs/pref_service.h" #include "chrome/browser/plugins/plugin_prefs.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_dependency_manager.h" #include "chrome/browser/profiles/profile_keyed_service.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" // static PluginPrefsFactory* PluginPrefsFactory::GetInstance() { diff --git a/chrome/browser/policy/url_blacklist_manager.cc b/chrome/browser/policy/url_blacklist_manager.cc index 0b6b7b6..93deff6 100644 --- a/chrome/browser/policy/url_blacklist_manager.cc +++ b/chrome/browser/policy/url_blacklist_manager.cc @@ -11,9 +11,9 @@ #include "base/strings/string_number_conversions.h" #include "base/values.h" #include "chrome/browser/net/url_fixer_upper.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" diff --git a/chrome/browser/policy/user_policy_signin_service_factory.cc b/chrome/browser/policy/user_policy_signin_service_factory.cc index 3033a97..d4f18a6 100644 --- a/chrome/browser/policy/user_policy_signin_service_factory.cc +++ b/chrome/browser/policy/user_policy_signin_service_factory.cc @@ -7,12 +7,12 @@ #include "base/prefs/pref_service.h" #include "chrome/browser/policy/user_cloud_policy_manager_factory.h" #include "chrome/browser/policy/user_policy_signin_service.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_dependency_manager.h" #include "chrome/browser/signin/signin_manager_factory.h" #include "chrome/browser/signin/token_service_factory.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" namespace policy { diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc index e2385bb..27dbd04 100644 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc @@ -52,7 +52,6 @@ #include "chrome/browser/pepper_flash_settings_manager.h" #include "chrome/browser/plugins/plugin_finder.h" #include "chrome/browser/prefs/incognito_mode_prefs.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/pref_service_syncable.h" #include "chrome/browser/prefs/session_startup_pref.h" #include "chrome/browser/printing/cloud_print/cloud_print_url.h" @@ -90,6 +89,7 @@ #include "chrome/browser/upgrade_detector.h" #include "chrome/browser/web_resource/promo_resource_service.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/render_process_host.h" #if defined(ENABLE_CONFIGURATION_POLICY) diff --git a/chrome/browser/prefs/chrome_pref_service_factory.cc b/chrome/browser/prefs/chrome_pref_service_factory.cc index 792e2e8..d3f60bb 100644 --- a/chrome/browser/prefs/chrome_pref_service_factory.cc +++ b/chrome/browser/prefs/chrome_pref_service_factory.cc @@ -17,10 +17,9 @@ #include "chrome/browser/policy/configuration_policy_pref_store.h" #include "chrome/browser/prefs/command_line_pref_store.h" #include "chrome/browser/prefs/pref_model_associator.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/pref_service_syncable_builder.h" -#include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/profile_error_dialog.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" #include "grit/chromium_strings.h" @@ -93,11 +92,6 @@ void PrepareBuilder( } // namespace -// TODO(joi): Find a better home for this. -PrefService* PrefServiceFromBrowserContext(BrowserContext* context) { - return static_cast<Profile*>(context)->GetPrefs(); -} - namespace chrome_prefs { PrefService* CreateLocalState( diff --git a/chrome/browser/prefs/chrome_pref_service_unittest.cc b/chrome/browser/prefs/chrome_pref_service_unittest.cc index b65ee3e..c2e8a30 100644 --- a/chrome/browser/prefs/chrome_pref_service_unittest.cc +++ b/chrome/browser/prefs/chrome_pref_service_unittest.cc @@ -14,7 +14,6 @@ #include "chrome/browser/policy/mock_configuration_policy_provider.h" #include "chrome/browser/prefs/browser_prefs.h" #include "chrome/browser/prefs/command_line_pref_store.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/pref_service_mock_builder.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/common/chrome_paths.h" @@ -23,6 +22,7 @@ #include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "chrome/test/base/testing_pref_service_syncable.h" #include "chrome/test/base/testing_profile.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/test/test_browser_thread.h" #include "content/public/test/web_contents_tester.h" #include "ui/base/test/data/resource.h" diff --git a/chrome/browser/prefs/incognito_mode_prefs.cc b/chrome/browser/prefs/incognito_mode_prefs.cc index 22d67ac..e073013 100644 --- a/chrome/browser/prefs/incognito_mode_prefs.cc +++ b/chrome/browser/prefs/incognito_mode_prefs.cc @@ -7,9 +7,9 @@ #include "base/command_line.h" #include "base/logging.h" #include "base/prefs/pref_service.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #if defined(OS_WIN) #include "base/win/metro.h" diff --git a/chrome/browser/prefs/pref_service_mock_builder.cc b/chrome/browser/prefs/pref_service_mock_builder.cc index 51ae6fb..661e891 100644 --- a/chrome/browser/prefs/pref_service_mock_builder.cc +++ b/chrome/browser/prefs/pref_service_mock_builder.cc @@ -5,7 +5,7 @@ #include "chrome/browser/prefs/pref_service_mock_builder.h" #include "base/prefs/testing_pref_store.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" +#include "components/user_prefs/pref_registry_syncable.h" PrefServiceMockBuilder::PrefServiceMockBuilder() { ResetDefaultState(); diff --git a/chrome/browser/prefs/pref_service_syncable.cc b/chrome/browser/prefs/pref_service_syncable.cc index 01db256..8f2f867 100644 --- a/chrome/browser/prefs/pref_service_syncable.cc +++ b/chrome/browser/prefs/pref_service_syncable.cc @@ -14,10 +14,10 @@ #include "base/strings/string_number_conversions.h" #include "base/value_conversions.h" #include "chrome/browser/prefs/pref_model_associator.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/pref_service_syncable_observer.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/prefs/prefs_tab_helper.h" +#include "components/user_prefs/pref_registry_syncable.h" // static PrefServiceSyncable* PrefServiceSyncable::FromProfile(Profile* profile) { diff --git a/chrome/browser/prefs/pref_service_syncable_builder.cc b/chrome/browser/prefs/pref_service_syncable_builder.cc index b11ba20..5e97d4d 100644 --- a/chrome/browser/prefs/pref_service_syncable_builder.cc +++ b/chrome/browser/prefs/pref_service_syncable_builder.cc @@ -10,8 +10,8 @@ #include "chrome/browser/policy/configuration_policy_pref_store.h" #include "chrome/browser/policy/policy_service.h" #include "chrome/browser/prefs/command_line_pref_store.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/pref_service_syncable.h" +#include "components/user_prefs/pref_registry_syncable.h" PrefServiceSyncableBuilder::PrefServiceSyncableBuilder() { } diff --git a/chrome/browser/prefs/proxy_policy_unittest.cc b/chrome/browser/prefs/proxy_policy_unittest.cc index 0318516..ec51894 100644 --- a/chrome/browser/prefs/proxy_policy_unittest.cc +++ b/chrome/browser/prefs/proxy_policy_unittest.cc @@ -8,13 +8,13 @@ #include "chrome/browser/policy/policy_map.h" #include "chrome/browser/policy/policy_service_impl.h" #include "chrome/browser/prefs/browser_prefs.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/pref_service_mock_builder.h" #include "chrome/browser/prefs/pref_service_syncable.h" #include "chrome/browser/prefs/proxy_config_dictionary.h" #include "chrome/browser/prefs/proxy_prefs.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "policy/policy_constants.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/prefs/scoped_user_pref_update_unittest.cc b/chrome/browser/prefs/scoped_user_pref_update_unittest.cc index 6a2b280..f12c099 100644 --- a/chrome/browser/prefs/scoped_user_pref_update_unittest.cc +++ b/chrome/browser/prefs/scoped_user_pref_update_unittest.cc @@ -4,9 +4,9 @@ #include "base/prefs/mock_pref_change_callback.h" #include "base/prefs/public/pref_change_registrar.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/test/base/testing_pref_service_syncable.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/prefs/session_startup_pref.cc b/chrome/browser/prefs/session_startup_pref.cc index decc622..9ce5f44 100644 --- a/chrome/browser/prefs/session_startup_pref.cc +++ b/chrome/browser/prefs/session_startup_pref.cc @@ -10,10 +10,10 @@ #include "base/values.h" #include "base/version.h" #include "chrome/browser/net/url_fixer_upper.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #if defined(OS_MACOSX) #include "chrome/browser/ui/cocoa/window_restore_utils.h" diff --git a/chrome/browser/prefs/session_startup_pref_unittest.cc b/chrome/browser/prefs/session_startup_pref_unittest.cc index fac4ec1..7f7c5a4 100644 --- a/chrome/browser/prefs/session_startup_pref_unittest.cc +++ b/chrome/browser/prefs/session_startup_pref_unittest.cc @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/session_startup_pref.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_pref_service_syncable.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/printing/cloud_print/cloud_print_url.cc b/chrome/browser/printing/cloud_print/cloud_print_url.cc index 92450ce..f710380 100644 --- a/chrome/browser/printing/cloud_print/cloud_print_url.cc +++ b/chrome/browser/printing/cloud_print/cloud_print_url.cc @@ -9,10 +9,10 @@ #include "base/prefs/pref_service.h" #include "base/stringprintf.h" #include "chrome/browser/google/google_util.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "google_apis/gaia/gaia_urls.h" #include "googleurl/src/gurl.h" #include "net/base/escape.h" diff --git a/chrome/browser/printing/print_dialog_cloud.cc b/chrome/browser/printing/print_dialog_cloud.cc index caed739..c97d314 100644 --- a/chrome/browser/printing/print_dialog_cloud.cc +++ b/chrome/browser/printing/print_dialog_cloud.cc @@ -16,7 +16,6 @@ #include "base/values.h" #include "chrome/browser/devtools/devtools_window.h" #include "chrome/browser/lifetime/application_lifetime.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/printing/cloud_print/cloud_print_url.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" @@ -25,6 +24,7 @@ #include "chrome/common/pref_names.h" #include "chrome/common/print_messages.h" #include "chrome/common/url_constants.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/navigation_entry.h" diff --git a/chrome/browser/profiles/chrome_version_service.cc b/chrome/browser/profiles/chrome_version_service.cc index 7133139..21b6954 100644 --- a/chrome/browser/profiles/chrome_version_service.cc +++ b/chrome/browser/profiles/chrome_version_service.cc @@ -6,9 +6,9 @@ #include "base/prefs/pref_service.h" #include "base/version.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/common/chrome_version_info.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" // static void ChromeVersionService::RegisterUserPrefs(PrefRegistrySyncable* registry) { diff --git a/chrome/browser/profiles/gaia_info_update_service_factory.cc b/chrome/browser/profiles/gaia_info_update_service_factory.cc index 245f36f..88ef612 100644 --- a/chrome/browser/profiles/gaia_info_update_service_factory.cc +++ b/chrome/browser/profiles/gaia_info_update_service_factory.cc @@ -4,10 +4,10 @@ #include "chrome/browser/profiles/gaia_info_update_service_factory.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/gaia_info_update_service.h" #include "chrome/browser/profiles/profile_dependency_manager.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" GAIAInfoUpdateServiceFactory::GAIAInfoUpdateServiceFactory() : ProfileKeyedServiceFactory("GAIAInfoUpdateService", diff --git a/chrome/browser/profiles/off_the_record_profile_impl.cc b/chrome/browser/profiles/off_the_record_profile_impl.cc index 48cd3b1..81062f47d 100644 --- a/chrome/browser/profiles/off_the_record_profile_impl.cc +++ b/chrome/browser/profiles/off_the_record_profile_impl.cc @@ -42,6 +42,7 @@ #include "chrome/common/extensions/extension.h" #include "chrome/common/pref_names.h" #include "chrome/common/render_messages.h" +#include "components/user_prefs/user_prefs.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/host_zoom_map.h" #include "content/public/browser/render_process_host.h" @@ -88,6 +89,8 @@ OffTheRecordProfileImpl::OffTheRecordProfileImpl(Profile* real_profile) start_time_(Time::Now()), zoom_callback_(base::Bind(&OffTheRecordProfileImpl::OnZoomLevelChanged, base::Unretained(this))) { + // Register on BrowserContext. + components::UserPrefs::Set(this, prefs_); } void OffTheRecordProfileImpl::Init() { diff --git a/chrome/browser/profiles/profile.cc b/chrome/browser/profiles/profile.cc index 0302bf8..47347f1 100644 --- a/chrome/browser/profiles/profile.cc +++ b/chrome/browser/profiles/profile.cc @@ -8,11 +8,11 @@ #include "base/prefs/pref_service.h" #include "build/build_config.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/sync/sync_prefs.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/web_contents.h" diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc index 8026e12..128197d 100644 --- a/chrome/browser/profiles/profile_impl.cc +++ b/chrome/browser/profiles/profile_impl.cc @@ -55,7 +55,6 @@ #include "chrome/browser/plugins/plugin_prefs.h" #include "chrome/browser/prefs/browser_prefs.h" #include "chrome/browser/prefs/chrome_pref_service_factory.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/pref_service_syncable.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/prerender/prerender_manager_factory.h" @@ -81,6 +80,8 @@ #include "chrome/common/pref_names.h" #include "chrome/common/startup_metric_utils.h" #include "chrome/common/url_constants.h" +#include "components/user_prefs/pref_registry_syncable.h" +#include "components/user_prefs/user_prefs.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/dom_storage_context.h" #include "content/public/browser/host_zoom_map.h" @@ -406,6 +407,8 @@ ProfileImpl::ProfileImpl( ExtensionPrefValueMapFactory::GetForProfile(this), false), pref_registry_, async_prefs)); + // Register on BrowserContext. + components::UserPrefs::Set(this, prefs_.get()); } startup_metric_utils::ScopedSlowStartupUMA diff --git a/chrome/browser/profiles/profile_impl.h b/chrome/browser/profiles/profile_impl.h index 7ffa968..7e0fa0e 100644 --- a/chrome/browser/profiles/profile_impl.h +++ b/chrome/browser/profiles/profile_impl.h @@ -230,7 +230,7 @@ class ProfileImpl : public Profile { scoped_ptr<policy::PolicyService> policy_service_; // Keep |prefs_| on top for destruction order because |extension_prefs_|, - // |net_pref_observer_|, |io_data_| an others store pointers to |prefs_| and + // |net_pref_observer_|, |io_data_| and others store pointers to |prefs_| and // shall be destructed first. scoped_refptr<PrefRegistrySyncable> pref_registry_; scoped_ptr<PrefServiceSyncable> prefs_; diff --git a/chrome/browser/profiles/profile_keyed_base_factory.cc b/chrome/browser/profiles/profile_keyed_base_factory.cc index 8277f87..7f52e3d 100644 --- a/chrome/browser/profiles/profile_keyed_base_factory.cc +++ b/chrome/browser/profiles/profile_keyed_base_factory.cc @@ -5,9 +5,9 @@ #include "chrome/browser/profiles/profile_keyed_base_factory.h" #include "base/prefs/pref_service.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_dependency_manager.h" +#include "components/user_prefs/pref_registry_syncable.h" ProfileKeyedBaseFactory::ProfileKeyedBaseFactory( const char* name, ProfileDependencyManager* manager) diff --git a/chrome/browser/search_engines/template_url_prepopulate_data.cc b/chrome/browser/search_engines/template_url_prepopulate_data.cc index 09617c6..baa79f5 100644 --- a/chrome/browser/search_engines/template_url_prepopulate_data.cc +++ b/chrome/browser/search_engines/template_url_prepopulate_data.cc @@ -18,7 +18,6 @@ #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "chrome/browser/google/google_util.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/search_engines/prepopulated_engines.h" #include "chrome/browser/search_engines/search_engine_type.h" @@ -27,6 +26,7 @@ #include "chrome/browser/search_engines/template_url_service.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/browser_thread.h" #include "googleurl/src/gurl.h" #include "grit/generated_resources.h" diff --git a/chrome/browser/search_engines/template_url_service_factory.cc b/chrome/browser/search_engines/template_url_service_factory.cc index f5355ae..561fefb 100644 --- a/chrome/browser/search_engines/template_url_service_factory.cc +++ b/chrome/browser/search_engines/template_url_service_factory.cc @@ -7,11 +7,11 @@ #include "base/prefs/pref_service.h" #include "chrome/browser/google/google_url_tracker_factory.h" #include "chrome/browser/history/history_service_factory.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile_dependency_manager.h" #include "chrome/browser/search_engines/template_url_service.h" #include "chrome/browser/webdata/web_data_service_factory.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" // static TemplateURLService* TemplateURLServiceFactory::GetForProfile(Profile* profile) { diff --git a/chrome/browser/signin/about_signin_internals_factory.cc b/chrome/browser/signin/about_signin_internals_factory.cc index 6f9bd88..ccce353 100644 --- a/chrome/browser/signin/about_signin_internals_factory.cc +++ b/chrome/browser/signin/about_signin_internals_factory.cc @@ -5,12 +5,12 @@ #include "chrome/browser/signin/about_signin_internals_factory.h" #include "base/prefs/pref_service.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile_dependency_manager.h" #include "chrome/browser/signin/about_signin_internals.h" #include "chrome/browser/signin/signin_internals_util.h" #include "chrome/browser/signin/token_service_factory.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "google_apis/gaia/gaia_constants.h" using namespace signin_internals_util; diff --git a/chrome/browser/signin/signin_manager_factory.cc b/chrome/browser/signin/signin_manager_factory.cc index 1db6aae..67e33c0 100644 --- a/chrome/browser/signin/signin_manager_factory.cc +++ b/chrome/browser/signin/signin_manager_factory.cc @@ -5,12 +5,12 @@ #include "chrome/browser/signin/signin_manager_factory.h" #include "base/prefs/pref_registry_simple.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile_dependency_manager.h" #include "chrome/browser/signin/signin_manager.h" #include "chrome/browser/signin/token_service_factory.h" #include "chrome/browser/ui/global_error/global_error_service_factory.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" SigninManagerFactory::SigninManagerFactory() : ProfileKeyedServiceFactory("SigninManager", diff --git a/chrome/browser/speech/chrome_speech_recognition_preferences.cc b/chrome/browser/speech/chrome_speech_recognition_preferences.cc index 0954a9a..839fb23 100644 --- a/chrome/browser/speech/chrome_speech_recognition_preferences.cc +++ b/chrome/browser/speech/chrome_speech_recognition_preferences.cc @@ -7,11 +7,11 @@ #include "base/bind.h" #include "base/prefs/pref_service.h" #include "base/values.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_dependency_manager.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_details.h" diff --git a/chrome/browser/spellchecker/spellcheck_factory.cc b/chrome/browser/spellchecker/spellcheck_factory.cc index cf95260..c859897 100644 --- a/chrome/browser/spellchecker/spellcheck_factory.cc +++ b/chrome/browser/spellchecker/spellcheck_factory.cc @@ -6,11 +6,11 @@ #include "base/prefs/pref_service.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_dependency_manager.h" #include "chrome/browser/spellchecker/spellcheck_service.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "grit/locale_settings.h" // static diff --git a/chrome/browser/sync/glue/session_model_associator.cc b/chrome/browser/sync/glue/session_model_associator.cc index 512d4af..a2f2bdd 100644 --- a/chrome/browser/sync/glue/session_model_associator.cc +++ b/chrome/browser/sync/glue/session_model_associator.cc @@ -16,7 +16,6 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/favicon/favicon_service_factory.h" #include "chrome/browser/history/history_service.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/pref_service_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sessions/session_id.h" @@ -30,6 +29,7 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_service.h" diff --git a/chrome/browser/sync/glue/sync_backend_host_unittest.cc b/chrome/browser/sync/glue/sync_backend_host_unittest.cc index 1415d0c..96d1acb 100644 --- a/chrome/browser/sync/glue/sync_backend_host_unittest.cc +++ b/chrome/browser/sync/glue/sync_backend_host_unittest.cc @@ -11,7 +11,6 @@ #include "base/message_loop.h" #include "base/synchronization/waitable_event.h" #include "base/test/test_timeouts.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/pref_service_syncable.h" #include "chrome/browser/sync/glue/device_info.h" #include "chrome/browser/sync/glue/synced_device_tracker.h" @@ -19,6 +18,7 @@ #include "chrome/browser/sync/sync_prefs.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/test/base/testing_profile.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/notification_service.h" #include "content/public/test/test_browser_thread.h" #include "google/cacheinvalidation/include/types.h" diff --git a/chrome/browser/sync/invalidations/invalidator_storage.cc b/chrome/browser/sync/invalidations/invalidator_storage.cc index 26a997c..f4189a0 100644 --- a/chrome/browser/sync/invalidations/invalidator_storage.cc +++ b/chrome/browser/sync/invalidations/invalidator_storage.cc @@ -14,8 +14,8 @@ #include "base/strings/string_number_conversions.h" #include "base/task_runner.h" #include "base/values.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "sync/internal_api/public/base/model_type.h" using syncer::InvalidationStateMap; diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc index 4526fd0..17996d7 100644 --- a/chrome/browser/sync/profile_sync_service.cc +++ b/chrome/browser/sync/profile_sync_service.cc @@ -26,7 +26,6 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/defaults.h" #include "chrome/browser/net/chrome_cookie_notification_details.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/pref_service_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/signin/signin_manager.h" @@ -57,6 +56,7 @@ #include "chrome/common/pref_names.h" #include "chrome/common/time_format.h" #include "chrome/common/url_constants.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" diff --git a/chrome/browser/sync/profile_sync_service_preference_unittest.cc b/chrome/browser/sync/profile_sync_service_preference_unittest.cc index ff9fe87..9e9fb57 100644 --- a/chrome/browser/sync/profile_sync_service_preference_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_preference_unittest.cc @@ -14,7 +14,6 @@ #include "base/stl_util.h" #include "base/string_piece.h" #include "chrome/browser/prefs/pref_model_associator.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/signin/signin_manager.h" #include "chrome/browser/signin/signin_manager_factory.h" @@ -29,6 +28,7 @@ #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_pref_service_syncable.h" #include "chrome/test/base/testing_profile.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "google_apis/gaia/gaia_constants.h" #include "sync/api/sync_data.h" #include "sync/internal_api/public/base/model_type.h" diff --git a/chrome/browser/sync/sync_prefs.cc b/chrome/browser/sync/sync_prefs.cc index e2c40dd..9d8e349 100644 --- a/chrome/browser/sync/sync_prefs.cc +++ b/chrome/browser/sync/sync_prefs.cc @@ -11,12 +11,12 @@ #include "base/strings/string_number_conversions.h" #include "base/values.h" #include "build/build_config.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile_io_data.h" #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" diff --git a/chrome/browser/themes/theme_service_factory.cc b/chrome/browser/themes/theme_service_factory.cc index cb2ef7e..ba360d0 100644 --- a/chrome/browser/themes/theme_service_factory.cc +++ b/chrome/browser/themes/theme_service_factory.cc @@ -7,11 +7,11 @@ #include "base/logging.h" #include "base/prefs/pref_service.h" #include "chrome/browser/extensions/extension_service.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_dependency_manager.h" #include "chrome/browser/themes/theme_service.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #if defined(TOOLKIT_GTK) #include "chrome/browser/ui/gtk/gtk_theme_service.h" @@ -81,4 +81,4 @@ void ThemeServiceFactory::RegisterUserPrefs(PrefRegistrySyncable* registry) { bool ThemeServiceFactory::ServiceRedirectedInIncognito() const { return true; -}
\ No newline at end of file +} diff --git a/chrome/browser/translate/translate_prefs.cc b/chrome/browser/translate/translate_prefs.cc index 7b75212..c4ca7ec 100644 --- a/chrome/browser/translate/translate_prefs.cc +++ b/chrome/browser/translate/translate_prefs.cc @@ -6,8 +6,8 @@ #include "base/prefs/pref_service.h" #include "base/string_util.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" +#include "components/user_prefs/pref_registry_syncable.h" const char TranslatePrefs::kPrefTranslateLanguageBlacklist[] = "translate_language_blacklist"; diff --git a/chrome/browser/ui/alternate_error_tab_observer.cc b/chrome/browser/ui/alternate_error_tab_observer.cc index b18eb92..8d439db 100644 --- a/chrome/browser/ui/alternate_error_tab_observer.cc +++ b/chrome/browser/ui/alternate_error_tab_observer.cc @@ -6,10 +6,10 @@ #include "base/prefs/pref_service.h" #include "chrome/browser/google/google_util.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" diff --git a/chrome/browser/ui/ash/chrome_launcher_prefs.cc b/chrome/browser/ui/ash/chrome_launcher_prefs.cc index 05e9b3b..05994ea 100644 --- a/chrome/browser/ui/ash/chrome_launcher_prefs.cc +++ b/chrome/browser/ui/ash/chrome_launcher_prefs.cc @@ -7,8 +7,8 @@ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "base/values.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" namespace { diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc index 9dedb80..ef4c241 100644 --- a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc +++ b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc @@ -26,7 +26,6 @@ #include "chrome/browser/autofill/wallet/wallet_items.h" #include "chrome/browser/autofill/wallet/wallet_service_url.h" #include "chrome/browser/extensions/shell_window_registry.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/autofill/autofill_dialog_view.h" #include "chrome/browser/ui/autofill/data_model_wrapper.h" @@ -38,6 +37,7 @@ #include "chrome/browser/ui/extensions/shell_window.h" #include "chrome/common/form_data.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/navigation_details.h" #include "content/public/browser/navigation_entry.h" diff --git a/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.cc b/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.cc index 47684b3..5483e2f 100644 --- a/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.cc +++ b/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.cc @@ -18,6 +18,7 @@ #include "chrome/browser/ui/chrome_pages.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/user_prefs.h" #include "content/public/browser/page_navigator.h" #include "content/public/browser/user_metrics.h" #include "grit/generated_resources.h" @@ -248,12 +249,12 @@ void BookmarkContextMenuController::ExecuteCommand(int id) { bool BookmarkContextMenuController::IsCommandIdChecked(int command_id) const { DCHECK(command_id == IDC_BOOKMARK_BAR_ALWAYS_SHOW); - PrefService* prefs = PrefServiceFromBrowserContext(profile_); + PrefService* prefs = components::UserPrefs::Get(profile_); return prefs->GetBoolean(prefs::kShowBookmarkBar); } bool BookmarkContextMenuController::IsCommandIdEnabled(int command_id) const { - PrefService* prefs = PrefServiceFromBrowserContext(profile_); + PrefService* prefs = components::UserPrefs::Get(profile_); bool is_root_node = selection_.size() == 1 && selection_[0]->parent() == model_->root_node(); diff --git a/chrome/browser/ui/bookmarks/bookmark_utils.cc b/chrome/browser/ui/bookmarks/bookmark_utils.cc index d09165c..4d104be 100644 --- a/chrome/browser/ui/bookmarks/bookmark_utils.cc +++ b/chrome/browser/ui/bookmarks/bookmark_utils.cc @@ -18,6 +18,7 @@ #include "chrome/browser/ui/simple_message_box.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/user_prefs.h" #include "content/public/browser/web_contents.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" @@ -240,7 +241,7 @@ void GetURLAndTitleToBookmark(content::WebContents* web_contents, } void ToggleBookmarkBarWhenVisible(content::BrowserContext* browser_context) { - PrefService* prefs = PrefServiceFromBrowserContext(browser_context); + PrefService* prefs = components::UserPrefs::Get(browser_context); const bool always_show = !prefs->GetBoolean(prefs::kShowBookmarkBar); // The user changed when the bookmark bar is shown, update the preferences. diff --git a/chrome/browser/ui/browser_instant_controller.cc b/chrome/browser/ui/browser_instant_controller.cc index 0eea71a..9e585aa 100644 --- a/chrome/browser/ui/browser_instant_controller.cc +++ b/chrome/browser/ui/browser_instant_controller.cc @@ -7,7 +7,6 @@ #include "base/prefs/pref_service.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_web_ui.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/themes/theme_properties.h" #include "chrome/browser/themes/theme_service.h" @@ -24,6 +23,7 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/user_metrics.h" #include "grit/theme_resources.h" diff --git a/chrome/browser/ui/browser_ui_prefs.cc b/chrome/browser/ui/browser_ui_prefs.cc index 2771e8a..54d84e7 100644 --- a/chrome/browser/ui/browser_ui_prefs.cc +++ b/chrome/browser/ui/browser_ui_prefs.cc @@ -7,9 +7,9 @@ #include "base/prefs/pref_registry_simple.h" #include "base/prefs/pref_service.h" #include "chrome/browser/first_run/first_run.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" namespace chrome { diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.mm index c689ac9..46226e7 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_controller.mm @@ -13,6 +13,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/bookmarks/bookmark_utils.h" #import "chrome/browser/ui/cocoa/bookmarks/bookmark_cell_single_line.h" +#include "components/user_prefs/user_prefs.h" #include "ui/base/l10n/l10n_util.h" @interface BookmarkEditorController (Private) @@ -70,7 +71,7 @@ if (node_) { [self setInitialName:base::SysUTF16ToNSString(node_->GetTitle())]; PrefService* prefs = [self profile] ? - PrefServiceFromBrowserContext([self profile]) : + components::UserPrefs::Get([self profile]) : NULL; string16 urlString = chrome::FormatBookmarkURLForDisplay(node_->url(), prefs); diff --git a/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm b/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm index 6ccb99c..2014688 100644 --- a/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm +++ b/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm @@ -14,7 +14,6 @@ #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_system.h" #include "chrome/browser/extensions/extension_toolbar_model.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sessions/session_tab_helper.h" #include "chrome/browser/ui/browser.h" @@ -28,6 +27,7 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/api/extension_action/action_info.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" diff --git a/chrome/browser/ui/cocoa/window_size_autosaver_unittest.mm b/chrome/browser/ui/cocoa/window_size_autosaver_unittest.mm index 0081895..0e7eaec 100644 --- a/chrome/browser/ui/cocoa/window_size_autosaver_unittest.mm +++ b/chrome/browser/ui/cocoa/window_size_autosaver_unittest.mm @@ -8,9 +8,9 @@ #include "base/memory/scoped_nsobject.h" #include "base/prefs/pref_service.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" diff --git a/chrome/browser/ui/gesture_prefs_observer_factory_aura.cc b/chrome/browser/ui/gesture_prefs_observer_factory_aura.cc index 9fd4e71..a5e0314 100644 --- a/chrome/browser/ui/gesture_prefs_observer_factory_aura.cc +++ b/chrome/browser/ui/gesture_prefs_observer_factory_aura.cc @@ -11,11 +11,11 @@ #include "base/compiler_specific.h" #include "base/prefs/pref_service.h" #include "base/prefs/public/pref_change_registrar.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_dependency_manager.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/overscroll_configuration.h" diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.cc index c3490fc..0526786 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.cc +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.cc @@ -26,6 +26,7 @@ #include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/gtk/menu_gtk.h" +#include "components/user_prefs/user_prefs.h" #include "googleurl/src/gurl.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" @@ -360,7 +361,7 @@ void BookmarkEditorGtk::Init(GtkWindow* parent_window) { if (details_.GetNodeType() != BookmarkNode::FOLDER) { url_entry_ = gtk_entry_new(); PrefService* prefs = profile_ ? - PrefServiceFromBrowserContext(profile_) : + components::UserPrefs::Get(profile_) : NULL; gtk_entry_set_text( GTK_ENTRY(url_entry_), diff --git a/chrome/browser/ui/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc index 63c6941..bc79b08 100644 --- a/chrome/browser/ui/gtk/browser_window_gtk.cc +++ b/chrome/browser/ui/gtk/browser_window_gtk.cc @@ -30,7 +30,6 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/download/download_item_model.h" #include "chrome/browser/extensions/tab_helper.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/themes/theme_properties.h" @@ -83,6 +82,7 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/download_manager.h" #include "content/public/browser/native_web_keyboard_event.h" #include "content/public/browser/notification_service.h" diff --git a/chrome/browser/ui/network_profile_bubble.cc b/chrome/browser/ui/network_profile_bubble.cc index 3fcdbab..3e8b9fc 100644 --- a/chrome/browser/ui/network_profile_bubble.cc +++ b/chrome/browser/ui/network_profile_bubble.cc @@ -19,13 +19,13 @@ #include "base/prefs/pref_service.h" #include "base/time.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_list_observer.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/browser_thread.h" namespace { diff --git a/chrome/browser/ui/prefs/prefs_tab_helper.cc b/chrome/browser/ui/prefs/prefs_tab_helper.cc index c6c9ccb..1bf7507 100644 --- a/chrome/browser/ui/prefs/prefs_tab_helper.cc +++ b/chrome/browser/ui/prefs/prefs_tab_helper.cc @@ -12,12 +12,12 @@ #include "base/stringprintf.h" #include "base/utf_string_conversions.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/renderer_preferences_util.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_names_util.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/render_view_host.h" diff --git a/chrome/browser/ui/startup/autolaunch_prompt.cc b/chrome/browser/ui/startup/autolaunch_prompt.cc index ed05494..bd36c65 100644 --- a/chrome/browser/ui/startup/autolaunch_prompt.cc +++ b/chrome/browser/ui/startup/autolaunch_prompt.cc @@ -4,7 +4,7 @@ #include "chrome/browser/ui/startup/autolaunch_prompt.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" +#include "components/user_prefs/pref_registry_syncable.h" namespace chrome { diff --git a/chrome/browser/ui/startup/autolaunch_prompt_win.cc b/chrome/browser/ui/startup/autolaunch_prompt_win.cc index e12288a..71eff23 100644 --- a/chrome/browser/ui/startup/autolaunch_prompt_win.cc +++ b/chrome/browser/ui/startup/autolaunch_prompt_win.cc @@ -12,7 +12,6 @@ #include "chrome/browser/api/infobars/infobar_service.h" #include "chrome/browser/auto_launch_trial.h" #include "chrome/browser/first_run/first_run.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" @@ -20,6 +19,7 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chrome/installer/util/auto_launch_util.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/navigation_details.h" #include "content/public/browser/web_contents.h" diff --git a/chrome/browser/ui/tabs/pinned_tab_codec.cc b/chrome/browser/ui/tabs/pinned_tab_codec.cc index 2c406fc..35d4ff8 100644 --- a/chrome/browser/ui/tabs/pinned_tab_codec.cc +++ b/chrome/browser/ui/tabs/pinned_tab_codec.cc @@ -7,7 +7,6 @@ #include "base/prefs/pref_service.h" #include "base/values.h" #include "chrome/browser/extensions/tab_helper.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" @@ -16,6 +15,7 @@ #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/web_contents.h" diff --git a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc index 92fc742..869536f 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc @@ -18,6 +18,7 @@ #include "chrome/browser/net/url_fixer_upper.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/bookmarks/bookmark_utils.h" +#include "components/user_prefs/user_prefs.h" #include "googleurl/src/gurl.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" @@ -335,7 +336,7 @@ void BookmarkEditorView::Init() { url_tf_ = new views::Textfield; PrefService* prefs = profile_ ? - PrefServiceFromBrowserContext(profile_) : + components::UserPrefs::Get(profile_) : NULL; url_tf_->SetText(chrome::FormatBookmarkURLForDisplay(url, prefs)); url_tf_->SetController(this); diff --git a/chrome/browser/ui/views/home_button.cc b/chrome/browser/ui/views/home_button.cc index 9264799..daba6e5 100644 --- a/chrome/browser/ui/views/home_button.cc +++ b/chrome/browser/ui/views/home_button.cc @@ -8,6 +8,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/user_prefs.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" #include "ui/views/bubble/bubble_delegate.h" @@ -113,7 +114,7 @@ void HomePageUndoBubble::Init() { } void HomePageUndoBubble::LinkClicked(views::Link* source, int event_flags) { - PrefService* prefs = PrefServiceFromBrowserContext(browser_->profile()); + PrefService* prefs = components::UserPrefs::Get(browser_->profile()); prefs->SetBoolean(prefs::kHomePageIsNewTabPage, undo_value_is_ntp_); prefs->SetString(prefs::kHomePage, undo_url_.spec()); diff --git a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc index 2d6638e..73842a8 100644 --- a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc +++ b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc @@ -32,7 +32,6 @@ #include "chrome/browser/extensions/unpacked_installer.h" #include "chrome/browser/extensions/updater/extension_updater.h" #include "chrome/browser/google/google_util.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/tab_contents/background_contents.h" #include "chrome/browser/ui/browser_finder.h" @@ -53,6 +52,7 @@ #include "chrome/common/extensions/manifest_url_handler.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h" diff --git a/chrome/browser/ui/webui/instant_ui.cc b/chrome/browser/ui/webui/instant_ui.cc index 7008a22..0e00082 100644 --- a/chrome/browser/ui/webui/instant_ui.cc +++ b/chrome/browser/ui/webui/instant_ui.cc @@ -9,13 +9,13 @@ #include "base/stringprintf.h" #include "base/time.h" #include "chrome/browser/instant/instant_controller.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_instant_controller.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui_data_source.h" #include "content/public/browser/web_ui_message_handler.h" diff --git a/chrome/browser/ui/webui/ntp/android/promo_handler.cc b/chrome/browser/ui/webui/ntp/android/promo_handler.cc index 7ed576a..3ad44a8 100644 --- a/chrome/browser/ui/webui/ntp/android/promo_handler.cc +++ b/chrome/browser/ui/webui/ntp/android/promo_handler.cc @@ -12,7 +12,6 @@ #include "base/strings/string_number_conversions.h" #include "base/utf_string_conversions.h" #include "chrome/browser/android/intent_helper.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/signin/signin_manager.h" @@ -25,6 +24,7 @@ #include "chrome/browser/web_resource/promo_resource_service.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/web_contents.h" diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc index b0a43dc..772b4c0 100644 --- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc +++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc @@ -24,7 +24,6 @@ #include "chrome/browser/extensions/extension_system.h" #include "chrome/browser/extensions/management_policy.h" #include "chrome/browser/favicon/favicon_service_factory.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser_finder.h" @@ -43,6 +42,7 @@ #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" #include "chrome/common/web_apps.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/web_ui.h" #include "content/public/common/favicon_url.h" diff --git a/chrome/browser/ui/webui/ntp/foreign_session_handler.cc b/chrome/browser/ui/webui/ntp/foreign_session_handler.cc index 129df95..0190cc1 100644 --- a/chrome/browser/ui/webui/ntp/foreign_session_handler.cc +++ b/chrome/browser/ui/webui/ntp/foreign_session_handler.cc @@ -16,7 +16,6 @@ #include "base/strings/string_number_conversions.h" #include "base/utf_string_conversions.h" #include "base/values.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sessions/session_restore.h" @@ -29,6 +28,7 @@ #include "chrome/common/pref_names.h" #include "chrome/common/time_format.h" #include "chrome/common/url_constants.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/url_data_source.h" diff --git a/chrome/browser/ui/webui/ntp/most_visited_handler.cc b/chrome/browser/ui/webui/ntp/most_visited_handler.cc index 305613b..d4e471e 100644 --- a/chrome/browser/ui/webui/ntp/most_visited_handler.cc +++ b/chrome/browser/ui/webui/ntp/most_visited_handler.cc @@ -21,7 +21,6 @@ #include "base/values.h" #include "chrome/browser/history/page_usage_data.h" #include "chrome/browser/history/top_sites.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/webui/favicon_source.h" @@ -31,6 +30,7 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_source.h" diff --git a/chrome/browser/ui/webui/ntp/new_tab_page_handler.cc b/chrome/browser/ui/webui/ntp/new_tab_page_handler.cc index 9ae6bb3..4b59a46 100644 --- a/chrome/browser/ui/webui/ntp/new_tab_page_handler.cc +++ b/chrome/browser/ui/webui/ntp/new_tab_page_handler.cc @@ -10,12 +10,12 @@ #include "base/memory/scoped_ptr.h" #include "base/metrics/histogram.h" #include "base/prefs/pref_service.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" #include "chrome/browser/web_resource/notification_promo.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/web_ui.h" #include "grit/chromium_strings.h" diff --git a/chrome/browser/ui/webui/ntp/new_tab_ui.cc b/chrome/browser/ui/webui/ntp/new_tab_ui.cc index 83c0bfe..1016572 100644 --- a/chrome/browser/ui/webui/ntp/new_tab_ui.cc +++ b/chrome/browser/ui/webui/ntp/new_tab_ui.cc @@ -13,7 +13,6 @@ #include "base/metrics/histogram.h" #include "base/prefs/pref_service.h" #include "base/utf_string_conversions.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/webui/metrics_handler.h" #include "chrome/browser/ui/webui/ntp/favicon_webui_handler.h" @@ -25,6 +24,7 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/render_view_host.h" diff --git a/chrome/browser/ui/webui/ntp/suggestions_page_handler.cc b/chrome/browser/ui/webui/ntp/suggestions_page_handler.cc index f51d759..d99956b 100644 --- a/chrome/browser/ui/webui/ntp/suggestions_page_handler.cc +++ b/chrome/browser/ui/webui/ntp/suggestions_page_handler.cc @@ -17,7 +17,6 @@ #include "base/values.h" #include "chrome/browser/history/page_usage_data.h" #include "chrome/browser/history/top_sites.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/webui/favicon_source.h" #include "chrome/browser/ui/webui/ntp/ntp_stats.h" @@ -26,6 +25,7 @@ #include "chrome/browser/ui/webui/ntp/thumbnail_source.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/url_constants.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_source.h" diff --git a/chrome/browser/ui/webui/options/preferences_browsertest.cc b/chrome/browser/ui/webui/options/preferences_browsertest.cc index e9aa573..5839538 100644 --- a/chrome/browser/ui/webui/options/preferences_browsertest.cc +++ b/chrome/browser/ui/webui/options/preferences_browsertest.cc @@ -22,6 +22,7 @@ #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" #include "chrome/test/base/ui_test_utils.h" +#include "components/user_prefs/user_prefs.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/render_view_host.h" @@ -81,8 +82,7 @@ void PreferencesBrowserTest::SetUpOnMainThread() { ASSERT_TRUE(web_contents); render_view_host_ = web_contents->GetRenderViewHost(); ASSERT_TRUE(render_view_host_); - pref_change_registrar_.Init( - PrefServiceFromBrowserContext(browser()->profile())); + pref_change_registrar_.Init(components::UserPrefs::Get(browser()->profile())); pref_service_ = browser()->profile()->GetPrefs(); ASSERT_TRUE(content::ExecuteScript(render_view_host_, "function TestEnv() {" diff --git a/chrome/browser/ui/webui/plugins_ui.cc b/chrome/browser/ui/webui/plugins_ui.cc index 2f34c8c..1cef447 100644 --- a/chrome/browser/ui/webui/plugins_ui.cc +++ b/chrome/browser/ui/webui/plugins_ui.cc @@ -24,7 +24,6 @@ #include "chrome/browser/plugins/plugin_finder.h" #include "chrome/browser/plugins/plugin_metadata.h" #include "chrome/browser/plugins/plugin_prefs.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" @@ -34,6 +33,7 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/plugin_service.h" #include "content/public/browser/web_contents.h" diff --git a/chrome/browser/ui/webui/print_preview/sticky_settings.cc b/chrome/browser/ui/webui/print_preview/sticky_settings.cc index e487e83..40f001d 100644 --- a/chrome/browser/ui/webui/print_preview/sticky_settings.cc +++ b/chrome/browser/ui/webui/print_preview/sticky_settings.cc @@ -8,10 +8,10 @@ #include "base/files/file_path.h" #include "base/prefs/pref_service.h" #include "base/values.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "printing/page_size_margins.h" namespace printing { diff --git a/chrome/browser/ui/webui/sync_promo/sync_promo_handler.cc b/chrome/browser/ui/webui/sync_promo/sync_promo_handler.cc index 9e3e4f7..a05906a 100644 --- a/chrome/browser/ui/webui/sync_promo/sync_promo_handler.cc +++ b/chrome/browser/ui/webui/sync_promo/sync_promo_handler.cc @@ -9,7 +9,6 @@ #include "base/metrics/histogram.h" #include "base/prefs/pref_service.h" #include "base/time.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/sync/profile_sync_service_factory.h" @@ -22,6 +21,7 @@ #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_details.h" diff --git a/chrome/browser/ui/webui/sync_promo/sync_promo_ui.cc b/chrome/browser/ui/webui/sync_promo/sync_promo_ui.cc index cb35b38..626894a 100644 --- a/chrome/browser/ui/webui/sync_promo/sync_promo_ui.cc +++ b/chrome/browser/ui/webui/sync_promo/sync_promo_ui.cc @@ -13,7 +13,6 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/first_run/first_run.h" #include "chrome/browser/google/google_util.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_info_cache.h" #include "chrome/browser/profiles/profile_manager.h" @@ -29,6 +28,7 @@ #include "chrome/common/net/url_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/url_data_source.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_ui.h" diff --git a/chrome/browser/web_resource/notification_promo.cc b/chrome/browser/web_resource/notification_promo.cc index 7e942fb..a088f32 100644 --- a/chrome/browser/web_resource/notification_promo.cc +++ b/chrome/browser/web_resource/notification_promo.cc @@ -18,10 +18,10 @@ #include "base/time.h" #include "base/values.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/web_resource/promo_resource_service.h" #include "chrome/common/chrome_version_info.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/user_metrics.h" #include "googleurl/src/gurl.h" #include "net/base/url_util.h" diff --git a/chrome/browser/web_resource/promo_resource_service.cc b/chrome/browser/web_resource/promo_resource_service.cc index 41ee47d..48f9dc6 100644 --- a/chrome/browser/web_resource/promo_resource_service.cc +++ b/chrome/browser/web_resource/promo_resource_service.cc @@ -12,11 +12,11 @@ #include "base/threading/thread_restrictions.h" #include "base/values.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" #include "chrome/browser/web_resource/notification_promo.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/notification_service.h" #include "googleurl/src/gurl.h" diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 0a0deee..8adec69 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -27,6 +27,7 @@ 'safe_browsing_report_proto', 'variations_seed_proto', '../build/temp_gyp/googleurl.gyp:googleurl', + '../components/components.gyp:user_prefs', '../components/components.gyp:visitedlink_browser', '../components/components.gyp:visitedlink_common', '../content/content.gyp:content_browser', @@ -1501,8 +1502,6 @@ 'browser/prefs/incognito_mode_prefs.h', 'browser/prefs/pref_model_associator.cc', 'browser/prefs/pref_model_associator.h', - 'browser/prefs/pref_registry_syncable.cc', - 'browser/prefs/pref_registry_syncable.h', 'browser/prefs/pref_service_syncable.cc', 'browser/prefs/pref_service_syncable.h', 'browser/prefs/pref_service_syncable_builder.cc', diff --git a/chrome/test/DEPS b/chrome/test/DEPS index 47315b3..c9e4461 100644 --- a/chrome/test/DEPS +++ b/chrome/test/DEPS @@ -1,6 +1,8 @@ include_rules = [ - # The test directory can do whatever it wants in chrome. + # The test directory can do whatever it wants in chrome, and may + # rely on components. "+chrome", + "+components", "+extensions", # Tests under chrome/ shouldn't need to access the internals of content/ and diff --git a/chrome/test/base/testing_pref_service_syncable.cc b/chrome/test/base/testing_pref_service_syncable.cc index 94b5fe5..470a697 100644 --- a/chrome/test/base/testing_pref_service_syncable.cc +++ b/chrome/test/base/testing_pref_service_syncable.cc @@ -7,7 +7,7 @@ #include "base/bind.h" #include "base/prefs/pref_notifier_impl.h" #include "base/prefs/pref_value_store.h" -#include "chrome/browser/prefs/pref_registry_syncable.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "testing/gtest/include/gtest/gtest.h" template<> diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc index 75f27cef..561c0f0 100644 --- a/chrome/test/base/testing_profile.cc +++ b/chrome/test/base/testing_profile.cc @@ -55,6 +55,7 @@ #include "chrome/test/base/history_index_restore_observer.h" #include "chrome/test/base/testing_pref_service_syncable.h" #include "chrome/test/base/ui_test_utils.h" +#include "components/user_prefs/user_prefs.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/render_process_host.h" @@ -271,6 +272,9 @@ void TestingProfile::CreateTempProfileDir() { } void TestingProfile::Init() { + if (prefs_.get()) + components::UserPrefs::Set(this, prefs_.get()); + if (!file_util::PathExists(profile_path_)) file_util::CreateDirectory(profile_path_); @@ -559,6 +563,7 @@ void TestingProfile::CreateTestingPrefService() { DCHECK(!prefs_.get()); testing_prefs_ = new TestingPrefServiceSyncable(); prefs_.reset(testing_prefs_); + components::UserPrefs::Set(this, prefs_.get()); chrome::RegisterUserPrefs(testing_prefs_->registry()); } diff --git a/components/OWNERS b/components/OWNERS index cd6c48c..17265c4 100644 --- a/components/OWNERS +++ b/components/OWNERS @@ -6,3 +6,8 @@ per-file components_tracing*=nduca@chromium.org per-file navigation_interception.gypi=jknotten@chromium.org per-file navigation_interception.gypi=joth@chromium.org per-file navigation_interception.gypi=mkosiba@chromium.org + +per-file user_prefs.gypi=battre@chromium.org +per-file user_prefs.gypi=bauerb@chromium.org +per-file user_prefs.gypi=mnissler@chromium.org +per-file user_prefs.gypi=pam@chromium.org diff --git a/components/components.gyp b/components/components.gyp index eea034a..f289651 100644 --- a/components/components.gyp +++ b/components/components.gyp @@ -7,6 +7,7 @@ 'auto_login_parser.gypi', 'components_tests.gypi', 'navigation_interception.gypi', + 'user_prefs.gypi', 'visitedlink.gypi', 'web_contents_delegate_android.gypi', ], diff --git a/components/user_prefs.gypi b/components/user_prefs.gypi new file mode 100644 index 0000000..a556e70 --- /dev/null +++ b/components/user_prefs.gypi @@ -0,0 +1,32 @@ +# Copyright (c) 2013 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. + +{ + 'targets': [ + { + 'target_name': 'user_prefs', + 'type': '<(component)', + 'dependencies': [ + '../base/base.gyp:base', + '../base/base.gyp:base_prefs', + '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', + '../content/content.gyp:content_browser', + '../ui/ui.gyp:ui', + ], + 'include_dirs': [ + '..', + ], + 'defines': [ + 'USER_PREFS_IMPLEMENTATION', + ], + 'sources': [ + 'user_prefs/pref_registry_syncable.cc', + 'user_prefs/pref_registry_syncable.h', + 'user_prefs/user_prefs.cc', + 'user_prefs/user_prefs.h', + 'user_prefs/user_prefs_export.h', + ], + }, + ], +} diff --git a/components/user_prefs/DEPS b/components/user_prefs/DEPS new file mode 100644 index 0000000..c36190b --- /dev/null +++ b/components/user_prefs/DEPS @@ -0,0 +1,4 @@ +include_rules = [ + "+content/public/browser", + "+ui/base", +] diff --git a/components/user_prefs/OWNERS b/components/user_prefs/OWNERS new file mode 100644 index 0000000..024da1c --- /dev/null +++ b/components/user_prefs/OWNERS @@ -0,0 +1,4 @@ +battre@chromium.org +bauerb@chromium.org +mnissler@chromium.org +pam@chromium.org diff --git a/components/user_prefs/README b/components/user_prefs/README new file mode 100644 index 0000000..a7ca509 --- /dev/null +++ b/components/user_prefs/README @@ -0,0 +1,8 @@ +The //components/user_pref component provides: + +a) The UserPrefs class, where components dependent on looking up +preferences associated with users can look them up by +content::BrowserContext. + +b) A place for PrefRegistrySyncable to live, where it can be used by +components that need to register preferences associated with users. diff --git a/chrome/browser/prefs/pref_registry_syncable.cc b/components/user_prefs/pref_registry_syncable.cc index 3a34360..874f8a6 100644 --- a/chrome/browser/prefs/pref_registry_syncable.cc +++ b/components/user_prefs/pref_registry_syncable.cc @@ -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 "chrome/browser/prefs/pref_registry_syncable.h" +#include "components/user_prefs/pref_registry_syncable.h" #include "base/files/file_path.h" #include "base/prefs/default_pref_store.h" diff --git a/chrome/browser/prefs/pref_registry_syncable.h b/components/user_prefs/pref_registry_syncable.h index d6d1a4a..08477f2 100644 --- a/chrome/browser/prefs/pref_registry_syncable.h +++ b/components/user_prefs/pref_registry_syncable.h @@ -2,13 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_PREFS_PREF_REGISTRY_SYNCABLE_H_ -#define CHROME_BROWSER_PREFS_PREF_REGISTRY_SYNCABLE_H_ +#ifndef COMPONENTS_USER_PREFS_PREF_REGISTRY_SYNCABLE_H_ +#define COMPONENTS_USER_PREFS_PREF_REGISTRY_SYNCABLE_H_ #include <set> #include <string> #include "base/prefs/pref_registry.h" +#include "components/user_prefs/user_prefs_export.h" namespace base { class DictionaryValue; @@ -19,7 +20,15 @@ class Value; // A PrefRegistry that forces users to choose whether each registered // preference is syncable or not. -class PrefRegistrySyncable : public PrefRegistry { +// +// Classes or components that want to register such preferences should +// define a static function named RegisterUserPrefs that takes a +// PrefRegistrySyncable*, and the top-level application using the +// class or embedding the component should call this function at an +// appropriate time before the PrefService for these preferences is +// constructed. See e.g. chrome/browser/prefs/browser_prefs.cc which +// does this for Chrome. +class USER_PREFS_EXPORT PrefRegistrySyncable : public PrefRegistry { public: typedef base::Callback<void(const char* path)> SyncableRegistrationCallback; @@ -107,4 +116,4 @@ class PrefRegistrySyncable : public PrefRegistry { DISALLOW_COPY_AND_ASSIGN(PrefRegistrySyncable); }; -#endif // CHROME_BROWSER_PREFS_PREF_REGISTRY_SYNCABLE_H_ +#endif // COMPONENTS_USER_PREFS_PREF_REGISTRY_SYNCABLE_H_ diff --git a/components/user_prefs/user_prefs.cc b/components/user_prefs/user_prefs.cc new file mode 100644 index 0000000..0c920f0 --- /dev/null +++ b/components/user_prefs/user_prefs.cc @@ -0,0 +1,44 @@ +// Copyright 2013 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. + +#include "components/user_prefs/user_prefs.h" + +#include "base/logging.h" +#include "base/memory/singleton.h" +#include "base/prefs/pref_service.h" +#include "content/public/browser/browser_context.h" + +namespace components { + +namespace { + +void* UserDataKey() { + // We just need a unique constant. Use the address of this static member. + return reinterpret_cast<void*>(&UserPrefs::Get); +} + +} // namespace + +UserPrefs::UserPrefs(PrefService* prefs) : prefs_(prefs) { +} + +UserPrefs::~UserPrefs() { +} + +// static +PrefService* UserPrefs::Get(content::BrowserContext* context) { + DCHECK(context); + return static_cast<UserPrefs*>( + context->GetUserData(UserDataKey()))->prefs_; +} + +// static +void UserPrefs::Set(content::BrowserContext* context, PrefService* prefs) { + DCHECK(context); + DCHECK(prefs); + DCHECK(!context->GetUserData(UserDataKey())); + context->SetUserData(UserDataKey(), new UserPrefs(prefs)); +} + +} // namespace components diff --git a/components/user_prefs/user_prefs.h b/components/user_prefs/user_prefs.h new file mode 100644 index 0000000..1919748 --- /dev/null +++ b/components/user_prefs/user_prefs.h @@ -0,0 +1,49 @@ +// Copyright 2013 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. + +#ifndef COMPONENTS_USER_PREFS_USER_PREFS_H_ +#define COMPONENTS_USER_PREFS_USER_PREFS_H_ + +#include "base/basictypes.h" +#include "base/memory/scoped_ptr.h" +#include "base/supports_user_data.h" +#include "components/user_prefs/user_prefs_export.h" + +class PrefService; + +namespace content { +class BrowserContext; +} + +namespace components { + +// Components may use preferences associated with a given user. These +// hang off of content::BrowserContext and can be retrieved using +// UserPrefs::Get(). +// +// It is up to the embedder tof create and own the PrefService and +// attach it to BrowserContext using the UserPrefs::Set() function. +class USER_PREFS_EXPORT UserPrefs : public base::SupportsUserData::Data { + public: + // Retrieves the PrefService for a given BrowserContext, or NULL if + // none is attached. + static PrefService* Get(content::BrowserContext* context); + + // Hangs the specified |prefs| off of |context|. Should be called + // only once per BrowserContext. + static void Set(content::BrowserContext* context, PrefService* prefs); + + private: + UserPrefs(PrefService* prefs); + virtual ~UserPrefs(); + + // Non-owning; owned by embedder. + PrefService* prefs_; + + DISALLOW_COPY_AND_ASSIGN(UserPrefs); +}; + +} // namespace components + +#endif // COMPONENTS_USER_PREFS_USER_PREFS_H_ diff --git a/components/user_prefs/user_prefs_export.h b/components/user_prefs/user_prefs_export.h new file mode 100644 index 0000000..3d20222 --- /dev/null +++ b/components/user_prefs/user_prefs_export.h @@ -0,0 +1,29 @@ +// Copyright 2013 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. + +#ifndef COMPONENTS_USER_PREFS_USER_PREFS_EXPORT_H_ +#define COMPONENTS_USER_PREFS_USER_PREFS_EXPORT_H_ + +#if defined(COMPONENT_BUILD) +#if defined(WIN32) + +#if defined(USER_PREFS_IMPLEMENTATION) +#define USER_PREFS_EXPORT __declspec(dllexport) +#else +#define USER_PREFS_EXPORT __declspec(dllimport) +#endif // defined(BASE_PREFS_IMPLEMENTATION) + +#else // defined(WIN32) +#if defined(USER_PREFS_IMPLEMENTATION) +#define USER_PREFS_EXPORT __attribute__((visibility("default"))) +#else +#define USER_PREFS_EXPORT +#endif +#endif + +#else // defined(COMPONENT_BUILD) +#define USER_PREFS_EXPORT +#endif + +#endif // COMPONENTS_USER_PREFS_USER_PREFS_EXPORT_H_ |