diff options
author | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-22 17:24:44 +0000 |
---|---|---|
committer | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-22 17:24:44 +0000 |
commit | 5b19952e27008d9cca170c1a517987795d145928 (patch) | |
tree | 34fea6a6f74a0388c68c4ba8cd8846f3ac879027 /chrome/browser | |
parent | 96828ec57f67f91b3b1b2269963680501a6de4b9 (diff) | |
download | chromium_src-5b19952e27008d9cca170c1a517987795d145928.zip chromium_src-5b19952e27008d9cca170c1a517987795d145928.tar.gz chromium_src-5b19952e27008d9cca170c1a517987795d145928.tar.bz2 |
Split PrefService into PrefService, PrefServiceSimple and PrefServiceSyncable.
The first two (PrefServiceSimple is a subclass of PrefService) know
nothing about sync or any Chrome or content concepts.
The third (PrefServiceSyncable, a separate subclass of PrefService)
knows about sync and requires users to choose whether each individual
preference is syncable or not when it is registered.
BrowserProcess::local_state() is a PrefServiceSimple after this
change, and Profile::prefs() is a PrefServiceSyncable.
COLLABORATOR=kaiwang@chromium.org
TBR=ben@chromium.org
BUG=155525
Review URL: https://chromiumcodereview.appspot.com/11570009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@174531 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
366 files changed, 2171 insertions, 1956 deletions
diff --git a/chrome/browser/about_flags_unittest.cc b/chrome/browser/about_flags_unittest.cc index 2cde57e..cff2597 100644 --- a/chrome/browser/about_flags_unittest.cc +++ b/chrome/browser/about_flags_unittest.cc @@ -86,8 +86,7 @@ static Experiment kExperiments[] = { class AboutFlagsTest : public ::testing::Test { protected: AboutFlagsTest() { - prefs_.RegisterListPref(prefs::kEnabledLabsExperiments, - PrefService::UNSYNCABLE_PREF); + prefs_.RegisterListPref(prefs::kEnabledLabsExperiments); testing::ClearState(); } @@ -107,7 +106,7 @@ class AboutFlagsTest : public ::testing::Test { testing::SetExperiments(NULL, 0); } - TestingPrefService prefs_; + TestingPrefServiceSimple prefs_; }; TEST_F(AboutFlagsTest, ChangeNeedsRestart) { @@ -261,7 +260,7 @@ TEST_F(AboutFlagsTest, CheckValues) { std::string switch2_with_equals = std::string("--") + std::string(kSwitch2) + std::string("="); -#if defined(OS_WIN) +#if defined(OS_WIN) EXPECT_NE(std::wstring::npos, command_line.GetCommandLineString().find( ASCIIToWide(switch2_with_equals))); diff --git a/chrome/browser/accessibility/invert_bubble_prefs.cc b/chrome/browser/accessibility/invert_bubble_prefs.cc index 7bb6dbb..001bcd3 100644 --- a/chrome/browser/accessibility/invert_bubble_prefs.cc +++ b/chrome/browser/accessibility/invert_bubble_prefs.cc @@ -9,10 +9,10 @@ namespace chrome { -void RegisterInvertBubbleUserPrefs(PrefService* prefs) { +void RegisterInvertBubbleUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterBooleanPref(prefs::kInvertNotificationShown, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } } // namespace chrome diff --git a/chrome/browser/accessibility/invert_bubble_prefs.h b/chrome/browser/accessibility/invert_bubble_prefs.h index 70e9790..94dba93 100644 --- a/chrome/browser/accessibility/invert_bubble_prefs.h +++ b/chrome/browser/accessibility/invert_bubble_prefs.h @@ -5,11 +5,11 @@ #ifndef CHROME_BROWSER_ACCESSIBILITY_INVERT_BUBBLE_PREFS_H_ #define CHROME_BROWSER_ACCESSIBILITY_INVERT_BUBBLE_PREFS_H_ -class PrefService; +class PrefServiceSyncable; namespace chrome { -void RegisterInvertBubbleUserPrefs(PrefService* prefs); +void RegisterInvertBubbleUserPrefs(PrefServiceSyncable* prefs); } // namespace chrome diff --git a/chrome/browser/autofill/DEPS b/chrome/browser/autofill/DEPS index 4d2dbde..f99f61b 100644 --- a/chrome/browser/autofill/DEPS +++ b/chrome/browser/autofill/DEPS @@ -12,6 +12,8 @@ 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/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc index 8559b92..c4b2f13 100644 --- a/chrome/browser/autofill/autofill_manager.cc +++ b/chrome/browser/autofill/autofill_manager.cc @@ -39,6 +39,7 @@ #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_service.h" #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" #include "chrome/common/autofill_messages.h" #include "chrome/common/chrome_notification_types.h" @@ -225,28 +226,28 @@ AutofillManager::~AutofillManager() { } // static -void AutofillManager::RegisterUserPrefs(PrefServiceBase* prefs) { +void AutofillManager::RegisterUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterBooleanPref(prefs::kAutofillEnabled, true, - PrefServiceBase::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kPasswordGenerationEnabled, true, - PrefServiceBase::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); #if defined(OS_MACOSX) prefs->RegisterBooleanPref(prefs::kAutofillAuxiliaryProfilesEnabled, true, - PrefServiceBase::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); #else prefs->RegisterBooleanPref(prefs::kAutofillAuxiliaryProfilesEnabled, false, - PrefServiceBase::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); #endif prefs->RegisterDoublePref(prefs::kAutofillPositiveUploadRate, kAutofillPositiveUploadRateDefaultValue, - PrefServiceBase::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDoublePref(prefs::kAutofillNegativeUploadRate, kAutofillNegativeUploadRateDefaultValue, - PrefServiceBase::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } void AutofillManager::RegisterWithSyncService() { diff --git a/chrome/browser/autofill/autofill_manager.h b/chrome/browser/autofill/autofill_manager.h index d175ce2..8318480 100644 --- a/chrome/browser/autofill/autofill_manager.h +++ b/chrome/browser/autofill/autofill_manager.h @@ -36,7 +36,7 @@ class AutofillMetrics; class CreditCard; class FormGroup; class GURL; -class PrefService; +class PrefServiceSyncable; class ProfileSyncService; struct FormData; @@ -77,7 +77,7 @@ class AutofillManager : public content::WebContentsObserver, static AutofillManager* FromWebContents(content::WebContents* contents); // Registers our Enable/Disable Autofill pref. - static void RegisterUserPrefs(PrefServiceBase* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); // Set an external delegate. void SetExternalDelegate(AutofillExternalDelegate* delegate); diff --git a/chrome/browser/background/background_contents_service_factory.cc b/chrome/browser/background/background_contents_service_factory.cc index c451e1c..3043efe 100644 --- a/chrome/browser/background/background_contents_service_factory.cc +++ b/chrome/browser/background/background_contents_service_factory.cc @@ -39,9 +39,9 @@ ProfileKeyedService* BackgroundContentsServiceFactory::BuildServiceInstanceFor( } void BackgroundContentsServiceFactory::RegisterUserPrefs( - PrefService* user_prefs) { + PrefServiceSyncable* user_prefs) { user_prefs->RegisterDictionaryPref(prefs::kRegisteredBackgroundContents, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } bool diff --git a/chrome/browser/background/background_contents_service_factory.h b/chrome/browser/background/background_contents_service_factory.h index b6577cb..6abdc3e 100644 --- a/chrome/browser/background/background_contents_service_factory.h +++ b/chrome/browser/background/background_contents_service_factory.h @@ -10,6 +10,7 @@ #include "chrome/browser/profiles/profile_keyed_service_factory.h" class BackgroundContentsService; +class PrefServiceSyncable; class Profile; // Singleton that owns all BackgroundContentsServices and associates them with @@ -30,7 +31,7 @@ class BackgroundContentsServiceFactory : public ProfileKeyedServiceFactory { // ProfileKeyedServiceFactory: virtual ProfileKeyedService* BuildServiceInstanceFor( Profile* profile) const OVERRIDE; - virtual void RegisterUserPrefs(PrefService* user_prefs) OVERRIDE; + virtual void RegisterUserPrefs(PrefServiceSyncable* user_prefs) OVERRIDE; // Use a separate background contents service for incognito. virtual bool ServiceHasOwnInstanceInIncognito() const OVERRIDE; virtual bool ServiceIsCreatedWithProfile() const OVERRIDE; diff --git a/chrome/browser/background/background_mode_manager.cc b/chrome/browser/background/background_mode_manager.cc index 06618dc..0454ef3 100644 --- a/chrome/browser/background/background_mode_manager.cc +++ b/chrome/browser/background/background_mode_manager.cc @@ -219,7 +219,7 @@ BackgroundModeManager::~BackgroundModeManager() { } // static -void BackgroundModeManager::RegisterPrefs(PrefService* prefs) { +void BackgroundModeManager::RegisterPrefs(PrefServiceSimple* prefs) { prefs->RegisterBooleanPref(prefs::kUserCreatedLoginItem, false); prefs->RegisterBooleanPref(prefs::kUserRemovedLoginItem, false); prefs->RegisterBooleanPref(prefs::kBackgroundModeEnabled, true); diff --git a/chrome/browser/background/background_mode_manager.h b/chrome/browser/background/background_mode_manager.h index 5a3db331..a5dd053 100644 --- a/chrome/browser/background/background_mode_manager.h +++ b/chrome/browser/background/background_mode_manager.h @@ -19,7 +19,7 @@ class Browser; class CommandLine; -class PrefService; +class PrefServiceSimple; class Profile; class ProfileInfoCache; class StatusIcon; @@ -53,7 +53,7 @@ class BackgroundModeManager ProfileInfoCache* profile_cache); virtual ~BackgroundModeManager(); - static void RegisterPrefs(PrefService* prefs); + static void RegisterPrefs(PrefServiceSimple* prefs); virtual void RegisterProfile(Profile* profile); diff --git a/chrome/browser/bookmarks/bookmark_model_factory.cc b/chrome/browser/bookmarks/bookmark_model_factory.cc index efa8779..4034579 100644 --- a/chrome/browser/bookmarks/bookmark_model_factory.cc +++ b/chrome/browser/bookmarks/bookmark_model_factory.cc @@ -40,13 +40,13 @@ ProfileKeyedService* BookmarkModelFactory::BuildServiceInstanceFor( return bookmark_model; } -void BookmarkModelFactory::RegisterUserPrefs(PrefService* prefs) { +void BookmarkModelFactory::RegisterUserPrefs(PrefServiceSyncable* prefs) { // Don't sync this, as otherwise, due to a limitation in sync, it // will cause a deadlock (see http://crbug.com/97955). If we truly // want to sync the expanded state of folders, it should be part of // bookmark sync itself (i.e., a property of the sync folder nodes). prefs->RegisterListPref(prefs::kBookmarkEditorExpandedNodes, new ListValue, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } bool BookmarkModelFactory::ServiceRedirectedInIncognito() const { diff --git a/chrome/browser/bookmarks/bookmark_model_factory.h b/chrome/browser/bookmarks/bookmark_model_factory.h index 72ed21e..5ad84d7 100644 --- a/chrome/browser/bookmarks/bookmark_model_factory.h +++ b/chrome/browser/bookmarks/bookmark_model_factory.h @@ -11,6 +11,7 @@ template <typename T> struct DefaultSingletonTraits; +class PrefServiceSyncable; class Profile; class BookmarkModel; @@ -33,7 +34,7 @@ class BookmarkModelFactory : public ProfileKeyedServiceFactory { // ProfileKeyedServiceFactory: virtual ProfileKeyedService* BuildServiceInstanceFor( Profile* profile) const OVERRIDE; - virtual void RegisterUserPrefs(PrefService* user_prefs) OVERRIDE; + virtual void RegisterUserPrefs(PrefServiceSyncable* user_prefs) OVERRIDE; virtual bool ServiceRedirectedInIncognito() const OVERRIDE; virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; diff --git a/chrome/browser/bookmarks/bookmark_prompt_prefs.cc b/chrome/browser/bookmarks/bookmark_prompt_prefs.cc index ca63066..bd7ef4e 100644 --- a/chrome/browser/bookmarks/bookmark_prompt_prefs.cc +++ b/chrome/browser/bookmarks/bookmark_prompt_prefs.cc @@ -4,7 +4,7 @@ #include "chrome/browser/bookmarks/bookmark_prompt_prefs.h" -#include "base/prefs/public/pref_service_base.h" +#include "chrome/browser/prefs/pref_service.h" #include "chrome/common/pref_names.h" namespace { @@ -36,11 +36,11 @@ bool BookmarkPromptPrefs::IsBookmarkPromptEnabled() const { } // static -void BookmarkPromptPrefs::RegisterUserPrefs(PrefServiceBase* user_prefs) { +void BookmarkPromptPrefs::RegisterUserPrefs(PrefServiceSyncable* user_prefs) { // We always register preferences without checking FieldTrial, because // we may not receive field trial list from the server yet. user_prefs->RegisterBooleanPref(prefs::kBookmarkPromptEnabled, true, - PrefServiceBase::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); user_prefs->RegisterIntegerPref(prefs::kBookmarkPromptImpressionCount, 0, - PrefServiceBase::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } diff --git a/chrome/browser/bookmarks/bookmark_prompt_prefs.h b/chrome/browser/bookmarks/bookmark_prompt_prefs.h index 1bba11e..f40ed90 100644 --- a/chrome/browser/bookmarks/bookmark_prompt_prefs.h +++ b/chrome/browser/bookmarks/bookmark_prompt_prefs.h @@ -7,6 +7,7 @@ #include "base/basictypes.h" +class PrefServiceSyncable; class PrefServiceBase; // Helper class for getting, changing bookmark prompt related preferences. @@ -30,7 +31,7 @@ class BookmarkPromptPrefs { bool IsBookmarkPromptEnabled() const; // Registers user preferences used by bookmark prompt feature. - static void RegisterUserPrefs(PrefServiceBase* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); private: PrefServiceBase* prefs_; // Weak. diff --git a/chrome/browser/bookmarks/bookmark_utils.cc b/chrome/browser/bookmarks/bookmark_utils.cc index 4772157..3b0bcbd 100644 --- a/chrome/browser/bookmarks/bookmark_utils.cc +++ b/chrome/browser/bookmarks/bookmark_utils.cc @@ -11,7 +11,6 @@ #include "base/i18n/case_conversion.h" #include "base/i18n/string_search.h" #include "base/metrics/histogram.h" -#include "base/prefs/public/pref_service_base.h" #include "base/string16.h" #include "base/time.h" #include "base/utf_string_conversions.h" @@ -19,6 +18,7 @@ #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_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/pref_names.h" #include "content/public/browser/user_metrics.h" @@ -436,13 +436,13 @@ const BookmarkNode* ApplyEditsWithPossibleFolderChange( return node; } -void RegisterUserPrefs(PrefServiceBase* prefs) { +void RegisterUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterBooleanPref(prefs::kShowBookmarkBar, false, - PrefServiceBase::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kEditBookmarksEnabled, true, - PrefServiceBase::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } const BookmarkNode* GetParentForNewNodes( diff --git a/chrome/browser/bookmarks/bookmark_utils.h b/chrome/browser/bookmarks/bookmark_utils.h index 1f2c678..7949adc 100644 --- a/chrome/browser/bookmarks/bookmark_utils.h +++ b/chrome/browser/bookmarks/bookmark_utils.h @@ -17,7 +17,7 @@ class BookmarkModel; class BookmarkNode; class Browser; -class PrefServiceBase; +class PrefServiceSyncable; class Profile; namespace content { @@ -164,7 +164,7 @@ const BookmarkNode* ApplyEditsWithPossibleFolderChange( const GURL& new_url); // Register user preferences for BookmarksBar. -void RegisterUserPrefs(PrefServiceBase* prefs); +void RegisterUserPrefs(PrefServiceSyncable* prefs); // Returns the parent for newly created folders/bookmarks. If |selection| has // one element and it is a folder, |selection[0]| is returned, otherwise diff --git a/chrome/browser/browser_process.h b/chrome/browser/browser_process.h index 4a02629..af1b13e 100644 --- a/chrome/browser/browser_process.h +++ b/chrome/browser/browser_process.h @@ -29,7 +29,7 @@ class IntranetRedirectDetector; class IOThread; class MetricsService; class NotificationUIManager; -class PrefService; +class PrefServiceSimple; class Profile; class ProfileManager; class RenderWidgetSnapshotTaker; @@ -97,7 +97,7 @@ class BrowserProcess { // Services: any of these getters may return NULL virtual MetricsService* metrics_service() = 0; virtual ProfileManager* profile_manager() = 0; - virtual PrefService* local_state() = 0; + virtual PrefServiceSimple* local_state() = 0; virtual net::URLRequestContextGetter* system_request_context() = 0; virtual chrome_variations::VariationsService* variations_service() = 0; diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc index aa144ca..3a72d68 100644 --- a/chrome/browser/browser_process_impl.cc +++ b/chrome/browser/browser_process_impl.cc @@ -49,7 +49,7 @@ #include "chrome/browser/plugins/plugin_finder.h" #include "chrome/browser/policy/policy_service.h" #include "chrome/browser/prefs/browser_prefs.h" -#include "chrome/browser/prefs/chrome_pref_service_builder.h" +#include "chrome/browser/prefs/chrome_pref_service_factory.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/prerender/prerender_tracker.h" #include "chrome/browser/printing/background_printing_manager.h" @@ -400,7 +400,10 @@ ProfileManager* BrowserProcessImpl::profile_manager() { return profile_manager_.get(); } -PrefService* BrowserProcessImpl::local_state() { +// TODO(joi): Switch to returning just PrefService, since those +// calling this function shouldn't be doing ad-hoc registration, that +// happens earlier in browser_prefs::RegisterLocalState. +PrefServiceSimple* BrowserProcessImpl::local_state() { DCHECK(CalledOnValidThread()); if (!created_local_state_) CreateLocalState(); @@ -735,10 +738,10 @@ void BrowserProcessImpl::CreateLocalState() { FilePath local_state_path; CHECK(PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path)); local_state_.reset( - ChromePrefServiceBuilder().CreateChromePrefs(local_state_path, - local_state_task_runner_, - policy_service(), - NULL, false)); + chrome_prefs::CreateLocalState(local_state_path, + local_state_task_runner_, + policy_service(), + NULL, false)); // Initialize the prefs of the local state. chrome::RegisterLocalState(local_state_.get()); diff --git a/chrome/browser/browser_process_impl.h b/chrome/browser/browser_process_impl.h index 85fcc40..7653e0c 100644 --- a/chrome/browser/browser_process_impl.h +++ b/chrome/browser/browser_process_impl.h @@ -25,6 +25,7 @@ class ChromeNetLog; class ChromeResourceDispatcherHostDelegate; class CommandLine; class RemoteDebuggingServer; +class PrefServiceSimple; #if defined(ENABLE_PLUGIN_INSTALLATION) class PluginsResourceService; @@ -74,7 +75,7 @@ class BrowserProcessImpl : public BrowserProcess, virtual IOThread* io_thread() OVERRIDE; virtual WatchDogThread* watchdog_thread() OVERRIDE; virtual ProfileManager* profile_manager() OVERRIDE; - virtual PrefService* local_state() OVERRIDE; + virtual PrefServiceSimple* local_state() OVERRIDE; virtual net::URLRequestContextGetter* system_request_context() OVERRIDE; virtual chrome_variations::VariationsService* variations_service() OVERRIDE; #if defined(OS_CHROMEOS) @@ -174,7 +175,7 @@ class BrowserProcessImpl : public BrowserProcess, scoped_ptr<ProfileManager> profile_manager_; bool created_local_state_; - scoped_ptr<PrefService> local_state_; + scoped_ptr<PrefServiceSimple> local_state_; bool created_icon_manager_; scoped_ptr<IconManager> icon_manager_; diff --git a/chrome/browser/browser_shutdown.cc b/chrome/browser/browser_shutdown.cc index 9a0d6f0..d733942 100644 --- a/chrome/browser/browser_shutdown.cc +++ b/chrome/browser/browser_shutdown.cc @@ -78,7 +78,7 @@ int shutdown_num_processes_slow_; const char kShutdownMsFile[] = "chrome_shutdown_ms.txt"; -void RegisterPrefs(PrefService* local_state) { +void RegisterPrefs(PrefServiceSimple* local_state) { local_state->RegisterIntegerPref(prefs::kShutdownType, NOT_VALID); local_state->RegisterIntegerPref(prefs::kShutdownNumProcesses, 0); local_state->RegisterIntegerPref(prefs::kShutdownNumProcessesSlow, 0); diff --git a/chrome/browser/browser_shutdown.h b/chrome/browser/browser_shutdown.h index 1f4aa23..cc4f728 100644 --- a/chrome/browser/browser_shutdown.h +++ b/chrome/browser/browser_shutdown.h @@ -5,7 +5,7 @@ #ifndef CHROME_BROWSER_BROWSER_SHUTDOWN_H__ #define CHROME_BROWSER_BROWSER_SHUTDOWN_H__ -class PrefService; +class PrefServiceSimple; namespace browser_shutdown { @@ -20,7 +20,7 @@ enum ShutdownType { END_SESSION }; -void RegisterPrefs(PrefService* local_state); +void RegisterPrefs(PrefServiceSimple* local_state); // Called when the browser starts shutting down so that we can measure shutdown // time. diff --git a/chrome/browser/browsing_data/cookies_tree_model_unittest.cc b/chrome/browser/browsing_data/cookies_tree_model_unittest.cc index 7f725a0..947ce49 100644 --- a/chrome/browser/browsing_data/cookies_tree_model_unittest.cc +++ b/chrome/browser/browsing_data/cookies_tree_model_unittest.cc @@ -20,6 +20,7 @@ #include "chrome/browser/content_settings/host_content_settings_map.h" #include "chrome/browser/content_settings/mock_settings_observer.h" #include "chrome/browser/extensions/extension_special_storage_policy.h" +#include "chrome/browser/prefs/pref_service.h" #include "chrome/test/base/testing_profile.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_types.h" diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc index 3c4168a..81e632d 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc @@ -67,7 +67,8 @@ #include "chrome/browser/performance_monitor/startup_timer.h" #include "chrome/browser/plugins/plugin_prefs.h" #include "chrome/browser/policy/policy_service.h" -#include "chrome/browser/prefs/chrome_pref_service_builder.h" +#include "chrome/browser/prefs/chrome_pref_service_factory.h" +#include "chrome/browser/prefs/command_line_pref_store.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/prefs/pref_value_store.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" @@ -233,7 +234,7 @@ PrefService* InitializeLocalState( // Load local state. This includes the application locale so we know which // locale dll to load. - PrefService* local_state = g_browser_process->local_state(); + PrefServiceSimple* local_state = g_browser_process->local_state(); DCHECK(local_state); // TODO(brettw,*): this comment about ResourceBundle was here since @@ -282,8 +283,8 @@ PrefService* InitializeLocalState( parsed_command_line.HasSwitch(switches::kParentProfile)) { FilePath parent_profile = parsed_command_line.GetSwitchValuePath(switches::kParentProfile); - scoped_ptr<PrefService> parent_local_state( - ChromePrefServiceBuilder().CreateChromePrefs( + scoped_ptr<PrefServiceSimple> parent_local_state( + chrome_prefs::CreateLocalState( parent_profile, local_state_task_runner, g_browser_process->policy_service(), @@ -750,7 +751,8 @@ int ChromeBrowserMainParts::PreCreateThreadsImpl() { // needed on Android as there aren't experimental flags. about_flags::ConvertFlagsToSwitches(local_state_, CommandLine::ForCurrentProcess()); - local_state_->UpdateCommandLinePrefStore(CommandLine::ForCurrentProcess()); + local_state_->UpdateCommandLinePrefStore( + new CommandLinePrefStore(CommandLine::ForCurrentProcess())); // Reset the command line in the crash report details, since we may have // just changed it to include experiments. diff --git a/chrome/browser/chrome_browser_main_unittest.cc b/chrome/browser/chrome_browser_main_unittest.cc index 11c1422..fcde8f6 100644 --- a/chrome/browser/chrome_browser_main_unittest.cc +++ b/chrome/browser/chrome_browser_main_unittest.cc @@ -24,7 +24,6 @@ class BrowserMainTest : public testing::Test { } protected: - TestingPrefService pref_service_; CommandLine command_line_; }; diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 6f7edfe..3a4140e 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -413,16 +413,16 @@ ChromeContentBrowserClient::~ChromeContentBrowserClient() { } // static -void ChromeContentBrowserClient::RegisterUserPrefs(PrefService* prefs) { +void ChromeContentBrowserClient::RegisterUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterBooleanPref(prefs::kDisable3DAPIs, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kEnableHyperlinkAuditing, true, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kEnableMemoryInfo, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } content::BrowserMainParts* ChromeContentBrowserClient::CreateBrowserMainParts( diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h index 973ea17..55cc78f 100644 --- a/chrome/browser/chrome_content_browser_client.h +++ b/chrome/browser/chrome_content_browser_client.h @@ -26,7 +26,7 @@ namespace extensions { class Extension; } -class PrefService; +class PrefServiceSyncable; namespace chrome { @@ -35,7 +35,7 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient { ChromeContentBrowserClient(); virtual ~ChromeContentBrowserClient(); - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); virtual content::BrowserMainParts* CreateBrowserMainParts( const content::MainFunctionParams& parameters) OVERRIDE; diff --git a/chrome/browser/chrome_to_mobile_service.cc b/chrome/browser/chrome_to_mobile_service.cc index 744153b..5ccbd8e 100644 --- a/chrome/browser/chrome_to_mobile_service.cc +++ b/chrome/browser/chrome_to_mobile_service.cc @@ -247,9 +247,9 @@ bool ChromeToMobileService::UpdateAndGetCommandState(Browser* browser) { } // static -void ChromeToMobileService::RegisterUserPrefs(PrefService* prefs) { +void ChromeToMobileService::RegisterUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterListPref(prefs::kChromeToMobileDeviceList, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } ChromeToMobileService::ChromeToMobileService(Profile* profile) diff --git a/chrome/browser/chrome_to_mobile_service.h b/chrome/browser/chrome_to_mobile_service.h index 2d0436c..cbf03e9 100644 --- a/chrome/browser/chrome_to_mobile_service.h +++ b/chrome/browser/chrome_to_mobile_service.h @@ -31,7 +31,7 @@ class OAuth2AccessTokenFetcher; class Browser; class CloudPrintURL; class MockChromeToMobileService; -class PrefService; +class PrefServiceSyncable; class Profile; namespace net { @@ -98,7 +98,7 @@ class ChromeToMobileService : public ProfileKeyedService, static bool UpdateAndGetCommandState(Browser* browser); // Register the user prefs associated with this service. - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); explicit ChromeToMobileService(Profile* profile); virtual ~ChromeToMobileService(); diff --git a/chrome/browser/chromeos/audio/audio_handler.cc b/chrome/browser/chromeos/audio/audio_handler.cc index bb10933..6d3da0d 100644 --- a/chrome/browser/chromeos/audio/audio_handler.cc +++ b/chrome/browser/chromeos/audio/audio_handler.cc @@ -78,30 +78,26 @@ AudioHandler* AudioHandler::GetInstance() { } // static -void AudioHandler::RegisterPrefs(PrefService* local_state) { +void AudioHandler::RegisterPrefs(PrefServiceSimple* local_state) { if (!local_state->FindPreference(prefs::kAudioVolumePercent)) { local_state->RegisterDoublePref(prefs::kAudioVolumePercent, - kDefaultVolumePercent, - PrefService::UNSYNCABLE_PREF); + kDefaultVolumePercent); } if (!local_state->FindPreference(prefs::kAudioMute)) { local_state->RegisterIntegerPref(prefs::kAudioMute, - kPrefMuteOff, - PrefService::UNSYNCABLE_PREF); + kPrefMuteOff); } if (!local_state->FindPreference(prefs::kAudioOutputAllowed)) { // Register the prefs backing the audio muting policies. local_state->RegisterBooleanPref(prefs::kAudioOutputAllowed, - true, - PrefService::UNSYNCABLE_PREF); + true); } // This pref has moved to the media subsystem but we should verify it is there // before we use it. if (!local_state->FindPreference(prefs::kAudioCaptureAllowed)) { local_state->RegisterBooleanPref(prefs::kAudioCaptureAllowed, - true, - PrefService::UNSYNCABLE_PREF); + true); } } diff --git a/chrome/browser/chromeos/audio/audio_handler.h b/chrome/browser/chromeos/audio/audio_handler.h index 870d3c3..78b333b 100644 --- a/chrome/browser/chromeos/audio/audio_handler.h +++ b/chrome/browser/chromeos/audio/audio_handler.h @@ -15,6 +15,7 @@ template <typename T> struct DefaultSingletonTraits; class PrefChangeRegistrar; class PrefService; +class PrefServiceSimple; namespace chromeos { @@ -43,7 +44,7 @@ class AudioHandler { static AudioHandler* GetInstance(); // Registers volume and mute preferences. - static void RegisterPrefs(PrefService* local_state); + static void RegisterPrefs(PrefServiceSimple* local_state); // Gets volume level in our internal 0-100% range, 0 being pure silence. double GetVolumePercent(); diff --git a/chrome/browser/chromeos/customization_document.cc b/chrome/browser/chromeos/customization_document.cc index 932ec75..6230b79 100644 --- a/chrome/browser/chromeos/customization_document.cc +++ b/chrome/browser/chromeos/customization_document.cc @@ -248,9 +248,9 @@ ServicesCustomizationDocument* ServicesCustomizationDocument::GetInstance() { } // static -void ServicesCustomizationDocument::RegisterPrefs(PrefService* local_state) { - local_state->RegisterBooleanPref(kServicesCustomizationAppliedPref, false, - PrefService::UNSYNCABLE_PREF); +void ServicesCustomizationDocument::RegisterPrefs( + PrefServiceSimple* local_state) { + local_state->RegisterBooleanPref(kServicesCustomizationAppliedPref, false); } // static diff --git a/chrome/browser/chromeos/customization_document.h b/chrome/browser/chromeos/customization_document.h index 8734701..93cb59a 100644 --- a/chrome/browser/chromeos/customization_document.h +++ b/chrome/browser/chromeos/customization_document.h @@ -17,7 +17,7 @@ #include "net/url_request/url_fetcher_delegate.h" class FilePath; -class PrefService; +class PrefServiceSimple; namespace base { class DictionaryValue; @@ -119,7 +119,7 @@ class ServicesCustomizationDocument : public CustomizationDocument, static ServicesCustomizationDocument* GetInstance(); // Registers preferences. - static void RegisterPrefs(PrefService* local_state); + static void RegisterPrefs(PrefServiceSimple* local_state); // Return true if the customization was applied. Customization is applied only // once per machine. diff --git a/chrome/browser/chromeos/display/display_preferences.cc b/chrome/browser/chromeos/display/display_preferences.cc index 1807333..90d7204 100644 --- a/chrome/browser/chromeos/display/display_preferences.cc +++ b/chrome/browser/chromeos/display/display_preferences.cc @@ -132,28 +132,22 @@ void NotifyDisplayOverscans() { } // namespace -void RegisterDisplayLocalStatePrefs(PrefService* local_state) { +void RegisterDisplayLocalStatePrefs(PrefServiceSimple* local_state) { // The default secondary display layout. local_state->RegisterIntegerPref(prefs::kSecondaryDisplayLayout, - static_cast<int>(ash::DisplayLayout::RIGHT), - PrefService::UNSYNCABLE_PREF); + static_cast<int>(ash::DisplayLayout::RIGHT)); // The default offset of the secondary display position from the primary // display. - local_state->RegisterIntegerPref(prefs::kSecondaryDisplayOffset, - 0, - PrefService::UNSYNCABLE_PREF); + local_state->RegisterIntegerPref(prefs::kSecondaryDisplayOffset, 0); // Per-display preference. - local_state->RegisterDictionaryPref(prefs::kSecondaryDisplays, - PrefService::UNSYNCABLE_PREF); + local_state->RegisterDictionaryPref(prefs::kSecondaryDisplays); // Primary output name. local_state->RegisterInt64Pref(prefs::kPrimaryDisplayID, - gfx::Display::kInvalidDisplayID, - PrefService::UNSYNCABLE_PREF); + gfx::Display::kInvalidDisplayID); // Display overscan preference. - local_state->RegisterDictionaryPref(prefs::kDisplayOverscans, - PrefService::UNSYNCABLE_PREF); + local_state->RegisterDictionaryPref(prefs::kDisplayOverscans); } void SetDisplayLayoutPref(const gfx::Display& display, diff --git a/chrome/browser/chromeos/display/display_preferences.h b/chrome/browser/chromeos/display/display_preferences.h index be358a1..615ce57 100644 --- a/chrome/browser/chromeos/display/display_preferences.h +++ b/chrome/browser/chromeos/display/display_preferences.h @@ -7,7 +7,8 @@ #include "base/basictypes.h" -class PrefService; +class PrefServiceSimple; + namespace gfx { class Display; class Insets; @@ -17,7 +18,7 @@ namespace chromeos { // Registers the prefs associated with display settings and stored // into Local State. -void RegisterDisplayLocalStatePrefs(PrefService* local_state); +void RegisterDisplayLocalStatePrefs(PrefServiceSimple* local_state); // Sets or updates the display layout data to the specified |display| and // |pref_service|. diff --git a/chrome/browser/chromeos/input_method/input_method_persistence_unittest.cc b/chrome/browser/chromeos/input_method/input_method_persistence_unittest.cc index 2581070..606ad6f 100644 --- a/chrome/browser/chromeos/input_method/input_method_persistence_unittest.cc +++ b/chrome/browser/chromeos/input_method/input_method_persistence_unittest.cc @@ -60,7 +60,7 @@ class InputMethodPersistenceTest : public testing::Test { language_prefs::kPreferredKeyboardLayout)); } - TestingPrefService* mock_user_prefs_; + TestingPrefServiceSyncable* mock_user_prefs_; MockInputMethodManager mock_manager_; TestingProfileManager mock_profile_manager_; }; diff --git a/chrome/browser/chromeos/language_preferences.cc b/chrome/browser/chromeos/language_preferences.cc index f2adbaa..77658dd 100644 --- a/chrome/browser/chromeos/language_preferences.cc +++ b/chrome/browser/chromeos/language_preferences.cc @@ -26,33 +26,33 @@ const char kChewingSectionName[] = "engine/Chewing"; const LanguageBooleanPrefs kChewingBooleanPrefs[] = { { prefs::kLanguageChewingAutoShiftCur, false, "autoShiftCur", IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_SETTING_AUTO_SHIFT_CUR, - PrefService::SYNCABLE_PREF }, + PrefServiceSyncable::SYNCABLE_PREF }, { prefs::kLanguageChewingAddPhraseDirection, false, "addPhraseDirection", IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_SETTING_ADD_PHRASE_DIRECTION, - PrefService::SYNCABLE_PREF }, + PrefServiceSyncable::SYNCABLE_PREF }, /* Temporarily disabled. (crosbug.com/14185) { prefs::kLanguageChewingEasySymbolInput, true, "easySymbolInput", IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_SETTING_EASY_SYMBOL_INPUT, - PrefService::SYNCABLE_PREF }, + PrefServiceSyncable::SYNCABLE_PREF }, */ { prefs::kLanguageChewingEscCleanAllBuf, false, "escCleanAllBuf", IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_SETTING_ESC_CLEAN_ALL_BUF, - PrefService::SYNCABLE_PREF }, + PrefServiceSyncable::SYNCABLE_PREF }, { prefs::kLanguageChewingForceLowercaseEnglish, false, "forceLowercaseEnglish", IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_SETTING_FORCE_LOWER_CASE_ENGLISH, - PrefService::SYNCABLE_PREF }, + PrefServiceSyncable::SYNCABLE_PREF }, /* Temporarily disabled. (crosbug.com/14185) { prefs::kLanguageChewingPlainZhuyin, false, "plainZhuyin", IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_SETTING_PLAIN_ZHUYIN, - PrefService::SYNCABLE_PREF }, + PrefServiceSyncable::SYNCABLE_PREF }, */ { prefs::kLanguageChewingPhraseChoiceRearward, true, "phraseChoiceRearward", IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_SETTING_PHRASE_CHOICE_REARWARD, - PrefService::SYNCABLE_PREF }, + PrefServiceSyncable::SYNCABLE_PREF }, { prefs::kLanguageChewingSpaceAsSelection, true, "spaceAsSelection", IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_SETTING_SPACE_AS_SELECTION, - PrefService::SYNCABLE_PREF }, + PrefServiceSyncable::SYNCABLE_PREF }, }; COMPILE_ASSERT(kNumChewingBooleanPrefs == arraysize(kChewingBooleanPrefs), TheSizeShouldMatch); @@ -60,11 +60,11 @@ COMPILE_ASSERT(kNumChewingBooleanPrefs == arraysize(kChewingBooleanPrefs), const LanguageIntegerRangePreference kChewingIntegerPrefs[] = { { prefs::kLanguageChewingMaxChiSymbolLen, 20, 8, 40, "maxChiSymbolLen", IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_SETTING_MAX_CHI_SYMBOL_LEN, - PrefService::SYNCABLE_PREF + PrefServiceSyncable::SYNCABLE_PREF }, { prefs::kLanguageChewingCandPerPage, 10, 8, 10, "candPerPage", IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_SETTING_CAND_PER_PAGE, - PrefService::SYNCABLE_PREF + PrefServiceSyncable::SYNCABLE_PREF }, }; COMPILE_ASSERT(kNumChewingIntegerPrefs == arraysize(kChewingIntegerPrefs), @@ -90,7 +90,7 @@ const LanguageMultipleChoicePreference<const char*> IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_KEYBOARD_TYPE_DACHEN_26 }, { "hanyu", IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_KEYBOARD_TYPE_HANYU }}, IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_KEYBOARD_TYPE, - PrefService::SYNCABLE_PREF, + PrefServiceSyncable::SYNCABLE_PREF, }, { prefs::kLanguageChewingSelKeys, "1234567890", @@ -112,7 +112,7 @@ const LanguageMultipleChoicePreference<const char*> { "1234qweras", IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_SEL_KEYS_1234QWERAS }}, IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_SEL_KEYS, - PrefService::SYNCABLE_PREF, + PrefServiceSyncable::SYNCABLE_PREF, }, }; COMPILE_ASSERT(kNumChewingMultipleChoicePrefs == @@ -126,7 +126,7 @@ const LanguageMultipleChoicePreference<int> kChewingHsuSelKeyType = { {{ 1, IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_HSU_SEL_KEY_TYPE_1 }, { 2, IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_HSU_SEL_KEY_TYPE_2 }}, IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_HSU_SEL_KEY_TYPE, - PrefService::SYNCABLE_PREF, + PrefServiceSyncable::SYNCABLE_PREF, }; // --------------------------------------------------------------------------- @@ -167,37 +167,37 @@ const char kPinyinSectionName[] = "engine/Pinyin"; const LanguageBooleanPrefs kPinyinBooleanPrefs[] = { { prefs::kLanguagePinyinCorrectPinyin, true, "CorrectPinyin", IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_SETTING_CORRECT_PINYIN, - PrefService::SYNCABLE_PREF }, + PrefServiceSyncable::SYNCABLE_PREF }, { prefs::kLanguagePinyinFuzzyPinyin, false, "FuzzyPinyin", IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_SETTING_FUZZY_PINYIN, - PrefService::SYNCABLE_PREF }, + PrefServiceSyncable::SYNCABLE_PREF }, { prefs::kLanguagePinyinShiftSelectCandidate, false, "ShiftSelectCandidate", IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_SETTING_SHIFT_SELECT_PINYIN, - PrefService::SYNCABLE_PREF }, + PrefServiceSyncable::SYNCABLE_PREF }, { prefs::kLanguagePinyinMinusEqualPage, true, "MinusEqualPage", IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_SETTING_MINUS_EQUAL_PAGE, - PrefService::SYNCABLE_PREF }, + PrefServiceSyncable::SYNCABLE_PREF }, { prefs::kLanguagePinyinCommaPeriodPage, true, "CommaPeriodPage", IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_SETTING_COMMA_PERIOD_PAGE, - PrefService::SYNCABLE_PREF }, + PrefServiceSyncable::SYNCABLE_PREF }, { prefs::kLanguagePinyinAutoCommit, false, "AutoCommit", IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_SETTING_AUTO_COMMIT, - PrefService::SYNCABLE_PREF }, + PrefServiceSyncable::SYNCABLE_PREF }, { prefs::kLanguagePinyinDoublePinyin, false, "DoublePinyin", IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_SETTING_DOUBLE_PINYIN, - PrefService::SYNCABLE_PREF }, + PrefServiceSyncable::SYNCABLE_PREF }, { prefs::kLanguagePinyinInitChinese, true, "InitChinese", IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_SETTING_INIT_CHINESE, - PrefService::SYNCABLE_PREF }, + PrefServiceSyncable::SYNCABLE_PREF }, { prefs::kLanguagePinyinInitFull, false, "InitFull", IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_SETTING_INIT_FULL, - PrefService::SYNCABLE_PREF }, + PrefServiceSyncable::SYNCABLE_PREF }, { prefs::kLanguagePinyinInitFullPunct, true, "InitFullPunct", IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_SETTING_INIT_FULL_PUNCT, - PrefService::SYNCABLE_PREF }, + PrefServiceSyncable::SYNCABLE_PREF }, { prefs::kLanguagePinyinInitSimplifiedChinese, true, "InitSimplifiedChinese", IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_SETTING_INIT_SIMPLIFIED_CHINESE, - PrefService::SYNCABLE_PREF }, + PrefServiceSyncable::SYNCABLE_PREF }, // TODO(yusukes): Support PINYIN_{INCOMPLETE,CORRECT,FUZZY}_... prefs (32 // additional boolean prefs.) }; @@ -215,13 +215,17 @@ const LanguageMultipleChoicePreference<int> kPinyinDoublePinyinSchema = { { 3, IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_DOUBLE_SCHEMA_ZGPY}, { 4, IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_DOUBLE_SCHEMA_PYJJ}}, IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_DOUBLE_SCHEMA, - PrefService::SYNCABLE_PREF, + PrefServiceSyncable::SYNCABLE_PREF, }; const PinyinIntegerPref kPinyinIntegerPrefs[] = { // TODO(yusukes): the type of lookup_table_page_size on ibus should be uint. - { prefs::kLanguagePinyinLookupTablePageSize, 5, "LookupTablePageSize", - PrefService::UNSYNCABLE_PREF } // don't sync as it's not user configurable. + { prefs::kLanguagePinyinLookupTablePageSize, + 5, + "LookupTablePageSize", + + // don't sync as it's not user configurable. + PrefServiceSyncable::UNSYNCABLE_PREF } }; COMPILE_ASSERT(kNumPinyinIntegerPrefs == arraysize(kPinyinIntegerPrefs), TheSizeShouldMatch); @@ -236,22 +240,22 @@ const LanguageBooleanPrefs kMozcBooleanPrefs[] = { false, "incognito_mode", IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_INCOGNITO_MODE, - PrefService::SYNCABLE_PREF }, + PrefServiceSyncable::SYNCABLE_PREF }, { prefs::kLanguageMozcUseAutoImeTurnOff, true, "use_auto_ime_turn_off", IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_USE_AUTO_IME_TURN_OFF, - PrefService::SYNCABLE_PREF }, + PrefServiceSyncable::SYNCABLE_PREF }, { prefs::kLanguageMozcUseHistorySuggest, true, "use_history_suggest", IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_USE_HISTORY_SUGGEST, - PrefService::SYNCABLE_PREF }, + PrefServiceSyncable::SYNCABLE_PREF }, { prefs::kLanguageMozcUseDictionarySuggest, true, "use_dictionary_suggest", IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_USE_DICTIONARY_SUGGEST, - PrefService::SYNCABLE_PREF }, + PrefServiceSyncable::SYNCABLE_PREF }, }; COMPILE_ASSERT(kNumMozcBooleanPrefs == arraysize(kMozcBooleanPrefs), TheSizeShouldMatch); @@ -264,7 +268,7 @@ extern const LanguageMultipleChoicePreference<const char*> {{ "ROMAN", IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_PREEDIT_METHOD_ROMAN }, { "KANA", IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_PREEDIT_METHOD_KANA }}, IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_PREEDIT_METHOD, - PrefService::SYNCABLE_PREF, + PrefServiceSyncable::SYNCABLE_PREF, }, { prefs::kLanguageMozcSessionKeymap, "MSIME", @@ -274,7 +278,7 @@ extern const LanguageMultipleChoicePreference<const char*> { "KOTOERI", IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_SESSION_KEYMAP_KOTOERI }}, // TODO: Support "CUSTOM" keymap. IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_SESSION_KEYMAP, - PrefService::SYNCABLE_PREF, + PrefServiceSyncable::SYNCABLE_PREF, }, { prefs::kLanguageMozcPunctuationMethod, "KUTEN_TOUTEN", @@ -288,7 +292,7 @@ extern const LanguageMultipleChoicePreference<const char*> { "COMMA_TOUTEN", IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_PUNCTUATION_METHOD_COMMA_TOUTEN }}, IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_PUNCTUATION_METHOD, - PrefService::SYNCABLE_PREF, + PrefServiceSyncable::SYNCABLE_PREF, }, { prefs::kLanguageMozcSymbolMethod, "CORNER_BRACKET_MIDDLE_DOT", @@ -302,7 +306,7 @@ extern const LanguageMultipleChoicePreference<const char*> { "SQUARE_BRACKET_MIDDLE_DOT", IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_SYMBOL_METHOD_SQUARE_BRACKET_MIDDLE_DOT }}, IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_SYMBOL_METHOD, - PrefService::SYNCABLE_PREF, + PrefServiceSyncable::SYNCABLE_PREF, }, { prefs::kLanguageMozcSpaceCharacterForm, "FUNDAMENTAL_INPUT_MODE", @@ -314,7 +318,7 @@ extern const LanguageMultipleChoicePreference<const char*> { "FUNDAMENTAL_HALF_WIDTH", IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_SPACE_CHARACTER_FORM_FUNDAMENTAL_HALF_WIDTH }}, IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_SPACE_CHARACTER_FORM, - PrefService::SYNCABLE_PREF, + PrefServiceSyncable::SYNCABLE_PREF, }, { prefs::kLanguageMozcHistoryLearningLevel, "DEFAULT_HISTORY", @@ -326,7 +330,7 @@ extern const LanguageMultipleChoicePreference<const char*> { "NO_HISTORY", IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_HISTORY_LEARNING_LEVEL_NO_HISTORY }}, IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_HISTORY_LEARNING_LEVEL, - PrefService::SYNCABLE_PREF, + PrefServiceSyncable::SYNCABLE_PREF, }, // TODO(mazda): Uncomment this block once the candidate window in Chrome OS // supports changing shortcut labels. @@ -340,7 +344,7 @@ extern const LanguageMultipleChoicePreference<const char*> // { "SHORTCUT_ASDFGHJKL", // IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_SELECTION_SHORTCUT_SHORTCUT_ASDFGHJKL }}, // IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_SELECTION_SHORTCUT, - // PrefService::SYNCABLE_PREF, + // PrefServiceSyncable::SYNCABLE_PREF, // }, { prefs::kLanguageMozcShiftKeyModeSwitch, "ASCII_INPUT_MODE", @@ -352,7 +356,7 @@ extern const LanguageMultipleChoicePreference<const char*> { "KATAKANA_INPUT_MODE", IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_SHIFT_KEY_MODE_SWITCH_KATAKANA_INPUT_MODE }}, IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_SHIFT_KEY_MODE_SWITCH, - PrefService::SYNCABLE_PREF, + PrefServiceSyncable::SYNCABLE_PREF, }, { prefs::kLanguageMozcNumpadCharacterForm, "NUMPAD_HALF_WIDTH", @@ -366,7 +370,7 @@ extern const LanguageMultipleChoicePreference<const char*> { "NUMPAD_DIRECT_INPUT", IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_NUMPAD_CHARACTER_FORM_NUMPAD_DIRECT_INPUT }}, IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_NUMPAD_CHARACTER_FORM, - PrefService::SYNCABLE_PREF, + PrefServiceSyncable::SYNCABLE_PREF, }, }; COMPILE_ASSERT(kNumMozcMultipleChoicePrefs == @@ -376,7 +380,7 @@ COMPILE_ASSERT(kNumMozcMultipleChoicePrefs == const LanguageIntegerRangePreference kMozcIntegerPrefs[] = { { prefs::kLanguageMozcSuggestionsSize, 3, 1, 9, "suggestions_size", IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_SUGGESTIONS_SIZE, - PrefService::SYNCABLE_PREF } + PrefServiceSyncable::SYNCABLE_PREF } }; COMPILE_ASSERT(kNumMozcIntegerPrefs == arraysize(kMozcIntegerPrefs), TheSizeShouldMatch); @@ -388,14 +392,13 @@ const int kXkbAutoRepeatDelayInMs = 500; const int kXkbAutoRepeatIntervalInMs = 50; const char kPreferredKeyboardLayout[] = "PreferredKeyboardLayout"; -void RegisterPrefs(PrefService* local_state) { +void RegisterPrefs(PrefServiceSimple* local_state) { // We use an empty string here rather than a hardware keyboard layout name // since input_method::GetHardwareInputMethodId() might return a fallback // layout name if local_state->RegisterStringPref(kHardwareKeyboardLayout) // is not called yet. local_state->RegisterStringPref(kPreferredKeyboardLayout, - "", - PrefService::UNSYNCABLE_PREF); + ""); } } // namespace language_prefs diff --git a/chrome/browser/chromeos/language_preferences.h b/chrome/browser/chromeos/language_preferences.h index 237b130..19c0031 100644 --- a/chrome/browser/chromeos/language_preferences.h +++ b/chrome/browser/chromeos/language_preferences.h @@ -36,7 +36,7 @@ struct LanguageMultipleChoicePreference { int item_message_id; // Resource grd ID for the combobox item. } values_and_ids[kMaxItems]; int label_message_id; // Resource grd ID for the label. - PrefService::PrefSyncStatus sync_status; + PrefServiceSyncable::PrefSyncStatus sync_status; }; // The struct is used for preferences of boolean values, like switches to @@ -46,7 +46,7 @@ struct LanguageBooleanPrefs { bool default_pref_value; const char* ibus_config_name; int message_id; - PrefService::PrefSyncStatus sync_status; + PrefServiceSyncable::PrefSyncStatus sync_status; }; // The struct is used for preferences of integer range values, like the @@ -58,7 +58,7 @@ struct LanguageIntegerRangePreference { int max_pref_value; const char* ibus_config_name; int message_id; - PrefService::PrefSyncStatus sync_status; + PrefServiceSyncable::PrefSyncStatus sync_status; }; // --------------------------------------------------------------------------- @@ -123,7 +123,7 @@ struct PinyinIntegerPref { const char* pref_name; // Chrome preference name. int default_pref_value; const char* ibus_config_name; - PrefService::PrefSyncStatus sync_status; + PrefServiceSyncable::PrefSyncStatus sync_status; // TODO(yusukes): Add message_id if needed. }; @@ -161,7 +161,7 @@ extern const int kXkbAutoRepeatIntervalInMs; extern const char kPreferredKeyboardLayout[]; // Registers non-user prefs for the default keyboard layout on the login screen. -void RegisterPrefs(PrefService* local_state); +void RegisterPrefs(PrefServiceSimple* local_state); } // language_prefs } // chromeos diff --git a/chrome/browser/chromeos/login/user_image_manager.h b/chrome/browser/chromeos/login/user_image_manager.h index ac6c1b07..1e88edf 100644 --- a/chrome/browser/chromeos/login/user_image_manager.h +++ b/chrome/browser/chromeos/login/user_image_manager.h @@ -10,7 +10,7 @@ #include "chrome/browser/chromeos/login/user.h" class FilePath; -class PrefService; +class PrefServiceSimple; namespace gfx { class ImageSkia; @@ -24,7 +24,7 @@ class UserImage; class UserImageManager { public: // Registers user image manager preferences. - static void RegisterPrefs(PrefService* local_state); + static void RegisterPrefs(PrefServiceSimple* local_state); virtual ~UserImageManager(); diff --git a/chrome/browser/chromeos/login/user_image_manager_impl.cc b/chrome/browser/chromeos/login/user_image_manager_impl.cc index a30e411..3116746 100644 --- a/chrome/browser/chromeos/login/user_image_manager_impl.cc +++ b/chrome/browser/chromeos/login/user_image_manager_impl.cc @@ -169,11 +169,9 @@ int UserImageManagerImpl::user_image_migration_delay_sec = kUserImageMigrationDelaySec; // static -void UserImageManager::RegisterPrefs(PrefService* local_state) { - local_state->RegisterDictionaryPref(kUserImages, - PrefService::UNSYNCABLE_PREF); - local_state->RegisterDictionaryPref(kUserImageProperties, - PrefService::UNSYNCABLE_PREF); +void UserImageManager::RegisterPrefs(PrefServiceSimple* local_state) { + local_state->RegisterDictionaryPref(kUserImages); + local_state->RegisterDictionaryPref(kUserImageProperties); } UserImageManagerImpl::UserImageManagerImpl() diff --git a/chrome/browser/chromeos/login/user_manager.h b/chrome/browser/chromeos/login/user_manager.h index a869380..ee2b59a 100644 --- a/chrome/browser/chromeos/login/user_manager.h +++ b/chrome/browser/chromeos/login/user_manager.h @@ -10,7 +10,7 @@ #include "base/memory/singleton.h" #include "chrome/browser/chromeos/login/user.h" -class PrefService; +class PrefServiceSimple; namespace chromeos { @@ -60,7 +60,7 @@ class UserManager { static UserManager* Set(UserManager* mock); // Registers user manager preferences. - static void RegisterPrefs(PrefService* local_state); + static void RegisterPrefs(PrefServiceSimple* local_state); // Indicates imminent shutdown, allowing the UserManager to remove any // observers it has registered. diff --git a/chrome/browser/chromeos/login/user_manager_impl.cc b/chrome/browser/chromeos/login/user_manager_impl.cc index 963d2eb..aa4c14cd 100644 --- a/chrome/browser/chromeos/login/user_manager_impl.cc +++ b/chrome/browser/chromeos/login/user_manager_impl.cc @@ -148,17 +148,13 @@ bool ParseUserList(const ListValue& users_list, } // namespace // static -void UserManager::RegisterPrefs(PrefService* local_state) { - local_state->RegisterListPref(kRegularUsers, PrefService::UNSYNCABLE_PREF); - local_state->RegisterListPref(kPublicAccounts, PrefService::UNSYNCABLE_PREF); - local_state->RegisterStringPref(kPublicAccountPendingDataRemoval, "", - PrefService::UNSYNCABLE_PREF); - local_state->RegisterDictionaryPref(kUserOAuthTokenStatus, - PrefService::UNSYNCABLE_PREF); - local_state->RegisterDictionaryPref(kUserDisplayName, - PrefService::UNSYNCABLE_PREF); - local_state->RegisterDictionaryPref(kUserDisplayEmail, - PrefService::UNSYNCABLE_PREF); +void UserManager::RegisterPrefs(PrefServiceSimple* local_state) { + local_state->RegisterListPref(kRegularUsers); + local_state->RegisterListPref(kPublicAccounts); + local_state->RegisterStringPref(kPublicAccountPendingDataRemoval, ""); + local_state->RegisterDictionaryPref(kUserOAuthTokenStatus); + local_state->RegisterDictionaryPref(kUserDisplayName); + local_state->RegisterDictionaryPref(kUserDisplayEmail); SessionLengthLimiter::RegisterPrefs(local_state); } diff --git a/chrome/browser/chromeos/login/user_manager_unittest.cc b/chrome/browser/chromeos/login/user_manager_unittest.cc index a19d119..475ad11 100644 --- a/chrome/browser/chromeos/login/user_manager_unittest.cc +++ b/chrome/browser/chromeos/login/user_manager_unittest.cc @@ -57,7 +57,7 @@ class UserManagerTest : public testing::Test { SetDeviceSettings(false, ""); // Register an in-memory local settings instance. - local_state_.reset(new TestingPrefService); + local_state_.reset(new TestingPrefServiceSimple); reinterpret_cast<TestingBrowserProcess*>(g_browser_process) ->SetLocalState(local_state_.get()); UserManager::RegisterPrefs(local_state_.get()); @@ -141,7 +141,7 @@ class UserManagerTest : public testing::Test { CrosSettings* cros_settings_; CrosSettingsProvider* device_settings_provider_; StubCrosSettingsProvider stub_settings_provider_; - scoped_ptr<TestingPrefService> local_state_; + scoped_ptr<TestingPrefServiceSimple> local_state_; // Initializes / shuts down a stub CrosLibrary. chromeos::ScopedStubCrosEnabler stub_cros_enabler_; diff --git a/chrome/browser/chromeos/login/wallpaper_manager.cc b/chrome/browser/chromeos/login/wallpaper_manager.cc index 8d89e77..eb8044d 100644 --- a/chrome/browser/chromeos/login/wallpaper_manager.cc +++ b/chrome/browser/chromeos/login/wallpaper_manager.cc @@ -123,13 +123,10 @@ WallpaperManager::WallpaperManager() } // static -void WallpaperManager::RegisterPrefs(PrefService* local_state) { - local_state->RegisterDictionaryPref(prefs::kUsersWallpaperInfo, - PrefService::UNSYNCABLE_PREF); - local_state->RegisterDictionaryPref(kUserWallpapers, - PrefService::UNSYNCABLE_PREF); - local_state->RegisterDictionaryPref(kUserWallpapersProperties, - PrefService::UNSYNCABLE_PREF); +void WallpaperManager::RegisterPrefs(PrefServiceSimple* local_state) { + local_state->RegisterDictionaryPref(prefs::kUsersWallpaperInfo); + local_state->RegisterDictionaryPref(kUserWallpapers); + local_state->RegisterDictionaryPref(kUserWallpapersProperties); } void WallpaperManager::AddObservers() { diff --git a/chrome/browser/chromeos/login/wallpaper_manager.h b/chrome/browser/chromeos/login/wallpaper_manager.h index f0c8b32..4da1401 100644 --- a/chrome/browser/chromeos/login/wallpaper_manager.h +++ b/chrome/browser/chromeos/login/wallpaper_manager.h @@ -24,7 +24,7 @@ #include "ui/gfx/image/image_skia.h" #include "unicode/timezone.h" -class PrefService; +class PrefServiceSimple; namespace base { class SequencedTaskRunner; @@ -65,7 +65,7 @@ class WallpaperManager: public system::TimezoneSettings::Observer, WallpaperManager(); // Registers wallpaper manager preferences. - static void RegisterPrefs(PrefService* local_state); + static void RegisterPrefs(PrefServiceSimple* local_state); // Adds RootPowerManagerClient and TimeZoneSettings observers. It needs to be // added after RootPowerManagerClient has been initialized. diff --git a/chrome/browser/chromeos/login/wizard_controller.cc b/chrome/browser/chromeos/login/wizard_controller.cc index f9f7cec..2f494c3 100644 --- a/chrome/browser/chromeos/login/wizard_controller.cc +++ b/chrome/browser/chromeos/login/wizard_controller.cc @@ -385,41 +385,26 @@ void WizardController::SkipUpdateEnrollAfterEula() { } // static -void WizardController::RegisterPrefs(PrefService* local_state) { - local_state->RegisterBooleanPref(kOobeComplete, - false, - PrefService::UNSYNCABLE_PREF); - local_state->RegisterIntegerPref(kDeviceRegistered, - -1, - PrefService::UNSYNCABLE_PREF); - local_state->RegisterBooleanPref(kEulaAccepted, - false, - PrefService::UNSYNCABLE_PREF); - local_state->RegisterStringPref(kInitialLocale, - "en-US", - PrefService::UNSYNCABLE_PREF); +void WizardController::RegisterPrefs(PrefServiceSimple* local_state) { + local_state->RegisterBooleanPref(kOobeComplete, false); + local_state->RegisterIntegerPref(kDeviceRegistered, -1); + local_state->RegisterBooleanPref(kEulaAccepted, false); + local_state->RegisterStringPref(kInitialLocale, "en-US"); // Check if the pref is already registered in case // Preferences::RegisterUserPrefs runs before this code in the future. if (local_state->FindPreference(prefs::kSpokenFeedbackEnabled) == NULL) { - local_state->RegisterBooleanPref(prefs::kSpokenFeedbackEnabled, - false, - PrefService::UNSYNCABLE_PREF); + local_state->RegisterBooleanPref(prefs::kSpokenFeedbackEnabled, false); } if (local_state->FindPreference(prefs::kHighContrastEnabled) == NULL) { - local_state->RegisterBooleanPref(prefs::kHighContrastEnabled, - false, - PrefService::UNSYNCABLE_PREF); + local_state->RegisterBooleanPref(prefs::kHighContrastEnabled, false); } if (local_state->FindPreference(prefs::kVirtualKeyboardEnabled) == NULL) { - local_state->RegisterBooleanPref(prefs::kVirtualKeyboardEnabled, - false, - PrefService::UNSYNCABLE_PREF); + local_state->RegisterBooleanPref(prefs::kVirtualKeyboardEnabled, false); } local_state->RegisterBooleanPref(prefs::kOwnerPrimaryMouseButtonRight, false); local_state->RegisterBooleanPref(prefs::kOwnerTapToClickEnabled, true); local_state->RegisterBooleanPref(prefs::kFactoryResetRequested, false); - local_state->RegisterStringPref(prefs::kRLZBrand, std::string(), - PrefService::UNSYNCABLE_PREF); + local_state->RegisterStringPref(prefs::kRLZBrand, std::string()); } /////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/chromeos/login/wizard_controller.h b/chrome/browser/chromeos/login/wizard_controller.h index 822e2e6..3154776 100644 --- a/chrome/browser/chromeos/login/wizard_controller.h +++ b/chrome/browser/chromeos/login/wizard_controller.h @@ -18,7 +18,7 @@ #include "googleurl/src/gurl.h" #include "ui/gfx/rect.h" -class PrefService; +class PrefServiceSimple; namespace base { class DictionaryValue; @@ -99,7 +99,7 @@ class WizardController : public ScreenObserver { static void SetInitialLocale(const std::string& locale); // Registers OOBE preferences. - static void RegisterPrefs(PrefService* local_state); + static void RegisterPrefs(PrefServiceSimple* local_state); // Marks user image screen to be always skipped after login. static void SkipImageSelectionForTesting(); diff --git a/chrome/browser/chromeos/power/session_length_limiter.cc b/chrome/browser/chromeos/power/session_length_limiter.cc index d55f900..8a716bc 100644 --- a/chrome/browser/chromeos/power/session_length_limiter.cc +++ b/chrome/browser/chromeos/power/session_length_limiter.cc @@ -65,13 +65,9 @@ SessionLengthLimiter::Delegate::~Delegate() { } // static -void SessionLengthLimiter::RegisterPrefs(PrefService* local_state) { - local_state->RegisterInt64Pref(prefs::kSessionStartTime, - 0, - PrefService::UNSYNCABLE_PREF); - local_state->RegisterIntegerPref(prefs::kSessionLengthLimit, - 0, - PrefService::UNSYNCABLE_PREF); +void SessionLengthLimiter::RegisterPrefs(PrefServiceSimple* local_state) { + local_state->RegisterInt64Pref(prefs::kSessionStartTime, 0); + local_state->RegisterIntegerPref(prefs::kSessionLengthLimit, 0); } SessionLengthLimiter::SessionLengthLimiter(Delegate* delegate, diff --git a/chrome/browser/chromeos/power/session_length_limiter.h b/chrome/browser/chromeos/power/session_length_limiter.h index aaeefb6..ebeb355 100644 --- a/chrome/browser/chromeos/power/session_length_limiter.h +++ b/chrome/browser/chromeos/power/session_length_limiter.h @@ -13,6 +13,7 @@ #include "base/timer.h" class PrefService; +class PrefServiceSimple; namespace chromeos { @@ -29,7 +30,7 @@ class SessionLengthLimiter { }; // Registers preferences. - static void RegisterPrefs(PrefService* local_state); + static void RegisterPrefs(PrefServiceSimple* local_state); SessionLengthLimiter(Delegate* delegate, bool browser_restarted); ~SessionLengthLimiter(); diff --git a/chrome/browser/chromeos/power/session_length_limiter_unittest.cc b/chrome/browser/chromeos/power/session_length_limiter_unittest.cc index c2b778d..60a52a4 100644 --- a/chrome/browser/chromeos/power/session_length_limiter_unittest.cc +++ b/chrome/browser/chromeos/power/session_length_limiter_unittest.cc @@ -176,7 +176,7 @@ class SessionLengthLimiterTest : public testing::Test { return now_; } - TestingPrefService local_state_; + TestingPrefServiceSimple local_state_; MockSessionLengthLimiterDelegate* delegate_; // Owned by // session_length_limiter_. scoped_refptr<ImmediateSingleThreadTaskRunner> runner_; diff --git a/chrome/browser/chromeos/preferences.cc b/chrome/browser/chromeos/preferences.cc index 362a82f..6ef97eb 100644 --- a/chrome/browser/chromeos/preferences.cc +++ b/chrome/browser/chromeos/preferences.cc @@ -53,7 +53,7 @@ Preferences::~Preferences() { } // static -void Preferences::RegisterUserPrefs(PrefService* prefs) { +void Preferences::RegisterUserPrefs(PrefServiceSyncable* prefs) { std::string hardware_keyboard_id; // TODO(yusukes): Remove the runtime hack. if (base::chromeos::IsRunningOnChromeOS()) { @@ -69,102 +69,102 @@ void Preferences::RegisterUserPrefs(PrefService* prefs) { prefs->RegisterBooleanPref(prefs::kTapToClickEnabled, true, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kTapDraggingEnabled, false, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kEnableTouchpadThreeFingerClick, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kEnableTouchpadThreeFingerSwipe, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref( prefs::kNaturalScroll, CommandLine::ForCurrentProcess()->HasSwitch( switches::kNaturalScrollDefault), - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kPrimaryMouseButtonRight, false, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kLabsMediaplayerEnabled, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kLabsAdvancedFilesystemEnabled, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); // Check if the accessibility pref is already registered, which can happen // in WizardController::RegisterPrefs. We still want to try to register // the pref here in case of Chrome/Linux with ChromeOS=1. if (prefs->FindPreference(prefs::kSpokenFeedbackEnabled) == NULL) { prefs->RegisterBooleanPref(prefs::kSpokenFeedbackEnabled, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } if (prefs->FindPreference(prefs::kHighContrastEnabled) == NULL) { prefs->RegisterBooleanPref(prefs::kHighContrastEnabled, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } if (prefs->FindPreference(prefs::kScreenMagnifierEnabled) == NULL) { prefs->RegisterBooleanPref(prefs::kScreenMagnifierEnabled, false, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); } if (prefs->FindPreference(prefs::kScreenMagnifierScale) == NULL) { prefs->RegisterDoublePref(prefs::kScreenMagnifierScale, std::numeric_limits<double>::min(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } if (prefs->FindPreference(prefs::kShouldAlwaysShowAccessibilityMenu) == NULL) { prefs->RegisterBooleanPref(prefs::kShouldAlwaysShowAccessibilityMenu, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } if (prefs->FindPreference(prefs::kVirtualKeyboardEnabled) == NULL) { prefs->RegisterBooleanPref(prefs::kVirtualKeyboardEnabled, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } prefs->RegisterIntegerPref(prefs::kMouseSensitivity, 3, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterIntegerPref(prefs::kTouchpadSensitivity, 3, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kUse24HourClock, base::GetHourClockType() == base::k24HourClock, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kDisableDrive, false, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kDisableDriveOverCellular, true, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kDisableDriveHostedFiles, false, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); // We don't sync prefs::kLanguageCurrentInputMethod and PreviousInputMethod // because they're just used to track the logout state of the device. prefs->RegisterStringPref(prefs::kLanguageCurrentInputMethod, "", - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterStringPref(prefs::kLanguagePreviousInputMethod, "", - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); // We don't sync the list of input methods and preferred languages since a // user might use two or more devices with different hardware keyboards. // crosbug.com/15181 prefs->RegisterStringPref(prefs::kLanguagePreferredLanguages, kFallbackInputMethodLocale, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterStringPref(prefs::kLanguagePreloadEngines, hardware_keyboard_id, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterStringPref(prefs::kLanguageFilteredExtensionImes, "", - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); for (size_t i = 0; i < language_prefs::kNumChewingBooleanPrefs; ++i) { prefs->RegisterBooleanPref( language_prefs::kChewingBooleanPrefs[i].pref_name, @@ -191,11 +191,11 @@ void Preferences::RegisterUserPrefs(PrefService* prefs) { prefs->RegisterStringPref( prefs::kLanguageHangulKeyboard, language_prefs::kHangulKeyboardNameIDPairs[0].keyboard_id, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterStringPref(prefs::kLanguageHangulHanjaBindingKeys, language_prefs::kHangulHanjaBindingKeys, // Don't sync the pref as it's not user-configurable - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); for (size_t i = 0; i < language_prefs::kNumPinyinBooleanPrefs; ++i) { prefs->RegisterBooleanPref( language_prefs::kPinyinBooleanPrefs[i].pref_name, @@ -211,7 +211,7 @@ void Preferences::RegisterUserPrefs(PrefService* prefs) { prefs->RegisterIntegerPref( language_prefs::kPinyinDoublePinyinSchema.pref_name, language_prefs::kPinyinDoublePinyinSchema.default_pref_value, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); for (size_t i = 0; i < language_prefs::kNumMozcBooleanPrefs; ++i) { prefs->RegisterBooleanPref( @@ -233,69 +233,69 @@ void Preferences::RegisterUserPrefs(PrefService* prefs) { } prefs->RegisterIntegerPref(prefs::kLanguageRemapSearchKeyTo, input_method::kSearchKey, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterIntegerPref(prefs::kLanguageRemapControlKeyTo, input_method::kControlKey, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterIntegerPref(prefs::kLanguageRemapAltKeyTo, input_method::kAltKey, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterIntegerPref(prefs::kLanguageRemapCapsLockKeyTo, input_method::kCapsLockKey, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); // We don't sync the following keyboard prefs since they are not user- // configurable. prefs->RegisterBooleanPref(prefs::kLanguageXkbAutoRepeatEnabled, true, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterIntegerPref(prefs::kLanguageXkbAutoRepeatDelay, language_prefs::kXkbAutoRepeatDelayInMs, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterIntegerPref(prefs::kLanguageXkbAutoRepeatInterval, language_prefs::kXkbAutoRepeatIntervalInMs, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); // Screen lock default to off. prefs->RegisterBooleanPref(prefs::kEnableScreenLock, false, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); // Mobile plan notifications default to on. prefs->RegisterBooleanPref(prefs::kShowPlanNotifications, true, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); // 3G first-time usage promo will be shown at least once. prefs->RegisterBooleanPref(prefs::kShow3gPromoNotification, true, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); // Initially all existing users would see "What's new" // for current version after update. prefs->RegisterStringPref(prefs::kChromeOSReleaseNotesVersion, "0.0.0.0", - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); // OAuth1 all access token and secret pair. prefs->RegisterStringPref(prefs::kOAuth1Token, "", - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterStringPref(prefs::kOAuth1Secret, "", - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); // TODO(wad): Once UI is connected, a final default can be set. At that point // change this pref from UNSYNCABLE to SYNCABLE. prefs->RegisterBooleanPref(prefs::kEnableCrosDRM, true, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kExternalStorageDisabled, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } -void Preferences::InitUserPrefs(PrefService* prefs) { +void Preferences::InitUserPrefs(PrefServiceSyncable* prefs) { prefs_ = prefs; BooleanPrefMember::NamedChangeCallback callback = @@ -386,7 +386,7 @@ void Preferences::InitUserPrefs(PrefService* prefs) { enable_drm_.Init(prefs::kEnableCrosDRM, prefs, callback); } -void Preferences::Init(PrefService* prefs) { +void Preferences::Init(PrefServiceSyncable* prefs) { InitUserPrefs(prefs); // This causes OnIsSyncingChanged to be called when the value of @@ -403,7 +403,7 @@ void Preferences::Init(PrefService* prefs) { } } -void Preferences::InitUserPrefsForTesting(PrefService* prefs) { +void Preferences::InitUserPrefsForTesting(PrefServiceSyncable* prefs) { InitUserPrefs(prefs); } diff --git a/chrome/browser/chromeos/preferences.h b/chrome/browser/chromeos/preferences.h index 0789d3c..d00b66e 100644 --- a/chrome/browser/chromeos/preferences.h +++ b/chrome/browser/chromeos/preferences.h @@ -14,6 +14,7 @@ #include "chrome/browser/prefs/pref_service_observer.h" class PrefService; +class PrefServiceSyncable; namespace chromeos { namespace input_method { @@ -32,17 +33,17 @@ class Preferences : public PrefServiceObserver { virtual ~Preferences(); // This method will register the prefs associated with Chrome OS settings. - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); // This method will initialize Chrome OS settings to values in user prefs. - void Init(PrefService* prefs); + void Init(PrefServiceSyncable* prefs); - void InitUserPrefsForTesting(PrefService* prefs); + void InitUserPrefsForTesting(PrefServiceSyncable* prefs); void SetInputMethodListForTesting(); private: // Initializes all member prefs. - void InitUserPrefs(PrefService* prefs); + void InitUserPrefs(PrefServiceSyncable* prefs); // Callback method for preference changes. void OnPreferenceChanged(const std::string& pref_name); @@ -98,7 +99,7 @@ class Preferences : public PrefServiceObserver { // PrefServiceObserver implementation. virtual void OnIsSyncingChanged() OVERRIDE; - PrefService* prefs_; + PrefServiceSyncable* prefs_; input_method::InputMethodManager* input_method_manager_; diff --git a/chrome/browser/chromeos/preferences_unittest.cc b/chrome/browser/chromeos/preferences_unittest.cc index 69e3621..caece5e 100644 --- a/chrome/browser/chromeos/preferences_unittest.cc +++ b/chrome/browser/chromeos/preferences_unittest.cc @@ -54,7 +54,7 @@ class MyMockInputMethodManager : public input_method::MockInputMethodManager { } // anonymous namespace TEST(PreferencesTest, TestUpdatePrefOnBrowserScreenDetails) { - TestingPrefService prefs; + TestingPrefServiceSyncable prefs; Preferences::RegisterUserPrefs(&prefs); DownloadPrefs::RegisterUserPrefs(&prefs); diff --git a/chrome/browser/chromeos/proxy_config_service_impl.cc b/chrome/browser/chromeos/proxy_config_service_impl.cc index 74617ad..eee5875 100644 --- a/chrome/browser/chromeos/proxy_config_service_impl.cc +++ b/chrome/browser/chromeos/proxy_config_service_impl.cc @@ -580,12 +580,18 @@ bool ProxyConfigServiceImpl::ParseProxyConfig(const Network* network, } // static -void ProxyConfigServiceImpl::RegisterPrefs(PrefService* pref_service) { +void ProxyConfigServiceImpl::RegisterPrefs(PrefServiceSimple* pref_service) { // Use shared proxies default to off. GetUseSharedProxies will return the // correct value based on pre-login and login. + pref_service->RegisterBooleanPref(prefs::kUseSharedProxies, true); +} + +// static +void ProxyConfigServiceImpl::RegisterUserPrefs( + PrefServiceSyncable* pref_service) { pref_service->RegisterBooleanPref(prefs::kUseSharedProxies, true, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } //------------------ ProxyConfigServiceImpl: private methods ------------------- diff --git a/chrome/browser/chromeos/proxy_config_service_impl.h b/chrome/browser/chromeos/proxy_config_service_impl.h index b2a3b7b..bb95ee2 100644 --- a/chrome/browser/chromeos/proxy_config_service_impl.h +++ b/chrome/browser/chromeos/proxy_config_service_impl.h @@ -199,7 +199,8 @@ class ProxyConfigServiceImpl net::ProxyConfig* proxy_config); // Register UseShardProxies preference. - static void RegisterPrefs(PrefService* pref_service); + static void RegisterPrefs(PrefServiceSimple* pref_service); + static void RegisterUserPrefs(PrefServiceSyncable* pref_service); #if defined(UNIT_TEST) void SetTesting(ProxyConfig* test_config) { diff --git a/chrome/browser/chromeos/proxy_config_service_impl_unittest.cc b/chrome/browser/chromeos/proxy_config_service_impl_unittest.cc index e102e04..9040c77 100644 --- a/chrome/browser/chromeos/proxy_config_service_impl_unittest.cc +++ b/chrome/browser/chromeos/proxy_config_service_impl_unittest.cc @@ -235,7 +235,7 @@ class ProxyConfigServiceImplTestBase : public TESTBASE { : ui_thread_(BrowserThread::UI, &loop_), io_thread_(BrowserThread::IO, &loop_) {} - virtual void Init(PrefService* pref_service) { + virtual void Init(PrefServiceSimple* pref_service) { ASSERT_TRUE(pref_service); DBusThreadManager::Initialize(); PrefProxyConfigTrackerImpl::RegisterPrefs(pref_service); @@ -340,7 +340,7 @@ class ProxyConfigServiceImplTest Init(&pref_service_); } - TestingPrefService pref_service_; + TestingPrefServiceSimple pref_service_; }; TEST_F(ProxyConfigServiceImplTest, NetworkProxy) { diff --git a/chrome/browser/chromeos/settings/device_settings_cache.cc b/chrome/browser/chromeos/settings/device_settings_cache.cc index 178cbfb..d8c5739 100644 --- a/chrome/browser/chromeos/settings/device_settings_cache.cc +++ b/chrome/browser/chromeos/settings/device_settings_cache.cc @@ -19,10 +19,8 @@ namespace chromeos { namespace device_settings_cache { -void RegisterPrefs(PrefService* local_state) { - local_state->RegisterStringPref(prefs::kDeviceSettingsCache, - "invalid", - PrefService::UNSYNCABLE_PREF); +void RegisterPrefs(PrefServiceSimple* local_state) { + local_state->RegisterStringPref(prefs::kDeviceSettingsCache, "invalid"); } bool Store(const em::PolicyData& policy, PrefService* local_state) { diff --git a/chrome/browser/chromeos/settings/device_settings_cache.h b/chrome/browser/chromeos/settings/device_settings_cache.h index 8f6f7cf..1a632d4 100644 --- a/chrome/browser/chromeos/settings/device_settings_cache.h +++ b/chrome/browser/chromeos/settings/device_settings_cache.h @@ -10,6 +10,7 @@ class PolicyData; } class PrefService; +class PrefServiceSimple; namespace chromeos { @@ -19,7 +20,7 @@ namespace chromeos { // case. namespace device_settings_cache { // Registers required pref section. -void RegisterPrefs(PrefService* local_state); +void RegisterPrefs(PrefServiceSimple* local_state); // Stores a new policy blob inside the cache stored in |local_state|. bool Store(const enterprise_management::PolicyData &policy, diff --git a/chrome/browser/chromeos/settings/device_settings_cache_unittest.cc b/chrome/browser/chromeos/settings/device_settings_cache_unittest.cc index d47021b5..9b7a016 100644 --- a/chrome/browser/chromeos/settings/device_settings_cache_unittest.cc +++ b/chrome/browser/chromeos/settings/device_settings_cache_unittest.cc @@ -26,7 +26,7 @@ class DeviceSettingsCacheTest : public testing::Test { device_settings_cache::RegisterPrefs(&local_state_); } - TestingPrefService local_state_; + TestingPrefServiceSimple local_state_; em::PolicyData policy_; }; diff --git a/chrome/browser/chromeos/settings/device_settings_provider.cc b/chrome/browser/chromeos/settings/device_settings_provider.cc index 7785ee0..8f66211 100644 --- a/chrome/browser/chromeos/settings/device_settings_provider.cc +++ b/chrome/browser/chromeos/settings/device_settings_provider.cc @@ -23,6 +23,7 @@ #include "chrome/browser/policy/browser_policy_connector.h" #include "chrome/browser/policy/cloud_policy_constants.h" #include "chrome/browser/policy/proto/device_management_backend.pb.h" +#include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/ui/options/options_util.h" #include "chrome/common/chrome_switches.h" #include "chrome/installer/util/google_update_settings.h" diff --git a/chrome/browser/chromeos/status/data_promo_notification.cc b/chrome/browser/chromeos/status/data_promo_notification.cc index 6c1fa56..016e376 100644 --- a/chrome/browser/chromeos/status/data_promo_notification.cc +++ b/chrome/browser/chromeos/status/data_promo_notification.cc @@ -127,7 +127,7 @@ DataPromoNotification::~DataPromoNotification() { CloseNotification(); } -void DataPromoNotification::RegisterPrefs(PrefService* local_state) { +void DataPromoNotification::RegisterPrefs(PrefServiceSimple* local_state) { // Carrier deal notification shown count defaults to 0. local_state->RegisterIntegerPref(prefs::kCarrierDealPromoShown, 0); } diff --git a/chrome/browser/chromeos/status/data_promo_notification.h b/chrome/browser/chromeos/status/data_promo_notification.h index 0fe3600..e1a03a3 100644 --- a/chrome/browser/chromeos/status/data_promo_notification.h +++ b/chrome/browser/chromeos/status/data_promo_notification.h @@ -8,7 +8,7 @@ #include "base/basictypes.h" #include "base/memory/weak_ptr.h" -class PrefService; +class PrefServiceSimple; namespace ash { class NetworkTrayDelegate; @@ -26,7 +26,7 @@ class DataPromoNotification { DataPromoNotification(); virtual ~DataPromoNotification(); - static void RegisterPrefs(PrefService* local_state); + static void RegisterPrefs(PrefServiceSimple* local_state); const std::string& deal_info_url() const { return deal_info_url_; } const std::string& deal_topup_url() const { return deal_topup_url_; } diff --git a/chrome/browser/component_updater/recovery_component_installer.cc b/chrome/browser/component_updater/recovery_component_installer.cc index 1c2d61b..673a6ce 100644 --- a/chrome/browser/component_updater/recovery_component_installer.cc +++ b/chrome/browser/component_updater/recovery_component_installer.cc @@ -60,8 +60,12 @@ class RecoveryComponentInstaller : public ComponentInstaller { PrefService* prefs_; }; -void RecoveryRegisterHelper(ComponentUpdateService* cus, PrefService* prefs) { +void RecoveryRegisterHelper(ComponentUpdateService* cus, + PrefServiceSimple* prefs) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + // TODO(joi): Registrations for local state prefs shouldn't happen + // like this, they should be done via + // browser_prefs::RegisterLocalState. prefs->RegisterStringPref(prefs::kRecoveryComponentVersion, "0.0.0.0"); Version version(prefs->GetString(prefs::kRecoveryComponentVersion)); if (!version.IsValid()) { @@ -130,7 +134,7 @@ bool RecoveryComponentInstaller::Install(base::DictionaryValue* manifest, } void RegisterRecoveryComponent(ComponentUpdateService* cus, - PrefService* prefs) { + PrefServiceSimple* prefs) { #if !defined(OS_CHROMEOS) // We delay execute the registration because we are not required in // the critical path during browser startup. diff --git a/chrome/browser/component_updater/recovery_component_installer.h b/chrome/browser/component_updater/recovery_component_installer.h index 9a5e62c..5dd3bfa 100644 --- a/chrome/browser/component_updater/recovery_component_installer.h +++ b/chrome/browser/component_updater/recovery_component_installer.h @@ -6,12 +6,13 @@ #define CHROME_BROWSER_COMPONENT_UPDATER_RECOVERY_COMPONENT_INSTALLER_H_ class ComponentUpdateService; -class PrefService; +class PrefServiceSimple; // Component update registration for the recovery component. The job of the // recovery component is to repair the chrome installation or repair the Google // update installation. This is a last resort safety mechanism. -void RegisterRecoveryComponent(ComponentUpdateService* cus, PrefService* prefs); +void RegisterRecoveryComponent(ComponentUpdateService* cus, + PrefServiceSimple* prefs); #endif // CHROME_BROWSER_COMPONENT_UPDATER_RECOVERY_COMPONENT_INSTALLER_H_ diff --git a/chrome/browser/content_settings/content_settings_default_provider.cc b/chrome/browser/content_settings/content_settings_default_provider.cc index b4a18cf..f6304a1 100644 --- a/chrome/browser/content_settings/content_settings_default_provider.cc +++ b/chrome/browser/content_settings/content_settings_default_provider.cc @@ -87,7 +87,7 @@ class DefaultRuleIterator : public RuleIterator { } // namespace // static -void DefaultProvider::RegisterUserPrefs(PrefService* prefs) { +void DefaultProvider::RegisterUserPrefs(PrefServiceSyncable* prefs) { // The registration of the preference prefs::kDefaultContentSettings should // also include the default values for default content settings. This allows // functional tests to get default content settings by reading the preference @@ -97,7 +97,7 @@ void DefaultProvider::RegisterUserPrefs(PrefService* prefs) { DictionaryValue* default_content_settings = new DictionaryValue(); prefs->RegisterDictionaryPref(prefs::kDefaultContentSettings, default_content_settings, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); } DefaultProvider::DefaultProvider(PrefService* prefs, bool incognito) diff --git a/chrome/browser/content_settings/content_settings_default_provider.h b/chrome/browser/content_settings/content_settings_default_provider.h index fadca25..d54a32f 100644 --- a/chrome/browser/content_settings/content_settings_default_provider.h +++ b/chrome/browser/content_settings/content_settings_default_provider.h @@ -16,6 +16,7 @@ #include "chrome/browser/content_settings/content_settings_observable_provider.h" class PrefService; +class PrefServiceSyncable; namespace content_settings { @@ -24,7 +25,7 @@ namespace content_settings { // default values. class DefaultProvider : public ObservableProvider { public: - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); DefaultProvider(PrefService* prefs, bool incognito); diff --git a/chrome/browser/content_settings/content_settings_policy_provider.cc b/chrome/browser/content_settings/content_settings_policy_provider.cc index 0175901..3ab6899 100644 --- a/chrome/browser/content_settings/content_settings_policy_provider.cc +++ b/chrome/browser/content_settings/content_settings_policy_provider.cc @@ -117,61 +117,61 @@ const PrefsForManagedContentSettingsMapEntry namespace content_settings { // static -void PolicyProvider::RegisterUserPrefs(PrefService* prefs) { +void PolicyProvider::RegisterUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterListPref(prefs::kManagedAutoSelectCertificateForUrls, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterListPref(prefs::kManagedCookiesAllowedForUrls, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterListPref(prefs::kManagedCookiesBlockedForUrls, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterListPref(prefs::kManagedCookiesSessionOnlyForUrls, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterListPref(prefs::kManagedImagesAllowedForUrls, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterListPref(prefs::kManagedImagesBlockedForUrls, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterListPref(prefs::kManagedJavaScriptAllowedForUrls, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterListPref(prefs::kManagedJavaScriptBlockedForUrls, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterListPref(prefs::kManagedPluginsAllowedForUrls, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterListPref(prefs::kManagedPluginsBlockedForUrls, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterListPref(prefs::kManagedPopupsAllowedForUrls, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterListPref(prefs::kManagedPopupsBlockedForUrls, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterListPref(prefs::kManagedNotificationsAllowedForUrls, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterListPref(prefs::kManagedNotificationsBlockedForUrls, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); // Preferences for default content setting policies. If a policy is not set of // the corresponding preferences below is set to CONTENT_SETTING_DEFAULT. prefs->RegisterIntegerPref(prefs::kManagedDefaultCookiesSetting, CONTENT_SETTING_DEFAULT, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterIntegerPref(prefs::kManagedDefaultImagesSetting, CONTENT_SETTING_DEFAULT, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterIntegerPref(prefs::kManagedDefaultJavaScriptSetting, CONTENT_SETTING_DEFAULT, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterIntegerPref(prefs::kManagedDefaultPluginsSetting, CONTENT_SETTING_DEFAULT, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterIntegerPref(prefs::kManagedDefaultPopupsSetting, CONTENT_SETTING_DEFAULT, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterIntegerPref(prefs::kManagedDefaultGeolocationSetting, CONTENT_SETTING_DEFAULT, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterIntegerPref(prefs::kManagedDefaultNotificationsSetting, CONTENT_SETTING_DEFAULT, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterIntegerPref(prefs::kManagedDefaultMediaStreamSetting, CONTENT_SETTING_DEFAULT, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } PolicyProvider::PolicyProvider(PrefService* prefs) : prefs_(prefs) { diff --git a/chrome/browser/content_settings/content_settings_policy_provider.h b/chrome/browser/content_settings/content_settings_policy_provider.h index b9c2b4b..eb8c3d01 100644 --- a/chrome/browser/content_settings/content_settings_policy_provider.h +++ b/chrome/browser/content_settings/content_settings_policy_provider.h @@ -16,6 +16,7 @@ #include "chrome/browser/content_settings/content_settings_origin_identifier_value_map.h" class PrefService; +class PrefServiceSyncable; namespace content_settings { @@ -24,7 +25,7 @@ class PolicyProvider : public ObservableProvider { public: explicit PolicyProvider(PrefService* prefs); virtual ~PolicyProvider(); - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); // ProviderInterface implementations. virtual RuleIterator* GetRuleIterator( diff --git a/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc b/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc index 04f8011..a2ffa01 100644 --- a/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc +++ b/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc @@ -47,7 +47,7 @@ class PolicyProviderTest : public testing::Test { TEST_F(PolicyProviderTest, DefaultGeolocationContentSetting) { TestingProfile profile; - TestingPrefService* prefs = profile.GetTestingPrefService(); + TestingPrefServiceSyncable* prefs = profile.GetTestingPrefService(); PolicyProvider provider(prefs); Rules rules; @@ -81,7 +81,7 @@ TEST_F(PolicyProviderTest, DefaultGeolocationContentSetting) { TEST_F(PolicyProviderTest, ManagedDefaultContentSettings) { TestingProfile profile; - TestingPrefService* prefs = profile.GetTestingPrefService(); + TestingPrefServiceSyncable* prefs = profile.GetTestingPrefService(); PolicyProvider provider(prefs); prefs->SetManagedPref(prefs::kManagedDefaultPluginsSetting, @@ -108,7 +108,7 @@ TEST_F(PolicyProviderTest, ManagedDefaultContentSettings) { // if the managed setting is removed. TEST_F(PolicyProviderTest, ObserveManagedSettingsChange) { TestingProfile profile; - TestingPrefService* prefs = profile.GetTestingPrefService(); + TestingPrefServiceSyncable* prefs = profile.GetTestingPrefService(); PolicyProvider provider(prefs); MockObserver mock_observer; @@ -135,7 +135,7 @@ TEST_F(PolicyProviderTest, ObserveManagedSettingsChange) { TEST_F(PolicyProviderTest, GettingManagedContentSettings) { TestingProfile profile; - TestingPrefService* prefs = profile.GetTestingPrefService(); + TestingPrefServiceSyncable* prefs = profile.GetTestingPrefService(); ListValue* value = new ListValue(); value->Append(Value::CreateStringValue("[*.]google.com")); @@ -193,7 +193,7 @@ TEST_F(PolicyProviderTest, GettingManagedContentSettings) { TEST_F(PolicyProviderTest, ResourceIdentifier) { TestingProfile profile; - TestingPrefService* prefs = profile.GetTestingPrefService(); + TestingPrefServiceSyncable* prefs = profile.GetTestingPrefService(); ListValue* value = new ListValue(); value->Append(Value::CreateStringValue("[*.]google.com")); @@ -227,7 +227,7 @@ TEST_F(PolicyProviderTest, ResourceIdentifier) { TEST_F(PolicyProviderTest, AutoSelectCertificateList) { TestingProfile profile; - TestingPrefService* prefs = profile.GetTestingPrefService(); + TestingPrefServiceSyncable* prefs = profile.GetTestingPrefService(); PolicyProvider provider(prefs); GURL google_url("https://mail.google.com"); diff --git a/chrome/browser/content_settings/content_settings_pref_provider.cc b/chrome/browser/content_settings/content_settings_pref_provider.cc index 6c5e1be..ddf6efc4 100644 --- a/chrome/browser/content_settings/content_settings_pref_provider.cc +++ b/chrome/browser/content_settings/content_settings_pref_provider.cc @@ -71,13 +71,13 @@ namespace content_settings { // // static -void PrefProvider::RegisterUserPrefs(PrefService* prefs) { +void PrefProvider::RegisterUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterIntegerPref( prefs::kContentSettingsVersion, ContentSettingsPattern::kContentSettingsPatternVersion, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDictionaryPref(prefs::kContentSettingsPatternPairs, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); } PrefProvider::PrefProvider(PrefService* prefs, diff --git a/chrome/browser/content_settings/content_settings_pref_provider.h b/chrome/browser/content_settings/content_settings_pref_provider.h index de13196..3c87bed 100644 --- a/chrome/browser/content_settings/content_settings_pref_provider.h +++ b/chrome/browser/content_settings/content_settings_pref_provider.h @@ -17,6 +17,7 @@ #include "chrome/browser/content_settings/content_settings_utils.h" class PrefService; +class PrefServiceSyncable; namespace base { class DictionaryValue; @@ -28,10 +29,9 @@ namespace content_settings { // preference. class PrefProvider : public ObservableProvider { public: - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); - PrefProvider(PrefService* prefs, - bool incognito); + PrefProvider(PrefService* prefs, bool incognito); virtual ~PrefProvider(); // ProviderInterface implementations. 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 6b92b21..eced832 100644 --- a/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc +++ b/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc @@ -133,12 +133,14 @@ TEST_F(PrefProviderTest, Incognito) { new OverlayUserPrefStore(user_prefs); PrefServiceMockBuilder builder; - PrefService* regular_prefs = builder.WithUserPrefs(user_prefs).Create(); + builder.WithUserPrefs(user_prefs); + PrefServiceSyncable* regular_prefs = builder.CreateSyncable(); Profile::RegisterUserPrefs(regular_prefs); chrome::RegisterUserPrefs(regular_prefs); - PrefService* otr_prefs = builder.WithUserPrefs(otr_user_prefs).Create(); + builder.WithUserPrefs(otr_user_prefs); + PrefServiceSyncable* otr_prefs = builder.CreateSyncable(); Profile::RegisterUserPrefs(otr_prefs); chrome::RegisterUserPrefs(otr_prefs); @@ -331,7 +333,7 @@ TEST_F(PrefProviderTest, ResourceIdentifier) { TEST_F(PrefProviderTest, AutoSubmitCertificateContentSetting) { TestingProfile profile; - TestingPrefService* prefs = profile.GetTestingPrefService(); + TestingPrefServiceSyncable* prefs = profile.GetTestingPrefService(); GURL primary_url("https://www.example.com"); GURL secondary_url("https://www.sample.com"); @@ -365,7 +367,7 @@ TEST_F(PrefProviderTest, AutoSubmitCertificateContentSetting) { // http://crosbug.com/17760 TEST_F(PrefProviderTest, Deadlock) { - TestingPrefService prefs; + TestingPrefServiceSyncable prefs; PrefProvider::RegisterUserPrefs(&prefs); // Chain of events: a preference changes, |PrefProvider| notices it, and reads diff --git a/chrome/browser/content_settings/cookie_settings.cc b/chrome/browser/content_settings/cookie_settings.cc index 3bb1c14..a9cf918 100644 --- a/chrome/browser/content_settings/cookie_settings.cc +++ b/chrome/browser/content_settings/cookie_settings.cc @@ -64,10 +64,11 @@ CookieSettings::Factory::Factory() CookieSettings::Factory::~Factory() {} -void CookieSettings::Factory::RegisterUserPrefs(PrefService* user_prefs) { +void CookieSettings::Factory::RegisterUserPrefs( + PrefServiceSyncable* user_prefs) { user_prefs->RegisterBooleanPref(prefs::kBlockThirdPartyCookies, false, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); } bool CookieSettings::Factory::ServiceRedirectedInIncognito() const { diff --git a/chrome/browser/content_settings/cookie_settings.h b/chrome/browser/content_settings/cookie_settings.h index 77f66f3..f76ce0d 100644 --- a/chrome/browser/content_settings/cookie_settings.h +++ b/chrome/browser/content_settings/cookie_settings.h @@ -21,6 +21,7 @@ class ContentSettingsPattern; class CookieSettingsWrapper; class GURL; class PrefService; +class PrefServiceSyncable; class Profile; // A frontend to the cookie settings of |HostContentSettingsMap|. Handles @@ -101,7 +102,7 @@ class CookieSettings bool setting_cookie, content_settings::SettingSource* source) const; - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); class Factory : public RefcountedProfileKeyedServiceFactory { public: @@ -119,7 +120,7 @@ class CookieSettings virtual ~Factory(); // |ProfileKeyedBaseFactory| methods: - virtual void RegisterUserPrefs(PrefService* user_prefs) OVERRIDE; + virtual void RegisterUserPrefs(PrefServiceSyncable* user_prefs) OVERRIDE; virtual bool ServiceRedirectedInIncognito() const OVERRIDE; virtual scoped_refptr<RefcountedProfileKeyedService> BuildServiceInstanceFor(Profile* profile) const OVERRIDE; diff --git a/chrome/browser/content_settings/host_content_settings_map.cc b/chrome/browser/content_settings/host_content_settings_map.cc index 458d0a5..4503e06 100644 --- a/chrome/browser/content_settings/host_content_settings_map.cc +++ b/chrome/browser/content_settings/host_content_settings_map.cc @@ -130,14 +130,14 @@ void HostContentSettingsMap::RegisterExtensionService( #endif // static -void HostContentSettingsMap::RegisterUserPrefs(PrefService* prefs) { +void HostContentSettingsMap::RegisterUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterIntegerPref(prefs::kContentSettingsWindowLastTabIndex, 0, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterIntegerPref(prefs::kContentSettingsDefaultWhitelistVersion, - 0, PrefService::SYNCABLE_PREF); + 0, PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kContentSettingsClearOnExitMigrated, - false, PrefService::SYNCABLE_PREF); + false, PrefServiceSyncable::SYNCABLE_PREF); // Register the prefs for the content settings providers. content_settings::DefaultProvider::RegisterUserPrefs(prefs); diff --git a/chrome/browser/content_settings/host_content_settings_map.h b/chrome/browser/content_settings/host_content_settings_map.h index 602ff15..74421fa 100644 --- a/chrome/browser/content_settings/host_content_settings_map.h +++ b/chrome/browser/content_settings/host_content_settings_map.h @@ -33,6 +33,7 @@ class ProviderInterface; class ExtensionService; class GURL; class PrefService; +class PrefServiceSyncable; class HostContentSettingsMap : public content_settings::Observer, @@ -47,8 +48,7 @@ class HostContentSettingsMap NUM_PROVIDER_TYPES, }; - HostContentSettingsMap(PrefService* prefs, - bool incognito); + HostContentSettingsMap(PrefService* prefs, bool incognito); #if defined(ENABLE_EXTENSIONS) // In some cases, the ExtensionService is not available at the time the @@ -57,7 +57,7 @@ class HostContentSettingsMap void RegisterExtensionService(ExtensionService* extension_service); #endif - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); // Returns the default setting for a particular content type. If |provider_id| // is not NULL, the id of the provider which provided the default setting is diff --git a/chrome/browser/content_settings/host_content_settings_map_unittest.cc b/chrome/browser/content_settings/host_content_settings_map_unittest.cc index 3c470c7..646d3c1 100644 --- a/chrome/browser/content_settings/host_content_settings_map_unittest.cc +++ b/chrome/browser/content_settings/host_content_settings_map_unittest.cc @@ -824,7 +824,7 @@ TEST_F(HostContentSettingsMapTest, ManagedDefaultContentSetting) { TestingProfile profile; HostContentSettingsMap* host_content_settings_map = profile.GetHostContentSettingsMap(); - TestingPrefService* prefs = profile.GetTestingPrefService(); + TestingPrefServiceSyncable* prefs = profile.GetTestingPrefService(); EXPECT_EQ(CONTENT_SETTING_ALLOW, host_content_settings_map->GetDefaultContentSetting( @@ -862,7 +862,7 @@ TEST_F(HostContentSettingsMapTest, TestingProfile profile; HostContentSettingsMap* host_content_settings_map = profile.GetHostContentSettingsMap(); - TestingPrefService* prefs = profile.GetTestingPrefService(); + TestingPrefServiceSyncable* prefs = profile.GetTestingPrefService(); // Set pattern for JavaScript setting. ContentSettingsPattern pattern = @@ -898,7 +898,7 @@ TEST_F(HostContentSettingsMapTest, TestingProfile profile; HostContentSettingsMap* host_content_settings_map = profile.GetHostContentSettingsMap(); - TestingPrefService* prefs = profile.GetTestingPrefService(); + TestingPrefServiceSyncable* prefs = profile.GetTestingPrefService(); // Block all JavaScript. host_content_settings_map->SetDefaultContentSetting( @@ -943,7 +943,7 @@ TEST_F(HostContentSettingsMapTest, OverwrittenDefaultContentSetting) { TestingProfile profile; HostContentSettingsMap* host_content_settings_map = profile.GetHostContentSettingsMap(); - TestingPrefService* prefs = profile.GetTestingPrefService(); + TestingPrefServiceSyncable* prefs = profile.GetTestingPrefService(); // Set user defined default-content-setting for Cookies. host_content_settings_map->SetDefaultContentSetting( @@ -973,7 +973,7 @@ TEST_F(HostContentSettingsMapTest, SettingDefaultContentSettingsWhenManaged) { TestingProfile profile; HostContentSettingsMap* host_content_settings_map = profile.GetHostContentSettingsMap(); - TestingPrefService* prefs = profile.GetTestingPrefService(); + TestingPrefServiceSyncable* prefs = profile.GetTestingPrefService(); prefs->SetManagedPref(prefs::kManagedDefaultPluginsSetting, Value::CreateIntegerValue(CONTENT_SETTING_ALLOW)); @@ -1049,7 +1049,7 @@ TEST_F(HostContentSettingsMapTest, ShouldAllowAllContent) { TEST_F(HostContentSettingsMapTest, MigrateClearOnExit) { TestingProfile profile; - TestingPrefService* prefs = profile.GetTestingPrefService(); + TestingPrefServiceSyncable* prefs = profile.GetTestingPrefService(); prefs->SetBoolean(prefs::kClearSiteDataOnExit, true); diff --git a/chrome/browser/custom_handlers/protocol_handler_registry.cc b/chrome/browser/custom_handlers/protocol_handler_registry.cc index a95fd1c..bab8c44 100644 --- a/chrome/browser/custom_handlers/protocol_handler_registry.cc +++ b/chrome/browser/custom_handlers/protocol_handler_registry.cc @@ -708,13 +708,14 @@ void ProtocolHandlerRegistry::Shutdown() { } // static -void ProtocolHandlerRegistry::RegisterPrefs(PrefService* pref_service) { +void ProtocolHandlerRegistry::RegisterUserPrefs( + PrefServiceSyncable* pref_service) { pref_service->RegisterListPref(prefs::kRegisteredProtocolHandlers, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); pref_service->RegisterListPref(prefs::kIgnoredProtocolHandlers, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); pref_service->RegisterBooleanPref(prefs::kCustomHandlersEnabled, true, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } ProtocolHandlerRegistry::~ProtocolHandlerRegistry() { diff --git a/chrome/browser/custom_handlers/protocol_handler_registry.h b/chrome/browser/custom_handlers/protocol_handler_registry.h index 25de955..e8ae913 100644 --- a/chrome/browser/custom_handlers/protocol_handler_registry.h +++ b/chrome/browser/custom_handlers/protocol_handler_registry.h @@ -22,6 +22,8 @@ #include "net/url_request/url_request_job.h" #include "net/url_request/url_request_job_factory.h" +class PrefServiceSyncable; + // This is where handlers for protocols registered with // navigator.registerProtocolHandler() are registered. Each Profile owns an // instance of this class, which is initialized on browser start through @@ -191,7 +193,7 @@ class ProtocolHandlerRegistry : public ProfileKeyedService { virtual void Shutdown() OVERRIDE; // Registers the preferences that we store registered protocol handlers in. - static void RegisterPrefs(PrefService* prefService); + static void RegisterUserPrefs(PrefServiceSyncable* prefService); bool enabled() const { return enabled_; } diff --git a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc index 0c89013..1561a14 100644 --- a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc +++ b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc @@ -279,7 +279,9 @@ class ProtocolHandlerRegistryTest : public testing::Test { FakeDelegate* delegate() const { return delegate_; } ProtocolHandlerRegistry* registry() { return registry_.get(); } TestingProfile* profile() const { return profile_.get(); } - PrefService* pref_service() const { return profile_->GetPrefs(); } + // TODO(joi): Check if this can be removed, as well as the call to + // SetPrefService in SetUp. + PrefServiceSyncable* pref_service() const { return profile_->GetPrefs(); } const ProtocolHandler& test_protocol_handler() const { return test_protocol_handler_; } @@ -318,11 +320,14 @@ class ProtocolHandlerRegistryTest : public testing::Test { virtual void SetUp() { profile_.reset(new TestingProfile()); - profile_->SetPrefService(new TestingPrefService()); + profile_->SetPrefService(new TestingPrefServiceSyncable()); SetUpRegistry(true); test_protocol_handler_ = CreateProtocolHandler("test", GURL("http://test.com/%s"), "Test"); - ProtocolHandlerRegistry::RegisterPrefs(pref_service()); + + // TODO(joi): If pref_service() and the SetPrefService above go, + // then this could go. + ProtocolHandlerRegistry::RegisterUserPrefs(pref_service()); } virtual void TearDown() { diff --git a/chrome/browser/devtools/devtools_window.cc b/chrome/browser/devtools/devtools_window.cc index 02fd744..998e27f 100644 --- a/chrome/browser/devtools/devtools_window.cc +++ b/chrome/browser/devtools/devtools_window.cc @@ -87,15 +87,15 @@ const int kMinDevToolsWidth = 150; const int kMinContentsSize = 50; // static -void DevToolsWindow::RegisterUserPrefs(PrefService* prefs) { +void DevToolsWindow::RegisterUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterBooleanPref(prefs::kDevToolsOpenDocked, true, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterStringPref(prefs::kDevToolsDockSide, kDockSideBottom, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDictionaryPref(prefs::kDevToolsEditedFiles, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } // static @@ -372,9 +372,10 @@ void DevToolsWindow::CreateDevToolsBrowser() { wp_key.append("_"); wp_key.append(kDevToolsApp); - PrefService* prefs = profile_->GetPrefs(); + PrefServiceSyncable* prefs = profile_->GetPrefs(); if (!prefs->FindPreference(wp_key.c_str())) { - prefs->RegisterDictionaryPref(wp_key.c_str(), PrefService::UNSYNCABLE_PREF); + prefs->RegisterDictionaryPref(wp_key.c_str(), + PrefServiceSyncable::UNSYNCABLE_PREF); } const DictionaryValue* wp_pref = prefs->GetDictionary(wp_key.c_str()); diff --git a/chrome/browser/devtools/devtools_window.h b/chrome/browser/devtools/devtools_window.h index 90accfd..3c474512 100644 --- a/chrome/browser/devtools/devtools_window.h +++ b/chrome/browser/devtools/devtools_window.h @@ -20,7 +20,7 @@ class Browser; class BrowserWindow; -class PrefService; +class PrefServiceSyncable; class Profile; namespace base { @@ -55,7 +55,7 @@ class DevToolsWindow : private content::NotificationObserver, private DevToolsFileHelper::Delegate { public: static const char kDevToolsApp[]; - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); static DevToolsWindow* GetDockedInstanceForInspectedTab( content::WebContents* inspected_tab); static bool IsDevToolsWindow(content::RenderViewHost* window_rvh); diff --git a/chrome/browser/download/chrome_download_manager_delegate.cc b/chrome/browser/download/chrome_download_manager_delegate.cc index dec52fc..488793b 100644 --- a/chrome/browser/download/chrome_download_manager_delegate.cc +++ b/chrome/browser/download/chrome_download_manager_delegate.cc @@ -483,7 +483,7 @@ void ChromeDownloadManagerDelegate::GetSaveDir(BrowserContext* browser_context, FilePath* download_save_dir, bool* skip_dir_check) { Profile* profile = Profile::FromBrowserContext(browser_context); - PrefService* prefs = profile->GetPrefs(); + PrefServiceSyncable* prefs = profile->GetPrefs(); // Check whether the preference has the preferred directory for saving file. // If not, initialize it with default directory. @@ -493,7 +493,7 @@ void ChromeDownloadManagerDelegate::GetSaveDir(BrowserContext* browser_context, prefs::kDownloadDefaultDirectory); prefs->RegisterFilePathPref(prefs::kSaveFileDefaultDirectory, default_save_path, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } // Get the directory from preference. diff --git a/chrome/browser/download/chrome_download_manager_delegate_unittest.cc b/chrome/browser/download/chrome_download_manager_delegate_unittest.cc index 53b83cc..2bda304 100644 --- a/chrome/browser/download/chrome_download_manager_delegate_unittest.cc +++ b/chrome/browser/download/chrome_download_manager_delegate_unittest.cc @@ -279,7 +279,7 @@ class ChromeDownloadManagerDelegateTest : content::DownloadDangerType danger_type, const FilePath& intermediate_path); - TestingPrefService* pref_service_; + TestingPrefServiceSyncable* pref_service_; base::ScopedTempDir test_download_dir_; content::TestBrowserThread ui_thread_; content::TestBrowserThread file_thread_; diff --git a/chrome/browser/download/download_prefs.cc b/chrome/browser/download/download_prefs.cc index b991c27..39f3327 100644 --- a/chrome/browser/download/download_prefs.cc +++ b/chrome/browser/download/download_prefs.cc @@ -67,26 +67,26 @@ DownloadPrefs::~DownloadPrefs() { } // static -void DownloadPrefs::RegisterUserPrefs(PrefServiceBase* prefs) { +void DownloadPrefs::RegisterUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterBooleanPref(prefs::kPromptForDownload, false, - PrefServiceBase::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterStringPref(prefs::kDownloadExtensionsToOpen, "", - PrefServiceBase::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kDownloadDirUpgraded, false, - PrefServiceBase::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterIntegerPref(prefs::kSaveFileType, content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML, - PrefServiceBase::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); // The default download path is userprofile\download. const FilePath& default_download_path = download_util::GetDefaultDownloadDirectory(); prefs->RegisterFilePathPref(prefs::kDownloadDefaultDirectory, default_download_path, - PrefServiceBase::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); #if defined(OS_CHROMEOS) // Ensure that the download directory specified in the preferences exists. diff --git a/chrome/browser/download/download_prefs.h b/chrome/browser/download/download_prefs.h index 95d581d..e8dfefb 100644 --- a/chrome/browser/download/download_prefs.h +++ b/chrome/browser/download/download_prefs.h @@ -10,6 +10,7 @@ #include "base/file_path.h" #include "base/prefs/public/pref_member.h" +class PrefServiceSyncable; class Profile; namespace content { @@ -23,7 +24,7 @@ class DownloadPrefs { explicit DownloadPrefs(Profile* profile); ~DownloadPrefs(); - static void RegisterUserPrefs(PrefServiceBase* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); // Returns the DownloadPrefs corresponding to the given DownloadManager // or BrowserContext. diff --git a/chrome/browser/extensions/api/commands/command_service.cc b/chrome/browser/extensions/api/commands/command_service.cc index c4967fd..ba37a10 100644 --- a/chrome/browser/extensions/api/commands/command_service.cc +++ b/chrome/browser/extensions/api/commands/command_service.cc @@ -35,10 +35,9 @@ std::string GetPlatformKeybindingKeyForAccelerator( namespace extensions { // static -void CommandService::RegisterUserPrefs( - PrefService* user_prefs) { - user_prefs->RegisterDictionaryPref(prefs::kExtensionCommands, - PrefService::SYNCABLE_PREF); +void CommandService::RegisterUserPrefs(PrefServiceSyncable* user_prefs) { + user_prefs->RegisterDictionaryPref(prefs::kExtensionCommands, + PrefServiceSyncable::SYNCABLE_PREF); } CommandService::CommandService(Profile* profile) diff --git a/chrome/browser/extensions/api/commands/command_service.h b/chrome/browser/extensions/api/commands/command_service.h index 8d0e70f..ce3ba5a 100644 --- a/chrome/browser/extensions/api/commands/command_service.h +++ b/chrome/browser/extensions/api/commands/command_service.h @@ -16,7 +16,7 @@ #include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_source.h" -class PrefService; +class PrefServiceSyncable; class Profile; namespace base { @@ -43,7 +43,7 @@ class CommandService : public ProfileKeyedService, }; // Register prefs for keybinding. - static void RegisterUserPrefs(PrefService* user_prefs); + static void RegisterUserPrefs(PrefServiceSyncable* user_prefs); // Constructs a CommandService object for the given profile. explicit CommandService(Profile* profile); diff --git a/chrome/browser/extensions/api/tabs/tabs.cc b/chrome/browser/extensions/api/tabs/tabs.cc index 9afc9d7..717502f 100644 --- a/chrome/browser/extensions/api/tabs/tabs.cc +++ b/chrome/browser/extensions/api/tabs/tabs.cc @@ -1640,7 +1640,7 @@ bool CaptureVisibleTabFunction::GetTabToCapture(WebContents** web_contents) { }; bool CaptureVisibleTabFunction::RunImpl() { - PrefService* service = profile()->GetPrefs(); + PrefServiceBase* service = profile()->GetPrefs(); if (service->GetBoolean(prefs::kDisableScreenshots)) { error_ = keys::kScreenshotsDisabled; return false; @@ -1801,9 +1801,10 @@ void CaptureVisibleTabFunction::SendResultFromBitmap( SendResponse(true); } -void CaptureVisibleTabFunction::RegisterUserPrefs(PrefService* service) { +void CaptureVisibleTabFunction::RegisterUserPrefs( + PrefServiceSyncable* service) { service->RegisterBooleanPref(prefs::kDisableScreenshots, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } bool DetectTabLanguageFunction::RunImpl() { diff --git a/chrome/browser/extensions/api/tabs/tabs.h b/chrome/browser/extensions/api/tabs/tabs.h index e5780c3..5011c3f 100644 --- a/chrome/browser/extensions/api/tabs/tabs.h +++ b/chrome/browser/extensions/api/tabs/tabs.h @@ -16,7 +16,7 @@ class BackingStore; class GURL; -class PrefService; +class PrefServiceSyncable; class SkBitmap; namespace base { @@ -171,7 +171,7 @@ class DetectTabLanguageFunction : public AsyncExtensionFunction, class CaptureVisibleTabFunction : public AsyncExtensionFunction, public content::NotificationObserver { public: - static void RegisterUserPrefs(PrefService* service); + static void RegisterUserPrefs(PrefServiceSyncable* service); protected: enum ImageFormat { diff --git a/chrome/browser/extensions/api/tabs/tabs_test.cc b/chrome/browser/extensions/api/tabs/tabs_test.cc index e04d5cf..30f192c 100644 --- a/chrome/browser/extensions/api/tabs/tabs_test.cc +++ b/chrome/browser/extensions/api/tabs/tabs_test.cc @@ -15,6 +15,7 @@ #include "chrome/browser/extensions/extension_function_test_utils.h" #include "chrome/browser/extensions/extension_tab_util.h" #include "chrome/browser/prefs/incognito_mode_prefs.h" +#include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_commands.h" @@ -30,6 +31,7 @@ namespace { class ExtensionTabsTest : public InProcessBrowserTest { }; + } IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, GetWindow) { diff --git a/chrome/browser/extensions/app_notify_channel_setup_unittest.cc b/chrome/browser/extensions/app_notify_channel_setup_unittest.cc index bd59663..730c2c1 100644 --- a/chrome/browser/extensions/app_notify_channel_setup_unittest.cc +++ b/chrome/browser/extensions/app_notify_channel_setup_unittest.cc @@ -182,9 +182,7 @@ class AppNotifyChannelSetupTest : public testing::Test { virtual ~AppNotifyChannelSetupTest() {} virtual void SetLoggedInUser(const std::string username) { - TestingPrefService* prefs = profile_.GetTestingPrefService(); - prefs->SetUserPref(prefs::kGoogleServicesUsername, - new StringValue(username)); + profile_.GetPrefs()->SetString(prefs::kGoogleServicesUsername, username); } virtual AppNotifyChannelSetup* CreateInstance() { diff --git a/chrome/browser/extensions/component_loader.cc b/chrome/browser/extensions/component_loader.cc index 82cdcc9..c844c92 100644 --- a/chrome/browser/extensions/component_loader.cc +++ b/chrome/browser/extensions/component_loader.cc @@ -69,12 +69,12 @@ ComponentLoader::ComponentExtensionInfo::ComponentExtensionInfo( } ComponentLoader::ComponentLoader(ExtensionServiceInterface* extension_service, - PrefService* prefs, - PrefService* local_state) - : prefs_(prefs), + PrefServiceBase* profile_prefs, + PrefServiceBase* local_state) + : profile_prefs_(profile_prefs), local_state_(local_state), extension_service_(extension_service) { - pref_change_registrar_.Init(prefs); + pref_change_registrar_.Init(profile_prefs); // This pref is set by policy. We have to watch it for change because on // ChromeOS, policy isn't loaded until after the browser process is started. @@ -294,7 +294,7 @@ void ComponentLoader::AddOrReloadEnterpriseWebStore() { Remove(path); std::string enterprise_webstore_url = - prefs_->GetString(prefs::kEnterpriseWebStoreURL); + profile_prefs_->GetString(prefs::kEnterpriseWebStoreURL); // Load the extension only if the URL preference is set. if (!enterprise_webstore_url.empty()) { @@ -305,7 +305,8 @@ void ComponentLoader::AddOrReloadEnterpriseWebStore() { // The manifest is missing some values that are provided by policy. DictionaryValue* manifest = ParseManifest(manifest_contents); if (manifest) { - std::string name = prefs_->GetString(prefs::kEnterpriseWebStoreName); + std::string name = + profile_prefs_->GetString(prefs::kEnterpriseWebStoreName); manifest->SetString("app.launch.web_url", enterprise_webstore_url); manifest->SetString("name", name); Add(manifest, path); @@ -448,13 +449,13 @@ void ComponentLoader::UnloadComponent(ComponentExtensionInfo* component) { } // static -void ComponentLoader::RegisterUserPrefs(PrefService* prefs) { +void ComponentLoader::RegisterUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterStringPref(prefs::kEnterpriseWebStoreURL, std::string() /* default_value */, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterStringPref(prefs::kEnterpriseWebStoreName, std::string() /* default_value */, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } } // namespace extensions diff --git a/chrome/browser/extensions/component_loader.h b/chrome/browser/extensions/component_loader.h index 7e61e0b..e5ec028 100644 --- a/chrome/browser/extensions/component_loader.h +++ b/chrome/browser/extensions/component_loader.h @@ -14,7 +14,8 @@ #include "base/values.h" class ExtensionServiceInterface; -class PrefService; +class PrefServiceBase; +class PrefServiceSyncable; namespace extensions { @@ -24,8 +25,8 @@ class Extension; class ComponentLoader { public: ComponentLoader(ExtensionServiceInterface* extension_service, - PrefService* prefs, - PrefService* local_state); + PrefServiceBase* prefs, + PrefServiceBase* local_state); virtual ~ComponentLoader(); size_t registered_extensions_count() const { @@ -88,7 +89,7 @@ class ComponentLoader { // platforms this |skip_session_components| is expected to be unset. void AddDefaultComponentExtensions(bool skip_session_components); - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); // Parse the given JSON manifest. Returns NULL if it cannot be parsed, or if // if the result is not a DictionaryValue. @@ -139,8 +140,8 @@ class ComponentLoader { // Unloads |component| from the memory. void UnloadComponent(ComponentExtensionInfo* component); - PrefService* prefs_; - PrefService* local_state_; + PrefServiceBase* profile_prefs_; + PrefServiceBase* local_state_; ExtensionServiceInterface* extension_service_; diff --git a/chrome/browser/extensions/component_loader_unittest.cc b/chrome/browser/extensions/component_loader_unittest.cc index fa64fd4..288a16f 100644 --- a/chrome/browser/extensions/component_loader_unittest.cc +++ b/chrome/browser/extensions/component_loader_unittest.cc @@ -75,7 +75,7 @@ class ComponentLoaderTest : public testing::Test { ComponentLoaderTest() : // Note: we pass the same pref service here, to stand in for both // user prefs and local state. - component_loader_(&extension_service_, &prefs_, &prefs_) { + component_loader_(&extension_service_, &prefs_, &local_state_) { } void SetUp() { @@ -91,18 +91,23 @@ class ComponentLoaderTest : public testing::Test { &manifest_contents_)); // Register the user prefs that ComponentLoader will read. - prefs_.RegisterStringPref(prefs::kEnterpriseWebStoreURL, std::string()); - prefs_.RegisterStringPref(prefs::kEnterpriseWebStoreName, std::string()); + prefs_.RegisterStringPref(prefs::kEnterpriseWebStoreURL, + std::string(), + PrefServiceSyncable::UNSYNCABLE_PREF); + prefs_.RegisterStringPref(prefs::kEnterpriseWebStoreName, + std::string(), + PrefServiceSyncable::UNSYNCABLE_PREF); // Register the local state prefs. #if defined(OS_CHROMEOS) - prefs_.RegisterBooleanPref(prefs::kSpokenFeedbackEnabled, false); + local_state_.RegisterBooleanPref(prefs::kSpokenFeedbackEnabled, false); #endif } protected: MockExtensionService extension_service_; - TestingPrefService prefs_; + TestingPrefServiceSyncable prefs_; + TestingPrefServiceSimple local_state_; ComponentLoader component_loader_; // The root directory of the text extension. diff --git a/chrome/browser/extensions/default_apps.cc b/chrome/browser/extensions/default_apps.cc index 3583416..604f0cd 100644 --- a/chrome/browser/extensions/default_apps.cc +++ b/chrome/browser/extensions/default_apps.cc @@ -48,9 +48,9 @@ bool IsLocaleSupported() { namespace default_apps { -void RegisterUserPrefs(PrefService* prefs) { +void RegisterUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterIntegerPref(prefs::kDefaultAppsInstallState, kUnknown, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } bool Provider::ShouldInstallInProfile() { diff --git a/chrome/browser/extensions/default_apps.h b/chrome/browser/extensions/default_apps.h index 52e6e94..cc5ede1 100644 --- a/chrome/browser/extensions/default_apps.h +++ b/chrome/browser/extensions/default_apps.h @@ -8,7 +8,7 @@ #include "base/basictypes.h" #include "chrome/browser/extensions/external_provider_impl.h" -class PrefService; +class PrefServiceSyncable; class Profile; namespace extensions { @@ -34,7 +34,7 @@ enum InstallState { // Register preference properties used by default apps to maintain // install state. -void RegisterUserPrefs(PrefService* prefs); +void RegisterUserPrefs(PrefServiceSyncable* prefs); // A specialization of the ExternalProviderImpl that conditionally installs apps // from the chrome::DIR_DEFAULT_APPS location based on a preference in the diff --git a/chrome/browser/extensions/extension_prefs.cc b/chrome/browser/extensions/extension_prefs.cc index 29e3b38..9b687b8 100644 --- a/chrome/browser/extensions/extension_prefs.cc +++ b/chrome/browser/extensions/extension_prefs.cc @@ -371,7 +371,7 @@ base::Time ExtensionPrefs::TimeProvider::GetCurrentTime() const { // static scoped_ptr<ExtensionPrefs> ExtensionPrefs::Create( - PrefService* prefs, + PrefServiceSyncable* prefs, const FilePath& root_dir, ExtensionPrefValueMap* extension_pref_value_map, bool extensions_disabled) { @@ -384,7 +384,7 @@ scoped_ptr<ExtensionPrefs> ExtensionPrefs::Create( // static scoped_ptr<ExtensionPrefs> ExtensionPrefs::Create( - PrefService* pref_service, + PrefServiceSyncable* pref_service, const FilePath& root_dir, ExtensionPrefValueMap* extension_pref_value_map, bool extensions_disabled, @@ -2205,7 +2205,7 @@ void ExtensionPrefs::SetGeometryCache( } ExtensionPrefs::ExtensionPrefs( - PrefService* prefs, + PrefServiceSyncable* prefs, const FilePath& root_dir, ExtensionPrefValueMap* extension_pref_value_map, scoped_ptr<TimeProvider> time_provider) @@ -2235,47 +2235,51 @@ bool ExtensionPrefs::NeedsStorageGarbageCollection() { } // static -void ExtensionPrefs::RegisterUserPrefs(PrefService* prefs) { - prefs->RegisterDictionaryPref(kExtensionsPref, PrefService::UNSYNCABLE_PREF); - prefs->RegisterListPref(kExtensionToolbar, PrefService::UNSYNCABLE_PREF); - prefs->RegisterListPref(kExtensionActionBox, PrefService::UNSYNCABLE_PREF); - prefs->RegisterListPref(kExtensionActionBoxBar, PrefService::UNSYNCABLE_PREF); +void ExtensionPrefs::RegisterUserPrefs(PrefServiceSyncable* prefs) { + prefs->RegisterDictionaryPref(kExtensionsPref, + PrefServiceSyncable::UNSYNCABLE_PREF); + prefs->RegisterListPref(kExtensionToolbar, + PrefServiceSyncable::UNSYNCABLE_PREF); + prefs->RegisterListPref(kExtensionActionBox, + PrefServiceSyncable::UNSYNCABLE_PREF); + prefs->RegisterListPref(kExtensionActionBoxBar, + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterIntegerPref(prefs::kExtensionToolbarSize, -1, // default value - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDictionaryPref(kExtensionsBlacklistUpdate, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterListPref(prefs::kExtensionInstallAllowList, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterListPref(prefs::kExtensionInstallDenyList, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDictionaryPref(prefs::kExtensionInstallForceList, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterListPref(prefs::kExtensionAllowedTypes, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterStringPref(kWebStoreLogin, std::string(), // default value - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterStringPref(prefs::kExtensionBlacklistUpdateVersion, "0", // default value - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kExtensionStorageGarbageCollect, false, // default value - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterInt64Pref(prefs::kLastExtensionsUpdateCheck, 0, // default value - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterInt64Pref(prefs::kNextExtensionsUpdateCheck, 0, // default value - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterListPref(prefs::kExtensionAllowedInstallSites, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterStringPref(kExtensionsLastChromeVersion, std::string(), // default value - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(kSideloadWipeoutDone, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } ExtensionIdList ExtensionPrefs::GetExtensionPrefAsVector( diff --git a/chrome/browser/extensions/extension_prefs.h b/chrome/browser/extensions/extension_prefs.h index 410a802..4aedb87 100644 --- a/chrome/browser/extensions/extension_prefs.h +++ b/chrome/browser/extensions/extension_prefs.h @@ -24,6 +24,7 @@ class ExtensionPrefValueMap; class ExtensionSorting; class PrefService; +class PrefServiceSyncable; namespace extensions { class ExtensionPrefsUninstallExtension; @@ -92,7 +93,7 @@ class ExtensionPrefs : public ContentSettingsStore::Observer, // Creates and initializes an ExtensionPrefs object. // Does not take ownership of |prefs| and |extension_pref_value_map|. static scoped_ptr<ExtensionPrefs> Create( - PrefService* prefs, + PrefServiceSyncable* prefs, const FilePath& root_dir, ExtensionPrefValueMap* extension_pref_value_map, bool extensions_disabled); @@ -100,7 +101,7 @@ class ExtensionPrefs : public ContentSettingsStore::Observer, // A version of Create which allows injection of a custom base::Time provider. // Use this as needed for testing. static scoped_ptr<ExtensionPrefs> Create( - PrefService* prefs, + PrefServiceSyncable* prefs, const FilePath& root_dir, ExtensionPrefValueMap* extension_pref_value_map, bool extensions_disabled, @@ -485,14 +486,14 @@ class ExtensionPrefs : public ContentSettingsStore::Observer, // found. base::Time GetInstallTime(const std::string& extension_id) const; - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); ContentSettingsStore* content_settings_store() { return content_settings_store_.get(); } // The underlying PrefService. - PrefService* pref_service() const { return prefs_; } + PrefServiceSyncable* pref_service() const { return prefs_; } // The underlying ExtensionSorting. ExtensionSorting* extension_sorting() const { @@ -521,7 +522,7 @@ class ExtensionPrefs : public ContentSettingsStore::Observer, friend class ExtensionPrefsUninstallExtension; // Unit test. // See the Create methods. - ExtensionPrefs(PrefService* prefs, + ExtensionPrefs(PrefServiceSyncable* prefs, const FilePath& root_dir, ExtensionPrefValueMap* extension_pref_value_map, scoped_ptr<TimeProvider> time_provider); @@ -641,7 +642,7 @@ class ExtensionPrefs : public ContentSettingsStore::Observer, DictionaryValue* extension_dict); // The pref service specific to this set of extension prefs. Owned by profile. - PrefService* prefs_; + PrefServiceSyncable* prefs_; // Base extensions install directory. FilePath install_directory_; diff --git a/chrome/browser/extensions/extension_prefs_unittest.cc b/chrome/browser/extensions/extension_prefs_unittest.cc index 5a9b340..cd1b14a 100644 --- a/chrome/browser/extensions/extension_prefs_unittest.cc +++ b/chrome/browser/extensions/extension_prefs_unittest.cc @@ -834,18 +834,14 @@ ExtensionPrefsPrepopulatedTest::ExtensionPrefsPrepopulatedTest() ExtensionPrefsPrepopulatedTest::~ExtensionPrefsPrepopulatedTest() {} void ExtensionPrefsPrepopulatedTest::RegisterPreferences() { - prefs()->pref_service()->RegisterStringPref(kPref1, - kDefaultPref1, - PrefService::UNSYNCABLE_PREF); - prefs()->pref_service()->RegisterStringPref(kPref2, - kDefaultPref2, - PrefService::UNSYNCABLE_PREF); - prefs()->pref_service()->RegisterStringPref(kPref3, - kDefaultPref3, - PrefService::UNSYNCABLE_PREF); - prefs()->pref_service()->RegisterStringPref(kPref4, - kDefaultPref4, - PrefService::UNSYNCABLE_PREF); + prefs()->pref_service()->RegisterStringPref( + kPref1, kDefaultPref1, PrefServiceSyncable::UNSYNCABLE_PREF); + prefs()->pref_service()->RegisterStringPref( + kPref2, kDefaultPref2, PrefServiceSyncable::UNSYNCABLE_PREF); + prefs()->pref_service()->RegisterStringPref( + kPref3, kDefaultPref3, PrefServiceSyncable::UNSYNCABLE_PREF); + prefs()->pref_service()->RegisterStringPref( + kPref4, kDefaultPref4, PrefServiceSyncable::UNSYNCABLE_PREF); } void ExtensionPrefsPrepopulatedTest::InstallExtControlledPref( diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc index 99ae5fd..6d56fe0 100644 --- a/chrome/browser/extensions/extension_service_unittest.cc +++ b/chrome/browser/extensions/extension_service_unittest.cc @@ -425,9 +425,10 @@ void ExtensionServiceTestBase::InitializeExtensionService( bool autoupdate_enabled) { TestingProfile::Builder profile_builder; // Create a PrefService that only contains user defined preference values. - scoped_ptr<PrefService> prefs( - PrefServiceMockBuilder().WithUserFilePrefs( - pref_file, loop_.message_loop_proxy()).Create()); + PrefServiceMockBuilder builder; + builder.WithUserFilePrefs( + pref_file, loop_.message_loop_proxy()); + scoped_ptr<PrefServiceSyncable> prefs(builder.CreateSyncable()); Profile::RegisterUserPrefs(prefs.get()); chrome::RegisterUserPrefs(prefs.get()); profile_builder.SetPrefService(prefs.Pass()); diff --git a/chrome/browser/extensions/extension_web_ui.cc b/chrome/browser/extensions/extension_web_ui.cc index 0ab6dc6..e93bcbc 100644 --- a/chrome/browser/extensions/extension_web_ui.cc +++ b/chrome/browser/extensions/extension_web_ui.cc @@ -191,9 +191,9 @@ ExtensionWebUI::bookmark_manager_private_event_router() { // chrome:// URL overrides // static -void ExtensionWebUI::RegisterUserPrefs(PrefService* prefs) { +void ExtensionWebUI::RegisterUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterDictionaryPref(kExtensionURLOverrides, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } // static diff --git a/chrome/browser/extensions/extension_web_ui.h b/chrome/browser/extensions/extension_web_ui.h index 4d46e8f..99a29e7 100644 --- a/chrome/browser/extensions/extension_web_ui.h +++ b/chrome/browser/extensions/extension_web_ui.h @@ -21,7 +21,7 @@ namespace extensions { class BookmarkManagerPrivateEventRouter; } -class PrefService; +class PrefServiceSyncable; class Profile; // This class implements WebUI for extensions and allows extensions to put UI in @@ -57,7 +57,7 @@ class ExtensionWebUI : public content::WebUIController { const base::Value* override); // Called from BrowserPrefs - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); // Get the favicon for the extension by getting an icon from the manifest. // Note. |callback| is always run asynchronously. diff --git a/chrome/browser/extensions/platform_app_browsertest.cc b/chrome/browser/extensions/platform_app_browsertest.cc index cd4c10c..fb2f2a0 100644 --- a/chrome/browser/extensions/platform_app_browsertest.cc +++ b/chrome/browser/extensions/platform_app_browsertest.cc @@ -896,7 +896,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, pref_path += extension->id(); pref_path += ".manifest.version"; extension_prefs->pref_service()->RegisterStringPref( - pref_path.c_str(), std::string(), PrefServiceBase::UNSYNCABLE_PREF); + pref_path.c_str(), std::string(), PrefServiceSyncable::UNSYNCABLE_PREF); extension_prefs->pref_service()->Set(pref_path.c_str(), old_version); } diff --git a/chrome/browser/extensions/test_extension_prefs.cc b/chrome/browser/extensions/test_extension_prefs.cc index fe016fc..d95e03c 100644 --- a/chrome/browser/extensions/test_extension_prefs.cc +++ b/chrome/browser/extensions/test_extension_prefs.cc @@ -93,7 +93,7 @@ void TestExtensionPrefs::RecreateExtensionPrefs() { builder.WithUserFilePrefs(preferences_file_, task_runner_); builder.WithExtensionPrefs( new ExtensionPrefStore(extension_pref_value_map_.get(), false)); - pref_service_.reset(builder.Create()); + pref_service_.reset(builder.CreateSyncable()); ExtensionPrefs::RegisterUserPrefs(pref_service_.get()); prefs_ = ExtensionPrefs::Create( @@ -156,7 +156,7 @@ std::string TestExtensionPrefs::AddExtensionAndReturnId(std::string name) { return extension->id(); } -PrefService* TestExtensionPrefs::CreateIncognitoPrefService() const { +PrefServiceSyncable* TestExtensionPrefs::CreateIncognitoPrefService() const { return pref_service_->CreateIncognitoPrefService( new ExtensionPrefStore(extension_pref_value_map_.get(), true)); } diff --git a/chrome/browser/extensions/test_extension_prefs.h b/chrome/browser/extensions/test_extension_prefs.h index b4b92dd..6949f15 100644 --- a/chrome/browser/extensions/test_extension_prefs.h +++ b/chrome/browser/extensions/test_extension_prefs.h @@ -12,7 +12,7 @@ #include "chrome/common/extensions/extension.h" class ExtensionPrefValueMap; -class PrefService; +class PrefServiceSyncable; namespace base { class DictionaryValue; @@ -33,7 +33,7 @@ class TestExtensionPrefs { const ExtensionPrefs& const_prefs() const { return *prefs_.get(); } - PrefService* pref_service() { return pref_service_.get(); } + PrefServiceSyncable* pref_service() { return pref_service_.get(); } const FilePath& temp_dir() const { return temp_dir_.path(); } const FilePath& extensions_dir() const { return extensions_dir_; } @@ -65,7 +65,7 @@ class TestExtensionPrefs { // assigned. std::string AddExtensionAndReturnId(std::string name); - PrefService* CreateIncognitoPrefService() const; + PrefServiceSyncable* CreateIncognitoPrefService() const; // Allows disabling the loading of preferences of extensions. Becomes // active after calling RecreateExtensionPrefs(). Defaults to false. @@ -75,7 +75,7 @@ class TestExtensionPrefs { base::ScopedTempDir temp_dir_; FilePath preferences_file_; FilePath extensions_dir_; - scoped_ptr<PrefService> pref_service_; + scoped_ptr<PrefServiceSyncable> pref_service_; scoped_ptr<ExtensionPrefs> prefs_; scoped_ptr<ExtensionPrefValueMap> extension_pref_value_map_; const scoped_refptr<base::SequencedTaskRunner> task_runner_; diff --git a/chrome/browser/extensions/test_extension_system.cc b/chrome/browser/extensions/test_extension_system.cc index c300bf2..6a1fa0b 100644 --- a/chrome/browser/extensions/test_extension_system.cc +++ b/chrome/browser/extensions/test_extension_system.cc @@ -20,6 +20,7 @@ #include "chrome/browser/extensions/standard_management_policy_provider.h" #include "chrome/browser/extensions/state_store.h" #include "chrome/browser/extensions/user_script_master.h" +#include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/value_store/testing_value_store.h" #include "chrome/common/chrome_switches.h" diff --git a/chrome/browser/extensions/updater/extension_updater_unittest.cc b/chrome/browser/extensions/updater/extension_updater_unittest.cc index 0cd8a08..66370c6 100644 --- a/chrome/browser/extensions/updater/extension_updater_unittest.cc +++ b/chrome/browser/extensions/updater/extension_updater_unittest.cc @@ -222,7 +222,7 @@ class MockService : public TestExtensionService { ExtensionPrefs* extension_prefs() { return prefs_->prefs(); } - PrefService* pref_service() { return prefs_->pref_service(); } + PrefServiceSyncable* pref_service() { return prefs_->pref_service(); } Blacklist* blacklist() { return &blacklist_; } diff --git a/chrome/browser/external_protocol/external_protocol_handler.cc b/chrome/browser/external_protocol/external_protocol_handler.cc index ef58d2c..85c9237 100644 --- a/chrome/browser/external_protocol/external_protocol_handler.cc +++ b/chrome/browser/external_protocol/external_protocol_handler.cc @@ -293,7 +293,7 @@ void ExternalProtocolHandler::LaunchUrlWithoutSecurityCheck(const GURL& url) { } // static -void ExternalProtocolHandler::RegisterPrefs(PrefService* prefs) { +void ExternalProtocolHandler::RegisterPrefs(PrefServiceSimple* prefs) { prefs->RegisterDictionaryPref(prefs::kExcludedSchemes); } diff --git a/chrome/browser/external_protocol/external_protocol_handler.h b/chrome/browser/external_protocol/external_protocol_handler.h index 2cab580..ae61f92 100644 --- a/chrome/browser/external_protocol/external_protocol_handler.h +++ b/chrome/browser/external_protocol/external_protocol_handler.h @@ -10,7 +10,7 @@ #include "chrome/browser/shell_integration.h" class GURL; -class PrefService; +class PrefServiceSimple; namespace base { class DictionaryValue; @@ -78,7 +78,7 @@ class ExternalProtocolHandler { int routing_id); // Register the ExcludedSchemes preference. - static void RegisterPrefs(PrefService* prefs); + static void RegisterPrefs(PrefServiceSimple* prefs); // Starts a url using the external protocol handler with the help // of shellexecute. Should only be called if the protocol is whitelisted diff --git a/chrome/browser/first_run/first_run.cc b/chrome/browser/first_run/first_run.cc index 15ca817..2e1693f 100644 --- a/chrome/browser/first_run/first_run.cc +++ b/chrome/browser/first_run/first_run.cc @@ -401,10 +401,10 @@ std::string GetPingDelayPrefName() { installer::master_preferences::kDistroPingDelay); } -void RegisterUserPrefs(PrefService* prefs) { +void RegisterUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterIntegerPref(GetPingDelayPrefName().c_str(), 0, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } bool RemoveSentinel() { @@ -429,9 +429,10 @@ bool SetShowFirstRunBubblePref(FirstRunBubbleOptions show_bubble_option) { } bool SetShowWelcomePagePref() { - PrefService* local_state = g_browser_process->local_state(); + PrefServiceSimple* local_state = g_browser_process->local_state(); if (!local_state) return false; + // TODO(joi): This should happen via browser_prefs::RegisterLocalState(). if (!local_state->FindPreference(prefs::kShouldShowWelcomePage)) { local_state->RegisterBooleanPref(prefs::kShouldShowWelcomePage, false); local_state->SetBoolean(prefs::kShouldShowWelcomePage, true); @@ -440,11 +441,12 @@ bool SetShowWelcomePagePref() { } bool SetPersonalDataManagerFirstRunPref() { - PrefService* local_state = g_browser_process->local_state(); + PrefServiceSimple* local_state = g_browser_process->local_state(); if (!local_state) return false; if (!local_state->FindPreference( prefs::kAutofillPersonalDataManagerFirstRun)) { + // TODO(joi): This should happen via browser_prefs::RegisterLocalState(). local_state->RegisterBooleanPref( prefs::kAutofillPersonalDataManagerFirstRun, false); local_state->SetBoolean(prefs::kAutofillPersonalDataManagerFirstRun, true); diff --git a/chrome/browser/first_run/first_run.h b/chrome/browser/first_run/first_run.h index 56258e6..31524e3 100644 --- a/chrome/browser/first_run/first_run.h +++ b/chrome/browser/first_run/first_run.h @@ -19,7 +19,7 @@ class CommandLine; class FilePath; class GURL; -class PrefService; +class PrefServiceSyncable; class Profile; class ProcessSingleton; @@ -80,7 +80,7 @@ bool CreateSentinel(); std::string GetPingDelayPrefName(); // Register user preferences used by the MasterPrefs structure. -void RegisterUserPrefs(PrefService* prefs); +void RegisterUserPrefs(PrefServiceSyncable* prefs); // Removes the sentinel file created in ConfigDone(). Returns false if the // sentinel file could not be removed. diff --git a/chrome/browser/geolocation/chrome_access_token_store.cc b/chrome/browser/geolocation/chrome_access_token_store.cc index 891fe14..b895ee7 100644 --- a/chrome/browser/geolocation/chrome_access_token_store.cc +++ b/chrome/browser/geolocation/chrome_access_token_store.cc @@ -98,7 +98,7 @@ class TokenLoadingJob : public base::RefCountedThreadSafe<TokenLoadingJob> { } // namespace -void ChromeAccessTokenStore::RegisterPrefs(PrefService* prefs) { +void ChromeAccessTokenStore::RegisterPrefs(PrefServiceSimple* prefs) { prefs->RegisterDictionaryPref(prefs::kGeolocationAccessToken); } diff --git a/chrome/browser/geolocation/chrome_access_token_store.h b/chrome/browser/geolocation/chrome_access_token_store.h index 117eec5..b1ecd56 100644 --- a/chrome/browser/geolocation/chrome_access_token_store.h +++ b/chrome/browser/geolocation/chrome_access_token_store.h @@ -8,12 +8,12 @@ #include "base/memory/ref_counted.h" #include "content/public/browser/access_token_store.h" -class PrefService; +class PrefServiceSimple; // Creates a new access token store backed by the global chome prefs. class ChromeAccessTokenStore : public content::AccessTokenStore { public: - static void RegisterPrefs(PrefService* prefs); + static void RegisterPrefs(PrefServiceSimple* prefs); ChromeAccessTokenStore(); diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context_factory.cc b/chrome/browser/geolocation/chrome_geolocation_permission_context_factory.cc index 83e274f..c7ada62c 100644 --- a/chrome/browser/geolocation/chrome_geolocation_permission_context_factory.cc +++ b/chrome/browser/geolocation/chrome_geolocation_permission_context_factory.cc @@ -21,10 +21,10 @@ ChromeGeolocationPermissionContext* } void ChromeGeolocationPermissionContextFactory::RegisterUserPrefs( - PrefService* user_prefs) { + PrefServiceSyncable* user_prefs) { #if defined(OS_ANDROID) user_prefs->RegisterBooleanPref(prefs::kGeolocationEnabled, true, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); #endif } diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context_factory.h b/chrome/browser/geolocation/chrome_geolocation_permission_context_factory.h index 8e598b2..64ff446 100644 --- a/chrome/browser/geolocation/chrome_geolocation_permission_context_factory.h +++ b/chrome/browser/geolocation/chrome_geolocation_permission_context_factory.h @@ -16,7 +16,7 @@ class ChromeGeolocationPermissionContextFactory { ChromeGeolocationPermissionContextFactory() {} ~ChromeGeolocationPermissionContextFactory() {} static ChromeGeolocationPermissionContext* Create(Profile* profile); - static void RegisterUserPrefs(PrefService* user_prefs); + static void RegisterUserPrefs(PrefServiceSyncable* user_prefs); private: diff --git a/chrome/browser/geolocation/geolocation_prefs.cc b/chrome/browser/geolocation/geolocation_prefs.cc index 4f2826e..92fd06e 100644 --- a/chrome/browser/geolocation/geolocation_prefs.cc +++ b/chrome/browser/geolocation/geolocation_prefs.cc @@ -8,12 +8,12 @@ #include "chrome/browser/geolocation/chrome_geolocation_permission_context_factory.h" namespace geolocation { -void RegisterPrefs(PrefService* prefs) { +void RegisterPrefs(PrefServiceSimple* prefs) { // Fan out to all geolocation sub-components that use prefs. ChromeAccessTokenStore::RegisterPrefs(prefs); } -void RegisterUserPrefs(PrefService* user_prefs) { +void RegisterUserPrefs(PrefServiceSyncable* user_prefs) { ChromeGeolocationPermissionContextFactory::RegisterUserPrefs(user_prefs); } diff --git a/chrome/browser/geolocation/geolocation_prefs.h b/chrome/browser/geolocation/geolocation_prefs.h index f838057..735e511 100644 --- a/chrome/browser/geolocation/geolocation_prefs.h +++ b/chrome/browser/geolocation/geolocation_prefs.h @@ -5,11 +5,12 @@ #ifndef CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PREFS_H_ #define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PREFS_H_ -class PrefService; +class PrefServiceSimple; +class PrefServiceSyncable; namespace geolocation { -void RegisterPrefs(PrefService* prefs); -void RegisterUserPrefs(PrefService* user_prefs); +void RegisterPrefs(PrefServiceSimple* prefs); +void RegisterUserPrefs(PrefServiceSyncable* user_prefs); } #endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PREFS_H_ diff --git a/chrome/browser/google/google_url_tracker_factory.cc b/chrome/browser/google/google_url_tracker_factory.cc index 1908961..732cdc1 100644 --- a/chrome/browser/google/google_url_tracker_factory.cc +++ b/chrome/browser/google/google_url_tracker_factory.cc @@ -34,11 +34,14 @@ ProfileKeyedService* GoogleURLTrackerFactory::BuildServiceInstanceFor( return new GoogleURLTracker(profile, GoogleURLTracker::NORMAL_MODE); } -void GoogleURLTrackerFactory::RegisterUserPrefs(PrefService* user_prefs) { +void GoogleURLTrackerFactory::RegisterUserPrefs( + PrefServiceSyncable* user_prefs) { user_prefs->RegisterStringPref(prefs::kLastKnownGoogleURL, - GoogleURLTracker::kDefaultGoogleHomepage, PrefService::UNSYNCABLE_PREF); - user_prefs->RegisterStringPref(prefs::kLastPromptedGoogleURL, std::string(), - PrefService::UNSYNCABLE_PREF); + GoogleURLTracker::kDefaultGoogleHomepage, + PrefServiceSyncable::UNSYNCABLE_PREF); + user_prefs->RegisterStringPref(prefs::kLastPromptedGoogleURL, + std::string(), + PrefServiceSyncable::UNSYNCABLE_PREF); } bool GoogleURLTrackerFactory::ServiceRedirectedInIncognito() const { diff --git a/chrome/browser/google/google_url_tracker_factory.h b/chrome/browser/google/google_url_tracker_factory.h index 4dfe261..e74d112 100644 --- a/chrome/browser/google/google_url_tracker_factory.h +++ b/chrome/browser/google/google_url_tracker_factory.h @@ -10,6 +10,7 @@ #include "chrome/browser/profiles/profile_keyed_service_factory.h" class GoogleURLTracker; +class PrefServiceSyncable; class Profile; // Singleton that owns all GoogleURLTrackers and associates them with Profiles. @@ -30,7 +31,7 @@ class GoogleURLTrackerFactory : public ProfileKeyedServiceFactory { // ProfileKeyedServiceFactory: virtual ProfileKeyedService* BuildServiceInstanceFor( Profile* profile) const OVERRIDE; - virtual void RegisterUserPrefs(PrefService* user_prefs) OVERRIDE; + virtual void RegisterUserPrefs(PrefServiceSyncable* user_prefs) OVERRIDE; virtual bool ServiceRedirectedInIncognito() const OVERRIDE; virtual bool ServiceIsCreatedWithProfile() const OVERRIDE; virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; diff --git a/chrome/browser/gpu/gl_string_manager.cc b/chrome/browser/gpu/gl_string_manager.cc index 7cc8bc6..a9216f5 100644 --- a/chrome/browser/gpu/gl_string_manager.cc +++ b/chrome/browser/gpu/gl_string_manager.cc @@ -21,10 +21,11 @@ void GLStringManager::Initialize() { // We never remove this observer from GpuDataManager. content::GpuDataManager::GetInstance()->AddObserver(this); - PrefService* local_state = g_browser_process->local_state(); + PrefServiceSimple* local_state = g_browser_process->local_state(); if (!local_state) return; + // TODO(joi): This should happen via browser_prefs::RegisterLocalState(). local_state->RegisterStringPref(prefs::kGLVendorString, gl_vendor_); local_state->RegisterStringPref(prefs::kGLRendererString, gl_renderer_); local_state->RegisterStringPref(prefs::kGLVersionString, gl_version_); diff --git a/chrome/browser/intents/web_intents_util.cc b/chrome/browser/intents/web_intents_util.cc index 5ee5d4b..868d8d0 100644 --- a/chrome/browser/intents/web_intents_util.cc +++ b/chrome/browser/intents/web_intents_util.cc @@ -59,9 +59,9 @@ const char kQuickOfficeViewerServiceURL[] = const char kQuickOfficeViewerDevServiceURL[] = "chrome-extension://ionpfmkccalenbmnddpbmocokhaknphg/views/appEditor.html"; -void RegisterUserPrefs(PrefService* user_prefs) { +void RegisterUserPrefs(PrefServiceSyncable* user_prefs) { user_prefs->RegisterBooleanPref(prefs::kWebIntentsEnabled, true, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); } bool IsWebIntentsEnabled(PrefService* prefs) { diff --git a/chrome/browser/intents/web_intents_util.h b/chrome/browser/intents/web_intents_util.h index 7d4ade7..e53286d 100644 --- a/chrome/browser/intents/web_intents_util.h +++ b/chrome/browser/intents/web_intents_util.h @@ -10,6 +10,7 @@ class Browser; class Profile; class PrefService; +class PrefServiceSyncable; namespace web_intents { @@ -37,7 +38,7 @@ extern const char kQuickOfficeViewerServiceURL[]; extern const char kQuickOfficeViewerDevServiceURL[]; // Registers the preferences related to Web Intents. -void RegisterUserPrefs(PrefService* user_prefs); +void RegisterUserPrefs(PrefServiceSyncable* user_prefs); // Returns true if WebIntents are enabled in preferences. bool IsWebIntentsEnabled(PrefService* prefs); diff --git a/chrome/browser/intranet_redirect_detector.cc b/chrome/browser/intranet_redirect_detector.cc index d7f9f63..a2ae736 100644 --- a/chrome/browser/intranet_redirect_detector.cc +++ b/chrome/browser/intranet_redirect_detector.cc @@ -55,7 +55,7 @@ GURL IntranetRedirectDetector::RedirectOrigin() { } // static -void IntranetRedirectDetector::RegisterPrefs(PrefService* prefs) { +void IntranetRedirectDetector::RegisterPrefs(PrefServiceSimple* prefs) { prefs->RegisterStringPref(prefs::kLastKnownIntranetRedirectOrigin, std::string()); } diff --git a/chrome/browser/intranet_redirect_detector.h b/chrome/browser/intranet_redirect_detector.h index e08b2de..a0a575d 100644 --- a/chrome/browser/intranet_redirect_detector.h +++ b/chrome/browser/intranet_redirect_detector.h @@ -17,7 +17,7 @@ #include "net/base/network_change_notifier.h" #include "net/url_request/url_fetcher_delegate.h" -class PrefService; +class PrefServiceSimple; // This object is responsible for determining whether the user is on a network // that redirects requests for intranet hostnames to another site, and if so, @@ -52,7 +52,7 @@ class IntranetRedirectDetector // is in place. static GURL RedirectOrigin(); - static void RegisterPrefs(PrefService* prefs); + static void RegisterPrefs(PrefServiceSimple* prefs); // The number of characters the fetcher will use for its randomly-generated // hostnames. diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc index 65a555f..3740513 100644 --- a/chrome/browser/io_thread.cc +++ b/chrome/browser/io_thread.cc @@ -357,7 +357,7 @@ IOThread::Globals::~Globals() {} // |local_state| is passed in explicitly in order to (1) reduce implicit // dependencies and (2) make IOThread more flexible for testing. IOThread::IOThread( - PrefService* local_state, + PrefServiceSimple* local_state, policy::PolicyService* policy_service, ChromeNetLog* net_log, extensions::EventRouterForwarder* extension_event_router_forwarder) @@ -369,6 +369,9 @@ IOThread::IOThread( ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { // We call RegisterPrefs() here (instead of inside browser_prefs.cc) to make // sure that everything is initialized in the right order. + // + // TODO(joi): See if we can fix so it does get registered from + // browser_prefs::RegisterLocalState. RegisterPrefs(local_state); auth_schemes_ = local_state->GetString(prefs::kAuthSchemes); negotiate_disable_cname_lookup_ = local_state->GetBoolean( @@ -718,7 +721,7 @@ void IOThread::EnableSpdy(const std::string& mode) { } // static -void IOThread::RegisterPrefs(PrefService* local_state) { +void IOThread::RegisterPrefs(PrefServiceSimple* local_state) { local_state->RegisterStringPref(prefs::kAuthSchemes, "basic,digest,ntlm,negotiate," "spdyproxy"); diff --git a/chrome/browser/io_thread.h b/chrome/browser/io_thread.h index 0f1eab3..5d7388c 100644 --- a/chrome/browser/io_thread.h +++ b/chrome/browser/io_thread.h @@ -24,6 +24,7 @@ class ChromeNetLog; class CommandLine; class PrefProxyConfigTrackerImpl; class PrefService; +class PrefServiceSimple; class SystemURLRequestContextGetter; namespace chrome_browser_net { @@ -166,7 +167,7 @@ class IOThread : public content::BrowserThreadDelegate { }; // |net_log| must either outlive the IOThread or be NULL. - IOThread(PrefService* local_state, + IOThread(PrefServiceSimple* local_state, policy::PolicyService* policy_service, ChromeNetLog* net_log, extensions::EventRouterForwarder* extension_event_router_forwarder); @@ -231,7 +232,7 @@ class IOThread : public content::BrowserThreadDelegate { // SystemRequestContext state has been initialized on the UI thread. void InitSystemRequestContextOnIOThread(); - static void RegisterPrefs(PrefService* local_state); + static void RegisterPrefs(PrefServiceSimple* local_state); net::HttpAuthHandlerFactory* CreateDefaultAuthHandlerFactory( net::HostResolver* resolver); diff --git a/chrome/browser/managed_mode/managed_mode.cc b/chrome/browser/managed_mode/managed_mode.cc index a40042f..f1acb3b 100644 --- a/chrome/browser/managed_mode/managed_mode.cc +++ b/chrome/browser/managed_mode/managed_mode.cc @@ -82,15 +82,15 @@ ManagedMode* ManagedMode::GetInstance() { } // static -void ManagedMode::RegisterPrefs(PrefService* prefs) { +void ManagedMode::RegisterPrefs(PrefServiceSimple* prefs) { prefs->RegisterBooleanPref(prefs::kInManagedMode, false); } // static -void ManagedMode::RegisterUserPrefs(PrefService* prefs) { +void ManagedMode::RegisterUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterIntegerPref(prefs::kDefaultManagedModeFilteringBehavior, 2, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } // static diff --git a/chrome/browser/managed_mode/managed_mode.h b/chrome/browser/managed_mode/managed_mode.h index 37d53ae..1c8eba9 100644 --- a/chrome/browser/managed_mode/managed_mode.h +++ b/chrome/browser/managed_mode/managed_mode.h @@ -24,7 +24,8 @@ struct DefaultSingletonTraits; class ManagedModeSiteList; class ManagedModeURLFilter; class PrefChangeRegistrar; -class PrefService; +class PrefServiceSimple; +class PrefServiceSyncable; class Profile; // Managed mode allows one person to manage the Chrome experience for another @@ -38,8 +39,8 @@ class ManagedMode : public chrome::BrowserListObserver, public: typedef base::Callback<void(bool)> EnterCallback; - static void RegisterPrefs(PrefService* prefs); - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterPrefs(PrefServiceSimple* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); // Initializes the singleton, setting the managed_profile_. Must be called // after g_browser_process and the LocalState have been created. diff --git a/chrome/browser/media/media_capture_devices_dispatcher.cc b/chrome/browser/media/media_capture_devices_dispatcher.cc index e31e09d..91923c6 100644 --- a/chrome/browser/media/media_capture_devices_dispatcher.cc +++ b/chrome/browser/media/media_capture_devices_dispatcher.cc @@ -18,16 +18,17 @@ MediaCaptureDevicesDispatcher::MediaCaptureDevicesDispatcher() MediaCaptureDevicesDispatcher::~MediaCaptureDevicesDispatcher() {} -void MediaCaptureDevicesDispatcher::RegisterUserPrefs(PrefService* user_prefs) { +void MediaCaptureDevicesDispatcher::RegisterUserPrefs( + PrefServiceSyncable* user_prefs) { if (!user_prefs->FindPreference(prefs::kDefaultAudioCaptureDevice)) { user_prefs->RegisterStringPref(prefs::kDefaultAudioCaptureDevice, std::string(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } if (!user_prefs->FindPreference(prefs::kDefaultVideoCaptureDevice)) { user_prefs->RegisterStringPref(prefs::kDefaultVideoCaptureDevice, std::string(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } } diff --git a/chrome/browser/media/media_capture_devices_dispatcher.h b/chrome/browser/media/media_capture_devices_dispatcher.h index 6dce9fa..3e7462a 100644 --- a/chrome/browser/media/media_capture_devices_dispatcher.h +++ b/chrome/browser/media/media_capture_devices_dispatcher.h @@ -10,7 +10,7 @@ #include "base/observer_list.h" #include "content/public/common/media_stream_request.h" -class PrefService; +class PrefServiceSyncable; // This observer is owned by MediaInternals and deleted when MediaInternals // is deleted. @@ -35,7 +35,7 @@ class MediaCaptureDevicesDispatcher MediaCaptureDevicesDispatcher(); // Registers the preferences related to Media Stream default devices. - static void RegisterUserPrefs(PrefService* user_prefs); + static void RegisterUserPrefs(PrefServiceSyncable* user_prefs); // Called on IO thread when one audio device is plugged in or unplugged. void AudioCaptureDevicesChanged(const content::MediaStreamDevices& devices); diff --git a/chrome/browser/media/media_stream_devices_controller.cc b/chrome/browser/media/media_stream_devices_controller.cc index 2013280..dc12269 100644 --- a/chrome/browser/media/media_stream_devices_controller.cc +++ b/chrome/browser/media/media_stream_devices_controller.cc @@ -56,13 +56,14 @@ MediaStreamDevicesController::MediaStreamDevicesController( MediaStreamDevicesController::~MediaStreamDevicesController() {} // static -void MediaStreamDevicesController::RegisterUserPrefs(PrefService* prefs) { +void MediaStreamDevicesController::RegisterUserPrefs( + PrefServiceSyncable* prefs) { prefs->RegisterBooleanPref(prefs::kVideoCaptureAllowed, true, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kAudioCaptureAllowed, true, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } diff --git a/chrome/browser/media/media_stream_devices_controller.h b/chrome/browser/media/media_stream_devices_controller.h index eb71033..8dc58a4 100644 --- a/chrome/browser/media/media_stream_devices_controller.h +++ b/chrome/browser/media/media_stream_devices_controller.h @@ -9,7 +9,7 @@ #include "content/public/browser/web_contents_delegate.h" -class PrefService; +class PrefServiceSyncable; class Profile; class MediaStreamDevicesController { @@ -22,7 +22,7 @@ class MediaStreamDevicesController { virtual ~MediaStreamDevicesController(); // Registers the prefs backing the audio and video policies. - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); // Public method to be called before creating the MediaStreamInfoBarDelegate. // This function will check the content settings exceptions and take the diff --git a/chrome/browser/media_gallery/media_galleries_preferences.cc b/chrome/browser/media_gallery/media_galleries_preferences.cc index e01d9d6..7667003 100644 --- a/chrome/browser/media_gallery/media_galleries_preferences.cc +++ b/chrome/browser/media_gallery/media_galleries_preferences.cc @@ -420,12 +420,12 @@ bool MediaGalleriesPreferences::APIHasBeenUsed(Profile* profile) { } // static -void MediaGalleriesPreferences::RegisterUserPrefs(PrefService* prefs) { +void MediaGalleriesPreferences::RegisterUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterListPref(prefs::kMediaGalleriesRememberedGalleries, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterUint64Pref(prefs::kMediaGalleriesUniqueId, kInvalidMediaGalleryPrefId + 1, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } extensions::ExtensionPrefs* diff --git a/chrome/browser/media_gallery/media_galleries_preferences.h b/chrome/browser/media_gallery/media_galleries_preferences.h index b41a573..3ff136e 100644 --- a/chrome/browser/media_gallery/media_galleries_preferences.h +++ b/chrome/browser/media_gallery/media_galleries_preferences.h @@ -14,7 +14,7 @@ #include "base/string16.h" #include "chrome/browser/profiles/profile_keyed_service.h" -class PrefService; +class PrefServiceSyncable; class Profile; namespace base { @@ -115,7 +115,7 @@ class MediaGalleriesPreferences : public ProfileKeyedService { // ProfileKeyedService implementation: virtual void Shutdown() OVERRIDE; - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); // Returns true if the media gallery preferences system has ever been used // for this profile. To be exact, it checks if a gallery has ever been added diff --git a/chrome/browser/media_gallery/media_galleries_preferences_factory.cc b/chrome/browser/media_gallery/media_galleries_preferences_factory.cc index 37c8ea3..0e7fda3 100644 --- a/chrome/browser/media_gallery/media_galleries_preferences_factory.cc +++ b/chrome/browser/media_gallery/media_galleries_preferences_factory.cc @@ -31,7 +31,8 @@ ProfileKeyedService* MediaGalleriesPreferencesFactory::BuildServiceInstanceFor( return new chrome::MediaGalleriesPreferences(profile); } -void MediaGalleriesPreferencesFactory::RegisterUserPrefs(PrefService* prefs) { +void MediaGalleriesPreferencesFactory::RegisterUserPrefs( + PrefServiceSyncable* prefs) { chrome::MediaGalleriesPreferences::RegisterUserPrefs(prefs); } diff --git a/chrome/browser/media_gallery/media_galleries_preferences_factory.h b/chrome/browser/media_gallery/media_galleries_preferences_factory.h index b21a5c2..2ccf97a 100644 --- a/chrome/browser/media_gallery/media_galleries_preferences_factory.h +++ b/chrome/browser/media_gallery/media_galleries_preferences_factory.h @@ -9,6 +9,7 @@ #include "base/memory/singleton.h" #include "chrome/browser/profiles/profile_keyed_service_factory.h" +class PrefServiceSyncable; class Profile; namespace chrome { @@ -34,7 +35,7 @@ class MediaGalleriesPreferencesFactory : public ProfileKeyedServiceFactory { // ProfileKeyedServiceFactory: virtual ProfileKeyedService* BuildServiceInstanceFor( Profile* profile) const OVERRIDE; - virtual void RegisterUserPrefs(PrefService* prefs) OVERRIDE; + virtual void RegisterUserPrefs(PrefServiceSyncable* prefs) OVERRIDE; virtual bool ServiceRedirectedInIncognito() const OVERRIDE; DISALLOW_COPY_AND_ASSIGN(MediaGalleriesPreferencesFactory); diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc index 0a074d8..c3b3458 100644 --- a/chrome/browser/metrics/metrics_log.cc +++ b/chrome/browser/metrics/metrics_log.cc @@ -278,7 +278,7 @@ MetricsLog::MetricsLog(const std::string& client_id, int session_id) MetricsLog::~MetricsLog() {} // static -void MetricsLog::RegisterPrefs(PrefService* local_state) { +void MetricsLog::RegisterPrefs(PrefServiceSimple* local_state) { local_state->RegisterListPref(prefs::kStabilityPluginStats); } diff --git a/chrome/browser/metrics/metrics_log.h b/chrome/browser/metrics/metrics_log.h index 366fa29..df6a3b5 100644 --- a/chrome/browser/metrics/metrics_log.h +++ b/chrome/browser/metrics/metrics_log.h @@ -19,6 +19,7 @@ struct AutocompleteLog; class PrefService; +class PrefServiceSimple; namespace base { class DictionaryValue; @@ -63,7 +64,7 @@ class MetricsLog : public MetricsLogBase { MetricsLog(const std::string& client_id, int session_id); virtual ~MetricsLog(); - static void RegisterPrefs(PrefService* prefs); + static void RegisterPrefs(PrefServiceSimple* prefs); // Get the amount of uptime in seconds since this function was last called. // This updates the cumulative uptime metric for uninstall as a side effect. diff --git a/chrome/browser/metrics/metrics_log_unittest.cc b/chrome/browser/metrics/metrics_log_unittest.cc index bd25700..0f8a6a0 100644 --- a/chrome/browser/metrics/metrics_log_unittest.cc +++ b/chrome/browser/metrics/metrics_log_unittest.cc @@ -97,7 +97,7 @@ class TestMetricsLog : public MetricsLog { return kScreenCount; } - TestingPrefService prefs_; + TestingPrefServiceSimple prefs_; DISALLOW_COPY_AND_ASSIGN(TestMetricsLog); }; diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc index 3d80b77..303adb0 100644 --- a/chrome/browser/metrics/metrics_service.cc +++ b/chrome/browser/metrics/metrics_service.cc @@ -436,7 +436,7 @@ class MetricsMemoryDetails : public MemoryDetails { }; // static -void MetricsService::RegisterPrefs(PrefService* local_state) { +void MetricsService::RegisterPrefs(PrefServiceSimple* local_state) { DCHECK(IsSingleThreaded()); local_state->RegisterStringPref(prefs::kMetricsClientID, ""); local_state->RegisterIntegerPref(prefs::kMetricsLowEntropySource, diff --git a/chrome/browser/metrics/metrics_service.h b/chrome/browser/metrics/metrics_service.h index d95d331..308fe57 100644 --- a/chrome/browser/metrics/metrics_service.h +++ b/chrome/browser/metrics/metrics_service.h @@ -34,6 +34,7 @@ class BookmarkModel; class BookmarkNode; class MetricsReportingScheduler; class PrefService; +class PrefServiceSimple; class Profile; class TemplateURLService; @@ -123,7 +124,7 @@ class MetricsService // At startup, prefs needs to be called with a list of all the pref names and // types we'll be using. - static void RegisterPrefs(PrefService* local_state); + static void RegisterPrefs(PrefServiceSimple* local_state); // Set up notifications which indicate that a user is performing work. This is // useful to allow some features to sleep, until the machine becomes active, diff --git a/chrome/browser/metrics/variations/variations_service.cc b/chrome/browser/metrics/variations/variations_service.cc index 68ac533..b4e12da 100644 --- a/chrome/browser/metrics/variations/variations_service.cc +++ b/chrome/browser/metrics/variations/variations_service.cc @@ -160,7 +160,7 @@ void VariationsService::StartRepeatedVariationsSeedFetch() { } // static -void VariationsService::RegisterPrefs(PrefService* prefs) { +void VariationsService::RegisterPrefs(PrefServiceSimple* prefs) { prefs->RegisterStringPref(prefs::kVariationsSeed, std::string()); prefs->RegisterInt64Pref(prefs::kVariationsSeedDate, base::Time().ToInternalValue()); diff --git a/chrome/browser/metrics/variations/variations_service.h b/chrome/browser/metrics/variations/variations_service.h index da1f371..5a36387 100644 --- a/chrome/browser/metrics/variations/variations_service.h +++ b/chrome/browser/metrics/variations/variations_service.h @@ -21,6 +21,7 @@ #include "net/url_request/url_fetcher_delegate.h" class PrefService; +class PrefServiceSimple; namespace chrome_variations { @@ -49,7 +50,7 @@ class VariationsService void StartRepeatedVariationsSeedFetch(); // Register Variations related prefs in Local State. - static void RegisterPrefs(PrefService* prefs); + static void RegisterPrefs(PrefServiceSimple* prefs); // Exposed for testing. void SetCreateTrialsFromSeedCalledForTesting(bool called); diff --git a/chrome/browser/metrics/variations/variations_service_unittest.cc b/chrome/browser/metrics/variations/variations_service_unittest.cc index c18c702..2137be0 100644 --- a/chrome/browser/metrics/variations/variations_service_unittest.cc +++ b/chrome/browser/metrics/variations/variations_service_unittest.cc @@ -338,7 +338,7 @@ TEST(VariationsServiceTest, IsStudyExpired) { } TEST(VariationsServiceTest, LoadSeed) { - TestingPrefService pref_service; + TestingPrefServiceSimple pref_service; VariationsService::RegisterPrefs(&pref_service); @@ -378,7 +378,7 @@ TEST(VariationsServiceTest, LoadSeed) { } TEST(VariationsServiceTest, StoreSeed) { - TestingPrefService pref_service; + TestingPrefServiceSimple pref_service; VariationsService::RegisterPrefs(&pref_service); const base::Time now = base::Time::Now(); diff --git a/chrome/browser/net/http_server_properties_manager.cc b/chrome/browser/net/http_server_properties_manager.cc index 167392d..87b4d93 100644 --- a/chrome/browser/net/http_server_properties_manager.cc +++ b/chrome/browser/net/http_server_properties_manager.cc @@ -89,9 +89,10 @@ void HttpServerPropertiesManager::ShutdownOnUIThread() { } // static -void HttpServerPropertiesManager::RegisterPrefs(PrefService* prefs) { +void HttpServerPropertiesManager::RegisterUserPrefs( + PrefServiceSyncable* prefs) { prefs->RegisterDictionaryPref(prefs::kHttpServerProperties, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } // This is required for conformance with the HttpServerProperties interface. diff --git a/chrome/browser/net/http_server_properties_manager.h b/chrome/browser/net/http_server_properties_manager.h index d71813e..c9ede4a 100644 --- a/chrome/browser/net/http_server_properties_manager.h +++ b/chrome/browser/net/http_server_properties_manager.h @@ -20,6 +20,7 @@ #include "net/http/http_server_properties_impl.h" class PrefService; +class PrefServiceSyncable; namespace chrome_browser_net { @@ -63,7 +64,7 @@ class HttpServerPropertiesManager void ShutdownOnUIThread(); // Register |prefs| for properties managed here. - static void RegisterPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); // Deletes all data. Works asynchronously, but if a |completion| callback is // provided, it will be fired on the UI thread when everything is done. diff --git a/chrome/browser/net/http_server_properties_manager_unittest.cc b/chrome/browser/net/http_server_properties_manager_unittest.cc index f06b16a..6495c23 100644 --- a/chrome/browser/net/http_server_properties_manager_unittest.cc +++ b/chrome/browser/net/http_server_properties_manager_unittest.cc @@ -117,7 +117,7 @@ class HttpServerPropertiesManagerTest : public testing::Test { } MessageLoop loop_; - TestingPrefService pref_service_; + TestingPrefServiceSimple pref_service_; scoped_ptr<TestingHttpServerPropertiesManager> http_server_props_manager_; private: diff --git a/chrome/browser/net/net_pref_observer.cc b/chrome/browser/net/net_pref_observer.cc index 7517323..411f657 100644 --- a/chrome/browser/net/net_pref_observer.cc +++ b/chrome/browser/net/net_pref_observer.cc @@ -47,11 +47,11 @@ void NetPrefObserver::ApplySettings() { } // static -void NetPrefObserver::RegisterPrefs(PrefService* prefs) { +void NetPrefObserver::RegisterUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterBooleanPref(prefs::kNetworkPredictionEnabled, true, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kDisableSpdy, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } diff --git a/chrome/browser/net/net_pref_observer.h b/chrome/browser/net/net_pref_observer.h index f7dab1d..69afe8b 100644 --- a/chrome/browser/net/net_pref_observer.h +++ b/chrome/browser/net/net_pref_observer.h @@ -17,6 +17,7 @@ class PrerenderManager; } class PrefService; +class PrefServiceSyncable; // Monitors network-related preferences for changes and applies them. // The supplied PrefService must outlive this NetPrefObserver. @@ -31,7 +32,7 @@ class NetPrefObserver { chrome_browser_net::Predictor* predictor); virtual ~NetPrefObserver(); - static void RegisterPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); private: void ApplySettings(); diff --git a/chrome/browser/net/predictor.cc b/chrome/browser/net/predictor.cc index ff03b79..d513126 100644 --- a/chrome/browser/net/predictor.cc +++ b/chrome/browser/net/predictor.cc @@ -154,11 +154,11 @@ Predictor* Predictor::CreatePredictor(bool preconnect_enabled, return new Predictor(preconnect_enabled); } -void Predictor::RegisterUserPrefs(PrefService* user_prefs) { +void Predictor::RegisterUserPrefs(PrefServiceSyncable* user_prefs) { user_prefs->RegisterListPref(prefs::kDnsPrefetchingStartupList, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); user_prefs->RegisterListPref(prefs::kDnsPrefetchingHostReferralList, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } // --------------------- Start UI methods. ------------------------------------ diff --git a/chrome/browser/net/predictor.h b/chrome/browser/net/predictor.h index 5ed5c21c..66a2ff6 100644 --- a/chrome/browser/net/predictor.h +++ b/chrome/browser/net/predictor.h @@ -48,6 +48,7 @@ class URLRequestContextGetter; class IOThread; class PrefService; +class PrefServiceSyncable; class Profile; namespace chrome_browser_net { @@ -101,7 +102,7 @@ class Predictor { static Predictor* CreatePredictor(bool preconnect_enabled, bool simple_shutdown); - static void RegisterUserPrefs(PrefService* user_prefs); + static void RegisterUserPrefs(PrefServiceSyncable* user_prefs); // ------------- Start UI thread methods. diff --git a/chrome/browser/net/pref_proxy_config_tracker_impl.cc b/chrome/browser/net/pref_proxy_config_tracker_impl.cc index 69f9387..2b7f747 100644 --- a/chrome/browser/net/pref_proxy_config_tracker_impl.cc +++ b/chrome/browser/net/pref_proxy_config_tracker_impl.cc @@ -196,11 +196,19 @@ net::ProxyConfigService::ConfigAvailability } // static -void PrefProxyConfigTrackerImpl::RegisterPrefs(PrefService* pref_service) { +void PrefProxyConfigTrackerImpl::RegisterPrefs( + PrefServiceSimple* local_state) { + DictionaryValue* default_settings = ProxyConfigDictionary::CreateSystem(); + local_state->RegisterDictionaryPref(prefs::kProxy, default_settings); +} + +// static +void PrefProxyConfigTrackerImpl::RegisterUserPrefs( + PrefServiceSyncable* pref_service) { DictionaryValue* default_settings = ProxyConfigDictionary::CreateSystem(); pref_service->RegisterDictionaryPref(prefs::kProxy, default_settings, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } ProxyPrefs::ConfigState PrefProxyConfigTrackerImpl::GetProxyConfig( diff --git a/chrome/browser/net/pref_proxy_config_tracker_impl.h b/chrome/browser/net/pref_proxy_config_tracker_impl.h index 9157f55..d37c01c 100644 --- a/chrome/browser/net/pref_proxy_config_tracker_impl.h +++ b/chrome/browser/net/pref_proxy_config_tracker_impl.h @@ -15,6 +15,8 @@ #include "net/proxy/proxy_config_service.h" class PrefService; +class PrefServiceSimple; +class PrefServiceSyncable; // A net::ProxyConfigService implementation that applies preference proxy // settings (pushed from PrefProxyConfigTrackerImpl) as overrides to the proxy @@ -116,8 +118,10 @@ class PrefProxyConfigTrackerImpl { static bool PrefConfigToNetConfig(const ProxyConfigDictionary& proxy_dict, net::ProxyConfig* config); - // Registers the proxy preference. - static void RegisterPrefs(PrefService* user_prefs); + // Registers the proxy preferences. These are actually registered + // the same way in local state and in user prefs. + static void RegisterPrefs(PrefServiceSimple* local_state); + static void RegisterUserPrefs(PrefServiceSyncable* user_prefs); protected: // Get the proxy configuration currently defined by preferences. diff --git a/chrome/browser/net/pref_proxy_config_tracker_impl_unittest.cc b/chrome/browser/net/pref_proxy_config_tracker_impl_unittest.cc index aaa4a44..e14841c 100644 --- a/chrome/browser/net/pref_proxy_config_tracker_impl_unittest.cc +++ b/chrome/browser/net/pref_proxy_config_tracker_impl_unittest.cc @@ -77,7 +77,7 @@ class PrefProxyConfigTrackerImplTestBase : public TESTBASE { : ui_thread_(BrowserThread::UI, &loop_), io_thread_(BrowserThread::IO, &loop_) {} - virtual void Init(PrefService* pref_service) { + virtual void Init(PrefServiceSimple* pref_service) { ASSERT_TRUE(pref_service); PrefProxyConfigTrackerImpl::RegisterPrefs(pref_service); fixed_config_.set_pac_url(GURL(kFixedPacUrl)); @@ -117,11 +117,11 @@ class PrefProxyConfigTrackerImplTest : public PrefProxyConfigTrackerImplTestBase<testing::Test> { protected: virtual void SetUp() { - pref_service_.reset(new TestingPrefService()); + pref_service_.reset(new TestingPrefServiceSimple()); Init(pref_service_.get()); } - scoped_ptr<TestingPrefService> pref_service_; + scoped_ptr<TestingPrefServiceSimple> pref_service_; }; TEST_F(PrefProxyConfigTrackerImplTest, BaseConfiguration) { @@ -339,13 +339,14 @@ class PrefProxyConfigTrackerImplCommandLineTest command_line_.AppendSwitch(name); } pref_service_.reset( - PrefServiceMockBuilder().WithCommandLine(&command_line_).Create()); + PrefServiceMockBuilder().WithCommandLine( + &command_line_).CreateSimple()); Init(pref_service_.get()); } private: CommandLine command_line_; - scoped_ptr<PrefService> pref_service_; + scoped_ptr<PrefServiceSimple> pref_service_; }; TEST_P(PrefProxyConfigTrackerImplCommandLineTest, CommandLine) { diff --git a/chrome/browser/net/ssl_config_service_manager.h b/chrome/browser/net/ssl_config_service_manager.h index b5c7b2b..570d496 100644 --- a/chrome/browser/net/ssl_config_service_manager.h +++ b/chrome/browser/net/ssl_config_service_manager.h @@ -10,6 +10,7 @@ class SSLConfigService; } // namespace net class PrefService; +class PrefServiceSimple; // An interface for creating SSLConfigService objects. class SSLConfigServiceManager { @@ -22,7 +23,7 @@ class SSLConfigServiceManager { PrefService* local_state, PrefService* user_prefs); - static void RegisterPrefs(PrefService* local_state); + static void RegisterPrefs(PrefServiceSimple* local_state); virtual ~SSLConfigServiceManager() {} diff --git a/chrome/browser/net/ssl_config_service_manager_pref.cc b/chrome/browser/net/ssl_config_service_manager_pref.cc index ff86906..07be26b 100644 --- a/chrome/browser/net/ssl_config_service_manager_pref.cc +++ b/chrome/browser/net/ssl_config_service_manager_pref.cc @@ -149,7 +149,7 @@ class SSLConfigServiceManagerPref virtual ~SSLConfigServiceManagerPref() {} // Register local_state SSL preferences. - static void RegisterPrefs(PrefService* local_state); + static void RegisterPrefs(PrefServiceSimple* local_state); virtual net::SSLConfigService* Get(); @@ -245,7 +245,8 @@ SSLConfigServiceManagerPref::SSLConfigServiceManagerPref( } // static -void SSLConfigServiceManagerPref::RegisterPrefs(PrefService* local_state) { +void SSLConfigServiceManagerPref::RegisterPrefs( + PrefServiceSimple* local_state) { net::SSLConfig default_config; local_state->RegisterBooleanPref(prefs::kCertRevocationCheckingEnabled, default_config.rev_checking_enabled); @@ -352,6 +353,6 @@ SSLConfigServiceManager* SSLConfigServiceManager::CreateDefaultManager( } // static -void SSLConfigServiceManager::RegisterPrefs(PrefService* prefs) { +void SSLConfigServiceManager::RegisterPrefs(PrefServiceSimple* prefs) { SSLConfigServiceManagerPref::RegisterPrefs(prefs); } diff --git a/chrome/browser/net/ssl_config_service_manager_pref_unittest.cc b/chrome/browser/net/ssl_config_service_manager_pref_unittest.cc index ef9b0be..4149637 100644 --- a/chrome/browser/net/ssl_config_service_manager_pref_unittest.cc +++ b/chrome/browser/net/ssl_config_service_manager_pref_unittest.cc @@ -60,7 +60,7 @@ class SSLConfigServiceManagerPrefTest : public testing::Test { // Test channel id with no user prefs. TEST_F(SSLConfigServiceManagerPrefTest, ChannelIDWithoutUserPrefs) { - TestingPrefService local_state; + TestingPrefServiceSimple local_state; SSLConfigServiceManager::RegisterPrefs(&local_state); local_state.SetUserPref(prefs::kEnableOriginBoundCerts, Value::CreateBooleanValue(false)); @@ -86,13 +86,14 @@ TEST_F(SSLConfigServiceManagerPrefTest, ChannelIDWithoutUserPrefs) { // Test channel id with user prefs. TEST_F(SSLConfigServiceManagerPrefTest, ChannelIDWithUserPrefs) { - TestingPrefService local_state; + TestingPrefServiceSimple local_state; SSLConfigServiceManager::RegisterPrefs(&local_state); local_state.SetUserPref(prefs::kEnableOriginBoundCerts, Value::CreateBooleanValue(false)); TestingProfile testing_profile; - TestingPrefService* user_prefs = testing_profile.GetTestingPrefService(); + TestingPrefServiceSyncable* user_prefs = + testing_profile.GetTestingPrefService(); SetCookiePref(&testing_profile, CONTENT_SETTING_BLOCK); user_prefs->SetUserPref(prefs::kBlockThirdPartyCookies, Value::CreateBooleanValue(true)); @@ -150,7 +151,7 @@ TEST_F(SSLConfigServiceManagerPrefTest, ChannelIDWithUserPrefs) { // Test that cipher suites can be disabled. "Good" refers to the fact that // every value is expected to be successfully parsed into a cipher suite. TEST_F(SSLConfigServiceManagerPrefTest, GoodDisabledCipherSuites) { - TestingPrefService local_state; + TestingPrefServiceSimple local_state; SSLConfigServiceManager::RegisterPrefs(&local_state); scoped_ptr<SSLConfigServiceManager> config_manager( @@ -185,7 +186,7 @@ TEST_F(SSLConfigServiceManagerPrefTest, GoodDisabledCipherSuites) { // there are one or more non-cipher suite strings in the preference. They // should be ignored. TEST_F(SSLConfigServiceManagerPrefTest, BadDisabledCipherSuites) { - TestingPrefService local_state; + TestingPrefServiceSimple local_state; SSLConfigServiceManager::RegisterPrefs(&local_state); scoped_ptr<SSLConfigServiceManager> config_manager( @@ -225,7 +226,7 @@ TEST_F(SSLConfigServiceManagerPrefTest, NoCommandLinePrefs) { PrefServiceMockBuilder builder; builder.WithUserPrefs(local_state_store.get()); - scoped_ptr<PrefService> local_state(builder.Create()); + scoped_ptr<PrefServiceSimple> local_state(builder.CreateSimple()); SSLConfigServiceManager::RegisterPrefs(local_state.get()); @@ -268,7 +269,7 @@ TEST_F(SSLConfigServiceManagerPrefTest, CommandLinePrefs) { PrefServiceMockBuilder builder; builder.WithUserPrefs(local_state_store.get()); builder.WithCommandLine(&command_line); - scoped_ptr<PrefService> local_state(builder.Create()); + scoped_ptr<PrefServiceSimple> local_state(builder.CreateSimple()); SSLConfigServiceManager::RegisterPrefs(local_state.get()); diff --git a/chrome/browser/notifications/desktop_notifications_unittest.h b/chrome/browser/notifications/desktop_notifications_unittest.h index b5ddb29..9e4fbe4 100644 --- a/chrome/browser/notifications/desktop_notifications_unittest.h +++ b/chrome/browser/notifications/desktop_notifications_unittest.h @@ -100,7 +100,7 @@ class DesktopNotificationsTest : public testing::Test { content::TestBrowserThread ui_thread_; // Local state mock. - TestingPrefService local_state_; + TestingPrefServiceSimple local_state_; // Test profile. scoped_ptr<TestingProfile> profile_; diff --git a/chrome/browser/notifications/notification_prefs_manager.cc b/chrome/browser/notifications/notification_prefs_manager.cc index 58c005e..01928aa 100644 --- a/chrome/browser/notifications/notification_prefs_manager.cc +++ b/chrome/browser/notifications/notification_prefs_manager.cc @@ -8,7 +8,7 @@ #include "chrome/common/pref_names.h" // static -void NotificationPrefsManager::RegisterPrefs(PrefService* prefs) { +void NotificationPrefsManager::RegisterPrefs(PrefServiceSimple* prefs) { prefs->RegisterIntegerPref(prefs::kDesktopNotificationPosition, BalloonCollection::DEFAULT_POSITION); #if defined(OS_CHROMEOS) diff --git a/chrome/browser/notifications/notification_prefs_manager.h b/chrome/browser/notifications/notification_prefs_manager.h index 922e09f..03856aa 100644 --- a/chrome/browser/notifications/notification_prefs_manager.h +++ b/chrome/browser/notifications/notification_prefs_manager.h @@ -7,7 +7,7 @@ #include "chrome/browser/notifications/balloon_collection.h" -class PrefService; +class PrefServiceSimple; // This interface is used to access and mutate the preferences related to // desktop notifications. @@ -16,7 +16,7 @@ class NotificationPrefsManager { virtual ~NotificationPrefsManager() {} // Registers preferences. - static void RegisterPrefs(PrefService* prefs); + static void RegisterPrefs(PrefServiceSimple* prefs); // Gets the preference indicating where notifications should be placed. virtual BalloonCollection::PositionPreference diff --git a/chrome/browser/password_manager/password_manager.cc b/chrome/browser/password_manager/password_manager.cc index 9b0c2b2..66c90d8 100644 --- a/chrome/browser/password_manager/password_manager.cc +++ b/chrome/browser/password_manager/password_manager.cc @@ -57,13 +57,13 @@ void ReportMetrics(bool password_manager_enabled) { } // anonymous namespace // static -void PasswordManager::RegisterUserPrefs(PrefService* prefs) { +void PasswordManager::RegisterUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterBooleanPref(prefs::kPasswordManagerEnabled, true, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kPasswordManagerAllowShowPasswords, true, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } // static diff --git a/chrome/browser/password_manager/password_manager.h b/chrome/browser/password_manager/password_manager.h index 1e5a9f0..ac0db2d 100644 --- a/chrome/browser/password_manager/password_manager.h +++ b/chrome/browser/password_manager/password_manager.h @@ -21,7 +21,7 @@ class PasswordManagerDelegate; class PasswordManagerTest; class PasswordFormManager; -class PrefService; +class PrefServiceSyncable; // Per-tab password manager. Handles creation and management of UI elements, // receiving password form data from the renderer and managing the password @@ -31,7 +31,7 @@ class PasswordManager : public LoginModel, public content::WebContentsObserver, public content::WebContentsUserData<PasswordManager> { public: - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); static void CreateForWebContentsAndDelegate( content::WebContents* contents, diff --git a/chrome/browser/password_manager/password_manager_unittest.cc b/chrome/browser/password_manager/password_manager_unittest.cc index e297d7c..b8e664a 100644 --- a/chrome/browser/password_manager/password_manager_unittest.cc +++ b/chrome/browser/password_manager/password_manager_unittest.cc @@ -348,7 +348,8 @@ TEST_F(PasswordManagerTest, InitiallyInvisibleForm) { TEST_F(PasswordManagerTest, SavingDependsOnManagerEnabledPreference) { // Test that saving passwords depends on the password manager enabled // preference. - TestingPrefService* prefService = testing_profile_->GetTestingPrefService(); + TestingPrefServiceSyncable* prefService = + testing_profile_->GetTestingPrefService(); prefService->SetUserPref(prefs::kPasswordManagerEnabled, Value::CreateBooleanValue(true)); EXPECT_TRUE(manager()->IsSavingEnabled()); @@ -363,7 +364,8 @@ TEST_F(PasswordManagerTest, FillPasswordsOnDisabledManager) { std::vector<PasswordForm*> result; PasswordForm* existing = new PasswordForm(MakeSimpleForm()); result.push_back(existing); - TestingPrefService* prefService = testing_profile_->GetTestingPrefService(); + TestingPrefServiceSyncable* prefService = + testing_profile_->GetTestingPrefService(); prefService->SetUserPref(prefs::kPasswordManagerEnabled, Value::CreateBooleanValue(false)); EXPECT_CALL(delegate_, FillPasswordForm(_)); diff --git a/chrome/browser/password_manager/password_store_factory.cc b/chrome/browser/password_manager/password_store_factory.cc index 70922f0..d2da9db 100644 --- a/chrome/browser/password_manager/password_store_factory.cc +++ b/chrome/browser/password_manager/password_store_factory.cc @@ -192,12 +192,12 @@ PasswordStoreFactory::BuildServiceInstanceFor(Profile* profile) const { return ps; } -void PasswordStoreFactory::RegisterUserPrefs(PrefService* prefs) { +void PasswordStoreFactory::RegisterUserPrefs(PrefServiceSyncable* prefs) { #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID) \ && defined(OS_POSIX) prefs->RegisterIntegerPref(prefs::kLocalProfileId, kInvalidLocalProfileId, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); // Notice that the preprocessor conditions above are exactly those that will // result in using PasswordStoreX in CreatePasswordStore() below. diff --git a/chrome/browser/password_manager/password_store_factory.h b/chrome/browser/password_manager/password_store_factory.h index cd85063..8eea9ae 100644 --- a/chrome/browser/password_manager/password_store_factory.h +++ b/chrome/browser/password_manager/password_store_factory.h @@ -11,6 +11,7 @@ #include "chrome/browser/profiles/refcounted_profile_keyed_service_factory.h" class PasswordStore; +class PrefServiceSyncable; class Profile; #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX) @@ -44,7 +45,7 @@ class PasswordStoreFactory : public RefcountedProfileKeyedServiceFactory { // ProfileKeyedServiceFactory: virtual scoped_refptr<RefcountedProfileKeyedService> BuildServiceInstanceFor( Profile* profile) const OVERRIDE; - virtual void RegisterUserPrefs(PrefService* prefs) OVERRIDE; + virtual void RegisterUserPrefs(PrefServiceSyncable* prefs) OVERRIDE; virtual bool ServiceRedirectedInIncognito() const OVERRIDE; virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; diff --git a/chrome/browser/password_manager/password_store_x.cc b/chrome/browser/password_manager/password_store_x.cc index eae3161..2e5dc10 100644 --- a/chrome/browser/password_manager/password_store_x.cc +++ b/chrome/browser/password_manager/password_store_x.cc @@ -270,11 +270,11 @@ ssize_t PasswordStoreX::MigrateLogins() { #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX) // static -void PasswordStoreX::RegisterUserPrefs(PrefService* prefs) { +void PasswordStoreX::RegisterUserPrefs(PrefServiceSyncable* prefs) { // Normally we should be on the UI thread here, but in tests we might not. prefs->RegisterBooleanPref(prefs::kPasswordsUseLocalProfileId, false, // default: passwords don't use local ids - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } // static diff --git a/chrome/browser/password_manager/password_store_x.h b/chrome/browser/password_manager/password_store_x.h index ab69ca7..4a25ae9 100644 --- a/chrome/browser/password_manager/password_store_x.h +++ b/chrome/browser/password_manager/password_store_x.h @@ -13,6 +13,7 @@ class LoginDatabase; class PrefService; +class PrefServiceSyncable; class Profile; // PasswordStoreX is used on Linux and other non-Windows, non-Mac OS X @@ -56,7 +57,7 @@ class PasswordStoreX : public PasswordStoreDefault { #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX) // Registers the pref setting used for the methods below. - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); // Returns true if passwords have been tagged with the local profile id. static bool PasswordsUseLocalProfileId(PrefService* prefs); diff --git a/chrome/browser/pepper_flash_settings_manager.cc b/chrome/browser/pepper_flash_settings_manager.cc index 97fa310..3f78afe 100644 --- a/chrome/browser/pepper_flash_settings_manager.cc +++ b/chrome/browser/pepper_flash_settings_manager.cc @@ -927,14 +927,14 @@ bool PepperFlashSettingsManager::IsPepperFlashInUse( } // static -void PepperFlashSettingsManager::RegisterUserPrefs(PrefService* prefs) { +void PepperFlashSettingsManager::RegisterUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterBooleanPref(prefs::kDeauthorizeContentLicenses, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kPepperFlashSettingsEnabled, true, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } uint32 PepperFlashSettingsManager::DeauthorizeContentLicenses() { diff --git a/chrome/browser/pepper_flash_settings_manager.h b/chrome/browser/pepper_flash_settings_manager.h index 3fd242b..4ff992e 100644 --- a/chrome/browser/pepper_flash_settings_manager.h +++ b/chrome/browser/pepper_flash_settings_manager.h @@ -12,7 +12,7 @@ #include "ppapi/shared_impl/ppp_flash_browser_operations_shared.h" class PluginPrefs; -class PrefService; +class PrefServiceSyncable; namespace content { class BrowserContext; @@ -62,7 +62,7 @@ class PepperFlashSettingsManager { static bool IsPepperFlashInUse(PluginPrefs* plugin_prefs, webkit::WebPluginInfo* plugin_info); - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); // Requests to deauthorize content licenses. // Client::OnDeauthorizeContentLicensesCompleted() will be called when the diff --git a/chrome/browser/plugins/plugin_finder.cc b/chrome/browser/plugins/plugin_finder.cc index 43f3dfa..b362c80 100644 --- a/chrome/browser/plugins/plugin_finder.cc +++ b/chrome/browser/plugins/plugin_finder.cc @@ -135,7 +135,7 @@ PluginMetadata* CreatePluginMetadata( } // namespace // static -void PluginFinder::RegisterPrefs(PrefService* local_state) { +void PluginFinder::RegisterPrefs(PrefServiceSimple* local_state) { local_state->RegisterBooleanPref(prefs::kDisablePluginFinder, false); } diff --git a/chrome/browser/plugins/plugin_finder.h b/chrome/browser/plugins/plugin_finder.h index a8a07f6..0b6d1de 100644 --- a/chrome/browser/plugins/plugin_finder.h +++ b/chrome/browser/plugins/plugin_finder.h @@ -22,7 +22,7 @@ class DictionaryValue; class GURL; class PluginMetadata; -class PrefService; +class PrefServiceSimple; #if defined(ENABLE_PLUGIN_INSTALLATION) class PluginInstaller; @@ -33,7 +33,7 @@ class PluginInstaller; // After that it can be safely used on any other thread. class PluginFinder { public: - static void RegisterPrefs(PrefService* local_state); + static void RegisterPrefs(PrefServiceSimple* local_state); static PluginFinder* GetInstance(); diff --git a/chrome/browser/plugins/plugin_prefs_factory.cc b/chrome/browser/plugins/plugin_prefs_factory.cc index 9f29718..e1e3ba9 100644 --- a/chrome/browser/plugins/plugin_prefs_factory.cc +++ b/chrome/browser/plugins/plugin_prefs_factory.cc @@ -47,29 +47,29 @@ PluginPrefsFactory::BuildServiceInstanceFor(Profile* profile) const { return plugin_prefs; } -void PluginPrefsFactory::RegisterUserPrefs(PrefService* prefs) { +void PluginPrefsFactory::RegisterUserPrefs(PrefServiceSyncable* prefs) { FilePath internal_dir; PathService::Get(chrome::DIR_INTERNAL_PLUGINS, &internal_dir); prefs->RegisterFilePathPref(prefs::kPluginsLastInternalDirectory, internal_dir, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kPluginsEnabledInternalPDF, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kPluginsEnabledNaCl, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kPluginsMigratedToPepperFlash, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterListPref(prefs::kPluginsPluginsList, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterListPref(prefs::kPluginsDisabledPlugins, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterListPref(prefs::kPluginsDisabledPluginsExceptions, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterListPref(prefs::kPluginsEnabledPlugins, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } bool PluginPrefsFactory::ServiceRedirectedInIncognito() const { diff --git a/chrome/browser/plugins/plugin_prefs_factory.h b/chrome/browser/plugins/plugin_prefs_factory.h index ae6e080..7c4c251 100644 --- a/chrome/browser/plugins/plugin_prefs_factory.h +++ b/chrome/browser/plugins/plugin_prefs_factory.h @@ -10,7 +10,7 @@ #include "chrome/browser/profiles/refcounted_profile_keyed_service_factory.h" class PluginPrefs; -class PrefService; +class PrefServiceSyncable; class Profile; class ProfileKeyedService; @@ -36,7 +36,7 @@ class PluginPrefsFactory : public RefcountedProfileKeyedServiceFactory { Profile* profile) const OVERRIDE; // ProfileKeyedServiceFactory methods: - virtual void RegisterUserPrefs(PrefService* prefs) OVERRIDE; + virtual void RegisterUserPrefs(PrefServiceSyncable* prefs) OVERRIDE; virtual bool ServiceRedirectedInIncognito() const OVERRIDE; virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; virtual bool ServiceIsCreatedWithProfile() const OVERRIDE; diff --git a/chrome/browser/policy/auto_enrollment_client.cc b/chrome/browser/policy/auto_enrollment_client.cc index ae8affb..fae7665 100644 --- a/chrome/browser/policy/auto_enrollment_client.cc +++ b/chrome/browser/policy/auto_enrollment_client.cc @@ -92,13 +92,9 @@ AutoEnrollmentClient::AutoEnrollmentClient(const base::Closure& callback, AutoEnrollmentClient::~AutoEnrollmentClient() {} // static -void AutoEnrollmentClient::RegisterPrefs(PrefService* local_state) { - local_state->RegisterBooleanPref(prefs::kShouldAutoEnroll, - false, - PrefService::UNSYNCABLE_PREF); - local_state->RegisterIntegerPref(prefs::kAutoEnrollmentPowerLimit, - -1, - PrefService::UNSYNCABLE_PREF); +void AutoEnrollmentClient::RegisterPrefs(PrefServiceSimple* local_state) { + local_state->RegisterBooleanPref(prefs::kShouldAutoEnroll, false); + local_state->RegisterIntegerPref(prefs::kAutoEnrollmentPowerLimit, -1); } // static diff --git a/chrome/browser/policy/auto_enrollment_client.h b/chrome/browser/policy/auto_enrollment_client.h index 9d2e41f..c733139 100644 --- a/chrome/browser/policy/auto_enrollment_client.h +++ b/chrome/browser/policy/auto_enrollment_client.h @@ -16,6 +16,7 @@ #include "third_party/protobuf/src/google/protobuf/repeated_field.h" class PrefService; +class PrefServiceSimple; namespace enterprise_management { class DeviceManagementResponse; @@ -46,7 +47,7 @@ class AutoEnrollmentClient { virtual ~AutoEnrollmentClient(); // Registers preferences in local state. - static void RegisterPrefs(PrefService* local_state); + static void RegisterPrefs(PrefServiceSimple* local_state); // Returns true if auto-enrollment is disabled in this device. In that case, // instances returned by Create() fail immediately once Start() is invoked. diff --git a/chrome/browser/policy/auto_enrollment_client_unittest.cc b/chrome/browser/policy/auto_enrollment_client_unittest.cc index 68e7755..f27aecf 100644 --- a/chrome/browser/policy/auto_enrollment_client_unittest.cc +++ b/chrome/browser/policy/auto_enrollment_client_unittest.cc @@ -114,7 +114,7 @@ class AutoEnrollmentClientTest : public testing::Test { } ScopedTestingLocalState scoped_testing_local_state_; - TestingPrefService* local_state_; + TestingPrefServiceSimple* local_state_; MockDeviceManagementService* service_; scoped_ptr<AutoEnrollmentClient> client_; em::DeviceManagementRequest last_request_; diff --git a/chrome/browser/policy/browser_policy_connector.cc b/chrome/browser/policy/browser_policy_connector.cc index bbb7aa3..93252ef 100644 --- a/chrome/browser/policy/browser_policy_connector.cc +++ b/chrome/browser/policy/browser_policy_connector.cc @@ -25,6 +25,7 @@ #include "chrome/browser/policy/policy_statistics_collector.h" #include "chrome/browser/policy/user_policy_cache.h" #include "chrome/browser/policy/user_policy_token_cache.h" +#include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/signin/token_service.h" #include "chrome/common/chrome_notification_types.h" @@ -702,10 +703,11 @@ void BrowserPolicyConnector::CompleteInitialization() { // TODO: Do not use g_browser_process once policy service is moved to // BrowserPolicyConnector (http://crbug.com/128999). - policy_statistics_collector_.reset(new policy::PolicyStatisticsCollector( - g_browser_process->policy_service(), - g_browser_process->local_state(), - MessageLoop::current()->message_loop_proxy())); + policy_statistics_collector_.reset( + new policy::PolicyStatisticsCollector( + g_browser_process->policy_service(), + g_browser_process->local_state(), + MessageLoop::current()->message_loop_proxy())); policy_statistics_collector_->Initialize(); } diff --git a/chrome/browser/policy/cloud_policy_browsertest.cc b/chrome/browser/policy/cloud_policy_browsertest.cc index ce92a56..50d6c3a 100644 --- a/chrome/browser/policy/cloud_policy_browsertest.cc +++ b/chrome/browser/policy/cloud_policy_browsertest.cc @@ -19,6 +19,7 @@ #include "chrome/browser/policy/policy_service.h" #include "chrome/browser/policy/proto/chrome_settings.pb.h" #include "chrome/browser/policy/proto/cloud_policy.pb.h" +#include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/common/chrome_notification_types.h" diff --git a/chrome/browser/policy/cloud_policy_core_unittest.cc b/chrome/browser/policy/cloud_policy_core_unittest.cc index 0080cbf..08908b7 100644 --- a/chrome/browser/policy/cloud_policy_core_unittest.cc +++ b/chrome/browser/policy/cloud_policy_core_unittest.cc @@ -25,7 +25,7 @@ class CloudPolicyCoreTest : public testing::Test { MessageLoop loop_; - TestingPrefService prefs_; + TestingPrefServiceSimple prefs_; MockCloudPolicyStore store_; CloudPolicyCore core_; diff --git a/chrome/browser/policy/cloud_policy_subsystem.cc b/chrome/browser/policy/cloud_policy_subsystem.cc index 272ac06..bb1689d 100644 --- a/chrome/browser/policy/cloud_policy_subsystem.cc +++ b/chrome/browser/policy/cloud_policy_subsystem.cc @@ -143,13 +143,11 @@ void CloudPolicySubsystem::RefreshPolicies(bool wait_for_auth_token) { } // static -void CloudPolicySubsystem::RegisterPrefs(PrefService* pref_service) { +void CloudPolicySubsystem::RegisterPrefs(PrefServiceSimple* pref_service) { pref_service->RegisterIntegerPref(prefs::kDevicePolicyRefreshRate, - kDefaultPolicyRefreshRateMs, - PrefService::UNSYNCABLE_PREF); + kDefaultPolicyRefreshRateMs); pref_service->RegisterIntegerPref(prefs::kUserPolicyRefreshRate, - kDefaultPolicyRefreshRateMs, - PrefService::UNSYNCABLE_PREF); + kDefaultPolicyRefreshRateMs); } void CloudPolicySubsystem::UpdatePolicyRefreshRate(int64 refresh_rate) { diff --git a/chrome/browser/policy/cloud_policy_subsystem.h b/chrome/browser/policy/cloud_policy_subsystem.h index c42d5c2..93fcec7 100644 --- a/chrome/browser/policy/cloud_policy_subsystem.h +++ b/chrome/browser/policy/cloud_policy_subsystem.h @@ -9,7 +9,7 @@ #include "base/prefs/public/pref_change_registrar.h" #include "net/base/network_change_notifier.h" -class PrefService; +class PrefServiceSimple; namespace policy { @@ -100,7 +100,7 @@ class CloudPolicySubsystem void RefreshPolicies(bool wait_for_auth_token); // Registers cloud policy related prefs. - static void RegisterPrefs(PrefService* pref_service); + static void RegisterPrefs(PrefServiceSimple* pref_service); // Schedule initialization of the policy backend service. void ScheduleServiceInitialization(int64 delay_milliseconds); diff --git a/chrome/browser/policy/cloud_policy_subsystem_unittest.cc b/chrome/browser/policy/cloud_policy_subsystem_unittest.cc index 2fad6eb..12147c9 100644 --- a/chrome/browser/policy/cloud_policy_subsystem_unittest.cc +++ b/chrome/browser/policy/cloud_policy_subsystem_unittest.cc @@ -115,7 +115,7 @@ class CloudPolicySubsystemTestBase : public testing::Test { } virtual void SetUp() { - prefs_.reset(new TestingPrefService); + prefs_.reset(new TestingPrefServiceSimple); CloudPolicySubsystem::RegisterPrefs(prefs_.get()); ((TestingBrowserProcess*) g_browser_process)->SetLocalState(prefs_.get()); @@ -255,7 +255,7 @@ class CloudPolicySubsystemTestBase : public testing::Test { scoped_ptr<EventLogger> logger_; scoped_ptr<CloudPolicyDataStore> data_store_; scoped_ptr<CloudPolicySubsystem> cloud_policy_subsystem_; - scoped_ptr<PrefService> prefs_; + scoped_ptr<PrefServiceSimple> prefs_; CloudPolicyCacheBase* cache_; scoped_ptr<TestingPolicyURLFetcherFactory> factory_; diff --git a/chrome/browser/policy/device_cloud_policy_manager_chromeos_unittest.cc b/chrome/browser/policy/device_cloud_policy_manager_chromeos_unittest.cc index ed6f41c..2fcc17d 100644 --- a/chrome/browser/policy/device_cloud_policy_manager_chromeos_unittest.cc +++ b/chrome/browser/policy/device_cloud_policy_manager_chromeos_unittest.cc @@ -55,7 +55,7 @@ class DeviceCloudPolicyManagerChromeOSTest scoped_ptr<chromeos::CryptohomeLibrary> cryptohome_library_; EnterpriseInstallAttributes install_attributes_; - TestingPrefService local_state_; + TestingPrefServiceSimple local_state_; MockDeviceManagementService device_management_service_; DeviceCloudPolicyStoreChromeOS* store_; diff --git a/chrome/browser/policy/device_status_collector.cc b/chrome/browser/policy/device_status_collector.cc index fd454aa..1917d07 100644 --- a/chrome/browser/policy/device_status_collector.cc +++ b/chrome/browser/policy/device_status_collector.cc @@ -152,7 +152,7 @@ DeviceStatusCollector::~DeviceStatusCollector() { } // static -void DeviceStatusCollector::RegisterPrefs(PrefService* local_state) { +void DeviceStatusCollector::RegisterPrefs(PrefServiceSimple* local_state) { local_state->RegisterDictionaryPref(prefs::kDeviceActivityTimes, new base::DictionaryValue); local_state->RegisterDictionaryPref(prefs::kDeviceLocation, diff --git a/chrome/browser/policy/device_status_collector.h b/chrome/browser/policy/device_status_collector.h index 6731ea2..2b9a094 100644 --- a/chrome/browser/policy/device_status_collector.h +++ b/chrome/browser/policy/device_status_collector.h @@ -37,6 +37,7 @@ class DeviceStatusReportRequest; } class PrefService; +class PrefServiceSimple; namespace policy { @@ -63,7 +64,7 @@ class DeviceStatusCollector : public CloudPolicyClient::StatusProvider, enterprise_management::SessionStatusReportRequest* status) OVERRIDE; virtual void OnSubmittedSuccessfully() OVERRIDE; - static void RegisterPrefs(PrefService* local_state); + static void RegisterPrefs(PrefServiceSimple* local_state); // How often, in seconds, to poll to see if the user is idle. static const unsigned int kIdlePollIntervalSeconds = 30; diff --git a/chrome/browser/policy/device_status_collector_browsertest.cc b/chrome/browser/policy/device_status_collector_browsertest.cc index 1ce63a8..672489a 100644 --- a/chrome/browser/policy/device_status_collector_browsertest.cc +++ b/chrome/browser/policy/device_status_collector_browsertest.cc @@ -231,7 +231,7 @@ class DeviceStatusCollectorTest : public testing::Test { content::TestBrowserThread file_thread_; content::TestBrowserThread io_thread_; - TestingPrefService prefs_; + TestingPrefServiceSimple prefs_; chromeos::system::MockStatisticsProvider statistics_provider_; scoped_ptr<TestingDeviceStatusCollector> status_collector_; em::DeviceStatusReportRequest status_; diff --git a/chrome/browser/policy/policy_prefs_browsertest.cc b/chrome/browser/policy/policy_prefs_browsertest.cc index 5d577f4..b004e51 100644 --- a/chrome/browser/policy/policy_prefs_browsertest.cc +++ b/chrome/browser/policy/policy_prefs_browsertest.cc @@ -430,8 +430,10 @@ IN_PROC_BROWSER_TEST_P(PolicyPrefsTest, PolicyToPrefsMapping) { if (StartsWithASCII((*pref_mapping)->pref(), kCrosSettingsPrefix, true)) continue; + PrefService* local_state = g_browser_process->local_state(); + PrefService* user_prefs = browser()->profile()->GetPrefs(); PrefService* prefs = (*pref_mapping)->is_local_state() ? - g_browser_process->local_state() : browser()->profile()->GetPrefs(); + local_state : user_prefs; // The preference must have been registered. const PrefService::Preference* pref = prefs->FindPreference((*pref_mapping)->pref().c_str()); @@ -520,8 +522,10 @@ IN_PROC_BROWSER_TEST_P(PolicyPrefsTest, CheckPolicyIndicators) { if (!policy_test_case->can_be_recommended()) continue; + PrefService* local_state = g_browser_process->local_state(); + PrefService* user_prefs = browser()->profile()->GetPrefs(); PrefService* prefs = (*pref_mapping)->is_local_state() ? - g_browser_process->local_state() : browser()->profile()->GetPrefs(); + local_state : user_prefs; // The preference must have been registered. const PrefService::Preference* pref = prefs->FindPreference((*pref_mapping)->pref().c_str()); diff --git a/chrome/browser/policy/policy_statistics_collector.cc b/chrome/browser/policy/policy_statistics_collector.cc index 3d01564..472c2dd 100644 --- a/chrome/browser/policy/policy_statistics_collector.cc +++ b/chrome/browser/policy/policy_statistics_collector.cc @@ -49,9 +49,8 @@ void PolicyStatisticsCollector::Initialize() { } // static -void PolicyStatisticsCollector::RegisterPrefs(PrefService* prefs) { - prefs->RegisterInt64Pref(prefs::kLastPolicyStatisticsUpdate, 0, - PrefService::UNSYNCABLE_PREF); +void PolicyStatisticsCollector::RegisterPrefs(PrefServiceSimple* prefs) { + prefs->RegisterInt64Pref(prefs::kLastPolicyStatisticsUpdate, 0); } void PolicyStatisticsCollector::RecordPolicyUse(int id) { diff --git a/chrome/browser/policy/policy_statistics_collector.h b/chrome/browser/policy/policy_statistics_collector.h index d97ce00..961f3d1 100644 --- a/chrome/browser/policy/policy_statistics_collector.h +++ b/chrome/browser/policy/policy_statistics_collector.h @@ -11,6 +11,7 @@ #include "base/time.h" class PrefService; +class PrefServiceSimple; namespace base { class TaskRunner; @@ -36,7 +37,7 @@ class PolicyStatisticsCollector { // Completes initialization and starts periodical statistic updates. void Initialize(); - static void RegisterPrefs(PrefService* prefs); + static void RegisterPrefs(PrefServiceSimple* prefs); protected: // protected virtual for mocking. diff --git a/chrome/browser/policy/policy_statistics_collector_unittest.cc b/chrome/browser/policy/policy_statistics_collector_unittest.cc index c3d627d..70b5176 100644 --- a/chrome/browser/policy/policy_statistics_collector_unittest.cc +++ b/chrome/browser/policy/policy_statistics_collector_unittest.cc @@ -109,7 +109,7 @@ class PolicyStatisticsCollectorTest : public testing::Test { base::TimeDelta last_delay_; - TestingPrefService prefs_; + TestingPrefServiceSimple prefs_; MockPolicyService policy_service_; PolicyMap policy_map_; diff --git a/chrome/browser/policy/url_blacklist_manager.cc b/chrome/browser/policy/url_blacklist_manager.cc index 272e6f1..172d4a3 100644 --- a/chrome/browser/policy/url_blacklist_manager.cc +++ b/chrome/browser/policy/url_blacklist_manager.cc @@ -355,11 +355,11 @@ bool URLBlacklistManager::IsURLBlocked(const GURL& url) const { } // static -void URLBlacklistManager::RegisterPrefs(PrefService* pref_service) { +void URLBlacklistManager::RegisterUserPrefs(PrefServiceSyncable* pref_service) { pref_service->RegisterListPref(prefs::kUrlBlacklist, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); pref_service->RegisterListPref(prefs::kUrlWhitelist, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } } // namespace policy diff --git a/chrome/browser/policy/url_blacklist_manager.h b/chrome/browser/policy/url_blacklist_manager.h index b2f6f83..1398c14 100644 --- a/chrome/browser/policy/url_blacklist_manager.h +++ b/chrome/browser/policy/url_blacklist_manager.h @@ -19,6 +19,7 @@ class GURL; class PrefService; +class PrefServiceSyncable; namespace base { class ListValue; @@ -130,7 +131,7 @@ class URLBlacklistManager { virtual void SetBlacklist(scoped_ptr<URLBlacklist> blacklist); // Registers the preferences related to blacklisting in the given PrefService. - static void RegisterPrefs(PrefService* pref_service); + static void RegisterUserPrefs(PrefServiceSyncable* pref_service); protected: // Used to delay updating the blacklist while the preferences are diff --git a/chrome/browser/policy/url_blacklist_manager_unittest.cc b/chrome/browser/policy/url_blacklist_manager_unittest.cc index 954d309..d800824 100644 --- a/chrome/browser/policy/url_blacklist_manager_unittest.cc +++ b/chrome/browser/policy/url_blacklist_manager_unittest.cc @@ -89,7 +89,7 @@ class URLBlacklistManagerTest : public testing::Test { } MessageLoop loop_; - TestingPrefService pref_service_; + TestingPrefServiceSimple pref_service_; scoped_ptr<TestingURLBlacklistManager> blacklist_manager_; private: diff --git a/chrome/browser/policy/user_cloud_policy_manager_chromeos_unittest.cc b/chrome/browser/policy/user_cloud_policy_manager_chromeos_unittest.cc index 1b1238e..b17fe17 100644 --- a/chrome/browser/policy/user_cloud_policy_manager_chromeos_unittest.cc +++ b/chrome/browser/policy/user_cloud_policy_manager_chromeos_unittest.cc @@ -88,7 +88,7 @@ class UserCloudPolicyManagerChromeOSTest : public testing::Test { PolicyBundle expected_bundle_; // Policy infrastructure. - TestingPrefService prefs_; + TestingPrefServiceSimple prefs_; MockConfigurationPolicyObserver observer_; MockDeviceManagementService device_management_service_; MockCloudPolicyStore* store_; diff --git a/chrome/browser/policy/user_policy_signin_service_factory.cc b/chrome/browser/policy/user_policy_signin_service_factory.cc index 6f939af..70456d7 100644 --- a/chrome/browser/policy/user_policy_signin_service_factory.cc +++ b/chrome/browser/policy/user_policy_signin_service_factory.cc @@ -49,9 +49,9 @@ bool UserPolicySigninServiceFactory::ServiceIsCreatedWithProfile() const { } void UserPolicySigninServiceFactory::RegisterUserPrefs( - PrefService* user_prefs) { + PrefServiceSyncable* user_prefs) { user_prefs->RegisterBooleanPref(prefs::kLoadCloudPolicyOnSignin, - false, PrefService::UNSYNCABLE_PREF); + false, PrefServiceSyncable::UNSYNCABLE_PREF); } } // namespace policy diff --git a/chrome/browser/policy/user_policy_signin_service_factory.h b/chrome/browser/policy/user_policy_signin_service_factory.h index 544ddcc..f935eb1 100644 --- a/chrome/browser/policy/user_policy_signin_service_factory.h +++ b/chrome/browser/policy/user_policy_signin_service_factory.h @@ -8,6 +8,8 @@ #include "base/memory/singleton.h" #include "chrome/browser/profiles/profile_keyed_service_factory.h" +class PrefServiceSyncable; + namespace policy { class UserPolicySigninService; @@ -32,7 +34,7 @@ class UserPolicySigninServiceFactory : public ProfileKeyedServiceFactory { virtual bool ServiceIsCreatedWithProfile() const OVERRIDE; // Register the preferences related to cloud-based user policy. - virtual void RegisterUserPrefs(PrefService* user_prefs) OVERRIDE; + virtual void RegisterUserPrefs(PrefServiceSyncable* user_prefs) OVERRIDE; private: friend struct DefaultSingletonTraits<UserPolicySigninServiceFactory>; diff --git a/chrome/browser/policy/user_policy_signin_service_unittest.cc b/chrome/browser/policy/user_policy_signin_service_unittest.cc index a1eb450..878c2b8 100644 --- a/chrome/browser/policy/user_policy_signin_service_unittest.cc +++ b/chrome/browser/policy/user_policy_signin_service_unittest.cc @@ -75,20 +75,21 @@ class UserPolicySigninServiceTest : public testing::Test { g_browser_process->browser_policy_connector()->Init(); - local_state_.reset(new TestingPrefService); + local_state_.reset(new TestingPrefServiceSimple); chrome::RegisterLocalState(local_state_.get()); static_cast<TestingBrowserProcess*>(g_browser_process)->SetLocalState( local_state_.get()); // Create a testing profile with cloud-policy-on-signin enabled, and bring // up a UserCloudPolicyManager with a MockUserCloudPolicyStore. - scoped_ptr<TestingPrefService> prefs(new TestingPrefService()); + scoped_ptr<TestingPrefServiceSyncable> prefs( + new TestingPrefServiceSyncable()); Profile::RegisterUserPrefs(prefs.get()); chrome::RegisterUserPrefs(prefs.get()); prefs->SetUserPref(prefs::kLoadCloudPolicyOnSignin, Value::CreateBooleanValue(true)); TestingProfile::Builder builder; - builder.SetPrefService(scoped_ptr<PrefService>(prefs.Pass())); + builder.SetPrefService(scoped_ptr<PrefServiceSyncable>(prefs.Pass())); profile_ = builder.Build().Pass(); profile_->CreateRequestContext(); @@ -231,7 +232,7 @@ class UserPolicySigninServiceTest : public testing::Test { // BrowserPolicyConnector). MockDeviceManagementService* device_management_service_; - scoped_ptr<TestingPrefService> local_state_; + scoped_ptr<TestingPrefServiceSimple> local_state_; }; TEST_F(UserPolicySigninServiceTest, InitWhileSignedOut) { diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc index 7247c6a..d4f2629 100644 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc @@ -144,7 +144,7 @@ enum MigratedPreferences { namespace chrome { -void RegisterLocalState(PrefService* local_state) { +void RegisterLocalState(PrefServiceSimple* local_state) { // Prefs in Local State. local_state->RegisterIntegerPref(prefs::kMultipleProfilePrefMigration, 0); @@ -218,7 +218,7 @@ void RegisterLocalState(PrefService* local_state) { #endif } -void RegisterUserPrefs(PrefService* user_prefs) { +void RegisterUserPrefs(PrefServiceSyncable* user_prefs) { // User prefs. Please keep this list alphabetized. AlternateErrorPageTabObserver::RegisterUserPrefs(user_prefs); AutofillManager::RegisterUserPrefs(user_prefs); @@ -227,7 +227,8 @@ void RegisterUserPrefs(PrefService* user_prefs) { BrowserInstantController::RegisterUserPrefs(user_prefs); ChromeContentBrowserClient::RegisterUserPrefs(user_prefs); ChromeVersionService::RegisterUserPrefs(user_prefs); - chrome_browser_net::HttpServerPropertiesManager::RegisterPrefs(user_prefs); + chrome_browser_net::HttpServerPropertiesManager::RegisterUserPrefs( + user_prefs); chrome_browser_net::Predictor::RegisterUserPrefs(user_prefs); DownloadPrefs::RegisterUserPrefs(user_prefs); extensions::ComponentLoader::RegisterUserPrefs(user_prefs); @@ -240,21 +241,21 @@ void RegisterUserPrefs(PrefService* user_prefs) { InstantUI::RegisterUserPrefs(user_prefs); MediaCaptureDevicesDispatcher::RegisterUserPrefs(user_prefs); MediaStreamDevicesController::RegisterUserPrefs(user_prefs); - NetPrefObserver::RegisterPrefs(user_prefs); + NetPrefObserver::RegisterUserPrefs(user_prefs); NewTabUI::RegisterUserPrefs(user_prefs); PasswordManager::RegisterUserPrefs(user_prefs); - PrefProxyConfigTrackerImpl::RegisterPrefs(user_prefs); + PrefProxyConfigTrackerImpl::RegisterUserPrefs(user_prefs); PrefsTabHelper::RegisterUserPrefs(user_prefs); ProfileImpl::RegisterUserPrefs(user_prefs); PromoResourceService::RegisterUserPrefs(user_prefs); - ProtocolHandlerRegistry::RegisterPrefs(user_prefs); + ProtocolHandlerRegistry::RegisterUserPrefs(user_prefs); RegisterBrowserUserPrefs(user_prefs); SessionStartupPref::RegisterUserPrefs(user_prefs); TemplateURLPrepopulateData::RegisterUserPrefs(user_prefs); TranslatePrefs::RegisterUserPrefs(user_prefs); #if defined(ENABLE_CONFIGURATION_POLICY) - policy::URLBlacklistManager::RegisterPrefs(user_prefs); + policy::URLBlacklistManager::RegisterUserPrefs(user_prefs); #endif #if defined(ENABLE_WEB_INTENTS) @@ -287,7 +288,7 @@ void RegisterUserPrefs(PrefService* user_prefs) { PinnedTabCodec::RegisterUserPrefs(user_prefs); PluginsUI::RegisterUserPrefs(user_prefs); printing::StickySettings::RegisterUserPrefs(user_prefs); - RegisterAutolaunchPrefs(user_prefs); + RegisterAutolaunchUserPrefs(user_prefs); SyncPromoUI::RegisterUserPrefs(user_prefs); #endif @@ -297,37 +298,35 @@ void RegisterUserPrefs(PrefService* user_prefs) { #if defined(OS_CHROMEOS) chromeos::Preferences::RegisterUserPrefs(user_prefs); - chromeos::ProxyConfigServiceImpl::RegisterPrefs(user_prefs); + chromeos::ProxyConfigServiceImpl::RegisterUserPrefs(user_prefs); #endif #if defined(OS_WIN) - NetworkProfileBubble::RegisterPrefs(user_prefs); + NetworkProfileBubble::RegisterUserPrefs(user_prefs); #endif } void MigrateUserPrefs(Profile* profile) { // Cleanup old prefs. static const char kBackupPref[] = "backup"; - PrefService* prefs = profile->GetPrefs(); + PrefServiceSyncable* prefs = profile->GetPrefs(); prefs->RegisterDictionaryPref(kBackupPref, new DictionaryValue(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->ClearPref(kBackupPref); prefs->UnregisterPreference(kBackupPref); } -void MigrateBrowserPrefs(Profile* profile, PrefService* local_state) { +void MigrateBrowserPrefs(Profile* profile, PrefServiceSimple* local_state) { // Copy pref values which have been migrated to user_prefs from local_state, // or remove them from local_state outright, if copying is not required. int current_version = local_state->GetInteger(prefs::kMultipleProfilePrefMigration); if (!(current_version & DNS_PREFS)) { - local_state->RegisterListPref(prefs::kDnsStartupPrefetchList, - PrefService::UNSYNCABLE_PREF); + local_state->RegisterListPref(prefs::kDnsStartupPrefetchList); local_state->ClearPref(prefs::kDnsStartupPrefetchList); - local_state->RegisterListPref(prefs::kDnsHostReferralList, - PrefService::UNSYNCABLE_PREF); + local_state->RegisterListPref(prefs::kDnsHostReferralList); local_state->ClearPref(prefs::kDnsHostReferralList); current_version |= DNS_PREFS; @@ -335,11 +334,12 @@ void MigrateBrowserPrefs(Profile* profile, PrefService* local_state) { current_version); } - PrefService* user_prefs = profile->GetPrefs(); + PrefServiceSyncable* user_prefs = profile->GetPrefs(); if (!(current_version & WINDOWS_PREFS)) { local_state->RegisterIntegerPref(prefs::kDevToolsHSplitLocation, -1); if (local_state->HasPrefPath(prefs::kDevToolsHSplitLocation)) { - user_prefs->SetInteger(prefs::kDevToolsHSplitLocation, + user_prefs->SetInteger( + prefs::kDevToolsHSplitLocation, local_state->GetInteger(prefs::kDevToolsHSplitLocation)); } local_state->ClearPref(prefs::kDevToolsHSplitLocation); @@ -349,7 +349,8 @@ void MigrateBrowserPrefs(Profile* profile, PrefService* local_state) { const PrefService::Preference* pref = local_state->FindPreference(prefs::kBrowserWindowPlacement); DCHECK(pref); - user_prefs->Set(prefs::kBrowserWindowPlacement, *(pref->GetValue())); + user_prefs->Set(prefs::kBrowserWindowPlacement, + *(pref->GetValue())); } local_state->ClearPref(prefs::kBrowserWindowPlacement); @@ -364,14 +365,15 @@ void MigrateBrowserPrefs(Profile* profile, PrefService* local_state) { GoogleURLTracker::kDefaultGoogleHomepage); if (local_state->HasPrefPath(prefs::kLastKnownGoogleURL)) { user_prefs->SetString(prefs::kLastKnownGoogleURL, - local_state->GetString(prefs::kLastKnownGoogleURL)); + local_state->GetString(prefs::kLastKnownGoogleURL)); } local_state->ClearPref(prefs::kLastKnownGoogleURL); local_state->RegisterStringPref(prefs::kLastPromptedGoogleURL, std::string()); if (local_state->HasPrefPath(prefs::kLastPromptedGoogleURL)) { - user_prefs->SetString(prefs::kLastPromptedGoogleURL, + user_prefs->SetString( + prefs::kLastPromptedGoogleURL, local_state->GetString(prefs::kLastPromptedGoogleURL)); } local_state->ClearPref(prefs::kLastPromptedGoogleURL); diff --git a/chrome/browser/prefs/browser_prefs.h b/chrome/browser/prefs/browser_prefs.h index 158de13d..296ab3b 100644 --- a/chrome/browser/prefs/browser_prefs.h +++ b/chrome/browser/prefs/browser_prefs.h @@ -6,16 +6,18 @@ #define CHROME_BROWSER_PREFS_BROWSER_PREFS_H_ class PrefService; +class PrefServiceSimple; +class PrefServiceSyncable; class Profile; namespace chrome { // Makes the PrefService objects aware of all the prefs. -void RegisterLocalState(PrefService* local_state); -void RegisterUserPrefs(PrefService* user_prefs); +void RegisterLocalState(PrefServiceSimple* local_state); +void RegisterUserPrefs(PrefServiceSyncable* user_prefs); // Migrates prefs from |local_state| to |profile|'s pref store. -void MigrateBrowserPrefs(Profile* profile, PrefService* local_state); +void MigrateBrowserPrefs(Profile* profile, PrefServiceSimple* local_state); // Migrates prefs in |profile|'s pref store. void MigrateUserPrefs(Profile* profile); diff --git a/chrome/browser/prefs/chrome_pref_service_builder.h b/chrome/browser/prefs/chrome_pref_service_builder.h deleted file mode 100644 index 4726466..0000000 --- a/chrome/browser/prefs/chrome_pref_service_builder.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_PREFS_CHROME_PREF_SERVICE_BUILDER_H_ -#define CHROME_BROWSER_PREFS_CHROME_PREF_SERVICE_BUILDER_H_ - -#include "chrome/browser/prefs/pref_service_builder.h" - -namespace policy { -class PolicyService; -} - -class PrefStore; - -class ChromePrefServiceBuilder : public PrefServiceBuilder { - public: - ChromePrefServiceBuilder(); - virtual ~ChromePrefServiceBuilder(); - - // Factory method that creates a new instance of a PrefService for - // Chrome with the applicable PrefStores. The |pref_filename| points - // to the user preference file. This is the usual way to create a - // new PrefService. - // |extension_pref_store| is used as the source for extension-controlled - // preferences and may be NULL. - // |policy_service| is used as the source for mandatory or recommended - // policies. - // If |async| is true, asynchronous version is used. - // Notifies using PREF_INITIALIZATION_COMPLETED in the end. Details is set to - // the created PrefService or NULL if creation has failed. Note, it is - // guaranteed that in asynchronous version initialization happens after this - // function returned. - PrefService* CreateChromePrefs( - const FilePath& pref_filename, - base::SequencedTaskRunner* pref_io_task_runner, - policy::PolicyService* policy_service, - PrefStore* extension_prefs, - bool async); - - private: - void ResetDefaultState(); - - DISALLOW_COPY_AND_ASSIGN(ChromePrefServiceBuilder); -}; - -#endif // CHROME_BROWSER_PREFS_CHROME_PREF_SERVICE_BUILDER_H_ diff --git a/chrome/browser/prefs/chrome_pref_service_builder.cc b/chrome/browser/prefs/chrome_pref_service_factory.cc index 77fb3de..a074a34 100644 --- a/chrome/browser/prefs/chrome_pref_service_builder.cc +++ b/chrome/browser/prefs/chrome_pref_service_factory.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/chrome_pref_service_builder.h" +#include "chrome/browser/prefs/chrome_pref_service_factory.h" #include "base/bind.h" #include "base/file_path.h" @@ -15,6 +15,7 @@ #include "chrome/browser/prefs/pref_model_associator.h" #include "chrome/browser/prefs/pref_notifier_impl.h" #include "chrome/browser/prefs/pref_service.h" +#include "chrome/browser/prefs/pref_service_syncable_builder.h" #include "chrome/browser/prefs/pref_value_store.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/profile_error_dialog.h" @@ -50,21 +51,8 @@ void HandleReadError(PersistentPrefStore::PrefReadError error) { } } -} // namespace - -// TODO(joi): Find a better home for this. -PrefServiceBase* PrefServiceBase::FromBrowserContext(BrowserContext* context) { - return static_cast<Profile*>(context)->GetPrefs(); -} - -ChromePrefServiceBuilder::ChromePrefServiceBuilder() { - ResetDefaultState(); -} - -ChromePrefServiceBuilder::~ChromePrefServiceBuilder() { -} - -PrefService* ChromePrefServiceBuilder::CreateChromePrefs( +void PrepareBuilder( + PrefServiceSyncableBuilder* builder, const FilePath& pref_filename, base::SequencedTaskRunner* pref_io_task_runner, policy::PolicyService* policy_service, @@ -85,26 +73,61 @@ PrefService* ChromePrefServiceBuilder::CreateChromePrefs( #if defined(ENABLE_CONFIGURATION_POLICY) using policy::ConfigurationPolicyPrefStore; - WithManagedPrefs( + builder->WithManagedPrefs( ConfigurationPolicyPrefStore::CreateMandatoryPolicyPrefStore( policy_service)); - WithRecommendedPrefs( + builder->WithRecommendedPrefs( ConfigurationPolicyPrefStore::CreateRecommendedPolicyPrefStore( policy_service)); #endif // ENABLE_CONFIGURATION_POLICY - WithAsync(async); - WithExtensionPrefs(extension_prefs); - WithCommandLinePrefs( + builder->WithAsync(async); + builder->WithExtensionPrefs(extension_prefs); + builder->WithCommandLinePrefs( new CommandLinePrefStore(CommandLine::ForCurrentProcess())); - WithUserPrefs(new JsonPrefStore(pref_filename, pref_io_task_runner)); + builder->WithReadErrorCallback(base::Bind(&HandleReadError)); + builder->WithUserPrefs(new JsonPrefStore(pref_filename, pref_io_task_runner)); +} - PrefService* pref_service = Create(); - ResetDefaultState(); - return pref_service; +} // namespace + +// TODO(joi): Find a better home for this. +PrefServiceBase* PrefServiceBase::FromBrowserContext(BrowserContext* context) { + return static_cast<Profile*>(context)->GetPrefs(); } -void ChromePrefServiceBuilder::ResetDefaultState() { - WithReadErrorCallback(base::Bind(&HandleReadError)); - WithSyncAssociator(new PrefModelAssociator()); +namespace chrome_prefs { + +PrefServiceSimple* CreateLocalState( + const FilePath& pref_filename, + base::SequencedTaskRunner* pref_io_task_runner, + policy::PolicyService* policy_service, + PrefStore* extension_prefs, + bool async) { + PrefServiceSyncableBuilder builder; + PrepareBuilder(&builder, + pref_filename, + pref_io_task_runner, + policy_service, + extension_prefs, + async); + return builder.CreateSimple(); } + +PrefServiceSyncable* CreateProfilePrefs( + const FilePath& pref_filename, + base::SequencedTaskRunner* pref_io_task_runner, + policy::PolicyService* policy_service, + PrefStore* extension_prefs, + bool async) { + PrefServiceSyncableBuilder builder; + PrepareBuilder(&builder, + pref_filename, + pref_io_task_runner, + policy_service, + extension_prefs, + async); + return builder.CreateSyncable(); +} + +} // namespace chrome_prefs diff --git a/chrome/browser/prefs/chrome_pref_service_factory.h b/chrome/browser/prefs/chrome_pref_service_factory.h new file mode 100644 index 0000000..84e5a63 --- /dev/null +++ b/chrome/browser/prefs/chrome_pref_service_factory.h @@ -0,0 +1,53 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_PREFS_CHROME_PREF_SERVICE_FACTORY_H_ +#define CHROME_BROWSER_PREFS_CHROME_PREF_SERVICE_FACTORY_H_ + +namespace base { +class SequencedTaskRunner; +} + +namespace policy { +class PolicyService; +} + +class FilePath; +class PrefServiceSimple; +class PrefServiceSyncable; +class PrefStore; + +namespace chrome_prefs { + +// Factory methods that create and initialize a new instance of a +// PrefService for Chrome with the applicable PrefStores. The +// |pref_filename| points to the user preference file. This is the +// usual way to create a new PrefService. +// |extension_pref_store| is used as the source for extension-controlled +// preferences and may be NULL. +// |policy_service| is used as the source for mandatory or recommended +// policies. +// If |async| is true, asynchronous version is used. +// Notifies using PREF_INITIALIZATION_COMPLETED in the end. Details is set to +// the created PrefService or NULL if creation has failed. Note, it is +// guaranteed that in asynchronous version initialization happens after this +// function returned. + +PrefServiceSimple* CreateLocalState( + const FilePath& pref_filename, + base::SequencedTaskRunner* pref_io_task_runner, + policy::PolicyService* policy_service, + PrefStore* extension_prefs, + bool async); + +PrefServiceSyncable* CreateProfilePrefs( + const FilePath& pref_filename, + base::SequencedTaskRunner* pref_io_task_runner, + policy::PolicyService* policy_service, + PrefStore* extension_prefs, + bool async); + +} // namespace chrome_prefs + +#endif // CHROME_BROWSER_PREFS_CHROME_PREF_SERVICE_FACTORY_H_ diff --git a/chrome/browser/prefs/incognito_mode_prefs.cc b/chrome/browser/prefs/incognito_mode_prefs.cc index fe498ea..958140b 100644 --- a/chrome/browser/prefs/incognito_mode_prefs.cc +++ b/chrome/browser/prefs/incognito_mode_prefs.cc @@ -52,11 +52,11 @@ void IncognitoModePrefs::SetAvailability(PrefService* prefs, } // static -void IncognitoModePrefs::RegisterUserPrefs(PrefService* pref_service) { +void IncognitoModePrefs::RegisterUserPrefs(PrefServiceSyncable* pref_service) { DCHECK(pref_service); pref_service->RegisterIntegerPref(prefs::kIncognitoModeAvailability, IncognitoModePrefs::ENABLED, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } // static diff --git a/chrome/browser/prefs/incognito_mode_prefs.h b/chrome/browser/prefs/incognito_mode_prefs.h index fb8c54b..dc1afaa 100644 --- a/chrome/browser/prefs/incognito_mode_prefs.h +++ b/chrome/browser/prefs/incognito_mode_prefs.h @@ -9,6 +9,7 @@ class CommandLine; class PrefService; +class PrefServiceSyncable; // Specifies Incognito mode availability preferences. class IncognitoModePrefs { @@ -30,7 +31,7 @@ class IncognitoModePrefs { }; // Register incognito related preferences. - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); // Returns kIncognitoModeAvailability preference value stored // in the given pref service. diff --git a/chrome/browser/prefs/incognito_mode_prefs_unittest.cc b/chrome/browser/prefs/incognito_mode_prefs_unittest.cc index ec945e6..2504dd9 100644 --- a/chrome/browser/prefs/incognito_mode_prefs_unittest.cc +++ b/chrome/browser/prefs/incognito_mode_prefs_unittest.cc @@ -14,7 +14,7 @@ class IncognitoModePrefsTest : public testing::Test { IncognitoModePrefs::RegisterUserPrefs(&prefs_); } - TestingPrefService prefs_; + TestingPrefServiceSyncable prefs_; }; TEST_F(IncognitoModePrefsTest, IntToAvailability) { diff --git a/chrome/browser/prefs/pref_model_associator.cc b/chrome/browser/prefs/pref_model_associator.cc index d994f8a..e767bbf 100644 --- a/chrome/browser/prefs/pref_model_associator.cc +++ b/chrome/browser/prefs/pref_model_associator.cc @@ -11,6 +11,7 @@ #include "base/logging.h" #include "base/utf_string_conversions.h" #include "base/values.h" +#include "chrome/browser/prefs/pref_service.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "sync/api/sync_change.h" @@ -452,7 +453,7 @@ void PrefModelAssociator::ProcessPrefChange(const std::string& name) { sync_processor_->ProcessSyncChanges(FROM_HERE, changes); } -void PrefModelAssociator::SetPrefService(PrefService* pref_service) { +void PrefModelAssociator::SetPrefService(PrefServiceSyncable* pref_service) { DCHECK(pref_service_ == NULL); pref_service_ = pref_service; } diff --git a/chrome/browser/prefs/pref_model_associator.h b/chrome/browser/prefs/pref_model_associator.h index 7229f11..1e3706a 100644 --- a/chrome/browser/prefs/pref_model_associator.h +++ b/chrome/browser/prefs/pref_model_associator.h @@ -12,10 +12,11 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/threading/non_thread_safe.h" -#include "chrome/browser/prefs/pref_service.h" #include "sync/api/sync_data.h" #include "sync/api/syncable_service.h" +class PrefServiceSyncable; + namespace sync_pb { class PreferenceSpecifics; } @@ -72,7 +73,7 @@ class PrefModelAssociator // sent to the syncer. virtual void ProcessPrefChange(const std::string& name); - void SetPrefService(PrefService* pref_service); + void SetPrefService(PrefServiceSyncable* pref_service); // Merges the local_value into the supplied server_value and returns // the result (caller takes ownership). If there is a conflict, the server @@ -143,7 +144,7 @@ class PrefModelAssociator PreferenceSet synced_preferences_; // The PrefService we are syncing to. - PrefService* pref_service_; + PrefServiceSyncable* pref_service_; // Sync's syncer::SyncChange handler. We push all our changes through this. scoped_ptr<syncer::SyncChangeProcessor> sync_processor_; diff --git a/chrome/browser/prefs/pref_notifier_impl_unittest.cc b/chrome/browser/prefs/pref_notifier_impl_unittest.cc index 7570aef..3d3057c 100644 --- a/chrome/browser/prefs/pref_notifier_impl_unittest.cc +++ b/chrome/browser/prefs/pref_notifier_impl_unittest.cc @@ -94,14 +94,12 @@ class PrefNotifierTest : public testing::Test { protected: virtual void SetUp() { pref_service_.RegisterBooleanPref(kChangedPref, - true, - PrefService::UNSYNCABLE_PREF); + true); pref_service_.RegisterBooleanPref(kUnchangedPref, - true, - PrefService::UNSYNCABLE_PREF); + true); } - TestingPrefService pref_service_; + TestingPrefServiceSimple pref_service_; PrefObserverMock obs1_; PrefObserverMock obs2_; diff --git a/chrome/browser/prefs/pref_service.cc b/chrome/browser/prefs/pref_service.cc index 87330dd..61f54f7 100644 --- a/chrome/browser/prefs/pref_service.cc +++ b/chrome/browser/prefs/pref_service.cc @@ -7,75 +7,23 @@ #include <algorithm> #include "base/bind.h" -#include "base/command_line.h" #include "base/file_path.h" #include "base/logging.h" #include "base/message_loop.h" #include "base/metrics/histogram.h" #include "base/prefs/default_pref_store.h" -#include "base/prefs/overlay_user_pref_store.h" #include "base/stl_util.h" #include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/value_conversions.h" #include "build/build_config.h" -#include "chrome/browser/browser_process.h" -#include "chrome/browser/prefs/command_line_pref_store.h" -#include "chrome/browser/prefs/pref_model_associator.h" #include "chrome/browser/prefs/pref_notifier_impl.h" -#include "chrome/browser/prefs/pref_service_observer.h" #include "chrome/browser/prefs/pref_value_store.h" -#include "chrome/browser/ui/prefs/prefs_tab_helper.h" -#include "ui/base/l10n/l10n_util.h" using content::BrowserContext; namespace { -// A helper function for RegisterLocalized*Pref that creates a Value* based on -// the string value in the locale dll. Because we control the values in a -// locale dll, this should always return a Value of the appropriate type. -Value* CreateLocaleDefaultValue(base::Value::Type type, int message_id) { - std::string resource_string = l10n_util::GetStringUTF8(message_id); - DCHECK(!resource_string.empty()); - switch (type) { - case Value::TYPE_BOOLEAN: { - if ("true" == resource_string) - return Value::CreateBooleanValue(true); - if ("false" == resource_string) - return Value::CreateBooleanValue(false); - break; - } - - case Value::TYPE_INTEGER: { - int val; - base::StringToInt(resource_string, &val); - return Value::CreateIntegerValue(val); - } - - case Value::TYPE_DOUBLE: { - double val; - base::StringToDouble(resource_string, &val); - return Value::CreateDoubleValue(val); - } - - case Value::TYPE_STRING: { - return Value::CreateStringValue(resource_string); - } - - default: { - NOTREACHED() << - "list and dictionary types cannot have default locale values"; - } - } - NOTREACHED(); - return Value::CreateNullValue(); -} - -// TODO(joi): Change the interface on PersistentPrefStore to just take -// a callback of this type. Then we can also typedef the callback in -// PersistentPrefStore and use that as the type of the callback used -// to initialize PrefService. class ReadErrorHandler : public PersistentPrefStore::ReadErrorDelegate { public: ReadErrorHandler(base::Callback<void(PersistentPrefStore::PrefReadError)> cb) @@ -91,37 +39,11 @@ class ReadErrorHandler : public PersistentPrefStore::ReadErrorDelegate { } // namespace -PrefService* PrefService::CreateIncognitoPrefService( - PrefStore* incognito_extension_prefs) { - pref_service_forked_ = true; - PrefNotifierImpl* pref_notifier = new PrefNotifierImpl(); - OverlayUserPrefStore* incognito_pref_store = - new OverlayUserPrefStore(user_pref_store_.get()); - PrefsTabHelper::InitIncognitoUserPrefStore(incognito_pref_store); - return new PrefService( - pref_notifier, - pref_value_store_->CloneAndSpecialize( - NULL, // managed - incognito_extension_prefs, - NULL, // command_line_prefs - incognito_pref_store, - NULL, // recommended - default_store_.get(), - NULL, // pref_sync_associator - pref_notifier), - incognito_pref_store, - default_store_.get(), - NULL, - read_error_callback_, - false); -} - PrefService::PrefService( PrefNotifierImpl* pref_notifier, PrefValueStore* pref_value_store, PersistentPrefStore* user_prefs, DefaultPrefStore* default_store, - PrefModelAssociator* pref_sync_associator, base::Callback<void(PersistentPrefStore::PrefReadError)> read_error_callback, bool async) @@ -129,12 +51,8 @@ PrefService::PrefService( pref_value_store_(pref_value_store), user_pref_store_(user_prefs), default_store_(default_store), - pref_sync_associator_(pref_sync_associator), - read_error_callback_(read_error_callback), - pref_service_forked_(false) { + read_error_callback_(read_error_callback) { pref_notifier_->SetPrefService(this); - if (pref_sync_associator_.get()) - pref_sync_associator_->SetPrefService(this); InitFromStorage(async); } @@ -145,7 +63,6 @@ PrefService::~PrefService() { pref_value_store_.reset(); user_pref_store_ = NULL; default_store_ = NULL; - pref_sync_associator_.reset(); pref_notifier_.reset(); } @@ -172,314 +89,6 @@ void PrefService::CommitPendingWrite() { user_pref_store_->CommitPendingWrite(); } -void PrefService::AddObserver(PrefServiceObserver* observer) { - observer_list_.AddObserver(observer); -} - -void PrefService::RemoveObserver(PrefServiceObserver* observer) { - observer_list_.RemoveObserver(observer); -} - -bool PrefService::IsSyncing() { - return pref_sync_associator_.get() && - pref_sync_associator_->models_associated(); -} - -void PrefService::OnIsSyncingChanged() { - FOR_EACH_OBSERVER(PrefServiceObserver, observer_list_, OnIsSyncingChanged()); -} - -namespace { - -// If there's no g_browser_process or no local state, return true (for testing). -bool IsLocalStatePrefService(PrefService* prefs) { - return (!g_browser_process || - !g_browser_process->local_state() || - g_browser_process->local_state() == prefs); -} - -// If there's no g_browser_process, return true (for testing). -bool IsProfilePrefService(PrefService* prefs) { - // TODO(zea): uncomment this once all preferences are only ever registered - // with either the local_state's pref service or the profile's pref service. - // return (!g_browser_process || g_browser_process->local_state() != prefs); - return true; -} - -} // namespace - -// Local State prefs. -void PrefService::RegisterBooleanPref(const char* path, - bool default_value) { - // If this fails, the pref service in use is a profile pref service, so the - // sync status must be provided (see profile pref registration calls below). - DCHECK(IsLocalStatePrefService(this)); - RegisterPreference(path, - Value::CreateBooleanValue(default_value), - UNSYNCABLE_PREF); -} - -void PrefService::RegisterIntegerPref(const char* path, int default_value) { - // If this fails, the pref service in use is a profile pref service, so the - // sync status must be provided (see profile pref registration calls below). - DCHECK(IsLocalStatePrefService(this)); - RegisterPreference(path, - Value::CreateIntegerValue(default_value), - UNSYNCABLE_PREF); -} - -void PrefService::RegisterDoublePref(const char* path, double default_value) { - // If this fails, the pref service in use is a profile pref service, so the - // sync status must be provided (see profile pref registration calls below). - DCHECK(IsLocalStatePrefService(this)); - RegisterPreference(path, - Value::CreateDoubleValue(default_value), - UNSYNCABLE_PREF); -} - -void PrefService::RegisterStringPref(const char* path, - const std::string& default_value) { - // If this fails, the pref service in use is a profile pref service, so the - // sync status must be provided (see profile pref registration calls below). - DCHECK(IsLocalStatePrefService(this)); - RegisterPreference(path, - Value::CreateStringValue(default_value), - UNSYNCABLE_PREF); -} - -void PrefService::RegisterFilePathPref(const char* path, - const FilePath& default_value) { - // If this fails, the pref service in use is a profile pref service, so the - // sync status must be provided (see profile pref registration calls below). - DCHECK(IsLocalStatePrefService(this)); - RegisterPreference(path, - Value::CreateStringValue(default_value.value()), - UNSYNCABLE_PREF); -} - -void PrefService::RegisterListPref(const char* path) { - // If this fails, the pref service in use is a profile pref service, so the - // sync status must be provided (see profile pref registration calls below). - DCHECK(IsLocalStatePrefService(this)); - RegisterPreference(path, - new ListValue(), - UNSYNCABLE_PREF); -} - -void PrefService::RegisterListPref(const char* path, ListValue* default_value) { - // If this fails, the pref service in use is a profile pref service, so the - // sync status must be provided (see profile pref registration calls below). - DCHECK(IsLocalStatePrefService(this)); - RegisterPreference(path, - default_value, - UNSYNCABLE_PREF); -} - -void PrefService::RegisterDictionaryPref(const char* path) { - // If this fails, the pref service in use is a profile pref service, so the - // sync status must be provided (see profile pref registration calls below). - DCHECK(IsLocalStatePrefService(this)); - RegisterPreference(path, - new DictionaryValue(), - UNSYNCABLE_PREF); -} - -void PrefService::RegisterDictionaryPref(const char* path, - DictionaryValue* default_value) { - // If this fails, the pref service in use is a profile pref service, so the - // sync status must be provided (see profile pref registration calls below). - DCHECK(IsLocalStatePrefService(this)); - RegisterPreference(path, - default_value, - UNSYNCABLE_PREF); -} - -void PrefService::RegisterLocalizedBooleanPref(const char* path, - int locale_default_message_id) { - // If this fails, the pref service in use is a profile pref service, so the - // sync status must be provided (see profile pref registration calls below). - DCHECK(IsLocalStatePrefService(this)); - RegisterPreference( - path, - CreateLocaleDefaultValue(Value::TYPE_BOOLEAN, locale_default_message_id), - UNSYNCABLE_PREF); -} - -void PrefService::RegisterLocalizedIntegerPref(const char* path, - int locale_default_message_id) { - // If this fails, the pref service in use is a profile pref service, so the - // sync status must be provided (see profile pref registration calls below). - DCHECK(IsLocalStatePrefService(this)); - RegisterPreference( - path, - CreateLocaleDefaultValue(Value::TYPE_INTEGER, locale_default_message_id), - UNSYNCABLE_PREF); -} - -void PrefService::RegisterLocalizedDoublePref(const char* path, - int locale_default_message_id) { - // If this fails, the pref service in use is a profile pref service, so the - // sync status must be provided (see profile pref registration calls below). - DCHECK(IsLocalStatePrefService(this)); - RegisterPreference( - path, - CreateLocaleDefaultValue(Value::TYPE_DOUBLE, locale_default_message_id), - UNSYNCABLE_PREF); -} - -void PrefService::RegisterLocalizedStringPref(const char* path, - int locale_default_message_id) { - // If this fails, the pref service in use is a profile pref service, so the - // sync status must be provided (see profile pref registration calls below). - DCHECK(IsLocalStatePrefService(this)); - RegisterPreference( - path, - CreateLocaleDefaultValue(Value::TYPE_STRING, locale_default_message_id), - UNSYNCABLE_PREF); -} - -void PrefService::RegisterInt64Pref(const char* path, int64 default_value) { - // If this fails, the pref service in use is a profile pref service, so the - // sync status must be provided (see profile pref registration calls below). - DCHECK(IsLocalStatePrefService(this)); - RegisterPreference( - path, - Value::CreateStringValue(base::Int64ToString(default_value)), - UNSYNCABLE_PREF); -} - -// Profile prefs (must use the sync_status variable). -void PrefService::RegisterBooleanPref(const char* path, - bool default_value, - PrefSyncStatus sync_status) { - DCHECK(IsProfilePrefService(this)); - RegisterPreference(path, - Value::CreateBooleanValue(default_value), - sync_status); -} - -void PrefService::RegisterIntegerPref(const char* path, - int default_value, - PrefSyncStatus sync_status) { - DCHECK(IsProfilePrefService(this)); - RegisterPreference(path, - Value::CreateIntegerValue(default_value), - sync_status); -} - -void PrefService::RegisterDoublePref(const char* path, - double default_value, - PrefSyncStatus sync_status) { - DCHECK(IsProfilePrefService(this)); - RegisterPreference(path, - Value::CreateDoubleValue(default_value), - sync_status); -} - -void PrefService::RegisterStringPref(const char* path, - const std::string& default_value, - PrefSyncStatus sync_status) { - DCHECK(IsProfilePrefService(this)); - RegisterPreference(path, - Value::CreateStringValue(default_value), - sync_status); -} - -void PrefService::RegisterFilePathPref(const char* path, - const FilePath& default_value, - PrefSyncStatus sync_status) { - DCHECK(IsProfilePrefService(this)); - RegisterPreference(path, - Value::CreateStringValue(default_value.value()), - sync_status); -} - -void PrefService::RegisterListPref(const char* path, - PrefSyncStatus sync_status) { - DCHECK(IsProfilePrefService(this)); - RegisterPreference(path, new ListValue(), sync_status); -} - -void PrefService::RegisterListPref(const char* path, - ListValue* default_value, - PrefSyncStatus sync_status) { - DCHECK(IsProfilePrefService(this)); - RegisterPreference(path, default_value, sync_status); -} - -void PrefService::RegisterDictionaryPref(const char* path, - PrefSyncStatus sync_status) { - DCHECK(IsProfilePrefService(this)); - RegisterPreference(path, new DictionaryValue(), sync_status); -} - -void PrefService::RegisterDictionaryPref(const char* path, - DictionaryValue* default_value, - PrefSyncStatus sync_status) { - DCHECK(IsProfilePrefService(this)); - RegisterPreference(path, default_value, sync_status); -} - -void PrefService::RegisterLocalizedBooleanPref(const char* path, - int locale_default_message_id, - PrefSyncStatus sync_status) { - DCHECK(IsProfilePrefService(this)); - RegisterPreference( - path, - CreateLocaleDefaultValue(Value::TYPE_BOOLEAN, locale_default_message_id), - sync_status); -} - -void PrefService::RegisterLocalizedIntegerPref(const char* path, - int locale_default_message_id, - PrefSyncStatus sync_status) { - DCHECK(IsProfilePrefService(this)); - RegisterPreference( - path, - CreateLocaleDefaultValue(Value::TYPE_INTEGER, locale_default_message_id), - sync_status); -} - -void PrefService::RegisterLocalizedDoublePref(const char* path, - int locale_default_message_id, - PrefSyncStatus sync_status) { - DCHECK(IsProfilePrefService(this)); - RegisterPreference( - path, - CreateLocaleDefaultValue(Value::TYPE_DOUBLE, locale_default_message_id), - sync_status); -} - -void PrefService::RegisterLocalizedStringPref(const char* path, - int locale_default_message_id, - PrefSyncStatus sync_status) { - DCHECK(IsProfilePrefService(this)); - RegisterPreference( - path, - CreateLocaleDefaultValue(Value::TYPE_STRING, locale_default_message_id), - sync_status); -} - -void PrefService::RegisterInt64Pref(const char* path, - int64 default_value, - PrefSyncStatus sync_status) { - DCHECK(IsProfilePrefService(this)); - RegisterPreference( - path, - Value::CreateStringValue(base::Int64ToString(default_value)), - sync_status); -} - -void PrefService::RegisterUint64Pref(const char* path, - uint64 default_value, - PrefSyncStatus sync_status) { - DCHECK(IsProfilePrefService(this)); - RegisterPreference( - path, - Value::CreateStringValue(base::Uint64ToString(default_value)), - sync_status); -} - bool PrefService::GetBoolean(const char* path) const { DCHECK(CalledOnValidThread()); @@ -692,8 +301,7 @@ void PrefService::AddPrefInitObserver(base::Callback<void(bool)> obs) { } void PrefService::RegisterPreference(const char* path, - Value* default_value, - PrefSyncStatus sync_status) { + Value* default_value) { DCHECK(CalledOnValidThread()); // The main code path takes ownership, but most don't. We'll be safe. @@ -724,10 +332,6 @@ void PrefService::RegisterPreference(const char* path, // Hand off ownership. default_store_->SetDefaultValue(path, scoped_value.release()); - - // Register with sync if necessary. - if (sync_status == SYNCABLE_PREF && pref_sync_associator_.get()) - pref_sync_associator_->RegisterPref(path); } void PrefService::UnregisterPreference(const char* path) { @@ -739,10 +343,6 @@ void PrefService::UnregisterPreference(const char* path) { prefs_map_.erase(it); default_store_->RemoveDefaultValue(path); - if (pref_sync_associator_.get() && - pref_sync_associator_->IsPrefRegistered(path)) { - pref_sync_associator_->UnregisterPref(path); - } } void PrefService::ClearPref(const char* path) { @@ -877,16 +477,8 @@ void PrefService::SetUserPrefValue(const char* path, Value* new_value) { user_pref_store_->SetValue(path, owned_value.release()); } -syncer::SyncableService* PrefService::GetSyncableService() { - return pref_sync_associator_.get(); -} - -void PrefService::UpdateCommandLinePrefStore(CommandLine* command_line) { - // If |pref_service_forked_| is true, then this PrefService and the forked - // copies will be out of sync. - DCHECK(!pref_service_forked_); - pref_value_store_->UpdateCommandLinePrefStore( - new CommandLinePrefStore(command_line)); +void PrefService::UpdateCommandLinePrefStore(PrefStore* command_line_store) { + pref_value_store_->UpdateCommandLinePrefStore(command_line_store); } /////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/prefs/pref_service.h b/chrome/browser/prefs/pref_service.h index f6c73d6..ff57a72 100644 --- a/chrome/browser/prefs/pref_service.h +++ b/chrome/browser/prefs/pref_service.h @@ -23,24 +23,20 @@ #include "base/prefs/public/pref_service_base.h" #include "base/threading/non_thread_safe.h" -class CommandLine; class DefaultPrefStore; -class PrefModelAssociator; class PrefNotifier; class PrefNotifierImpl; class PrefObserver; -class PrefServiceObserver; class PrefStore; class PrefValueStore; -namespace syncer { -class SyncableService; -} - namespace subtle { class ScopedUserPrefUpdateBase; }; +// Base class for PrefServices. You can use the base class to read and +// interact with preferences, but not to register new preferences; for +// that see subclasses like PrefServiceSimple. class PrefService : public PrefServiceBase, public base::NonThreadSafe { public: enum PrefInitializationStatus { @@ -90,15 +86,18 @@ class PrefService : public PrefServiceBase, public base::NonThreadSafe { // Reference to the PrefService in which this pref was created. const PrefService* pref_service_; - }; - // Creates an incognito copy of the pref service that shares most pref stores - // but uses a fresh non-persistent overlay for the user pref store and an - // individual extension pref store (to cache the effective extension prefs for - // incognito windows). - PrefService* CreateIncognitoPrefService(PrefStore* incognito_extension_prefs); - + // You may wish to use PrefServiceBuilder or one of its subclasses + // for simplified construction. + PrefService( + PrefNotifierImpl* pref_notifier, + PrefValueStore* pref_value_store, + PersistentPrefStore* user_prefs, + DefaultPrefStore* default_store, + base::Callback<void(PersistentPrefStore::PrefReadError)> + read_error_callback, + bool async); virtual ~PrefService(); // Reloads the data from file. This should only be called when the importer @@ -110,94 +109,9 @@ class PrefService : public PrefServiceBase, public base::NonThreadSafe { // immediately (basically, during shutdown). void CommitPendingWrite(); - void AddObserver(PrefServiceObserver* observer); - void RemoveObserver(PrefServiceObserver* observer); - - // Returns true if preferences state has synchronized with the remote - // preferences. If true is returned it can be assumed the local preferences - // has applied changes from the remote preferences. The two may not be - // identical if a change is in flight (from either side). - bool IsSyncing(); - - // Invoked internally when the IsSyncing() state changes. - void OnIsSyncingChanged(); - // PrefServiceBase implementation. virtual bool IsManagedPreference(const char* pref_name) const OVERRIDE; virtual bool IsUserModifiablePreference(const char* pref_name) const OVERRIDE; - virtual void RegisterBooleanPref(const char* path, - bool default_value) OVERRIDE; - virtual void RegisterIntegerPref(const char* path, - int default_value) OVERRIDE; - virtual void RegisterDoublePref(const char* path, - double default_value) OVERRIDE; - virtual void RegisterStringPref(const char* path, - const std::string& default_value) OVERRIDE; - virtual void RegisterFilePathPref(const char* path, - const FilePath& default_value) OVERRIDE; - virtual void RegisterListPref(const char* path) OVERRIDE; - virtual void RegisterDictionaryPref(const char* path) OVERRIDE; - virtual void RegisterListPref(const char* path, - base::ListValue* default_value) OVERRIDE; - virtual void RegisterDictionaryPref( - const char* path, base::DictionaryValue* default_value) OVERRIDE; - virtual void RegisterLocalizedBooleanPref( - const char* path, int locale_default_message_id) OVERRIDE; - virtual void RegisterLocalizedIntegerPref( - const char* path, int locale_default_message_id) OVERRIDE; - virtual void RegisterLocalizedDoublePref( - const char* path, int locale_default_message_id) OVERRIDE; - virtual void RegisterLocalizedStringPref( - const char* path, int locale_default_message_id) OVERRIDE; - virtual void RegisterInt64Pref(const char* path, - int64 default_value) OVERRIDE; - virtual void RegisterBooleanPref(const char* path, - bool default_value, - PrefSyncStatus sync_status) OVERRIDE; - virtual void RegisterIntegerPref(const char* path, - int default_value, - PrefSyncStatus sync_status) OVERRIDE; - virtual void RegisterDoublePref(const char* path, - double default_value, - PrefSyncStatus sync_status) OVERRIDE; - virtual void RegisterStringPref(const char* path, - const std::string& default_value, - PrefSyncStatus sync_status) OVERRIDE; - virtual void RegisterFilePathPref(const char* path, - const FilePath& default_value, - PrefSyncStatus sync_status) OVERRIDE; - virtual void RegisterListPref(const char* path, - PrefSyncStatus sync_status) OVERRIDE; - virtual void RegisterDictionaryPref(const char* path, - PrefSyncStatus sync_status) OVERRIDE; - virtual void RegisterListPref(const char* path, - base::ListValue* default_value, - PrefSyncStatus sync_status) OVERRIDE; - virtual void RegisterDictionaryPref(const char* path, - base::DictionaryValue* default_value, - PrefSyncStatus sync_status) OVERRIDE; - virtual void RegisterLocalizedBooleanPref( - const char* path, - int locale_default_message_id, - PrefSyncStatus sync_status) OVERRIDE; - virtual void RegisterLocalizedIntegerPref( - const char* path, - int locale_default_message_id, - PrefSyncStatus sync_status) OVERRIDE; - virtual void RegisterLocalizedDoublePref( - const char* path, - int locale_default_message_id, - PrefSyncStatus sync_status) OVERRIDE; - virtual void RegisterLocalizedStringPref( - const char* path, - int locale_default_message_id, - PrefSyncStatus sync_status) OVERRIDE; - virtual void RegisterInt64Pref(const char* path, - int64 default_value, - PrefSyncStatus sync_status) OVERRIDE; - virtual void RegisterUint64Pref(const char* path, - uint64 default_value, - PrefSyncStatus sync_status) OVERRIDE; virtual void UnregisterPreference(const char* path) OVERRIDE; virtual const PrefService::Preference* FindPreference( const char* path) const OVERRIDE; @@ -243,13 +157,9 @@ class PrefService : public PrefServiceBase, public base::NonThreadSafe { PrefInitializationStatus GetInitializationStatus() const; - // syncer::SyncableService getter. - // TODO(zea): Have PrefService implement syncer::SyncableService directly. - syncer::SyncableService* GetSyncableService(); - - // Tell our PrefValueStore to update itself using |command_line|. - // Do not call this after having derived an incognito or per tab pref service. - void UpdateCommandLinePrefStore(CommandLine* command_line); + // Tell our PrefValueStore to update itself to |command_line_store|. + // Takes ownership of the store. + virtual void UpdateCommandLinePrefStore(PrefStore* command_line_store); // We run the callback once, when initialization completes. The bool // parameter will be set to true for successful initialization, @@ -257,22 +167,28 @@ class PrefService : public PrefServiceBase, public base::NonThreadSafe { void AddPrefInitObserver(base::Callback<void(bool)> callback); protected: - // Construct a new pref service. This constructor is what - // factory methods end up calling and what is used for unit tests. - PrefService(PrefNotifierImpl* pref_notifier, - PrefValueStore* pref_value_store, - PersistentPrefStore* user_prefs, - DefaultPrefStore* default_store, - PrefModelAssociator* pref_sync_associator, - base::Callback<void(PersistentPrefStore::PrefReadError)> - read_error_callback, - bool async); + // Registers a new preference at |path|. The |default_value| must not be + // NULL as it determines the preference value's type. + // RegisterPreference must not be called twice for the same path. + // This method takes ownership of |default_value|. + void RegisterPreference(const char* path, base::Value* default_value); // The PrefNotifier handles registering and notifying preference observers. // It is created and owned by this PrefService. Subclasses may access it for // unit testing. scoped_ptr<PrefNotifierImpl> pref_notifier_; + // The PrefValueStore provides prioritized preference values. It is owned by + // this PrefService. Subclasses may access it for unit testing. + scoped_ptr<PrefValueStore> pref_value_store_; + + // Pref Stores and profile that we passed to the PrefValueStore. + scoped_refptr<PersistentPrefStore> user_pref_store_; + scoped_refptr<DefaultPrefStore> default_store_; + + // Callback to call when a read error occurs. + base::Callback<void(PersistentPrefStore::PrefReadError)> read_error_callback_; + private: // Hash map expected to be fastest here since it minimises expensive // string comparisons. Order is unimportant, and deletions are rare. @@ -280,6 +196,7 @@ class PrefService : public PrefServiceBase, public base::NonThreadSafe { // vs. std::map, and by roughly 180ms vs. std::set of Preference pointers. typedef base::hash_map<std::string, Preference> PreferenceMap; + // Give access to Initialize(). friend class PrefServiceBuilder; // Give access to ReportUserPrefChanged() and GetMutableUserPref(). @@ -295,14 +212,6 @@ class PrefService : public PrefServiceBase, public base::NonThreadSafe { // a ScopedUserPrefUpdate if a DictionaryValue or ListValue is changed. void ReportUserPrefChanged(const std::string& key); - // Registers a new preference at |path|. The |default_value| must not be - // NULL as it determines the preference value's type. - // RegisterPreference must not be called twice for the same path. - // This method takes ownership of |default_value|. - void RegisterPreference(const char* path, - base::Value* default_value, - PrefSyncStatus sync_status); - // Sets the value for this pref path in the user pref store and informs the // PrefNotifier of the change. void SetUserPrefValue(const char* path, base::Value* new_value); @@ -328,32 +237,18 @@ class PrefService : public PrefServiceBase, public base::NonThreadSafe { // actually get the value.). const base::Value* GetPreferenceValue(const std::string& path) const; - // The PrefValueStore provides prioritized preference values. It is owned by - // this PrefService. Subclasses may access it for unit testing. - scoped_ptr<PrefValueStore> pref_value_store_; - - // Pref Stores and profile that we passed to the PrefValueStore. - scoped_refptr<PersistentPrefStore> user_pref_store_; - scoped_refptr<DefaultPrefStore> default_store_; - // Local cache of registered Preference objects. The default_store_ // is authoritative with respect to what the types and default values // of registered preferences are. mutable PreferenceMap prefs_map_; - // The model associator that maintains the links with the sync db. - scoped_ptr<PrefModelAssociator> pref_sync_associator_; - - // Callback to call when a read error occurs. - base::Callback<void(PersistentPrefStore::PrefReadError)> read_error_callback_; - - // Whether CreateIncognitoPrefService() has been called to create a - // "forked" PrefService. - bool pref_service_forked_; - - ObserverList<PrefServiceObserver> observer_list_; - DISALLOW_COPY_AND_ASSIGN(PrefService); }; +// TODO(joi): Remove these forwards. They were placed here temporarily +// to limit the size of the initial change that split +// PrefServiceSimple and PrefServiceSyncable out of PrefService. +#include "chrome/browser/prefs/pref_service_simple.h" +#include "chrome/browser/prefs/pref_service_syncable.h" + #endif // CHROME_BROWSER_PREFS_PREF_SERVICE_H_ diff --git a/chrome/browser/prefs/pref_service_builder.cc b/chrome/browser/prefs/pref_service_builder.cc index f73f2f1..c1880b1 100644 --- a/chrome/browser/prefs/pref_service_builder.cc +++ b/chrome/browser/prefs/pref_service_builder.cc @@ -9,6 +9,7 @@ #include "base/prefs/json_pref_store.h" #include "chrome/browser/prefs/pref_notifier_impl.h" #include "chrome/browser/prefs/pref_service.h" +#include "chrome/browser/prefs/pref_service_simple.h" #include "chrome/browser/prefs/pref_value_store.h" namespace { @@ -19,8 +20,7 @@ void DoNothingHandleReadError(PersistentPrefStore::PrefReadError error) { } // namespace -PrefServiceBuilder::PrefServiceBuilder() - : sync_associator_(NULL) { +PrefServiceBuilder::PrefServiceBuilder() { ResetDefaultState(); } @@ -53,12 +53,6 @@ PrefServiceBuilder& PrefServiceBuilder::WithRecommendedPrefs(PrefStore* store) { return *this; } -PrefServiceBuilder& PrefServiceBuilder::WithSyncAssociator( - PrefModelAssociator* associator) { - sync_associator_ = associator; - return *this; -} - PrefServiceBuilder& PrefServiceBuilder::WithReadErrorCallback( const base::Callback<void(PersistentPrefStore::PrefReadError)>& read_error_callback) { @@ -78,38 +72,33 @@ PrefServiceBuilder& PrefServiceBuilder::WithAsync(bool async) { return *this; } -PrefService* PrefServiceBuilder::Create() { +PrefServiceSimple* PrefServiceBuilder::CreateSimple() { DefaultPrefStore* default_pref_store = new DefaultPrefStore(); PrefNotifierImpl* pref_notifier = new PrefNotifierImpl(); - PrefService* pref_service = - new PrefService( - pref_notifier, - new PrefValueStore( - managed_prefs_.get(), - extension_prefs_.get(), - command_line_prefs_.get(), - user_prefs_.get(), - recommended_prefs_.get(), - default_pref_store, - sync_associator_, - pref_notifier), + PrefServiceSimple* pref_service = new PrefServiceSimple( + pref_notifier, + new PrefValueStore( + managed_prefs_.get(), + extension_prefs_.get(), + command_line_prefs_.get(), user_prefs_.get(), + recommended_prefs_.get(), default_pref_store, - sync_associator_, - read_error_callback_, - async_); - managed_prefs_ = NULL; - extension_prefs_ = NULL; - command_line_prefs_ = NULL; - user_prefs_ = NULL; - recommended_prefs_ = NULL; - sync_associator_ = NULL; + pref_notifier), + user_prefs_.get(), + default_pref_store, + read_error_callback_, + async_); ResetDefaultState(); - return pref_service; } void PrefServiceBuilder::ResetDefaultState() { + managed_prefs_ = NULL; + extension_prefs_ = NULL; + command_line_prefs_ = NULL; + user_prefs_ = NULL; + recommended_prefs_ = NULL; read_error_callback_ = base::Bind(&DoNothingHandleReadError); async_ = false; } diff --git a/chrome/browser/prefs/pref_service_builder.h b/chrome/browser/prefs/pref_service_builder.h index 3c64d0d..adcbdf0 100644 --- a/chrome/browser/prefs/pref_service_builder.h +++ b/chrome/browser/prefs/pref_service_builder.h @@ -12,14 +12,13 @@ #include "base/prefs/pref_store.h" class FilePath; -class PrefModelAssociator; -class PrefService; +class PrefServiceSimple; namespace base { class SequencedTaskRunner; } -// A class that allows convenient building of custom PrefServices. +// A class that allows convenient building of PrefService. class PrefServiceBuilder { public: PrefServiceBuilder(); @@ -33,9 +32,6 @@ class PrefServiceBuilder { PrefServiceBuilder& WithUserPrefs(PersistentPrefStore* store); PrefServiceBuilder& WithRecommendedPrefs(PrefStore* store); - // Takes ownership of the associator. - PrefServiceBuilder& WithSyncAssociator(PrefModelAssociator* associator); - // Sets up error callback for the PrefService. A do-nothing default // is provided if this is not called. PrefServiceBuilder& WithReadErrorCallback( @@ -49,28 +45,25 @@ class PrefServiceBuilder { PrefServiceBuilder& WithAsync(bool async); - // Creates the PrefService, invalidating the entire builder configuration. - virtual PrefService* Create(); + // Creates a PrefServiceSimple object initialized with the + // parameters from this builder. + virtual PrefServiceSimple* CreateSimple(); protected: + virtual void ResetDefaultState(); + scoped_refptr<PrefStore> managed_prefs_; scoped_refptr<PrefStore> extension_prefs_; scoped_refptr<PrefStore> command_line_prefs_; scoped_refptr<PersistentPrefStore> user_prefs_; scoped_refptr<PrefStore> recommended_prefs_; - // TODO(joi): Would be nice to switch the various places that deal - // with this pointer to using scoped_ptr::Pass semantics. - PrefModelAssociator* sync_associator_; - base::Callback<void(PersistentPrefStore::PrefReadError)> read_error_callback_; // Defaults to false. bool async_; private: - void ResetDefaultState(); - DISALLOW_COPY_AND_ASSIGN(PrefServiceBuilder); }; diff --git a/chrome/browser/prefs/pref_service_mock_builder.cc b/chrome/browser/prefs/pref_service_mock_builder.cc index ce7f447..fb8b721 100644 --- a/chrome/browser/prefs/pref_service_mock_builder.cc +++ b/chrome/browser/prefs/pref_service_mock_builder.cc @@ -4,55 +4,24 @@ #include "chrome/browser/prefs/pref_service_mock_builder.h" -#include "base/bind.h" -#include "base/message_loop_proxy.h" -#include "base/prefs/default_pref_store.h" -#include "base/prefs/json_pref_store.h" #include "base/prefs/testing_pref_store.h" -#include "chrome/browser/policy/configuration_policy_pref_store.h" -#include "chrome/browser/prefs/command_line_pref_store.h" -#include "chrome/browser/prefs/pref_notifier_impl.h" -#include "chrome/browser/prefs/pref_service.h" -#include "chrome/browser/prefs/pref_value_store.h" -#include "content/public/browser/browser_thread.h" -#include "ui/base/l10n/l10n_util.h" - -using content::BrowserThread; PrefServiceMockBuilder::PrefServiceMockBuilder() { - ResetTestingState(); + ResetDefaultState(); } PrefServiceMockBuilder::~PrefServiceMockBuilder() {} -#if defined(ENABLE_CONFIGURATION_POLICY) -PrefServiceMockBuilder& PrefServiceMockBuilder::WithManagedPolicies( - policy::PolicyService* service) { - WithManagedPrefs(new policy::ConfigurationPolicyPrefStore( - service, policy::POLICY_LEVEL_MANDATORY)); - return *this; -} - -PrefServiceMockBuilder& PrefServiceMockBuilder::WithRecommendedPolicies( - policy::PolicyService* service) { - WithRecommendedPrefs(new policy::ConfigurationPolicyPrefStore( - service, policy::POLICY_LEVEL_RECOMMENDED)); - return *this; -} -#endif - -PrefServiceMockBuilder& -PrefServiceMockBuilder::WithCommandLine(CommandLine* command_line) { - WithCommandLinePrefs(new CommandLinePrefStore(command_line)); - return *this; +PrefServiceSimple* PrefServiceMockBuilder::CreateSimple() { + PrefServiceSimple* service = PrefServiceBuilder::CreateSimple(); + return service; } -PrefService* PrefServiceMockBuilder::Create() { - PrefService* pref_service = PrefServiceBuilder::Create(); - ResetTestingState(); - return pref_service; +PrefServiceSyncable* PrefServiceMockBuilder::CreateSyncable() { + PrefServiceSyncable* service = PrefServiceSyncableBuilder::CreateSyncable(); + return service; } -void PrefServiceMockBuilder::ResetTestingState() { +void PrefServiceMockBuilder::ResetDefaultState() { user_prefs_ = new TestingPrefStore; } diff --git a/chrome/browser/prefs/pref_service_mock_builder.h b/chrome/browser/prefs/pref_service_mock_builder.h index 8b8aeab..bfa0076 100644 --- a/chrome/browser/prefs/pref_service_mock_builder.h +++ b/chrome/browser/prefs/pref_service_mock_builder.h @@ -5,47 +5,24 @@ #ifndef CHROME_BROWSER_PREFS_PREF_SERVICE_MOCK_BUILDER_H_ #define CHROME_BROWSER_PREFS_PREF_SERVICE_MOCK_BUILDER_H_ -#include "base/basictypes.h" -#include "base/memory/ref_counted.h" -#include "base/prefs/persistent_pref_store.h" -#include "base/prefs/pref_store.h" -#include "chrome/browser/prefs/pref_service_builder.h" +#include "chrome/browser/prefs/pref_service_syncable_builder.h" -class CommandLine; -class FilePath; -class PrefService; - -namespace base { -class SequencedTaskRunner; -} - -namespace policy { -class PolicyService; -} +class PrefServiceSimple; +class PrefServiceSyncable; // A helper that allows convenient building of custom PrefServices in tests. -class PrefServiceMockBuilder : public PrefServiceBuilder { +class PrefServiceMockBuilder : public PrefServiceSyncableBuilder { public: PrefServiceMockBuilder(); virtual ~PrefServiceMockBuilder(); -#if defined(ENABLE_CONFIGURATION_POLICY) - // Set up policy pref stores using the given policy service. - PrefServiceMockBuilder& WithManagedPolicies( - policy::PolicyService* service); - PrefServiceMockBuilder& WithRecommendedPolicies( - policy::PolicyService* service); -#endif - - // Specifies to use an actual command-line backed command-line pref store. - PrefServiceMockBuilder& WithCommandLine(CommandLine* command_line); - // Creates a PrefService for testing, invalidating the entire // builder configuration. - virtual PrefService* Create() OVERRIDE; + virtual PrefServiceSimple* CreateSimple() OVERRIDE; + virtual PrefServiceSyncable* CreateSyncable() OVERRIDE; private: - void ResetTestingState(); + virtual void ResetDefaultState() OVERRIDE; DISALLOW_COPY_AND_ASSIGN(PrefServiceMockBuilder); }; diff --git a/chrome/browser/prefs/pref_service_simple.cc b/chrome/browser/prefs/pref_service_simple.cc new file mode 100644 index 0000000..b19dfe7 --- /dev/null +++ b/chrome/browser/prefs/pref_service_simple.cc @@ -0,0 +1,76 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/prefs/pref_service.h" + +#include "base/file_path.h" +#include "base/string_number_conversions.h" +#include "base/values.h" + +PrefServiceSimple::PrefServiceSimple( + PrefNotifierImpl* pref_notifier, + PrefValueStore* pref_value_store, + PersistentPrefStore* user_prefs, + DefaultPrefStore* default_store, + base::Callback<void(PersistentPrefStore::PrefReadError)> + read_error_callback, + bool async) + : PrefService(pref_notifier, + pref_value_store, + user_prefs, + default_store, + read_error_callback, + async) { +} + +PrefServiceSimple::~PrefServiceSimple() {} + +void PrefServiceSimple::RegisterBooleanPref(const char* path, + bool default_value) { + RegisterPreference(path, Value::CreateBooleanValue(default_value)); +} + +void PrefServiceSimple::RegisterIntegerPref(const char* path, + int default_value) { + RegisterPreference(path, Value::CreateIntegerValue(default_value)); +} + +void PrefServiceSimple::RegisterDoublePref(const char* path, + double default_value) { + RegisterPreference(path, Value::CreateDoubleValue(default_value)); +} + +void PrefServiceSimple::RegisterStringPref(const char* path, + const std::string& default_value) { + RegisterPreference(path, Value::CreateStringValue(default_value)); +} + +void PrefServiceSimple::RegisterFilePathPref(const char* path, + const FilePath& default_value) { + RegisterPreference(path, Value::CreateStringValue(default_value.value())); +} + +void PrefServiceSimple::RegisterListPref(const char* path) { + RegisterPreference(path, new ListValue()); +} + +void PrefServiceSimple::RegisterListPref(const char* path, + ListValue* default_value) { + RegisterPreference(path, default_value); +} + +void PrefServiceSimple::RegisterDictionaryPref(const char* path) { + RegisterPreference(path, new DictionaryValue()); +} + +void PrefServiceSimple::RegisterDictionaryPref(const char* path, + DictionaryValue* default_value) { + RegisterPreference(path, default_value); +} + +void PrefServiceSimple::RegisterInt64Pref(const char* path, + int64 default_value) { + RegisterPreference( + path, Value::CreateStringValue(base::Int64ToString(default_value))); +} diff --git a/chrome/browser/prefs/pref_service_simple.h b/chrome/browser/prefs/pref_service_simple.h new file mode 100644 index 0000000..c37d7d0 --- /dev/null +++ b/chrome/browser/prefs/pref_service_simple.h @@ -0,0 +1,42 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_PREFS_PREF_SERVICE_SIMPLE_H_ +#define CHROME_BROWSER_PREFS_PREF_SERVICE_SIMPLE_H_ + +#include "chrome/browser/prefs/pref_service.h" + +// A simple PrefService implementation. +class PrefServiceSimple : public PrefService { + public: + // You may wish to use PrefServiceBuilder or one of its subclasses + // for simplified construction. + PrefServiceSimple( + PrefNotifierImpl* pref_notifier, + PrefValueStore* pref_value_store, + PersistentPrefStore* user_prefs, + DefaultPrefStore* default_store, + base::Callback<void(PersistentPrefStore::PrefReadError)> + read_error_callback, + bool async); + virtual ~PrefServiceSimple(); + + void RegisterBooleanPref(const char* path, bool default_value); + void RegisterIntegerPref(const char* path, int default_value); + void RegisterDoublePref(const char* path, double default_value); + void RegisterStringPref(const char* path, const std::string& default_value); + void RegisterFilePathPref(const char* path, const FilePath& default_value); + void RegisterListPref(const char* path); + void RegisterDictionaryPref(const char* path); + void RegisterListPref(const char* path, base::ListValue* default_value); + void RegisterDictionaryPref( + const char* path, base::DictionaryValue* default_value); + void RegisterInt64Pref(const char* path, + int64 default_value); + + private: + DISALLOW_COPY_AND_ASSIGN(PrefServiceSimple); +}; + +#endif // CHROME_BROWSER_PREFS_PREF_SERVICE_SIMPLE_H_ diff --git a/chrome/browser/prefs/pref_service_syncable.cc b/chrome/browser/prefs/pref_service_syncable.cc new file mode 100644 index 0000000..7cf7874 --- /dev/null +++ b/chrome/browser/prefs/pref_service_syncable.cc @@ -0,0 +1,273 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/prefs/pref_service_syncable.h" + +#include "base/bind.h" +#include "base/file_path.h" +#include "base/prefs/default_pref_store.h" +#include "base/prefs/overlay_user_pref_store.h" +#include "base/string_number_conversions.h" +#include "base/value_conversions.h" +#include "chrome/browser/prefs/pref_model_associator.h" +#include "chrome/browser/prefs/pref_notifier_impl.h" +#include "chrome/browser/prefs/pref_service_observer.h" +#include "chrome/browser/prefs/pref_value_store.h" +#include "chrome/browser/ui/prefs/prefs_tab_helper.h" +#include "ui/base/l10n/l10n_util.h" + +namespace { + +// A helper function for RegisterLocalized*Pref that creates a Value* +// based on a localized resource. Because we control the values in a +// locale dll, this should always return a Value of the appropriate +// type. +Value* CreateLocaleDefaultValue(base::Value::Type type, + int message_id) { + const std::string& resource_string = l10n_util::GetStringUTF8(message_id); + DCHECK(!resource_string.empty()); + switch (type) { + case Value::TYPE_BOOLEAN: { + if ("true" == resource_string) + return Value::CreateBooleanValue(true); + if ("false" == resource_string) + return Value::CreateBooleanValue(false); + break; + } + + case Value::TYPE_INTEGER: { + int val; + base::StringToInt(resource_string, &val); + return Value::CreateIntegerValue(val); + } + + case Value::TYPE_DOUBLE: { + double val; + base::StringToDouble(resource_string, &val); + return Value::CreateDoubleValue(val); + } + + case Value::TYPE_STRING: { + return Value::CreateStringValue(resource_string); + } + + default: { + NOTREACHED() << + "list and dictionary types cannot have default locale values"; + } + } + NOTREACHED(); + return Value::CreateNullValue(); +} + +} // namespace + +PrefServiceSyncable::PrefServiceSyncable( + PrefNotifierImpl* pref_notifier, + PrefValueStore* pref_value_store, + PersistentPrefStore* user_prefs, + DefaultPrefStore* default_store, + base::Callback<void(PersistentPrefStore::PrefReadError)> + read_error_callback, + bool async) + : PrefService(pref_notifier, + pref_value_store, + user_prefs, + default_store, + read_error_callback, + async) { + pref_sync_associator_.SetPrefService(this); + pref_value_store->set_sync_associator(&pref_sync_associator_); +} + +PrefServiceSyncable::~PrefServiceSyncable() {} + +PrefServiceSyncable* PrefServiceSyncable::CreateIncognitoPrefService( + PrefStore* incognito_extension_prefs) { + pref_service_forked_ = true; + PrefNotifierImpl* pref_notifier = new PrefNotifierImpl(); + OverlayUserPrefStore* incognito_pref_store = + new OverlayUserPrefStore(user_pref_store_.get()); + PrefsTabHelper::InitIncognitoUserPrefStore(incognito_pref_store); + PrefServiceSyncable* incognito_service = new PrefServiceSyncable( + pref_notifier, + pref_value_store_->CloneAndSpecialize( + NULL, // managed + incognito_extension_prefs, + NULL, // command_line_prefs + incognito_pref_store, + NULL, // recommended + default_store_.get(), + pref_notifier), + incognito_pref_store, + default_store_.get(), + read_error_callback_, + false); + return incognito_service; +} + +bool PrefServiceSyncable::IsSyncing() { + return pref_sync_associator_.models_associated(); +} + +void PrefServiceSyncable::AddObserver(PrefServiceObserver* observer) { + observer_list_.AddObserver(observer); +} + +void PrefServiceSyncable::RemoveObserver(PrefServiceObserver* observer) { + observer_list_.RemoveObserver(observer); +} + +void PrefServiceSyncable::UnregisterPreference(const char* path) { + PrefService::UnregisterPreference(path); + if (pref_sync_associator_.IsPrefRegistered(path)) { + pref_sync_associator_.UnregisterPref(path); + } +} + +void PrefServiceSyncable::RegisterBooleanPref(const char* path, + bool default_value, + PrefSyncStatus sync_status) { + RegisterSyncablePreference(path, + Value::CreateBooleanValue(default_value), + sync_status); +} + +void PrefServiceSyncable::RegisterIntegerPref(const char* path, + int default_value, + PrefSyncStatus sync_status) { + RegisterSyncablePreference(path, + Value::CreateIntegerValue(default_value), + sync_status); +} + +void PrefServiceSyncable::RegisterDoublePref(const char* path, + double default_value, + PrefSyncStatus sync_status) { + RegisterSyncablePreference(path, + Value::CreateDoubleValue(default_value), + sync_status); +} + +void PrefServiceSyncable::RegisterStringPref(const char* path, + const std::string& default_value, + PrefSyncStatus sync_status) { + RegisterSyncablePreference(path, + Value::CreateStringValue(default_value), + sync_status); +} + +void PrefServiceSyncable::RegisterFilePathPref(const char* path, + const FilePath& default_value, + PrefSyncStatus sync_status) { + RegisterSyncablePreference(path, + Value::CreateStringValue(default_value.value()), + sync_status); +} + +void PrefServiceSyncable::RegisterListPref(const char* path, + PrefSyncStatus sync_status) { + RegisterSyncablePreference(path, new ListValue(), sync_status); +} + +void PrefServiceSyncable::RegisterListPref(const char* path, + ListValue* default_value, + PrefSyncStatus sync_status) { + RegisterSyncablePreference(path, default_value, sync_status); +} + +void PrefServiceSyncable::RegisterDictionaryPref(const char* path, + PrefSyncStatus sync_status) { + RegisterSyncablePreference(path, new DictionaryValue(), sync_status); +} + +void PrefServiceSyncable::RegisterDictionaryPref(const char* path, + DictionaryValue* default_value, + PrefSyncStatus sync_status) { + RegisterSyncablePreference(path, default_value, sync_status); +} + +void PrefServiceSyncable::RegisterLocalizedBooleanPref( + const char* path, + int locale_default_message_id, + PrefSyncStatus sync_status) { + RegisterSyncablePreference( + path, + CreateLocaleDefaultValue(Value::TYPE_BOOLEAN, locale_default_message_id), + sync_status); +} + +void PrefServiceSyncable::RegisterLocalizedIntegerPref( + const char* path, + int locale_default_message_id, + PrefSyncStatus sync_status) { + RegisterSyncablePreference( + path, + CreateLocaleDefaultValue(Value::TYPE_INTEGER, locale_default_message_id), + sync_status); +} + +void PrefServiceSyncable::RegisterLocalizedDoublePref( + const char* path, + int locale_default_message_id, + PrefSyncStatus sync_status) { + RegisterSyncablePreference( + path, + CreateLocaleDefaultValue(Value::TYPE_DOUBLE, locale_default_message_id), + sync_status); +} + +void PrefServiceSyncable::RegisterLocalizedStringPref( + const char* path, + int locale_default_message_id, + PrefSyncStatus sync_status) { + RegisterSyncablePreference( + path, + CreateLocaleDefaultValue(Value::TYPE_STRING, locale_default_message_id), + sync_status); +} + +void PrefServiceSyncable::RegisterInt64Pref( + const char* path, + int64 default_value, + PrefSyncStatus sync_status) { + RegisterSyncablePreference( + path, + Value::CreateStringValue(base::Int64ToString(default_value)), + sync_status); +} + +void PrefServiceSyncable::RegisterUint64Pref( + const char* path, + uint64 default_value, + PrefSyncStatus sync_status) { + RegisterSyncablePreference( + path, + Value::CreateStringValue(base::Uint64ToString(default_value)), + sync_status); +} + +syncer::SyncableService* PrefServiceSyncable::GetSyncableService() { + return &pref_sync_associator_; +} + +void PrefServiceSyncable::UpdateCommandLinePrefStore( + PrefStore* cmd_line_store) { + // If |pref_service_forked_| is true, then this PrefService and the forked + // copies will be out of sync. + DCHECK(!pref_service_forked_); + PrefService::UpdateCommandLinePrefStore(cmd_line_store); +} + +void PrefServiceSyncable::OnIsSyncingChanged() { + FOR_EACH_OBSERVER(PrefServiceObserver, observer_list_, OnIsSyncingChanged()); +} + +void PrefServiceSyncable::RegisterSyncablePreference( + const char* path, Value* default_value, PrefSyncStatus sync_status) { + PrefService::RegisterPreference(path, default_value); + // Register with sync if necessary. + if (sync_status == SYNCABLE_PREF) + pref_sync_associator_.RegisterPref(path); +} diff --git a/chrome/browser/prefs/pref_service_syncable.h b/chrome/browser/prefs/pref_service_syncable.h new file mode 100644 index 0000000..0360772 --- /dev/null +++ b/chrome/browser/prefs/pref_service_syncable.h @@ -0,0 +1,136 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_PREFS_PREF_SERVICE_SYNCABLE_H_ +#define CHROME_BROWSER_PREFS_PREF_SERVICE_SYNCABLE_H_ + +#include "chrome/browser/prefs/pref_model_associator.h" +#include "chrome/browser/prefs/pref_service.h" + +// TODO(joi) Move to c/b/prefs and rename PrefServiceSyncableObserver. +class PrefServiceObserver; + +namespace syncer { +class SyncableService; +} + +// A PrefService that can be synced. Users are forced to declare +// whether preferences are syncable or not when registering them to +// this PrefService. +class PrefServiceSyncable : public PrefService { + public: + // Enum used when registering preferences to determine if it should be synced + // or not. This is only used for profile prefs, not local state prefs. + // See the Register*Pref methods for profile prefs below. + enum PrefSyncStatus { + UNSYNCABLE_PREF, + SYNCABLE_PREF + }; + + // You may wish to use PrefServiceBuilder or one of its subclasses + // for simplified construction. + PrefServiceSyncable( + PrefNotifierImpl* pref_notifier, + PrefValueStore* pref_value_store, + PersistentPrefStore* user_prefs, + DefaultPrefStore* default_store, + base::Callback<void(PersistentPrefStore::PrefReadError)> + read_error_callback, + bool async); + virtual ~PrefServiceSyncable(); + + // Creates an incognito copy of the pref service that shares most pref stores + // but uses a fresh non-persistent overlay for the user pref store and an + // individual extension pref store (to cache the effective extension prefs for + // incognito windows). + PrefServiceSyncable* CreateIncognitoPrefService( + PrefStore* incognito_extension_prefs); + + // Returns true if preferences state has synchronized with the remote + // preferences. If true is returned it can be assumed the local preferences + // has applied changes from the remote preferences. The two may not be + // identical if a change is in flight (from either side). + bool IsSyncing(); + + void AddObserver(PrefServiceObserver* observer); + void RemoveObserver(PrefServiceObserver* observer); + + virtual void UnregisterPreference(const char* path) OVERRIDE; + + void RegisterBooleanPref(const char* path, + bool default_value, + PrefSyncStatus sync_status); + void RegisterIntegerPref(const char* path, + int default_value, + PrefSyncStatus sync_status); + void RegisterDoublePref(const char* path, + double default_value, + PrefSyncStatus sync_status); + void RegisterStringPref(const char* path, + const std::string& default_value, + PrefSyncStatus sync_status); + void RegisterFilePathPref(const char* path, + const FilePath& default_value, + PrefSyncStatus sync_status); + void RegisterListPref(const char* path, + PrefSyncStatus sync_status); + void RegisterDictionaryPref(const char* path, + PrefSyncStatus sync_status); + void RegisterListPref(const char* path, + base::ListValue* default_value, + PrefSyncStatus sync_status); + void RegisterDictionaryPref(const char* path, + base::DictionaryValue* default_value, + PrefSyncStatus sync_status); + void RegisterLocalizedBooleanPref(const char* path, + int locale_default_message_id, + PrefSyncStatus sync_status); + void RegisterLocalizedIntegerPref(const char* path, + int locale_default_message_id, + PrefSyncStatus sync_status); + void RegisterLocalizedDoublePref(const char* path, + int locale_default_message_id, + PrefSyncStatus sync_status); + void RegisterLocalizedStringPref(const char* path, + int locale_default_message_id, + PrefSyncStatus sync_status); + void RegisterInt64Pref(const char* path, + int64 default_value, + PrefSyncStatus sync_status); + void RegisterUint64Pref(const char* path, + uint64 default_value, + PrefSyncStatus sync_status); + + // TODO(zea): Have PrefServiceSyncable implement + // syncer::SyncableService directly. + syncer::SyncableService* GetSyncableService(); + + // Do not call this after having derived an incognito or per tab pref service. + virtual void UpdateCommandLinePrefStore(PrefStore* cmd_line_store) OVERRIDE; + + private: + friend class PrefModelAssociator; + + // Invoked internally when the IsSyncing() state changes. + void OnIsSyncingChanged(); + + // Registers a preference at |path| with |default_value|. If the + // preference is syncable per |sync_status|, also registers it with + // PrefModelAssociator. + void RegisterSyncablePreference(const char* path, + Value* default_value, + PrefSyncStatus sync_status); + + // Whether CreateIncognitoPrefService() has been called to create a + // "forked" PrefService. + bool pref_service_forked_; + + PrefModelAssociator pref_sync_associator_; + + ObserverList<PrefServiceObserver> observer_list_; + + DISALLOW_COPY_AND_ASSIGN(PrefServiceSyncable); +}; + +#endif // CHROME_BROWSER_PREFS_PREF_SERVICE_SYNCABLE_H_ diff --git a/chrome/browser/prefs/pref_service_syncable_builder.cc b/chrome/browser/prefs/pref_service_syncable_builder.cc new file mode 100644 index 0000000..4c13277 --- /dev/null +++ b/chrome/browser/prefs/pref_service_syncable_builder.cc @@ -0,0 +1,62 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/prefs/pref_service_syncable_builder.h" + +#include "base/prefs/default_pref_store.h" +#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_notifier_impl.h" +#include "chrome/browser/prefs/pref_service_syncable.h" +#include "chrome/browser/prefs/pref_value_store.h" + +PrefServiceSyncableBuilder::PrefServiceSyncableBuilder() { +} + +PrefServiceSyncableBuilder::~PrefServiceSyncableBuilder() { +} + +#if defined(ENABLE_CONFIGURATION_POLICY) +PrefServiceSyncableBuilder& PrefServiceSyncableBuilder::WithManagedPolicies( + policy::PolicyService* service) { + WithManagedPrefs(new policy::ConfigurationPolicyPrefStore( + service, policy::POLICY_LEVEL_MANDATORY)); + return *this; +} + +PrefServiceSyncableBuilder& PrefServiceSyncableBuilder::WithRecommendedPolicies( + policy::PolicyService* service) { + WithRecommendedPrefs(new policy::ConfigurationPolicyPrefStore( + service, policy::POLICY_LEVEL_RECOMMENDED)); + return *this; +} +#endif + +PrefServiceSyncableBuilder& +PrefServiceSyncableBuilder::WithCommandLine(CommandLine* command_line) { + WithCommandLinePrefs(new CommandLinePrefStore(command_line)); + return *this; +} + +PrefServiceSyncable* PrefServiceSyncableBuilder::CreateSyncable() { + DefaultPrefStore* default_pref_store = new DefaultPrefStore(); + PrefNotifierImpl* pref_notifier = new PrefNotifierImpl(); + PrefServiceSyncable* pref_service = new PrefServiceSyncable( + pref_notifier, + new PrefValueStore( + managed_prefs_.get(), + extension_prefs_.get(), + command_line_prefs_.get(), + user_prefs_.get(), + recommended_prefs_.get(), + default_pref_store, + pref_notifier), + user_prefs_.get(), + default_pref_store, + read_error_callback_, + async_); + ResetDefaultState(); + return pref_service; +} diff --git a/chrome/browser/prefs/pref_service_syncable_builder.h b/chrome/browser/prefs/pref_service_syncable_builder.h new file mode 100644 index 0000000..1dfb9ac --- /dev/null +++ b/chrome/browser/prefs/pref_service_syncable_builder.h @@ -0,0 +1,42 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_PREFS_PREF_SERVICE_SYNCABLE_BUILDER_H_ +#define CHROME_BROWSER_PREFS_PREF_SERVICE_SYNCABLE_BUILDER_H_ + +#include "chrome/browser/prefs/pref_service_builder.h" + +class CommandLine; +class PrefServiceSyncable; + +namespace policy { +class PolicyService; +} + +// A PrefServiceBuilder that also knows how to build a +// PrefServiceSyncable, and may know about Chrome concepts such as +// PolicyService. +class PrefServiceSyncableBuilder : public PrefServiceBuilder { + public: + PrefServiceSyncableBuilder(); + virtual ~PrefServiceSyncableBuilder(); + +#if defined(ENABLE_CONFIGURATION_POLICY) + // Set up policy pref stores using the given policy service. + PrefServiceSyncableBuilder& WithManagedPolicies( + policy::PolicyService* service); + PrefServiceSyncableBuilder& WithRecommendedPolicies( + policy::PolicyService* service); +#endif + + // Specifies to use an actual command-line backed command-line pref store. + PrefServiceSyncableBuilder& WithCommandLine(CommandLine* command_line); + + virtual PrefServiceSyncable* CreateSyncable(); + + private: + DISALLOW_COPY_AND_ASSIGN(PrefServiceSyncableBuilder); +}; + +#endif // CHROME_BROWSER_PREFS_PREF_SERVICE_SYNCABLE_BUILDER_H_ diff --git a/chrome/browser/prefs/pref_service_unittest.cc b/chrome/browser/prefs/pref_service_unittest.cc index e5607c1..27dfa7d 100644 --- a/chrome/browser/prefs/pref_service_unittest.cc +++ b/chrome/browser/prefs/pref_service_unittest.cc @@ -41,7 +41,7 @@ using testing::_; using testing::Mock; TEST(PrefServiceTest, NoObserverFire) { - TestingPrefService prefs; + TestingPrefServiceSimple prefs; const char pref_name[] = "homepage"; prefs.RegisterStringPref(pref_name, std::string()); @@ -77,7 +77,7 @@ TEST(PrefServiceTest, NoObserverFire) { } TEST(PrefServiceTest, HasPrefPath) { - TestingPrefService prefs; + TestingPrefServiceSimple prefs; const char path[] = "fake.path"; @@ -97,7 +97,7 @@ TEST(PrefServiceTest, HasPrefPath) { TEST(PrefServiceTest, Observers) { const char pref_name[] = "homepage"; - TestingPrefService prefs; + TestingPrefServiceSimple prefs; prefs.SetUserPref(pref_name, Value::CreateStringValue("http://www.cnn.com")); prefs.RegisterStringPref(pref_name, std::string()); @@ -152,7 +152,7 @@ TEST(PrefServiceTest, Observers) { // the user pref file, it uses the correct fallback value instead. TEST(PrefServiceTest, GetValueChangedType) { const int kTestValue = 10; - TestingPrefService prefs; + TestingPrefServiceSimple prefs; prefs.RegisterIntegerPref(prefs::kStabilityLaunchCount, kTestValue); // Check falling back to a recommended value. @@ -170,7 +170,7 @@ TEST(PrefServiceTest, GetValueChangedType) { } TEST(PrefServiceTest, UpdateCommandLinePrefStore) { - TestingPrefService prefs; + TestingPrefServiceSimple prefs; prefs.RegisterBooleanPref(prefs::kCloudPrintProxyEnabled, false); // Check to make sure the value is as expected. @@ -189,7 +189,7 @@ TEST(PrefServiceTest, UpdateCommandLinePrefStore) { cmd_line.AppendSwitch(switches::kEnableCloudPrintProxy); // Call UpdateCommandLinePrefStore and check to see if the value has changed. - prefs.UpdateCommandLinePrefStore(&cmd_line); + prefs.UpdateCommandLinePrefStore(new CommandLinePrefStore(&cmd_line)); pref = prefs.FindPreference(prefs::kCloudPrintProxyEnabled); ASSERT_TRUE(pref); value = pref->GetValue(); @@ -204,7 +204,7 @@ TEST(PrefServiceTest, GetValueAndGetRecommendedValue) { const int kDefaultValue = 5; const int kUserValue = 10; const int kRecommendedValue = 15; - TestingPrefService prefs; + TestingPrefServiceSimple prefs; prefs.RegisterIntegerPref(prefs::kStabilityLaunchCount, kDefaultValue); // Create pref with a default value only. @@ -319,25 +319,25 @@ TEST_F(PrefServiceUserFilePrefsTest, PreserveEmptyValue) { PrefServiceMockBuilder builder; builder.WithUserFilePrefs(pref_file, message_loop_.message_loop_proxy()); - scoped_ptr<PrefService> prefs(builder.Create()); + scoped_ptr<PrefServiceSyncable> prefs(builder.CreateSyncable()); // Register testing prefs. prefs->RegisterListPref("list", - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDictionaryPref("dict", - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); base::ListValue* non_empty_list = new base::ListValue; non_empty_list->Append(base::Value::CreateStringValue("test")); prefs->RegisterListPref("list_needs_empty_value", non_empty_list, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); base::DictionaryValue* non_empty_dict = new base::DictionaryValue; non_empty_dict->SetString("dummy", "whatever"); prefs->RegisterDictionaryPref("dict_needs_empty_value", non_empty_dict, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); // Set all testing prefs to empty. ClearListValue(prefs.get(), "list"); @@ -363,7 +363,7 @@ class PrefServiceSetValueTest : public testing::Test { PrefServiceSetValueTest() : observer_(&prefs_) {} - TestingPrefService prefs_; + TestingPrefServiceSimple prefs_; MockPrefChangeCallback observer_; }; @@ -458,7 +458,8 @@ class PrefServiceWebKitPrefs : public ChromeRenderViewHostTestHarness { // harness is not supposed to overwrite a profile if it's already created. // Set some (WebKit) user preferences. - TestingPrefService* pref_services = profile()->GetTestingPrefService(); + TestingPrefServiceSyncable* pref_services = + profile()->GetTestingPrefService(); #if defined(TOOLKIT_GTK) pref_services->SetUserPref(prefs::kUsesSystemTheme, Value::CreateBooleanValue(false)); diff --git a/chrome/browser/prefs/pref_value_store.cc b/chrome/browser/prefs/pref_value_store.cc index 7797077..82ee811 100644 --- a/chrome/browser/prefs/pref_value_store.cc +++ b/chrome/browser/prefs/pref_value_store.cc @@ -52,9 +52,8 @@ PrefValueStore::PrefValueStore(PrefStore* managed_prefs, PrefStore* user_prefs, PrefStore* recommended_prefs, PrefStore* default_prefs, - PrefModelAssociator* pref_sync_associator, PrefNotifier* pref_notifier) - : pref_sync_associator_(pref_sync_associator), + : pref_sync_associator_(NULL), pref_notifier_(pref_notifier), initialization_failed_(false) { InitPrefStore(MANAGED_STORE, managed_prefs); @@ -76,7 +75,6 @@ PrefValueStore* PrefValueStore::CloneAndSpecialize( PrefStore* user_prefs, PrefStore* recommended_prefs, PrefStore* default_prefs, - PrefModelAssociator* pref_sync_associator, PrefNotifier* pref_notifier) { DCHECK(pref_notifier); if (!managed_prefs) @@ -94,7 +92,11 @@ PrefValueStore* PrefValueStore::CloneAndSpecialize( return new PrefValueStore( managed_prefs, extension_prefs, command_line_prefs, user_prefs, - recommended_prefs, default_prefs, pref_sync_associator, pref_notifier); + recommended_prefs, default_prefs, pref_notifier); +} + +void PrefValueStore::set_sync_associator(PrefModelAssociator* sync_associator) { + pref_sync_associator_ = sync_associator; } bool PrefValueStore::GetValue(const std::string& name, diff --git a/chrome/browser/prefs/pref_value_store.h b/chrome/browser/prefs/pref_value_store.h index 4c027a5..47fb58e 100644 --- a/chrome/browser/prefs/pref_value_store.h +++ b/chrome/browser/prefs/pref_value_store.h @@ -46,7 +46,6 @@ class PrefValueStore { PrefStore* user_prefs, PrefStore* recommended_prefs, PrefStore* default_prefs, - PrefModelAssociator* pref_sync_associator, PrefNotifier* pref_notifier); virtual ~PrefValueStore(); @@ -58,9 +57,12 @@ class PrefValueStore { PrefStore* user_prefs, PrefStore* recommended_prefs, PrefStore* default_prefs, - PrefModelAssociator* pref_sync_associator, PrefNotifier* pref_notifier); + // TODO(joi): Remove this completely; the part PrefModelAssociator + // needs can be handled simply as a PrefObserver. + void set_sync_associator(PrefModelAssociator* sync_associator); + // Gets the value for the given preference name that has the specified value // type. Values stored in a PrefStore that have the matching |name| but // a non-matching |type| are silently skipped. Returns true if a valid value diff --git a/chrome/browser/prefs/pref_value_store_unittest.cc b/chrome/browser/prefs/pref_value_store_unittest.cc index 30f4aa3..aa874b3 100644 --- a/chrome/browser/prefs/pref_value_store_unittest.cc +++ b/chrome/browser/prefs/pref_value_store_unittest.cc @@ -106,8 +106,9 @@ class PrefValueStoreTest : public testing::Test { user_pref_store_, recommended_pref_store_, default_pref_store_, - sync_associator_.get(), &pref_notifier_)); + + pref_value_store_->set_sync_associator(sync_associator_.get()); } void CreateManagedPrefs() { diff --git a/chrome/browser/prefs/proxy_policy_unittest.cc b/chrome/browser/prefs/proxy_policy_unittest.cc index a2f3e1c..823c204 100644 --- a/chrome/browser/prefs/proxy_policy_unittest.cc +++ b/chrome/browser/prefs/proxy_policy_unittest.cc @@ -97,7 +97,7 @@ class ProxyPolicyTest : public testing::Test { builder.WithCommandLine(&command_line_); if (with_managed_policies) builder.WithManagedPolicies(policy_service_.get()); - PrefService* prefs = builder.Create(); + PrefServiceSyncable* prefs = builder.CreateSyncable(); chrome::RegisterUserPrefs(prefs); return prefs; } diff --git a/chrome/browser/prefs/scoped_user_pref_update_unittest.cc b/chrome/browser/prefs/scoped_user_pref_update_unittest.cc index c06d5ef..05e9c84 100644 --- a/chrome/browser/prefs/scoped_user_pref_update_unittest.cc +++ b/chrome/browser/prefs/scoped_user_pref_update_unittest.cc @@ -19,7 +19,8 @@ class ScopedUserPrefUpdateTest : public testing::Test { protected: virtual void SetUp() { - prefs_.RegisterDictionaryPref(kPref, PrefService::UNSYNCABLE_PREF); + prefs_.RegisterDictionaryPref(kPref, + PrefServiceSyncable::UNSYNCABLE_PREF); registrar_.Init(&prefs_); registrar_.Add(kPref, observer_.GetCallback()); } @@ -28,7 +29,7 @@ class ScopedUserPrefUpdateTest : public testing::Test { static const char kKey[]; static const char kValue[]; - TestingPrefService prefs_; + TestingPrefServiceSyncable prefs_; MockPrefChangeCallback observer_; PrefChangeRegistrar registrar_; }; diff --git a/chrome/browser/prefs/session_startup_pref.cc b/chrome/browser/prefs/session_startup_pref.cc index cb421b6..f4a0f01 100644 --- a/chrome/browser/prefs/session_startup_pref.cc +++ b/chrome/browser/prefs/session_startup_pref.cc @@ -53,15 +53,15 @@ void URLListToPref(const base::ListValue* url_list, SessionStartupPref* pref) { } // namespace // static -void SessionStartupPref::RegisterUserPrefs(PrefService* prefs) { +void SessionStartupPref::RegisterUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterIntegerPref(prefs::kRestoreOnStartup, TypeToPrefValue(GetDefaultStartupType()), - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterListPref(prefs::kURLsToRestoreOnStartup, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kRestoreOnStartupMigrated, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } // static diff --git a/chrome/browser/prefs/session_startup_pref.h b/chrome/browser/prefs/session_startup_pref.h index 878b3f3..9eae865 100644 --- a/chrome/browser/prefs/session_startup_pref.h +++ b/chrome/browser/prefs/session_startup_pref.h @@ -10,6 +10,7 @@ #include "googleurl/src/gurl.h" class PrefService; +class PrefServiceSyncable; class Profile; // StartupPref specifies what should happen at startup for a specified profile. @@ -40,7 +41,7 @@ struct SessionStartupPref { static const int kPrefValueURLs = 4; static const int kPrefValueNewTab = 5; - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); // Returns the default value for |type|. static Type GetDefaultStartupType(); diff --git a/chrome/browser/prefs/session_startup_pref_unittest.cc b/chrome/browser/prefs/session_startup_pref_unittest.cc index 207cbcf..675e327 100644 --- a/chrome/browser/prefs/session_startup_pref_unittest.cc +++ b/chrome/browser/prefs/session_startup_pref_unittest.cc @@ -16,13 +16,16 @@ class SessionStartupPrefTest : public testing::Test { public: virtual void SetUp() { - pref_service_.reset(new TestingPrefService); + pref_service_.reset(new TestingPrefServiceSyncable); SessionStartupPref::RegisterUserPrefs(pref_service_.get()); - pref_service_->RegisterBooleanPref(prefs::kHomePageIsNewTabPage, true); + pref_service_->RegisterBooleanPref(prefs::kHomePageIsNewTabPage, + true, + PrefServiceSyncable::UNSYNCABLE_PREF); // Make the tests independent of the Mac startup pref migration (see // SessionStartupPref::MigrateMacDefaultPrefIfNecessary). pref_service_->RegisterStringPref(prefs::kProfileCreatedByVersion, - "22.0.0.0"); + "22.0.0.0", + PrefServiceSyncable::UNSYNCABLE_PREF); } bool IsUseLastOpenDefault() { @@ -34,7 +37,7 @@ class SessionStartupPrefTest : public testing::Test { #endif } - scoped_ptr<TestingPrefService> pref_service_; + scoped_ptr<TestingPrefServiceSyncable> pref_service_; }; TEST_F(SessionStartupPrefTest, URLListIsFixedUp) { @@ -79,7 +82,8 @@ TEST_F(SessionStartupPrefTest, URLListManagedOverridesUser) { // (so that, in effect, the default value "Open the homepage" was selected), // their preferences are migrated on upgrade to m19. TEST_F(SessionStartupPrefTest, DefaultMigration) { - pref_service_->RegisterStringPref(prefs::kHomePage, "http://google.com/"); + pref_service_->RegisterStringPref(prefs::kHomePage, "http://google.com/", + PrefServiceSyncable::UNSYNCABLE_PREF); pref_service_->SetString(prefs::kHomePage, "http://chromium.org/"); pref_service_->SetBoolean(prefs::kHomePageIsNewTabPage, false); @@ -103,7 +107,8 @@ TEST_F(SessionStartupPrefTest, DefaultMigration) { // and the NTP is being used for the homepage, their preferences are migrated // to "Open the New Tab Page" on upgrade to M19. TEST_F(SessionStartupPrefTest, DefaultMigrationHomepageIsNTP) { - pref_service_->RegisterStringPref(prefs::kHomePage, "http://google.com/"); + pref_service_->RegisterStringPref(prefs::kHomePage, "http://google.com/", + PrefServiceSyncable::UNSYNCABLE_PREF); pref_service_->SetString(prefs::kHomePage, "http://chromium.org/"); pref_service_->SetBoolean(prefs::kHomePageIsNewTabPage, true); @@ -124,7 +129,8 @@ TEST_F(SessionStartupPrefTest, DefaultMigrationHomepageIsNTP) { // Checks to make sure that if the user had previously selected "Open the // "homepage", their preferences are migrated on upgrade to M19. TEST_F(SessionStartupPrefTest, HomePageMigration) { - pref_service_->RegisterStringPref(prefs::kHomePage, "http://google.com/"); + pref_service_->RegisterStringPref(prefs::kHomePage, "http://google.com/", + PrefServiceSyncable::UNSYNCABLE_PREF); // By design, it's impossible to set the 'restore on startup' pref to 0 // ("open the homepage") using SessionStartupPref::SetStartupPref(), so set it @@ -145,7 +151,8 @@ TEST_F(SessionStartupPrefTest, HomePageMigration) { // "homepage", and the NTP is being used for the homepage, their preferences // are migrated on upgrade to M19. TEST_F(SessionStartupPrefTest, HomePageMigrationHomepageIsNTP) { - pref_service_->RegisterStringPref(prefs::kHomePage, "http://google.com/"); + pref_service_->RegisterStringPref(prefs::kHomePage, "http://google.com/", + PrefServiceSyncable::UNSYNCABLE_PREF); // By design, it's impossible to set the 'restore on startup' pref to 0 // ("open the homepage") using SessionStartupPref::SetStartupPref(), so set it diff --git a/chrome/browser/printing/cloud_print/cloud_print_proxy_service_unittest.cc b/chrome/browser/printing/cloud_print/cloud_print_proxy_service_unittest.cc index 68005ff..b7b969b 100644 --- a/chrome/browser/printing/cloud_print/cloud_print_proxy_service_unittest.cc +++ b/chrome/browser/printing/cloud_print/cloud_print_proxy_service_unittest.cc @@ -220,7 +220,7 @@ TEST_F(CloudPrintProxyPolicyTest, StartWithNoPolicyProxyDisabled) { service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations( MockServiceProcessControl::kServiceStateDisabled, false); - TestingPrefService* prefs = profile_.GetTestingPrefService(); + TestingPrefServiceSyncable* prefs = profile_.GetTestingPrefService(); prefs->SetUserPref(prefs::kCloudPrintEmail, Value::CreateStringValue( MockServiceProcessControl::EnabledUserId())); @@ -236,7 +236,7 @@ TEST_F(CloudPrintProxyPolicyTest, StartWithNoPolicyProxyEnabled) { service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations( MockServiceProcessControl::kServiceStateEnabled, false); - TestingPrefService* prefs = profile_.GetTestingPrefService(); + TestingPrefServiceSyncable* prefs = profile_.GetTestingPrefService(); prefs->SetUserPref(prefs::kCloudPrintEmail, Value::CreateStringValue(std::string())); @@ -253,7 +253,7 @@ TEST_F(CloudPrintProxyPolicyTest, StartWithPolicySetProxyDisabled) { service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations( MockServiceProcessControl::kServiceStateDisabled, false); - TestingPrefService* prefs = profile_.GetTestingPrefService(); + TestingPrefServiceSyncable* prefs = profile_.GetTestingPrefService(); prefs->SetUserPref(prefs::kCloudPrintEmail, Value::CreateStringValue(std::string())); prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled, @@ -271,7 +271,7 @@ TEST_F(CloudPrintProxyPolicyTest, StartWithPolicySetProxyEnabled) { MockServiceProcessControl::kServiceStateEnabled, false); service.GetMockServiceProcessControl()->SetWillBeDisabledExpectations(); - TestingPrefService* prefs = profile_.GetTestingPrefService(); + TestingPrefServiceSyncable* prefs = profile_.GetTestingPrefService(); prefs->SetUserPref(prefs::kCloudPrintEmail, Value::CreateStringValue(std::string())); prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled, @@ -288,7 +288,7 @@ TEST_F(CloudPrintProxyPolicyTest, StartWithNoPolicyProxyDisabledThenSetPolicy) { service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations( MockServiceProcessControl::kServiceStateDisabled, false); - TestingPrefService* prefs = profile_.GetTestingPrefService(); + TestingPrefServiceSyncable* prefs = profile_.GetTestingPrefService(); prefs->SetUserPref(prefs::kCloudPrintEmail, Value::CreateStringValue( MockServiceProcessControl::EnabledUserId())); @@ -309,7 +309,7 @@ TEST_F(CloudPrintProxyPolicyTest, StartWithNoPolicyProxyEnabledThenSetPolicy) { service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations( MockServiceProcessControl::kServiceStateEnabled, false); - TestingPrefService* prefs = profile_.GetTestingPrefService(); + TestingPrefServiceSyncable* prefs = profile_.GetTestingPrefService(); prefs->SetUserPref(prefs::kCloudPrintEmail, Value::CreateStringValue(std::string())); @@ -333,7 +333,7 @@ TEST_F(CloudPrintProxyPolicyTest, service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations( MockServiceProcessControl::kServiceStateDisabled, false); - TestingPrefService* prefs = profile_.GetTestingPrefService(); + TestingPrefServiceSyncable* prefs = profile_.GetTestingPrefService(); prefs->SetUserPref(prefs::kCloudPrintEmail, Value::CreateStringValue(std::string())); prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled, @@ -354,7 +354,7 @@ TEST_F(CloudPrintProxyPolicyTest, MockServiceProcessControl::kServiceStateEnabled, false); service.GetMockServiceProcessControl()->SetWillBeDisabledExpectations(); - TestingPrefService* prefs = profile_.GetTestingPrefService(); + TestingPrefServiceSyncable* prefs = profile_.GetTestingPrefService(); prefs->SetUserPref(prefs::kCloudPrintEmail, Value::CreateStringValue(std::string())); prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled, @@ -373,7 +373,7 @@ TEST_F(CloudPrintProxyPolicyTest, StartWithNoPolicyProxyDisabledThenEnable) { service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations( MockServiceProcessControl::kServiceStateDisabled, false); - TestingPrefService* prefs = profile_.GetTestingPrefService(); + TestingPrefServiceSyncable* prefs = profile_.GetTestingPrefService(); prefs->SetUserPref(prefs::kCloudPrintEmail, Value::CreateStringValue( MockServiceProcessControl::EnabledUserId())); @@ -397,7 +397,7 @@ TEST_F(CloudPrintProxyPolicyTest, MockServiceProcessControl::kServiceStateEnabled, false); service.GetMockServiceProcessControl()->SetWillBeDisabledExpectations(); - TestingPrefService* prefs = profile_.GetTestingPrefService(); + TestingPrefServiceSyncable* prefs = profile_.GetTestingPrefService(); prefs->SetUserPref(prefs::kCloudPrintEmail, Value::CreateStringValue(std::string())); prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled, @@ -434,7 +434,7 @@ ProfileKeyedService* TestCloudPrintProxyServiceFactory(Profile* profile) { } TEST_F(CloudPrintProxyPolicyTest, StartupBrowserCreatorWithCommandLine) { - TestingPrefService* prefs = profile_.GetTestingPrefService(); + TestingPrefServiceSyncable* prefs = profile_.GetTestingPrefService(); prefs->SetUserPref(prefs::kCloudPrintEmail, Value::CreateStringValue(std::string())); prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled, diff --git a/chrome/browser/printing/cloud_print/cloud_print_url.cc b/chrome/browser/printing/cloud_print/cloud_print_url.cc index 7a41028..76dbacf 100644 --- a/chrome/browser/printing/cloud_print/cloud_print_url.cc +++ b/chrome/browser/printing/cloud_print/cloud_print_url.cc @@ -26,16 +26,16 @@ const char kTestPageURL[] = void CloudPrintURL::RegisterPreferences() { DCHECK(profile_); - PrefService* pref_service = profile_->GetPrefs(); + PrefServiceSyncable* pref_service = profile_->GetPrefs(); if (!pref_service->FindPreference(prefs::kCloudPrintServiceURL)) { pref_service->RegisterStringPref(prefs::kCloudPrintServiceURL, kDefaultCloudPrintServiceURL, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } if (!pref_service->FindPreference(prefs::kCloudPrintSigninURL)) { pref_service->RegisterStringPref(prefs::kCloudPrintSigninURL, kDefaultCloudPrintSigninURL, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } } diff --git a/chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc b/chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc index b88c8fb..61cb2b8 100644 --- a/chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc +++ b/chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc @@ -472,7 +472,7 @@ TEST_F(CloudPrintProxyPolicyStartupTest, StartBrowserWithoutPolicy) { CloudPrintProxyServiceFactory::GetInstance()-> SetTestingFactory(profile, CloudPrintProxyServiceFactoryForPolicyTest); - TestingPrefService* prefs = profile->GetTestingPrefService(); + TestingPrefServiceSyncable* prefs = profile->GetTestingPrefService(); prefs->SetUserPref(prefs::kCloudPrintEmail, Value::CreateStringValue( MockServiceIPCServer::EnabledUserId())); @@ -512,7 +512,7 @@ TEST_F(CloudPrintProxyPolicyStartupTest, StartBrowserWithPolicy) { CloudPrintProxyServiceFactory::GetInstance()-> SetTestingFactory(profile, CloudPrintProxyServiceFactoryForPolicyTest); - TestingPrefService* prefs = profile->GetTestingPrefService(); + TestingPrefServiceSyncable* prefs = profile->GetTestingPrefService(); prefs->SetUserPref(prefs::kCloudPrintEmail, Value::CreateStringValue( MockServiceIPCServer::EnabledUserId())); diff --git a/chrome/browser/printing/print_dialog_cloud.cc b/chrome/browser/printing/print_dialog_cloud.cc index 774f63d..601acee 100644 --- a/chrome/browser/printing/print_dialog_cloud.cc +++ b/chrome/browser/printing/print_dialog_cloud.cc @@ -532,14 +532,16 @@ void GetDialogWidthAndHeightFromPrefs(content::BrowserContext* browser_context, Profile* profile = Profile::FromBrowserContext(browser_context); if (!profile->GetPrefs()->FindPreference(prefs::kCloudPrintDialogWidth)) { - profile->GetPrefs()->RegisterIntegerPref(prefs::kCloudPrintDialogWidth, - kDefaultWidth, - PrefService::UNSYNCABLE_PREF); + profile->GetPrefs()->RegisterIntegerPref( + prefs::kCloudPrintDialogWidth, + kDefaultWidth, + PrefServiceSyncable::UNSYNCABLE_PREF); } if (!profile->GetPrefs()->FindPreference(prefs::kCloudPrintDialogHeight)) { - profile->GetPrefs()->RegisterIntegerPref(prefs::kCloudPrintDialogHeight, - kDefaultHeight, - PrefService::UNSYNCABLE_PREF); + profile->GetPrefs()->RegisterIntegerPref( + prefs::kCloudPrintDialogHeight, + kDefaultHeight, + PrefServiceSyncable::UNSYNCABLE_PREF); } *width = profile->GetPrefs()->GetInteger(prefs::kCloudPrintDialogWidth); diff --git a/chrome/browser/profiles/chrome_version_service.cc b/chrome/browser/profiles/chrome_version_service.cc index 59e27c3..faa1036 100644 --- a/chrome/browser/profiles/chrome_version_service.cc +++ b/chrome/browser/profiles/chrome_version_service.cc @@ -10,9 +10,9 @@ #include "chrome/common/pref_names.h" // static -void ChromeVersionService::RegisterUserPrefs(PrefService* prefs) { +void ChromeVersionService::RegisterUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterStringPref(prefs::kProfileCreatedByVersion, "1.0.0.0", - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } // static diff --git a/chrome/browser/profiles/chrome_version_service.h b/chrome/browser/profiles/chrome_version_service.h index 425b8b8..22d1299 100644 --- a/chrome/browser/profiles/chrome_version_service.h +++ b/chrome/browser/profiles/chrome_version_service.h @@ -10,13 +10,14 @@ #include "base/basictypes.h" class PrefService; +class PrefServiceSyncable; // This service manages a pref which is used to determine the version of // Chrome by which the profile was created. class ChromeVersionService { public: // Register the user pref we use. - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); // Sets the version string in the pref for the current profile. static void SetVersion(PrefService* prefs, const std::string& version); diff --git a/chrome/browser/profiles/gaia_info_update_service.cc b/chrome/browser/profiles/gaia_info_update_service.cc index bf7e925..c7229fc 100644 --- a/chrome/browser/profiles/gaia_info_update_service.cc +++ b/chrome/browser/profiles/gaia_info_update_service.cc @@ -78,11 +78,13 @@ bool GAIAInfoUpdateService::ShouldUseGAIAProfileInfo(Profile* profile) { } // static -void GAIAInfoUpdateService::RegisterUserPrefs(PrefServiceBase* prefs) { - prefs->RegisterInt64Pref( - prefs::kProfileGAIAInfoUpdateTime, 0, PrefServiceBase::UNSYNCABLE_PREF); - prefs->RegisterStringPref( - prefs::kProfileGAIAInfoPictureURL, "", PrefServiceBase::UNSYNCABLE_PREF); +void GAIAInfoUpdateService::RegisterUserPrefs(PrefServiceSyncable* prefs) { + prefs->RegisterInt64Pref(prefs::kProfileGAIAInfoUpdateTime, + 0, + PrefServiceSyncable::UNSYNCABLE_PREF); + prefs->RegisterStringPref(prefs::kProfileGAIAInfoPictureURL, + "", + PrefServiceSyncable::UNSYNCABLE_PREF); } bool GAIAInfoUpdateService::NeedsProfilePicture() const { diff --git a/chrome/browser/profiles/gaia_info_update_service.h b/chrome/browser/profiles/gaia_info_update_service.h index a51e865..d9fdafc 100644 --- a/chrome/browser/profiles/gaia_info_update_service.h +++ b/chrome/browser/profiles/gaia_info_update_service.h @@ -13,6 +13,7 @@ #include "chrome/browser/profiles/profile_downloader.h" #include "chrome/browser/profiles/profile_downloader_delegate.h" +class PrefServiceSyncable; class Profile; class ProfileDownloader; @@ -30,7 +31,7 @@ class GAIAInfoUpdateService : public ProfileDownloaderDelegate { static bool ShouldUseGAIAProfileInfo(Profile* profile); // Register prefs for a profile. - static void RegisterUserPrefs(PrefServiceBase* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); // ProfileDownloaderDelegate: virtual bool NeedsProfilePicture() const OVERRIDE; diff --git a/chrome/browser/profiles/off_the_record_profile_impl.cc b/chrome/browser/profiles/off_the_record_profile_impl.cc index 0d8faa8..9417847 100644 --- a/chrome/browser/profiles/off_the_record_profile_impl.cc +++ b/chrome/browser/profiles/off_the_record_profile_impl.cc @@ -242,11 +242,11 @@ policy::PolicyService* OffTheRecordProfileImpl::GetPolicyService() { return profile_->GetPolicyService(); } -PrefService* OffTheRecordProfileImpl::GetPrefs() { +PrefServiceSyncable* OffTheRecordProfileImpl::GetPrefs() { return prefs_; } -PrefService* OffTheRecordProfileImpl::GetOffTheRecordPrefs() { +PrefServiceSyncable* OffTheRecordProfileImpl::GetOffTheRecordPrefs() { return prefs_; } diff --git a/chrome/browser/profiles/off_the_record_profile_impl.h b/chrome/browser/profiles/off_the_record_profile_impl.h index 87c7095..378a15f 100644 --- a/chrome/browser/profiles/off_the_record_profile_impl.h +++ b/chrome/browser/profiles/off_the_record_profile_impl.h @@ -46,8 +46,8 @@ class OffTheRecordProfileImpl : public Profile, virtual policy::ManagedModePolicyProvider* GetManagedModePolicyProvider() OVERRIDE; virtual policy::PolicyService* GetPolicyService() OVERRIDE; - virtual PrefService* GetPrefs() OVERRIDE; - virtual PrefService* GetOffTheRecordPrefs() OVERRIDE; + virtual PrefServiceSyncable* GetPrefs() OVERRIDE; + virtual PrefServiceSyncable* GetOffTheRecordPrefs() OVERRIDE; virtual net::URLRequestContextGetter* GetRequestContextForExtensions() OVERRIDE; virtual net::URLRequestContextGetter* GetRequestContextForStoragePartition( @@ -129,7 +129,7 @@ class OffTheRecordProfileImpl : public Profile, Profile* profile_; // Weak pointer owned by |profile_|. - PrefService* prefs_; + PrefServiceSyncable* prefs_; OffTheRecordProfileIOData::Handle io_data_; diff --git a/chrome/browser/profiles/off_the_record_profile_impl_unittest.cc b/chrome/browser/profiles/off_the_record_profile_impl_unittest.cc index b85292a..7586981 100644 --- a/chrome/browser/profiles/off_the_record_profile_impl_unittest.cc +++ b/chrome/browser/profiles/off_the_record_profile_impl_unittest.cc @@ -6,6 +6,7 @@ #include "chrome/browser/net/ssl_config_service_manager.h" #include "chrome/browser/prefs/browser_prefs.h" +#include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/profiles/profile_dependency_manager.h" #include "chrome/common/pref_names.h" @@ -39,7 +40,7 @@ class TestingProfileWithHostZoomMap : public TestingProfile, return off_the_record_profile_.get(); } - virtual PrefService* GetOffTheRecordPrefs() OVERRIDE { + virtual PrefServiceSyncable* GetOffTheRecordPrefs() OVERRIDE { return GetPrefs(); } @@ -84,7 +85,7 @@ class OffTheRecordProfileImplTest : public BrowserWithTestWindowTest { virtual ~OffTheRecordProfileImplTest() {} virtual void SetUp() OVERRIDE { - prefs_.reset(new TestingPrefService); + prefs_.reset(new TestingPrefServiceSimple); chrome::RegisterLocalState(prefs_.get()); browser_process()->SetLocalState(prefs_.get()); @@ -104,7 +105,7 @@ class OffTheRecordProfileImplTest : public BrowserWithTestWindowTest { return static_cast<TestingBrowserProcess*>(g_browser_process); } - scoped_ptr<PrefService> prefs_; + scoped_ptr<PrefServiceSimple> prefs_; DISALLOW_COPY_AND_ASSIGN(OffTheRecordProfileImplTest); }; diff --git a/chrome/browser/profiles/profile.cc b/chrome/browser/profiles/profile.cc index 282c0b1..8bc4039 100644 --- a/chrome/browser/profiles/profile.cc +++ b/chrome/browser/profiles/profile.cc @@ -47,41 +47,41 @@ TestingProfile* Profile::AsTestingProfile() { const char* const Profile::kProfileKey = "__PROFILE__"; // static -void Profile::RegisterUserPrefs(PrefService* prefs) { +void Profile::RegisterUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterBooleanPref(prefs::kSearchSuggestEnabled, true, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kSessionExitedCleanly, true, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterStringPref(prefs::kSessionExitType, std::string(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kSafeBrowsingEnabled, true, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kSafeBrowsingReportingEnabled, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kSafeBrowsingProceedAnywayDisabled, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kDisableExtensions, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kExtensionAlertsInitializedPref, - false, PrefService::UNSYNCABLE_PREF); + false, PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterStringPref(prefs::kSelectFileLastDirectory, std::string(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDoublePref(prefs::kDefaultZoomLevel, 0.0, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDictionaryPref(prefs::kPerHostZoomLevels, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterStringPref(prefs::kDefaultApps, "install", - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); #if defined(OS_CHROMEOS) // TODO(dilmah): For OS_CHROMEOS we maintain kApplicationLocale in both // local state and user's profile. For other platforms we maintain @@ -90,22 +90,22 @@ void Profile::RegisterUserPrefs(PrefService* prefs) { // in user's profile for other platforms as well. prefs->RegisterStringPref(prefs::kApplicationLocale, std::string(), - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterStringPref(prefs::kApplicationLocaleBackup, std::string(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterStringPref(prefs::kApplicationLocaleAccepted, std::string(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); #endif #if defined(OS_ANDROID) prefs->RegisterBooleanPref(prefs::kDevToolsRemoteEnabled, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kSpdyProxyEnabled, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); #endif } diff --git a/chrome/browser/profiles/profile.h b/chrome/browser/profiles/profile.h index ded0879..639985a 100644 --- a/chrome/browser/profiles/profile.h +++ b/chrome/browser/profiles/profile.h @@ -24,7 +24,7 @@ class FaviconService; class GAIAInfoUpdateService; class HostContentSettingsMap; class PasswordStore; -class PrefService; +class PrefServiceSyncable; class PromoCounter; class ProtocolHandlerRegistry; class TestingProfile; @@ -138,7 +138,7 @@ class Profile : public content::BrowserContext { // Profile prefs are registered as soon as the prefs are loaded for the first // time. - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); // Gets task runner for I/O operations associated with |profile|. static scoped_refptr<base::SequencedTaskRunner> GetTaskRunnerForProfile( @@ -214,14 +214,15 @@ class Profile : public content::BrowserContext { // Returns the PolicyService that provides policies for this profile. virtual policy::PolicyService* GetPolicyService() = 0; - // Retrieves a pointer to the PrefService that manages the preferences + // Retrieves a pointer to the PrefServiceSyncable that manages the preferences // for this user profile. - virtual PrefService* GetPrefs() = 0; + // TODO(joi): Make this and the below return just a PrefService. + virtual PrefServiceSyncable* GetPrefs() = 0; // Retrieves a pointer to the PrefService that manages the preferences // for OffTheRecord Profiles. This PrefService is lazily created the first // time that this method is called. - virtual PrefService* GetOffTheRecordPrefs() = 0; + virtual PrefServiceSyncable* GetOffTheRecordPrefs() = 0; // Returns the main request context. virtual net::URLRequestContextGetter* GetRequestContext() = 0; diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc index 2a874c0..a17151e 100644 --- a/chrome/browser/profiles/profile_impl.cc +++ b/chrome/browser/profiles/profile_impl.cc @@ -53,7 +53,7 @@ #include "chrome/browser/net/url_fixer_upper.h" #include "chrome/browser/plugins/plugin_prefs.h" #include "chrome/browser/prefs/browser_prefs.h" -#include "chrome/browser/prefs/chrome_pref_service_builder.h" +#include "chrome/browser/prefs/chrome_pref_service_factory.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/prerender/prerender_manager_factory.h" #include "chrome/browser/profiles/chrome_version_service.h" @@ -269,29 +269,29 @@ int ProfileImpl::create_readme_delay_ms = 60000; const char* const ProfileImpl::kPrefExitTypeNormal = "Normal"; // static -void ProfileImpl::RegisterUserPrefs(PrefService* prefs) { +void ProfileImpl::RegisterUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterBooleanPref(prefs::kSavingBrowserHistoryDisabled, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kForceSafeSearch, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterIntegerPref(prefs::kProfileAvatarIndex, -1, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterStringPref(prefs::kProfileName, "", - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kProfileIsManaged, false, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterStringPref(prefs::kHomePage, std::string(), - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); #if defined(ENABLE_PRINTING) prefs->RegisterBooleanPref(prefs::kPrintingEnabled, true, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); #endif prefs->RegisterBooleanPref(prefs::kPrintPreviewDisabled, #if defined(GOOGLE_CHROME_BUILD) @@ -299,23 +299,23 @@ void ProfileImpl::RegisterUserPrefs(PrefService* prefs) { #else true, #endif - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); // Initialize the cache prefs. prefs->RegisterFilePathPref(prefs::kDiskCacheDir, FilePath(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterIntegerPref(prefs::kDiskCacheSize, 0, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterIntegerPref(prefs::kMediaCacheSize, 0, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); // Deprecated. Kept around for migration. prefs->RegisterBooleanPref(prefs::kClearSiteDataOnExit, false, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); } ProfileImpl::ProfileImpl( @@ -353,9 +353,9 @@ ProfileImpl::ProfileImpl( // TODO(atwilson): Change |cloud_policy_manager_| and // |managed_mode_policy_provider_| to proper ProfileKeyedServices once - // PrefService is a ProfileKeyedService (policy must be initialized before - // PrefService because PrefService depends on policy loading to get overridden - // pref values). + // PrefServiceSyncable is a ProfileKeyedService (policy must be initialized + // before PrefServiceSyncable because PrefServiceSyncable depends on policy + // loading to get overridden pref values). #if !defined(OS_CHROMEOS) if (command_line->HasSwitch(switches::kLoadCloudPolicyOnSignin)) { cloud_policy_manager_ = @@ -378,7 +378,7 @@ ProfileImpl::ProfileImpl( DCHECK(create_mode == CREATE_MODE_ASYNCHRONOUS || create_mode == CREATE_MODE_SYNCHRONOUS); bool async_prefs = create_mode == CREATE_MODE_ASYNCHRONOUS; - prefs_.reset(ChromePrefServiceBuilder().CreateChromePrefs( + prefs_.reset(chrome_prefs::CreateProfilePrefs( GetPrefFilePath(), sequenced_task_runner, policy_service_.get(), @@ -775,12 +775,12 @@ policy::PolicyService* ProfileImpl::GetPolicyService() { return policy_service_.get(); } -PrefService* ProfileImpl::GetPrefs() { +PrefServiceSyncable* ProfileImpl::GetPrefs() { DCHECK(prefs_.get()); // Should explicitly be initialized. return prefs_.get(); } -PrefService* ProfileImpl::GetOffTheRecordPrefs() { +PrefServiceSyncable* ProfileImpl::GetOffTheRecordPrefs() { if (!otr_prefs_.get()) { // The new ExtensionPrefStore is ref_counted and the new PrefService // stores a reference so that we do not leak memory here. diff --git a/chrome/browser/profiles/profile_impl.h b/chrome/browser/profiles/profile_impl.h index 88021c0..e461908 100644 --- a/chrome/browser/profiles/profile_impl.h +++ b/chrome/browser/profiles/profile_impl.h @@ -21,7 +21,7 @@ #include "content/public/browser/notification_registrar.h" class NetPrefObserver; -class PrefService; +class PrefServiceSyncable; class PrefServiceBase; class PromoResourceService; class SSLConfigServiceManager; @@ -59,7 +59,7 @@ class ProfileImpl : public Profile, virtual ~ProfileImpl(); - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); // content::BrowserContext implementation: virtual FilePath GetPath() OVERRIDE; @@ -102,8 +102,8 @@ class ProfileImpl : public Profile, virtual policy::ManagedModePolicyProvider* GetManagedModePolicyProvider() OVERRIDE; virtual policy::PolicyService* GetPolicyService() OVERRIDE; - virtual PrefService* GetPrefs() OVERRIDE; - virtual PrefService* GetOffTheRecordPrefs() OVERRIDE; + virtual PrefServiceSyncable* GetPrefs() OVERRIDE; + virtual PrefServiceSyncable* GetOffTheRecordPrefs() OVERRIDE; virtual net::URLRequestContextGetter* GetRequestContextForExtensions() OVERRIDE; virtual net::SSLConfigService* GetSSLConfigService() OVERRIDE; @@ -222,8 +222,8 @@ class ProfileImpl : public Profile, // Keep |prefs_| on top for destruction order because |extension_prefs_|, // |net_pref_observer_|, |promo_resource_service_|, |io_data_| an others store // pointers to |prefs_| and shall be destructed first. - scoped_ptr<PrefService> prefs_; - scoped_ptr<PrefService> otr_prefs_; + scoped_ptr<PrefServiceSyncable> prefs_; + scoped_ptr<PrefServiceSyncable> otr_prefs_; ProfileImplIOData::Handle io_data_; scoped_refptr<ExtensionSpecialStoragePolicy> extension_special_storage_policy_; diff --git a/chrome/browser/profiles/profile_info_cache.cc b/chrome/browser/profiles/profile_info_cache.cc index 2247627..cb645ee 100644 --- a/chrome/browser/profiles/profile_info_cache.cc +++ b/chrome/browser/profiles/profile_info_cache.cc @@ -823,6 +823,6 @@ std::vector<string16> ProfileInfoCache::GetProfileNames() { } // static -void ProfileInfoCache::RegisterPrefs(PrefService* prefs) { +void ProfileInfoCache::RegisterPrefs(PrefServiceSimple* prefs) { prefs->RegisterDictionaryPref(prefs::kProfileInfoCache); } diff --git a/chrome/browser/profiles/profile_info_cache.h b/chrome/browser/profiles/profile_info_cache.h index 469f521..9a6a9fd 100644 --- a/chrome/browser/profiles/profile_info_cache.h +++ b/chrome/browser/profiles/profile_info_cache.h @@ -27,6 +27,7 @@ class DictionaryValue; } class PrefService; +class PrefServiceSimple; // This class saves various information about profiles to local preferences. // This cache can be used to display a list of profiles without having to @@ -126,7 +127,7 @@ class ProfileInfoCache : public ProfileInfoInterface, static std::vector<string16> GetProfileNames(); // Register cache related preferences in Local State. - static void RegisterPrefs(PrefService* prefs); + static void RegisterPrefs(PrefServiceSimple* prefs); void AddObserver(ProfileInfoCacheObserver* obs); void RemoveObserver(ProfileInfoCacheObserver* obs); diff --git a/chrome/browser/profiles/profile_keyed_base_factory.h b/chrome/browser/profiles/profile_keyed_base_factory.h index 16e3f23..bcd9ebd 100644 --- a/chrome/browser/profiles/profile_keyed_base_factory.h +++ b/chrome/browser/profiles/profile_keyed_base_factory.h @@ -9,7 +9,7 @@ #include "base/threading/non_thread_safe.h" -class PrefService; +class PrefServiceSyncable; class Profile; class ProfileDependencyManager; @@ -50,7 +50,7 @@ class ProfileKeyedBaseFactory : public base::NonThreadSafe { // Register any user preferences on this service. This is called during // CreateProfileService() since preferences are registered on a per Profile // basis. - virtual void RegisterUserPrefs(PrefService* user_prefs) {} + virtual void RegisterUserPrefs(PrefServiceSyncable* user_prefs) {} // By default, if we are asked for a service with an Incognito profile, we // pass back NULL. To redirect to the Incognito's original profile or to diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc index cba5739..e766c53 100644 --- a/chrome/browser/profiles/profile_manager.cc +++ b/chrome/browser/profiles/profile_manager.cc @@ -829,7 +829,7 @@ void ProfileManager::CreateMultiProfileAsync( } // static -void ProfileManager::RegisterPrefs(PrefService* prefs) { +void ProfileManager::RegisterPrefs(PrefServiceSimple* prefs) { prefs->RegisterStringPref(prefs::kProfileLastUsed, ""); prefs->RegisterIntegerPref(prefs::kProfilesNumCreated, 1); prefs->RegisterListPref(prefs::kProfilesLastActive); diff --git a/chrome/browser/profiles/profile_manager.h b/chrome/browser/profiles/profile_manager.h index fa07010..a0672eb 100644 --- a/chrome/browser/profiles/profile_manager.h +++ b/chrome/browser/profiles/profile_manager.h @@ -185,7 +185,7 @@ class ProfileManager : public base::NonThreadSafe, bool is_managed); // Register multi-profile related preferences in Local State. - static void RegisterPrefs(PrefService* prefs); + static void RegisterPrefs(PrefServiceSimple* prefs); // Returns a ProfileInfoCache object which can be used to get information // about profiles without having to load them from disk. diff --git a/chrome/browser/renderer_host/web_cache_manager.cc b/chrome/browser/renderer_host/web_cache_manager.cc index 5999a27..0a13f88 100644 --- a/chrome/browser/renderer_host/web_cache_manager.cc +++ b/chrome/browser/renderer_host/web_cache_manager.cc @@ -53,7 +53,7 @@ int GetDefaultCacheSize() { } // anonymous namespace // static -void WebCacheManager::RegisterPrefs(PrefService* prefs) { +void WebCacheManager::RegisterPrefs(PrefServiceSimple* prefs) { prefs->RegisterIntegerPref(prefs::kMemoryCacheSize, GetDefaultCacheSize()); } diff --git a/chrome/browser/renderer_host/web_cache_manager.h b/chrome/browser/renderer_host/web_cache_manager.h index 19733cc..129baad 100644 --- a/chrome/browser/renderer_host/web_cache_manager.h +++ b/chrome/browser/renderer_host/web_cache_manager.h @@ -23,14 +23,14 @@ template<typename Type> struct DefaultSingletonTraits; -class PrefService; +class PrefServiceSimple; class WebCacheManager : public content::NotificationObserver { friend class WebCacheManagerTest; FRIEND_TEST_ALL_PREFIXES(WebCacheManagerBrowserTest, CrashOnceOnly); public: - static void RegisterPrefs(PrefService* prefs); + static void RegisterPrefs(PrefServiceSimple* prefs); // Gets the singleton WebCacheManager object. The first time this method // is called, a WebCacheManager object is constructed and returned. diff --git a/chrome/browser/search_engines/search_provider_install_data_unittest.cc b/chrome/browser/search_engines/search_provider_install_data_unittest.cc index df75f9c..9680acc 100644 --- a/chrome/browser/search_engines/search_provider_install_data_unittest.cc +++ b/chrome/browser/search_engines/search_provider_install_data_unittest.cc @@ -217,7 +217,8 @@ void SearchProviderInstallDataTest::TearDown() { void SearchProviderInstallDataTest::SimulateDefaultSearchIsManaged( const std::string& url) { ASSERT_FALSE(url.empty()); - TestingPrefService* service = util_.profile()->GetTestingPrefService(); + TestingPrefServiceSyncable* service = + util_.profile()->GetTestingPrefService(); service->SetManagedPref(prefs::kDefaultSearchProviderEnabled, Value::CreateBooleanValue(true)); service->SetManagedPref(prefs::kDefaultSearchProviderSearchURL, diff --git a/chrome/browser/search_engines/template_url_prepopulate_data.cc b/chrome/browser/search_engines/template_url_prepopulate_data.cc index 9e9e279..fa0fc4f4 100644 --- a/chrome/browser/search_engines/template_url_prepopulate_data.cc +++ b/chrome/browser/search_engines/template_url_prepopulate_data.cc @@ -1088,19 +1088,19 @@ const LogoURLs google_logos = { //////////////////////////////////////////////////////////////////////////////// -void RegisterUserPrefs(PrefService* prefs) { +void RegisterUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterIntegerPref(prefs::kCountryIDAtInstall, kCountryIDUnknown, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterListPref(prefs::kSearchProviderOverrides, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterIntegerPref(prefs::kSearchProviderOverridesVersion, -1, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); // Obsolete pref, for migration. prefs->RegisterIntegerPref(prefs::kGeoIDAtInstall, -1, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } int GetDataVersion(PrefService* prefs) { diff --git a/chrome/browser/search_engines/template_url_prepopulate_data.h b/chrome/browser/search_engines/template_url_prepopulate_data.h index c41e546..aee7679 100644 --- a/chrome/browser/search_engines/template_url_prepopulate_data.h +++ b/chrome/browser/search_engines/template_url_prepopulate_data.h @@ -14,6 +14,7 @@ class GURL; class PrefService; +class PrefServiceSyncable; class Profile; class TemplateURL; @@ -35,7 +36,7 @@ void InitCountryCode(const std::string& country_code); #endif -void RegisterUserPrefs(PrefService* prefs); +void RegisterUserPrefs(PrefServiceSyncable* prefs); // Returns the current version of the prepopulate data, so callers can know when // they need to re-merge. If the prepopulate data comes from the preferences diff --git a/chrome/browser/search_engines/template_url_prepopulate_data_unittest.cc b/chrome/browser/search_engines/template_url_prepopulate_data_unittest.cc index 9d5b09e..a8b765c 100644 --- a/chrome/browser/search_engines/template_url_prepopulate_data_unittest.cc +++ b/chrome/browser/search_engines/template_url_prepopulate_data_unittest.cc @@ -95,7 +95,7 @@ TEST(TemplateURLPrepopulateDataTest, UniqueIDs) { // override the built-in ones. TEST(TemplateURLPrepopulateDataTest, ProvidersFromPrefs) { TestingProfile profile; - TestingPrefService* prefs = profile.GetTestingPrefService(); + TestingPrefServiceSyncable* prefs = profile.GetTestingPrefService(); prefs->SetUserPref(prefs::kSearchProviderOverridesVersion, Value::CreateIntegerValue(1)); ListValue* overrides = new ListValue; diff --git a/chrome/browser/search_engines/template_url_service_factory.cc b/chrome/browser/search_engines/template_url_service_factory.cc index 198fdae..4dd8d29 100644 --- a/chrome/browser/search_engines/template_url_service_factory.cc +++ b/chrome/browser/search_engines/template_url_service_factory.cc @@ -44,42 +44,42 @@ ProfileKeyedService* TemplateURLServiceFactory::BuildServiceInstanceFor( return BuildInstanceFor(profile); } -void TemplateURLServiceFactory::RegisterUserPrefs(PrefService* prefs) { +void TemplateURLServiceFactory::RegisterUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterStringPref(prefs::kSyncedDefaultSearchProviderGUID, std::string(), - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kDefaultSearchProviderEnabled, true, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterStringPref(prefs::kDefaultSearchProviderName, std::string(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterStringPref(prefs::kDefaultSearchProviderID, std::string(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterStringPref(prefs::kDefaultSearchProviderPrepopulateID, std::string(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterStringPref(prefs::kDefaultSearchProviderSuggestURL, std::string(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterStringPref(prefs::kDefaultSearchProviderSearchURL, std::string(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterStringPref(prefs::kDefaultSearchProviderInstantURL, std::string(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterStringPref(prefs::kDefaultSearchProviderKeyword, std::string(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterStringPref(prefs::kDefaultSearchProviderIconURL, std::string(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterStringPref(prefs::kDefaultSearchProviderEncodings, std::string(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterListPref(prefs::kDefaultSearchProviderAlternateURLs, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } bool TemplateURLServiceFactory::ServiceRedirectedInIncognito() const { diff --git a/chrome/browser/search_engines/template_url_service_factory.h b/chrome/browser/search_engines/template_url_service_factory.h index 0541426..3727026 100644 --- a/chrome/browser/search_engines/template_url_service_factory.h +++ b/chrome/browser/search_engines/template_url_service_factory.h @@ -8,7 +8,7 @@ #include "base/memory/singleton.h" #include "chrome/browser/profiles/profile_keyed_service_factory.h" -class PrefService; +class PrefServiceSyncable; class Profile; class TemplateURLService; @@ -31,7 +31,7 @@ class TemplateURLServiceFactory : public ProfileKeyedServiceFactory { // ProfileKeyedServiceFactory: virtual ProfileKeyedService* BuildServiceInstanceFor( Profile* profile) const OVERRIDE; - virtual void RegisterUserPrefs(PrefService* user_prefs) OVERRIDE; + virtual void RegisterUserPrefs(PrefServiceSyncable* user_prefs) OVERRIDE; virtual bool ServiceRedirectedInIncognito() const OVERRIDE; virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; virtual void ProfileShutdown(Profile* profile) OVERRIDE; diff --git a/chrome/browser/search_engines/template_url_service_test_util.cc b/chrome/browser/search_engines/template_url_service_test_util.cc index 5eb45f4..2a616417 100644 --- a/chrome/browser/search_engines/template_url_service_test_util.cc +++ b/chrome/browser/search_engines/template_url_service_test_util.cc @@ -271,7 +271,7 @@ void TemplateURLServiceTestUtil::SetManagedDefaultSearchPreferences( const std::string& suggest_url, const std::string& icon_url, const std::string& encodings) { - TestingPrefService* pref_service = profile_->GetTestingPrefService(); + TestingPrefServiceSyncable* pref_service = profile_->GetTestingPrefService(); pref_service->SetManagedPref(prefs::kDefaultSearchProviderEnabled, Value::CreateBooleanValue(enabled)); pref_service->SetManagedPref(prefs::kDefaultSearchProviderName, @@ -292,7 +292,7 @@ void TemplateURLServiceTestUtil::SetManagedDefaultSearchPreferences( } void TemplateURLServiceTestUtil::RemoveManagedDefaultSearchPreferences() { - TestingPrefService* pref_service = profile_->GetTestingPrefService(); + TestingPrefServiceSyncable* pref_service = profile_->GetTestingPrefService(); pref_service->RemoveManagedPref(prefs::kDefaultSearchProviderEnabled); pref_service->RemoveManagedPref(prefs::kDefaultSearchProviderName); pref_service->RemoveManagedPref(prefs::kDefaultSearchProviderKeyword); diff --git a/chrome/browser/search_engines/util.cc b/chrome/browser/search_engines/util.cc index 4d0b6dc..5329bc4 100644 --- a/chrome/browser/search_engines/util.cc +++ b/chrome/browser/search_engines/util.cc @@ -12,6 +12,7 @@ #include "base/logging.h" #include "base/memory/scoped_vector.h" #include "base/time.h" +#include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/search_engines/template_url.h" #include "chrome/browser/search_engines/template_url_prepopulate_data.h" diff --git a/chrome/browser/signin/about_signin_internals_factory.cc b/chrome/browser/signin/about_signin_internals_factory.cc index 5d9b2b1..3102857 100644 --- a/chrome/browser/signin/about_signin_internals_factory.cc +++ b/chrome/browser/signin/about_signin_internals_factory.cc @@ -35,13 +35,14 @@ AboutSigninInternalsFactory* AboutSigninInternalsFactory::GetInstance() { return Singleton<AboutSigninInternalsFactory>::get(); } -void AboutSigninInternalsFactory::RegisterUserPrefs(PrefService* user_prefs) { +void AboutSigninInternalsFactory::RegisterUserPrefs( + PrefServiceSyncable* user_prefs) { // SigninManager information for about:signin-internals. for (int i = UNTIMED_FIELDS_BEGIN; i < UNTIMED_FIELDS_END; ++i) { const std::string pref_path = SigninStatusFieldToString( static_cast<UntimedSigninStatusField>(i)); user_prefs->RegisterStringPref(pref_path.c_str(), "", - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } for (int i = TIMED_FIELDS_BEGIN; i < TIMED_FIELDS_END; ++i) { const std::string value = SigninStatusFieldToString( @@ -49,9 +50,9 @@ void AboutSigninInternalsFactory::RegisterUserPrefs(PrefService* user_prefs) { const std::string time = SigninStatusFieldToString( static_cast<TimedSigninStatusField>(i)) + ".time"; user_prefs->RegisterStringPref(value.c_str(), "", - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); user_prefs->RegisterStringPref(time.c_str(), "", - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } // TokenService information for about:signin-internals. for (size_t i = 0; i < kNumTokenPrefs; i++) { @@ -60,11 +61,11 @@ void AboutSigninInternalsFactory::RegisterUserPrefs(PrefService* user_prefs) { const std::string status = pref + ".status"; const std::string time = pref + ".time"; user_prefs->RegisterStringPref(value.c_str(), "", - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); user_prefs->RegisterStringPref(status.c_str(), "", - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); user_prefs->RegisterStringPref(time.c_str(), "", - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } } diff --git a/chrome/browser/signin/about_signin_internals_factory.h b/chrome/browser/signin/about_signin_internals_factory.h index 83cf51d..66cc69b 100644 --- a/chrome/browser/signin/about_signin_internals_factory.h +++ b/chrome/browser/signin/about_signin_internals_factory.h @@ -9,6 +9,7 @@ #include "chrome/browser/profiles/profile_keyed_service_factory.h" class AboutSigninInternals; +class PrefServiceSyncable; class Profile; // Singleton that owns all AboutSigninInternals and associates them with @@ -23,7 +24,7 @@ class AboutSigninInternalsFactory : public ProfileKeyedServiceFactory { static AboutSigninInternalsFactory* GetInstance(); // Implementation of ProfileKeyedServiceFactory. - virtual void RegisterUserPrefs(PrefService* user_prefs) OVERRIDE; + virtual void RegisterUserPrefs(PrefServiceSyncable* user_prefs) OVERRIDE; private: friend struct DefaultSingletonTraits<AboutSigninInternalsFactory>; diff --git a/chrome/browser/signin/signin_manager_factory.cc b/chrome/browser/signin/signin_manager_factory.cc index 228e52c..dd9a5f2 100644 --- a/chrome/browser/signin/signin_manager_factory.cc +++ b/chrome/browser/signin/signin_manager_factory.cc @@ -35,25 +35,25 @@ SigninManagerFactory* SigninManagerFactory::GetInstance() { return Singleton<SigninManagerFactory>::get(); } -void SigninManagerFactory::RegisterUserPrefs(PrefService* user_prefs) { +void SigninManagerFactory::RegisterUserPrefs(PrefServiceSyncable* user_prefs) { user_prefs->RegisterStringPref(prefs::kGoogleServicesLastUsername, "", - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); user_prefs->RegisterStringPref(prefs::kGoogleServicesUsername, "", - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); user_prefs->RegisterBooleanPref(prefs::kAutologinEnabled, true, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); user_prefs->RegisterBooleanPref(prefs::kReverseAutologinEnabled, true, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); user_prefs->RegisterListPref(prefs::kReverseAutologinRejectedEmailList, - new ListValue, PrefService::UNSYNCABLE_PREF); + new ListValue, + PrefServiceSyncable::UNSYNCABLE_PREF); user_prefs->RegisterBooleanPref(prefs::kIsGooglePlusUser, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } // static -void SigninManagerFactory::RegisterPrefs(PrefService* local_state) { - local_state->RegisterStringPref(prefs::kGoogleServicesUsernamePattern, "", - PrefService::UNSYNCABLE_PREF); +void SigninManagerFactory::RegisterPrefs(PrefServiceSimple* local_state) { + local_state->RegisterStringPref(prefs::kGoogleServicesUsernamePattern, ""); } ProfileKeyedService* SigninManagerFactory::BuildServiceInstanceFor( diff --git a/chrome/browser/signin/signin_manager_factory.h b/chrome/browser/signin/signin_manager_factory.h index bccc1c1..c3c7602 100644 --- a/chrome/browser/signin/signin_manager_factory.h +++ b/chrome/browser/signin/signin_manager_factory.h @@ -9,6 +9,8 @@ #include "chrome/browser/profiles/profile_keyed_service_factory.h" class SigninManager; +class PrefServiceSimple; +class PrefServiceSyncable; class Profile; // Singleton that owns all SigninManagers and associates them with @@ -30,10 +32,10 @@ class SigninManagerFactory : public ProfileKeyedServiceFactory { static SigninManagerFactory* GetInstance(); // Implementation of ProfileKeyedServiceFactory (public so tests can call it). - virtual void RegisterUserPrefs(PrefService* user_prefs) OVERRIDE; + virtual void RegisterUserPrefs(PrefServiceSyncable* user_prefs) OVERRIDE; // Registers the browser-global prefs used by SigninManager. - static void RegisterPrefs(PrefService* local_state); + static void RegisterPrefs(PrefServiceSimple* local_state); private: friend struct DefaultSingletonTraits<SigninManagerFactory>; diff --git a/chrome/browser/signin/signin_manager_unittest.cc b/chrome/browser/signin/signin_manager_unittest.cc index 638d531..cc8e974 100644 --- a/chrome/browser/signin/signin_manager_unittest.cc +++ b/chrome/browser/signin/signin_manager_unittest.cc @@ -45,7 +45,7 @@ const char kGetTokenPairValidResponse[] = class SigninManagerTest : public TokenServiceTestHarness { public: virtual void SetUp() OVERRIDE { - prefs_.reset(new TestingPrefService); + prefs_.reset(new TestingPrefServiceSimple); chrome::RegisterLocalState(prefs_.get()); static_cast<TestingBrowserProcess*>(g_browser_process)->SetLocalState( prefs_.get()); @@ -187,7 +187,7 @@ class SigninManagerTest : public TokenServiceTestHarness { scoped_ptr<SigninManager> manager_; content::TestNotificationTracker google_login_success_; content::TestNotificationTracker google_login_failure_; - scoped_ptr<TestingPrefService> prefs_; + scoped_ptr<TestingPrefServiceSimple> prefs_; }; // NOTE: ClientLogin's "StartSignin" is called after collecting credentials diff --git a/chrome/browser/speech/chrome_speech_recognition_preferences.cc b/chrome/browser/speech/chrome_speech_recognition_preferences.cc index aa58681..bf4de55 100644 --- a/chrome/browser/speech/chrome_speech_recognition_preferences.cc +++ b/chrome/browser/speech/chrome_speech_recognition_preferences.cc @@ -65,15 +65,15 @@ ChromeSpeechRecognitionPreferences::Factory::BuildServiceInstanceFor( } void ChromeSpeechRecognitionPreferences::Factory::RegisterUserPrefs( - PrefService* prefs) { + PrefServiceSyncable* prefs) { prefs->RegisterBooleanPref( prefs::kSpeechRecognitionFilterProfanities, kDefaultFilterProfanities, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterListPref( prefs::kSpeechRecognitionTrayNotificationShownContexts, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } bool ChromeSpeechRecognitionPreferences::Factory:: diff --git a/chrome/browser/speech/chrome_speech_recognition_preferences.h b/chrome/browser/speech/chrome_speech_recognition_preferences.h index ffb172f..50945e7 100644 --- a/chrome/browser/speech/chrome_speech_recognition_preferences.h +++ b/chrome/browser/speech/chrome_speech_recognition_preferences.h @@ -70,7 +70,7 @@ class ChromeSpeechRecognitionPreferences // ProfileKeyedServiceFactory methods: virtual ProfileKeyedService* BuildServiceInstanceFor(Profile* profile) const OVERRIDE; - virtual void RegisterUserPrefs(PrefService* prefs) OVERRIDE; + virtual void RegisterUserPrefs(PrefServiceSyncable* prefs) OVERRIDE; virtual bool ServiceRedirectedInIncognito() const OVERRIDE; virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; virtual bool ServiceIsCreatedWithProfile() const OVERRIDE; diff --git a/chrome/browser/spellchecker/spellcheck_factory.cc b/chrome/browser/spellchecker/spellcheck_factory.cc index fd1f733..a90b693 100644 --- a/chrome/browser/spellchecker/spellcheck_factory.cc +++ b/chrome/browser/spellchecker/spellcheck_factory.cc @@ -45,23 +45,24 @@ ProfileKeyedService* SpellcheckServiceFactory::BuildServiceInstanceFor( return spellcheck; } -void SpellcheckServiceFactory::RegisterUserPrefs(PrefService* user_prefs) { +void SpellcheckServiceFactory::RegisterUserPrefs( + PrefServiceSyncable* user_prefs) { // TODO(estade): IDS_SPELLCHECK_DICTIONARY should be an ASCII string. user_prefs->RegisterLocalizedStringPref(prefs::kSpellCheckDictionary, IDS_SPELLCHECK_DICTIONARY, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); user_prefs->RegisterBooleanPref(prefs::kSpellCheckConfirmDialogShown, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); user_prefs->RegisterBooleanPref(prefs::kSpellCheckUseSpellingService, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); user_prefs->RegisterBooleanPref(prefs::kEnableContinuousSpellcheck, true, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); user_prefs->RegisterBooleanPref(prefs::kEnableAutoSpellCorrect, false, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); } bool SpellcheckServiceFactory::ServiceRedirectedInIncognito() const { diff --git a/chrome/browser/spellchecker/spellcheck_factory.h b/chrome/browser/spellchecker/spellcheck_factory.h index 57328f7..bb6efae 100644 --- a/chrome/browser/spellchecker/spellcheck_factory.h +++ b/chrome/browser/spellchecker/spellcheck_factory.h @@ -30,7 +30,7 @@ class SpellcheckServiceFactory : public ProfileKeyedServiceFactory { // ProfileKeyedServiceFactory: virtual ProfileKeyedService* BuildServiceInstanceFor( Profile* profile) const OVERRIDE; - virtual void RegisterUserPrefs(PrefService* user_prefs) OVERRIDE; + virtual void RegisterUserPrefs(PrefServiceSyncable* user_prefs) OVERRIDE; virtual bool ServiceRedirectedInIncognito() const OVERRIDE; virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; diff --git a/chrome/browser/sync/glue/session_model_associator.cc b/chrome/browser/sync/glue/session_model_associator.cc index 8024e3b..e5bedab 100644 --- a/chrome/browser/sync/glue/session_model_associator.cc +++ b/chrome/browser/sync/glue/session_model_associator.cc @@ -103,7 +103,7 @@ SessionModelAssociator::SessionModelAssociator(ProfileSyncService* sync_service, if (pref_service_->FindPreference(kSyncSessionsGUID) == NULL) { pref_service_->RegisterStringPref(kSyncSessionsGUID, std::string(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } } diff --git a/chrome/browser/sync/glue/session_model_associator.h b/chrome/browser/sync/glue/session_model_associator.h index 2927cf1..08f390e 100644 --- a/chrome/browser/sync/glue/session_model_associator.h +++ b/chrome/browser/sync/glue/session_model_associator.h @@ -28,7 +28,7 @@ #include "googleurl/src/gurl.h" #include "sync/internal_api/public/base/model_type.h" -class Prefservice; +class PrefServiceSyncable; class Profile; class ProfileSyncService; @@ -415,7 +415,7 @@ class SessionModelAssociator Profile* const profile_; // Pref service. Used to persist the session sync guid. Weak pointer. - PrefService* const pref_service_; + PrefServiceSyncable* const pref_service_; DataTypeErrorHandler* error_handler_; diff --git a/chrome/browser/sync/invalidations/invalidator_storage.cc b/chrome/browser/sync/invalidations/invalidator_storage.cc index ebd6dbc..b17ba50 100644 --- a/chrome/browser/sync/invalidations/invalidator_storage.cc +++ b/chrome/browser/sync/invalidations/invalidator_storage.cc @@ -93,17 +93,17 @@ DictionaryValue* ObjectIdAndStateToValue( } // namespace -InvalidatorStorage::InvalidatorStorage(PrefService* pref_service) +InvalidatorStorage::InvalidatorStorage(PrefServiceSyncable* pref_service) : pref_service_(pref_service) { // TODO(tim): Create a Mock instead of maintaining the if(!pref_service_) case // throughout this file. This is a problem now due to lack of injection at // ProfileSyncService. Bug 130176. if (pref_service_) { pref_service_->RegisterListPref(prefs::kInvalidatorMaxInvalidationVersions, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); pref_service_->RegisterStringPref(prefs::kInvalidatorInvalidationState, std::string(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); MigrateMaxInvalidationVersionsPref(); } @@ -195,7 +195,7 @@ void InvalidatorStorage::SerializeToList( // Legacy migration code. void InvalidatorStorage::MigrateMaxInvalidationVersionsPref() { pref_service_->RegisterDictionaryPref(prefs::kSyncMaxInvalidationVersions, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); const base::DictionaryValue* max_versions_dict = pref_service_->GetDictionary(prefs::kSyncMaxInvalidationVersions); CHECK(max_versions_dict); diff --git a/chrome/browser/sync/invalidations/invalidator_storage.h b/chrome/browser/sync/invalidations/invalidator_storage.h index 1916403..e13572b 100644 --- a/chrome/browser/sync/invalidations/invalidator_storage.h +++ b/chrome/browser/sync/invalidations/invalidator_storage.h @@ -15,7 +15,7 @@ #include "base/threading/thread_checker.h" #include "sync/notifier/invalidation_state_tracker.h" -class PrefService; +class PrefServiceSyncable; namespace base { class DictionaryValue; @@ -34,7 +34,7 @@ class InvalidatorStorage : public base::SupportsWeakPtr<InvalidatorStorage>, public: // |pref_service| may be NULL (for unit tests), but in that case no setter // methods should be called. Does not own |pref_service|. - explicit InvalidatorStorage(PrefService* pref_service); + explicit InvalidatorStorage(PrefServiceSyncable* pref_service); virtual ~InvalidatorStorage(); // Erases invalidation versions and state stored on disk. @@ -94,7 +94,7 @@ class InvalidatorStorage : public base::SupportsWeakPtr<InvalidatorStorage>, syncer::InvalidationStateMap* map); // May be NULL. - PrefService* const pref_service_; + PrefServiceSyncable* const pref_service_; DISALLOW_COPY_AND_ASSIGN(InvalidatorStorage); }; diff --git a/chrome/browser/sync/invalidations/invalidator_storage_unittest.cc b/chrome/browser/sync/invalidations/invalidator_storage_unittest.cc index 8beb9a5..b07b0e65 100644 --- a/chrome/browser/sync/invalidations/invalidator_storage_unittest.cc +++ b/chrome/browser/sync/invalidations/invalidator_storage_unittest.cc @@ -10,6 +10,7 @@ #include "base/message_loop_proxy.h" #include "base/string_number_conversions.h" #include "base/string_util.h" +#include "chrome/browser/prefs/pref_service.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_pref_service.h" #include "sync/internal_api/public/base/invalidation_test_util.h" @@ -47,7 +48,7 @@ class InvalidatorStorageTest : public testing::Test { kAutofillId_(kChromeSyncSourceId, "AUTOFILL") {} protected: - TestingPrefService pref_service_; + TestingPrefServiceSyncable pref_service_; const invalidation::ObjectId kBookmarksId_; const invalidation::ObjectId kPreferencesId_; diff --git a/chrome/browser/sync/profile_sync_components_factory_impl.cc b/chrome/browser/sync/profile_sync_components_factory_impl.cc index 8d0bddf..a9d9a52 100644 --- a/chrome/browser/sync/profile_sync_components_factory_impl.cc +++ b/chrome/browser/sync/profile_sync_components_factory_impl.cc @@ -13,6 +13,7 @@ #include "chrome/browser/history/history.h" #include "chrome/browser/history/history_service_factory.h" #include "chrome/browser/prefs/pref_model_associator.h" +#include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/search_engines/template_url_service.h" #include "chrome/browser/search_engines/template_url_service_factory.h" diff --git a/chrome/browser/sync/profile_sync_service_preference_unittest.cc b/chrome/browser/sync/profile_sync_service_preference_unittest.cc index e5eead2..421787b 100644 --- a/chrome/browser/sync/profile_sync_service_preference_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_preference_unittest.cc @@ -124,7 +124,7 @@ class ProfileSyncServicePreferenceTest prefs_->RegisterStringPref(not_synced_preference_name_.c_str(), not_synced_preference_default_value_, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } virtual void TearDown() { @@ -241,7 +241,7 @@ class ProfileSyncServicePreferenceTest } scoped_ptr<TestingProfile> profile_; - TestingPrefService* prefs_; + TestingPrefServiceSyncable* prefs_; UIDataTypeController* dtc_; PrefModelAssociator* pref_sync_service_; diff --git a/chrome/browser/sync/sync_prefs.cc b/chrome/browser/sync/sync_prefs.cc index 998c795..f6ac689 100644 --- a/chrome/browser/sync/sync_prefs.cc +++ b/chrome/browser/sync/sync_prefs.cc @@ -18,7 +18,7 @@ namespace browser_sync { SyncPrefObserver::~SyncPrefObserver() {} -SyncPrefs::SyncPrefs(PrefService* pref_service) +SyncPrefs::SyncPrefs(PrefServiceSyncable* pref_service) : pref_service_(pref_service) { RegisterPrefGroups(); // TODO(tim): Create a Mock instead of maintaining the if(!pref_service_) case @@ -307,15 +307,18 @@ void SyncPrefs::RegisterPreferences() { return; } + // TODO(joi): Switch to official way of registering user prefs for + // this class, i.e. in a function called from + // browser_prefs::RegisterUserPrefs. pref_service_->RegisterBooleanPref(prefs::kSyncHasSetupCompleted, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); pref_service_->RegisterBooleanPref(prefs::kSyncSuppressStart, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); pref_service_->RegisterInt64Pref(prefs::kSyncLastSyncedTime, 0, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); // If you've never synced before, or if you're using Chrome OS or Android, // all datatypes are on by default. @@ -330,7 +333,7 @@ void SyncPrefs::RegisterPreferences() { pref_service_->RegisterBooleanPref(prefs::kSyncKeepEverythingSynced, enable_by_default, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); syncer::ModelTypeSet user_types = syncer::UserTypes(); @@ -345,18 +348,18 @@ void SyncPrefs::RegisterPreferences() { pref_service_->RegisterBooleanPref(prefs::kSyncManaged, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); pref_service_->RegisterStringPref(prefs::kSyncEncryptionBootstrapToken, "", - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); pref_service_->RegisterStringPref( prefs::kSyncKeystoreEncryptionBootstrapToken, "", - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); #if defined(OS_CHROMEOS) pref_service_->RegisterStringPref(prefs::kSyncSpareBootstrapToken, "", - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); #endif // We will start prompting people about new data types after the launch of @@ -377,7 +380,7 @@ void SyncPrefs::RegisterPreferences() { model_set.Put(syncer::SESSIONS); pref_service_->RegisterListPref(prefs::kSyncAcknowledgedSyncTypes, syncer::ModelTypeSetToValue(model_set), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } void SyncPrefs::RegisterDataTypePreferredPref(syncer::ModelType type, @@ -390,7 +393,7 @@ void SyncPrefs::RegisterDataTypePreferredPref(syncer::ModelType type, return; } pref_service_->RegisterBooleanPref(pref_name, is_preferred, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } bool SyncPrefs::GetDataTypePreferred(syncer::ModelType type) const { diff --git a/chrome/browser/sync/sync_prefs.h b/chrome/browser/sync/sync_prefs.h index bd41e9c..5650086 100644 --- a/chrome/browser/sync/sync_prefs.h +++ b/chrome/browser/sync/sync_prefs.h @@ -15,7 +15,7 @@ #include "sync/internal_api/public/base/model_type.h" #include "sync/notifier/invalidation_state_tracker.h" -class PrefService; +class PrefServiceSyncable; namespace browser_sync { @@ -48,7 +48,7 @@ class SyncPrefs : NON_EXPORTED_BASE(public base::NonThreadSafe), // |pref_service| may be NULL (for unit tests), but in that case no // setter methods should be called. Does not take ownership of // |pref_service|. - explicit SyncPrefs(PrefService* pref_service); + explicit SyncPrefs(PrefServiceSyncable* pref_service); virtual ~SyncPrefs(); @@ -137,7 +137,7 @@ class SyncPrefs : NON_EXPORTED_BASE(public base::NonThreadSafe), void OnSyncManagedPrefChanged(); // May be NULL. - PrefService* const pref_service_; + PrefServiceSyncable* const pref_service_; ObserverList<SyncPrefObserver> sync_pref_observers_; diff --git a/chrome/browser/sync/sync_prefs_unittest.cc b/chrome/browser/sync/sync_prefs_unittest.cc index c3536fd..82bd53f 100644 --- a/chrome/browser/sync/sync_prefs_unittest.cc +++ b/chrome/browser/sync/sync_prefs_unittest.cc @@ -20,7 +20,7 @@ using ::testing::StrictMock; class SyncPrefsTest : public testing::Test { protected: - TestingPrefService pref_service_; + TestingPrefServiceSyncable pref_service_; private: MessageLoop loop_; diff --git a/chrome/browser/task_manager/task_manager.cc b/chrome/browser/task_manager/task_manager.cc index 489b48a..b55e604 100644 --- a/chrome/browser/task_manager/task_manager.cc +++ b/chrome/browser/task_manager/task_manager.cc @@ -1221,7 +1221,7 @@ content::WebContents* TaskManager::Resource::GetWebContents() const { bool TaskManager::Resource::IsBackground() const { return false; } // static -void TaskManager::RegisterPrefs(PrefService* prefs) { +void TaskManager::RegisterPrefs(PrefServiceSimple* prefs) { prefs->RegisterDictionaryPref(prefs::kTaskManagerWindowPlacement); } diff --git a/chrome/browser/task_manager/task_manager.h b/chrome/browser/task_manager/task_manager.h index cb313de..c1d3106 100644 --- a/chrome/browser/task_manager/task_manager.h +++ b/chrome/browser/task_manager/task_manager.h @@ -22,6 +22,7 @@ #include "content/public/common/gpu_memory_stats.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h" +class PrefServiceSimple; class TaskManagerModel; class TaskManagerModelGpuDataManagerObserver; @@ -185,7 +186,7 @@ class TaskManager { virtual ~ResourceProvider() {} }; - static void RegisterPrefs(PrefService* prefs); + static void RegisterPrefs(PrefServiceSimple* prefs); // Returns true if the process at the specified index is the browser process. bool IsBrowserProcess(int index) const; diff --git a/chrome/browser/themes/theme_service_factory.cc b/chrome/browser/themes/theme_service_factory.cc index 10a3b73..86072d6 100644 --- a/chrome/browser/themes/theme_service_factory.cc +++ b/chrome/browser/themes/theme_service_factory.cc @@ -56,26 +56,26 @@ ProfileKeyedService* ThemeServiceFactory::BuildServiceInstanceFor( return provider; } -void ThemeServiceFactory::RegisterUserPrefs(PrefService* prefs) { +void ThemeServiceFactory::RegisterUserPrefs(PrefServiceSyncable* prefs) { #if defined(TOOLKIT_GTK) prefs->RegisterBooleanPref(prefs::kUsesSystemTheme, GtkThemeService::DefaultUsesSystemTheme(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); #endif prefs->RegisterFilePathPref(prefs::kCurrentThemePackFilename, FilePath(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterStringPref(prefs::kCurrentThemeID, ThemeService::kDefaultThemeID, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDictionaryPref(prefs::kCurrentThemeImages, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDictionaryPref(prefs::kCurrentThemeColors, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDictionaryPref(prefs::kCurrentThemeTints, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDictionaryPref(prefs::kCurrentThemeDisplayProperties, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } bool ThemeServiceFactory::ServiceRedirectedInIncognito() const { diff --git a/chrome/browser/themes/theme_service_factory.h b/chrome/browser/themes/theme_service_factory.h index be7b956..865ff96 100644 --- a/chrome/browser/themes/theme_service_factory.h +++ b/chrome/browser/themes/theme_service_factory.h @@ -42,7 +42,7 @@ class ThemeServiceFactory : public ProfileKeyedServiceFactory { // ProfileKeyedServiceFactory: virtual ProfileKeyedService* BuildServiceInstanceFor( Profile* profile) const OVERRIDE; - virtual void RegisterUserPrefs(PrefService* prefs) OVERRIDE; + virtual void RegisterUserPrefs(PrefServiceSyncable* prefs) OVERRIDE; virtual bool ServiceRedirectedInIncognito() const OVERRIDE; DISALLOW_COPY_AND_ASSIGN(ThemeServiceFactory); diff --git a/chrome/browser/translate/translate_prefs.cc b/chrome/browser/translate/translate_prefs.cc index fb3fdaf..a642cb1 100644 --- a/chrome/browser/translate/translate_prefs.cc +++ b/chrome/browser/translate/translate_prefs.cc @@ -148,24 +148,24 @@ bool TranslatePrefs::ShouldAutoTranslate(PrefService* user_prefs, return prefs.IsLanguageWhitelisted(original_language, target_language); } -void TranslatePrefs::RegisterUserPrefs(PrefService* user_prefs) { +void TranslatePrefs::RegisterUserPrefs(PrefServiceSyncable* user_prefs) { if (!user_prefs->FindPreference(kPrefTranslateLanguageBlacklist)) user_prefs->RegisterListPref(kPrefTranslateLanguageBlacklist, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); if (!user_prefs->FindPreference(kPrefTranslateSiteBlacklist)) user_prefs->RegisterListPref(kPrefTranslateSiteBlacklist, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); if (!user_prefs->FindPreference(kPrefTranslateWhitelists)) { user_prefs->RegisterDictionaryPref(kPrefTranslateWhitelists, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); MigrateTranslateWhitelists(user_prefs); } if (!user_prefs->FindPreference(kPrefTranslateDeniedCount)) user_prefs->RegisterDictionaryPref(kPrefTranslateDeniedCount, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); if (!user_prefs->FindPreference(kPrefTranslateAcceptedCount)) user_prefs->RegisterDictionaryPref(kPrefTranslateAcceptedCount, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); } // TranslatePrefs: private, static: -------------------------------------------- diff --git a/chrome/browser/translate/translate_prefs.h b/chrome/browser/translate/translate_prefs.h index 8b757e6..0cb7d8b 100644 --- a/chrome/browser/translate/translate_prefs.h +++ b/chrome/browser/translate/translate_prefs.h @@ -10,6 +10,7 @@ #include "googleurl/src/gurl.h" class PrefService; +class PrefServiceSyncable; namespace base { class DictionaryValue; @@ -59,7 +60,7 @@ class TranslatePrefs { const std::string& original_language, const GURL& url); static bool ShouldAutoTranslate(PrefService* user_prefs, const std::string& original_language, std::string* target_language); - static void RegisterUserPrefs(PrefService* user_prefs); + static void RegisterUserPrefs(PrefServiceSyncable* user_prefs); private: static void MigrateTranslateWhitelists(PrefService* user_prefs); diff --git a/chrome/browser/ui/alternate_error_tab_observer.cc b/chrome/browser/ui/alternate_error_tab_observer.cc index 6bac4c3..bf52586 100644 --- a/chrome/browser/ui/alternate_error_tab_observer.cc +++ b/chrome/browser/ui/alternate_error_tab_observer.cc @@ -22,7 +22,7 @@ AlternateErrorPageTabObserver::AlternateErrorPageTabObserver( WebContents* web_contents) : content::WebContentsObserver(web_contents), profile_(Profile::FromBrowserContext(web_contents->GetBrowserContext())) { - PrefService* prefs = profile_->GetPrefs(); + PrefServiceSyncable* prefs = profile_->GetPrefs(); if (prefs) { pref_change_registrar_.Init(prefs); pref_change_registrar_.Add( @@ -40,9 +40,10 @@ AlternateErrorPageTabObserver::~AlternateErrorPageTabObserver() { } // static -void AlternateErrorPageTabObserver::RegisterUserPrefs(PrefService* prefs) { +void AlternateErrorPageTabObserver::RegisterUserPrefs( + PrefServiceSyncable* prefs) { prefs->RegisterBooleanPref(prefs::kAlternateErrorPagesEnabled, true, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); } //////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/ui/alternate_error_tab_observer.h b/chrome/browser/ui/alternate_error_tab_observer.h index 9a933b4..df4e174 100644 --- a/chrome/browser/ui/alternate_error_tab_observer.h +++ b/chrome/browser/ui/alternate_error_tab_observer.h @@ -22,7 +22,7 @@ class AlternateErrorPageTabObserver public: virtual ~AlternateErrorPageTabObserver(); - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); private: explicit AlternateErrorPageTabObserver(content::WebContents* web_contents); diff --git a/chrome/browser/ui/app_list/extension_app_item.cc b/chrome/browser/ui/app_list/extension_app_item.cc index 2a392b5..817fdad 100644 --- a/chrome/browser/ui/app_list/extension_app_item.cc +++ b/chrome/browser/ui/app_list/extension_app_item.cc @@ -13,6 +13,7 @@ #include "chrome/browser/extensions/extension_uninstall_dialog.h" #include "chrome/browser/extensions/management_policy.h" #include "chrome/browser/prefs/incognito_mode_prefs.h" +#include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/app_list/app_list_controller.h" #include "chrome/browser/ui/browser.h" diff --git a/chrome/browser/ui/ash/chrome_launcher_prefs.cc b/chrome/browser/ui/ash/chrome_launcher_prefs.cc index 985e3e5..74d1359 100644 --- a/chrome/browser/ui/ash/chrome_launcher_prefs.cc +++ b/chrome/browser/ui/ash/chrome_launcher_prefs.cc @@ -41,29 +41,29 @@ extern const char kShelfAlignmentBottom[] = "Bottom"; extern const char kShelfAlignmentLeft[] = "Left"; extern const char kShelfAlignmentRight[] = "Right"; -void RegisterChromeLauncherUserPrefs(PrefService* user_prefs) { +void RegisterChromeLauncherUserPrefs(PrefServiceSyncable* user_prefs) { // TODO: If we want to support multiple profiles this will likely need to be // pushed to local state and we'll need to track profile per item. user_prefs->RegisterListPref(prefs::kPinnedLauncherApps, CreateDefaultPinnedAppsList(), - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); user_prefs->RegisterStringPref(prefs::kShelfAutoHideBehavior, kShelfAutoHideBehaviorNever, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); user_prefs->RegisterStringPref(prefs::kShelfAutoHideBehaviorLocal, std::string(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); user_prefs->RegisterStringPref(prefs::kShelfAlignment, kShelfAlignmentBottom, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); user_prefs->RegisterStringPref(prefs::kShelfAlignmentLocal, std::string(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); user_prefs->RegisterBooleanPref(prefs::kShowLogoutButtonInTray, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); user_prefs->RegisterDictionaryPref(prefs::kShelfPreferences, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } base::DictionaryValue* CreateAppDict(const std::string& app_id) { diff --git a/chrome/browser/ui/ash/chrome_launcher_prefs.h b/chrome/browser/ui/ash/chrome_launcher_prefs.h index f92003e..6782306 100644 --- a/chrome/browser/ui/ash/chrome_launcher_prefs.h +++ b/chrome/browser/ui/ash/chrome_launcher_prefs.h @@ -7,7 +7,7 @@ #include <string> -class PrefService; +class PrefServiceSyncable; namespace base { class DictionaryValue; @@ -28,7 +28,7 @@ extern const char kShelfAlignmentBottom[]; extern const char kShelfAlignmentLeft[]; extern const char kShelfAlignmentRight[]; -void RegisterChromeLauncherUserPrefs(PrefService* user_prefs); +void RegisterChromeLauncherUserPrefs(PrefServiceSyncable* user_prefs); base::DictionaryValue* CreateAppDict(const std::string& app_id); diff --git a/chrome/browser/ui/ash/event_rewriter_unittest.cc b/chrome/browser/ui/ash/event_rewriter_unittest.cc index 94bc064..4887884 100644 --- a/chrome/browser/ui/ash/event_rewriter_unittest.cc +++ b/chrome/browser/ui/ash/event_rewriter_unittest.cc @@ -331,7 +331,7 @@ TEST_F(EventRewriterTest, TestDeviceAddedOrRemoved) { #if defined(OS_CHROMEOS) TEST_F(EventRewriterTest, TestRewriteCommandToControl) { // First, test with a PC keyboard. - TestingPrefService prefs; + TestingPrefServiceSyncable prefs; EventRewriter rewriter; rewriter.DeviceAddedForTesting(0, "PC Keyboard"); rewriter.set_last_device_id_for_testing(0); @@ -485,7 +485,7 @@ TEST_F(EventRewriterTest, TestRewriteCommandToControl) { // For crbug.com/133896. TEST_F(EventRewriterTest, TestRewriteCommandToControlWithControlRemapped) { // Remap Control to Alt. - TestingPrefService prefs; + TestingPrefServiceSyncable prefs; chromeos::Preferences::RegisterUserPrefs(&prefs); IntegerPrefMember control; control.Init(prefs::kLanguageRemapControlKeyTo, &prefs); @@ -546,7 +546,7 @@ TEST_F(EventRewriterTest, TestRewriteCommandToControlWithControlRemapped) { } TEST_F(EventRewriterTest, TestRewriteNumPadKeys) { - TestingPrefService prefs; + TestingPrefServiceSyncable prefs; EventRewriter rewriter; rewriter.set_pref_service_for_testing(&prefs); @@ -875,7 +875,7 @@ TEST_F(EventRewriterTest, TestRewriteNumPadKeys) { // Tests if the rewriter can handle a Command + Num Pad event. TEST_F(EventRewriterTest, TestRewriteNumPadKeysOnAppleKeyboard) { - TestingPrefService prefs; + TestingPrefServiceSyncable prefs; EventRewriter rewriter; rewriter.DeviceAddedForTesting(0, "Apple Keyboard"); rewriter.set_last_device_id_for_testing(0); @@ -913,7 +913,7 @@ TEST_F(EventRewriterTest, TestRewriteNumPadKeysOnAppleKeyboard) { } TEST_F(EventRewriterTest, TestRewriteModifiersNoRemap) { - TestingPrefService prefs; + TestingPrefServiceSyncable prefs; EventRewriter rewriter; rewriter.set_pref_service_for_testing(&prefs); @@ -1004,7 +1004,7 @@ TEST_F(EventRewriterTest, TestRewriteModifiersNoRemap) { } TEST_F(EventRewriterTest, TestRewriteModifiersNoRemapMultipleKeys) { - TestingPrefService prefs; + TestingPrefServiceSyncable prefs; EventRewriter rewriter; rewriter.set_pref_service_for_testing(&prefs); @@ -1085,7 +1085,7 @@ TEST_F(EventRewriterTest, TestRewriteModifiersNoRemapMultipleKeys) { TEST_F(EventRewriterTest, TestRewriteModifiersDisableSome) { // Disable Search and Control keys. - TestingPrefService prefs; + TestingPrefServiceSyncable prefs; chromeos::Preferences::RegisterUserPrefs(&prefs); IntegerPrefMember search; search.Init(prefs::kLanguageRemapSearchKeyTo, &prefs); @@ -1223,7 +1223,7 @@ TEST_F(EventRewriterTest, TestRewriteModifiersDisableSome) { TEST_F(EventRewriterTest, TestRewriteModifiersRemapToControl) { // Remap Search to Control. - TestingPrefService prefs; + TestingPrefServiceSyncable prefs; chromeos::Preferences::RegisterUserPrefs(&prefs); IntegerPrefMember search; search.Init(prefs::kLanguageRemapSearchKeyTo, &prefs); @@ -1343,7 +1343,7 @@ TEST_F(EventRewriterTest, TestRewriteModifiersRemapToControl) { TEST_F(EventRewriterTest, TestRewriteModifiersRemapMany) { // Remap Search to Alt. - TestingPrefService prefs; + TestingPrefServiceSyncable prefs; chromeos::Preferences::RegisterUserPrefs(&prefs); IntegerPrefMember search; search.Init(prefs::kLanguageRemapSearchKeyTo, &prefs); @@ -1455,7 +1455,7 @@ TEST_F(EventRewriterTest, TestRewriteModifiersRemapMany) { TEST_F(EventRewriterTest, TestRewriteModifiersRemapToCapsLock) { // Remap Search to Caps Lock. - TestingPrefService prefs; + TestingPrefServiceSyncable prefs; chromeos::Preferences::RegisterUserPrefs(&prefs); IntegerPrefMember search; search.Init(prefs::kLanguageRemapSearchKeyTo, &prefs); @@ -1571,7 +1571,7 @@ TEST_F(EventRewriterTest, DISABLED_TestRewriteCapsLock) { // support F16 (i.e. 'XKeysymToKeycode(display_, XF86XK_Launch7)' call). // TODO(yusukes): Reenable the test once build servers are upgraded. - TestingPrefService prefs; + TestingPrefServiceSyncable prefs; chromeos::Preferences::RegisterUserPrefs(&prefs); chromeos::input_method::MockXKeyboard xkeyboard; @@ -1598,7 +1598,7 @@ TEST_F(EventRewriterTest, DISABLED_TestRewriteCapsLock) { TEST_F(EventRewriterTest, DISABLED_TestRewriteCapsLockWithFlag) { // TODO(yusukes): Reenable the test once build servers are upgraded. - TestingPrefService prefs; + TestingPrefServiceSyncable prefs; chromeos::Preferences::RegisterUserPrefs(&prefs); chromeos::input_method::MockXKeyboard xkeyboard; @@ -1630,7 +1630,7 @@ TEST_F(EventRewriterTest, DISABLED_TestRewriteCapsLockWithFlag) { } TEST_F(EventRewriterTest, TestRewriteCapsLockToControl) { - TestingPrefService prefs; + TestingPrefServiceSyncable prefs; chromeos::Preferences::RegisterUserPrefs(&prefs); IntegerPrefMember control; control.Init(prefs::kLanguageRemapCapsLockKeyTo, &prefs); @@ -1685,7 +1685,7 @@ TEST_F(EventRewriterTest, TestRewriteCapsLockToControl) { TEST_F(EventRewriterTest, DISABLED_TestRewriteCapsLockToControlWithFlag) { // TODO(yusukes): Reenable the test once build servers are upgraded. - TestingPrefService prefs; + TestingPrefServiceSyncable prefs; chromeos::Preferences::RegisterUserPrefs(&prefs); IntegerPrefMember control; control.Init(prefs::kLanguageRemapCapsLockKeyTo, &prefs); @@ -1731,7 +1731,7 @@ TEST_F(EventRewriterTest, DISABLED_TestRewriteCapsLockToControlWithFlag) { TEST_F(EventRewriterTest, TestRewriteCapsLockMod3InUse) { // Remap CapsLock to Control. - TestingPrefService prefs; + TestingPrefServiceSyncable prefs; chromeos::Preferences::RegisterUserPrefs(&prefs); IntegerPrefMember control; control.Init(prefs::kLanguageRemapCapsLockKeyTo, &prefs); @@ -1760,7 +1760,7 @@ TEST_F(EventRewriterTest, TestRewriteCapsLockMod3InUse) { } TEST_F(EventRewriterTest, TestRewriteExtendedKeys) { - TestingPrefService prefs; + TestingPrefServiceSyncable prefs; chromeos::Preferences::RegisterUserPrefs(&prefs); EventRewriter rewriter; rewriter.set_pref_service_for_testing(&prefs); @@ -1904,7 +1904,7 @@ TEST_F(EventRewriterTest, TestRewriteExtendedKeys) { TEST_F(EventRewriterTest, TestRewriteFunctionKeys) { const CommandLine original_cl(*CommandLine::ForCurrentProcess()); - TestingPrefService prefs; + TestingPrefServiceSyncable prefs; chromeos::Preferences::RegisterUserPrefs(&prefs); EventRewriter rewriter; rewriter.set_pref_service_for_testing(&prefs); @@ -2123,7 +2123,7 @@ TEST_F(EventRewriterTest, TestRewriteExtendedKeysWithSearchRemapped) { const CommandLine original_cl(*CommandLine::ForCurrentProcess()); // Remap Search to Control. - TestingPrefService prefs; + TestingPrefServiceSyncable prefs; chromeos::Preferences::RegisterUserPrefs(&prefs); IntegerPrefMember search; search.Init(prefs::kLanguageRemapSearchKeyTo, &prefs); @@ -2168,7 +2168,7 @@ TEST_F(EventRewriterTest, TestRewriteExtendedKeysWithSearchRemapped) { TEST_F(EventRewriterTest, TestRewriteKeyEventSentByXSendEvent) { // Remap Control to Alt. - TestingPrefService prefs; + TestingPrefServiceSyncable prefs; chromeos::Preferences::RegisterUserPrefs(&prefs); IntegerPrefMember control; control.Init(prefs::kLanguageRemapControlKeyTo, &prefs); diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app.cc index e8f17ec..1c36328 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app.cc @@ -131,7 +131,7 @@ std::string GetPrefForRootWindow(PrefService* pref_service, // If prefs have synced and no user-set value exists at |local_path|, the value // from |synced_path| is copied to |local_path|. -void MaybePropagatePrefToLocal(PrefService* pref_service, +void MaybePropagatePrefToLocal(PrefServiceSyncable* pref_service, const char* local_path, const char* synced_path) { if (!pref_service->FindPreference(local_path)->HasUserSetting() && @@ -222,7 +222,7 @@ void ChromeLauncherControllerPerApp::Init() { if (ash::Shell::HasInstance()) { SetShelfAutoHideBehaviorFromPrefs(); SetShelfAlignmentFromPrefs(); - PrefService* prefs = profile_->GetPrefs(); + PrefServiceSyncable* prefs = profile_->GetPrefs(); if (!prefs->FindPreference(prefs::kShelfAlignmentLocal)->HasUserSetting() || !prefs->FindPreference(prefs::kShelfAutoHideBehaviorLocal)-> HasUserSetting()) { diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser.cc index bc6da1c..3ed39a3 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser.cc @@ -191,7 +191,7 @@ std::string GetPrefForRootWindow(PrefService* pref_service, // If prefs have synced and no user-set value exists at |local_path|, the value // from |synced_path| is copied to |local_path|. -void MaybePropagatePrefToLocal(PrefService* pref_service, +void MaybePropagatePrefToLocal(PrefServiceSyncable* pref_service, const char* local_path, const char* synced_path) { if (!pref_service->FindPreference(local_path)->HasUserSetting() && @@ -280,7 +280,7 @@ void ChromeLauncherControllerPerBrowser::Init() { if (ash::Shell::HasInstance()) { SetShelfAutoHideBehaviorFromPrefs(); SetShelfAlignmentFromPrefs(); - PrefService* prefs = profile_->GetPrefs(); + PrefServiceSyncable* prefs = profile_->GetPrefs(); if (!prefs->FindPreference(prefs::kShelfAlignmentLocal)->HasUserSetting() || !prefs->FindPreference(prefs::kShelfAutoHideBehaviorLocal)-> HasUserSetting()) { diff --git a/chrome/browser/ui/ash/launcher/launcher_context_menu.cc b/chrome/browser/ui/ash/launcher/launcher_context_menu.cc index 4b7801f..54c780ee 100644 --- a/chrome/browser/ui/ash/launcher/launcher_context_menu.cc +++ b/chrome/browser/ui/ash/launcher/launcher_context_menu.cc @@ -13,6 +13,7 @@ #include "chrome/browser/extensions/context_menu_matcher.h" #include "chrome/browser/extensions/extension_prefs.h" #include "chrome/browser/prefs/incognito_mode_prefs.h" +#include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" #include "chrome/common/chrome_switches.h" diff --git a/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.cc b/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.cc index 40a1fca..930fa00 100644 --- a/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.cc +++ b/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.cc @@ -12,6 +12,7 @@ #include "chrome/browser/bookmarks/bookmark_model_factory.h" #include "chrome/browser/bookmarks/bookmark_utils.h" #include "chrome/browser/prefs/incognito_mode_prefs.h" +#include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/bookmarks/bookmark_utils.h" #include "chrome/browser/ui/browser.h" diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc index 8af2399..16a5e9e 100644 --- a/chrome/browser/ui/browser_browsertest.cc +++ b/chrome/browser/ui/browser_browsertest.cc @@ -19,6 +19,7 @@ #include "chrome/browser/extensions/tab_helper.h" #include "chrome/browser/first_run/first_run.h" #include "chrome/browser/prefs/incognito_mode_prefs.h" +#include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/sessions/session_backend.h" diff --git a/chrome/browser/ui/browser_instant_controller.cc b/chrome/browser/ui/browser_instant_controller.cc index 8478f27..7abe3aa 100644 --- a/chrome/browser/ui/browser_instant_controller.cc +++ b/chrome/browser/ui/browser_instant_controller.cc @@ -69,13 +69,13 @@ bool BrowserInstantController::IsInstantEnabled(Profile* profile) { profile->GetPrefs()->GetBoolean(GetInstantPrefName(profile)); } -void BrowserInstantController::RegisterUserPrefs(PrefService* prefs) { +void BrowserInstantController::RegisterUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterBooleanPref(prefs::kInstantConfirmDialogShown, false, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kInstantExtendedEnabled, true, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kInstantEnabled, false, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); } bool BrowserInstantController::OpenInstant(WindowOpenDisposition disposition) { diff --git a/chrome/browser/ui/browser_instant_controller.h b/chrome/browser/ui/browser_instant_controller.h index 570c334..f27d7e0 100644 --- a/chrome/browser/ui/browser_instant_controller.h +++ b/chrome/browser/ui/browser_instant_controller.h @@ -17,7 +17,7 @@ class Browser; struct InstantSuggestion; -class PrefService; +class PrefServiceSyncable; class Profile; class ThemeService; @@ -41,7 +41,7 @@ class BrowserInstantController : public content::NotificationObserver, static bool IsInstantEnabled(Profile* profile); // Registers Instant related preferences. - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); // Commits the current Instant, returning true on success. This is intended // for use from OpenCurrentURL. diff --git a/chrome/browser/ui/browser_ui_prefs.cc b/chrome/browser/ui/browser_ui_prefs.cc index 206d6d7..6e945e4 100644 --- a/chrome/browser/ui/browser_ui_prefs.cc +++ b/chrome/browser/ui/browser_ui_prefs.cc @@ -11,26 +11,26 @@ namespace chrome { -void RegisterBrowserPrefs(PrefService* prefs) { +void RegisterBrowserPrefs(PrefServiceSimple* prefs) { prefs->RegisterIntegerPref(prefs::kOptionsWindowLastTabIndex, 0); prefs->RegisterBooleanPref(prefs::kAllowFileSelectionDialogs, true); prefs->RegisterIntegerPref(prefs::kShowFirstRunBubbleOption, first_run::FIRST_RUN_BUBBLE_DONT_SHOW); } -void RegisterBrowserUserPrefs(PrefService* prefs) { +void RegisterBrowserUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterBooleanPref(prefs::kHomePageChanged, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kHomePageIsNewTabPage, true, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kShowHomeButton, false, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterIntegerPref(prefs::kExtensionsSideloadWipeoutBubbleShown, 0, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); #if defined(OS_MACOSX) // This really belongs in platform code, but there's no good place to // initialize it between the time when the AppController is created @@ -42,126 +42,132 @@ void RegisterBrowserUserPrefs(PrefService* prefs) { // that use this preference. prefs->RegisterBooleanPref(prefs::kShowUpdatePromotionInfoBar, true, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); #endif prefs->RegisterBooleanPref(prefs::kDeleteBrowsingHistory, true, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kDeleteDownloadHistory, true, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kDeleteCache, true, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kDeleteCookies, true, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kDeletePasswords, false, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kDeleteFormData, false, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kDeleteHostedAppsData, false, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterIntegerPref(prefs::kDeleteTimePeriod, 0, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kCheckDefaultBrowser, true, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); #if defined(OS_WIN) // As with Mac-spacific code above, it should be in a platform-specific // section somewhere, but there is no good place for it. prefs->RegisterBooleanPref(prefs::kSuppressSwitchToMetroModeOnSetDefault, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); #endif prefs->RegisterBooleanPref(prefs::kShowOmniboxSearchHint, true, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kWebAppCreateOnDesktop, true, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kWebAppCreateInAppsMenu, true, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kWebAppCreateInQuickLaunchBar, true, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kEnableTranslate, true, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterStringPref(prefs::kCloudPrintEmail, std::string(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kCloudPrintProxyEnabled, true, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kCloudPrintSubmitEnabled, true, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kDevToolsDisabled, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterIntegerPref(prefs::kDevToolsHSplitLocation, -1, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterIntegerPref(prefs::kDevToolsVSplitLocation, -1, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDictionaryPref(prefs::kBrowserWindowPlacement, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDictionaryPref(prefs::kPreferencesWindowPlacement, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kImportBookmarks, true, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kImportHistory, true, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kImportHomepage, true, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kImportSearchEngine, true, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kImportSavedPasswords, true, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kEnableDoNotTrack, false, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); // Dictionaries to keep track of default tasks in the file browser. prefs->RegisterDictionaryPref(prefs::kDefaultTasksByMimeType, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterDictionaryPref(prefs::kDefaultTasksBySuffix, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); // We need to register the type of these preferences in order to query // them even though they're only typically controlled via policy. prefs->RegisterBooleanPref(prefs::kPluginsAllowOutdated, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kPluginsAlwaysAuthorize, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kClearPluginLSODataEnabled, true, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } void RegisterAppPrefs(const std::string& app_name, Profile* profile) { // We need to register the window position pref. + // + // TODO(mnissler): Use a separate pref name pointing to a single + // dictionary instead. Also tracked as http://crbug.com/167256 std::string window_pref(prefs::kBrowserWindowPlacement); window_pref.append("_"); window_pref.append(app_name); - PrefService* prefs = profile->GetPrefs(); + PrefServiceSyncable* prefs = profile->GetPrefs(); if (!prefs->FindPreference(window_pref.c_str())) { + // TODO(joi): Switch to official way of registering local prefs + // for this class, i.e. in a function called from + // browser_prefs::RegisterUserPrefs. prefs->RegisterDictionaryPref(window_pref.c_str(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } } diff --git a/chrome/browser/ui/browser_ui_prefs.h b/chrome/browser/ui/browser_ui_prefs.h index 92e44ae0f..6cef126 100644 --- a/chrome/browser/ui/browser_ui_prefs.h +++ b/chrome/browser/ui/browser_ui_prefs.h @@ -7,13 +7,14 @@ #include <string> -class PrefService; +class PrefServiceSimple; +class PrefServiceSyncable; class Profile; namespace chrome { -void RegisterBrowserPrefs(PrefService* prefs); -void RegisterBrowserUserPrefs(PrefService* prefs); +void RegisterBrowserPrefs(PrefServiceSimple* prefs); +void RegisterBrowserUserPrefs(PrefServiceSyncable* prefs); // Create a preference dictionary for the provided application name, in the // given user profile. This is done only once per application name / per diff --git a/chrome/browser/ui/browser_view_prefs.cc b/chrome/browser/ui/browser_view_prefs.cc index c62ec24..1872f9d 100644 --- a/chrome/browser/ui/browser_view_prefs.cc +++ b/chrome/browser/ui/browser_view_prefs.cc @@ -19,7 +19,7 @@ const int kDefaultHungPluginDetectFrequency = 2000; namespace chrome { -void RegisterBrowserViewPrefs(PrefService* prefs) { +void RegisterBrowserViewPrefs(PrefServiceSimple* prefs) { prefs->RegisterIntegerPref(prefs::kPluginMessageResponseTimeout, kDefaultPluginMessageResponseTimeout); prefs->RegisterIntegerPref(prefs::kHungPluginDetectFrequency, diff --git a/chrome/browser/ui/browser_view_prefs.h b/chrome/browser/ui/browser_view_prefs.h index 214aafd..71905f5 100644 --- a/chrome/browser/ui/browser_view_prefs.h +++ b/chrome/browser/ui/browser_view_prefs.h @@ -5,12 +5,12 @@ #ifndef CHROME_BROWSER_UI_BROWSER_VIEW_PREFS_H_ #define CHROME_BROWSER_UI_BROWSER_VIEW_PREFS_H_ -class PrefService; +class PrefServiceSimple; namespace chrome { // Register local state preferences specific to BrowserView. -void RegisterBrowserViewPrefs(PrefService* prefs); +void RegisterBrowserViewPrefs(PrefServiceSimple* prefs); } // namespace chrome diff --git a/chrome/browser/ui/cocoa/confirm_quit.h b/chrome/browser/ui/cocoa/confirm_quit.h index c2b43e7..4246155 100644 --- a/chrome/browser/ui/cocoa/confirm_quit.h +++ b/chrome/browser/ui/cocoa/confirm_quit.h @@ -5,7 +5,7 @@ #ifndef CHROME_BROWSER_UI_COCOA_CONFIRM_QUIT_H_ #define CHROME_BROWSER_UI_COCOA_CONFIRM_QUIT_H_ -class PrefService; +class PrefServiceSimple; namespace confirm_quit { @@ -26,7 +26,7 @@ enum ConfirmQuitMetric { void RecordHistogram(ConfirmQuitMetric sample); // Registers the preference in app-wide local state. -void RegisterLocalState(PrefService* local_state); +void RegisterLocalState(PrefServiceSimple* local_state); } // namespace confirm_quit diff --git a/chrome/browser/ui/cocoa/confirm_quit_panel_controller.mm b/chrome/browser/ui/cocoa/confirm_quit_panel_controller.mm index 86f8ca5..051a04e 100644 --- a/chrome/browser/ui/cocoa/confirm_quit_panel_controller.mm +++ b/chrome/browser/ui/cocoa/confirm_quit_panel_controller.mm @@ -45,7 +45,7 @@ void RecordHistogram(ConfirmQuitMetric sample) { UMA_HISTOGRAM_ENUMERATION("OSX.ConfirmToQuit", sample, kSampleCount); } -void RegisterLocalState(PrefService* local_state) { +void RegisterLocalState(PrefServiceSimple* local_state) { local_state->RegisterBooleanPref(prefs::kConfirmToQuitEnabled, false); } diff --git a/chrome/browser/ui/cocoa/extensions/browser_actions_controller.h b/chrome/browser/ui/cocoa/extensions/browser_actions_controller.h index fe66cdb..d33dbec 100644 --- a/chrome/browser/ui/cocoa/extensions/browser_actions_controller.h +++ b/chrome/browser/ui/cocoa/extensions/browser_actions_controller.h @@ -17,7 +17,7 @@ class Browser; class ExtensionToolbarModel; class ExtensionServiceObserverBridge; @class MenuButton; -class PrefService; +class PrefServiceSyncable; class Profile; namespace extensions { @@ -106,7 +106,7 @@ extern NSString* const kBrowserActionVisibilityChangedNotification; - (BOOL)chevronIsHidden; // Registers the user preferences used by this class. -+ (void)registerUserPrefs:(PrefService*)prefs; ++ (void)registerUserPrefs:(PrefServiceSyncable*)prefs; @end // @interface BrowserActionsController diff --git a/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm b/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm index 97e3a14..3bc1b74 100644 --- a/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm +++ b/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm @@ -440,10 +440,10 @@ class ExtensionServiceObserverBridge : public content::NotificationObserver, return YES; } -+ (void)registerUserPrefs:(PrefService*)prefs { ++ (void)registerUserPrefs:(PrefServiceSyncable*)prefs { prefs->RegisterDoublePref(prefs::kBrowserActionContainerWidth, 0, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } #pragma mark - diff --git a/chrome/browser/ui/cocoa/task_manager_mac.mm b/chrome/browser/ui/cocoa/task_manager_mac.mm index eecee3e..7b05e09 100644 --- a/chrome/browser/ui/cocoa/task_manager_mac.mm +++ b/chrome/browser/ui/cocoa/task_manager_mac.mm @@ -11,6 +11,7 @@ #include "base/mac/mac_util.h" #include "base/sys_string_conversions.h" #include "chrome/browser/browser_process.h" +#include "chrome/browser/prefs/pref_service.h" #import "chrome/browser/ui/cocoa/window_size_autosaver.h" #include "chrome/browser/ui/host_desktop.h" #include "chrome/common/pref_names.h" diff --git a/chrome/browser/ui/cocoa/window_size_autosaver_unittest.mm b/chrome/browser/ui/cocoa/window_size_autosaver_unittest.mm index fc0decc..bfb6481 100644 --- a/chrome/browser/ui/cocoa/window_size_autosaver_unittest.mm +++ b/chrome/browser/ui/cocoa/window_size_autosaver_unittest.mm @@ -27,7 +27,7 @@ class WindowSizeAutosaverTest : public CocoaProfileTest { defer:NO]; profile()->GetPrefs()->RegisterDictionaryPref( path_, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } virtual void TearDown() { diff --git a/chrome/browser/ui/gesture_prefs_observer_factory_aura.cc b/chrome/browser/ui/gesture_prefs_observer_factory_aura.cc index 3fceda0..e27a148 100644 --- a/chrome/browser/ui/gesture_prefs_observer_factory_aura.cc +++ b/chrome/browser/ui/gesture_prefs_observer_factory_aura.cc @@ -222,7 +222,7 @@ ProfileKeyedService* GesturePrefsObserverFactoryAura::BuildServiceInstanceFor( } void GesturePrefsObserverFactoryAura::RegisterOverscrollPrefs( - PrefService* prefs) { + PrefServiceSyncable* prefs) { const OverscrollPref* overscroll_prefs = GesturePrefsObserver::GetOverscrollPrefs(); @@ -230,114 +230,115 @@ void GesturePrefsObserverFactoryAura::RegisterOverscrollPrefs( prefs->RegisterDoublePref( overscroll_prefs[i].pref_name, content::GetOverscrollConfig(overscroll_prefs[i].config), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } } -void GesturePrefsObserverFactoryAura::RegisterUserPrefs(PrefService* prefs) { +void GesturePrefsObserverFactoryAura::RegisterUserPrefs( + PrefServiceSyncable* prefs) { prefs->RegisterDoublePref( prefs::kFlingAccelerationCurveCoefficient0, GestureConfiguration::fling_acceleration_curve_coefficients(0), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDoublePref( prefs::kFlingAccelerationCurveCoefficient1, GestureConfiguration::fling_acceleration_curve_coefficients(1), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDoublePref( prefs::kFlingAccelerationCurveCoefficient2, GestureConfiguration::fling_acceleration_curve_coefficients(2), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDoublePref( prefs::kFlingAccelerationCurveCoefficient3, GestureConfiguration::fling_acceleration_curve_coefficients(3), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDoublePref( prefs::kFlingVelocityCap, GestureConfiguration::fling_velocity_cap(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDoublePref( prefs::kLongPressTimeInSeconds, GestureConfiguration::long_press_time_in_seconds(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDoublePref( prefs::kSemiLongPressTimeInSeconds, GestureConfiguration::semi_long_press_time_in_seconds(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDoublePref( prefs::kMaxDistanceForTwoFingerTapInPixels, GestureConfiguration::max_distance_for_two_finger_tap_in_pixels(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDoublePref( prefs::kMaxSecondsBetweenDoubleClick, GestureConfiguration::max_seconds_between_double_click(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDoublePref( prefs::kMaxSeparationForGestureTouchesInPixels, GestureConfiguration::max_separation_for_gesture_touches_in_pixels(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDoublePref( prefs::kMaxSwipeDeviationRatio, GestureConfiguration::max_swipe_deviation_ratio(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDoublePref( prefs::kMaxTouchDownDurationInSecondsForClick, GestureConfiguration::max_touch_down_duration_in_seconds_for_click(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDoublePref( prefs::kMaxTouchMoveInPixelsForClick, GestureConfiguration::max_touch_move_in_pixels_for_click(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDoublePref( prefs::kMaxDistanceBetweenTapsForDoubleTap, GestureConfiguration::max_distance_between_taps_for_double_tap(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDoublePref( prefs::kMinDistanceForPinchScrollInPixels, GestureConfiguration::min_distance_for_pinch_scroll_in_pixels(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDoublePref( prefs::kMinFlickSpeedSquared, GestureConfiguration::min_flick_speed_squared(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDoublePref( prefs::kMinPinchUpdateDistanceInPixels, GestureConfiguration::min_pinch_update_distance_in_pixels(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDoublePref( prefs::kMinRailBreakVelocity, GestureConfiguration::min_rail_break_velocity(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDoublePref( prefs::kMinScrollDeltaSquared, GestureConfiguration::min_scroll_delta_squared(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDoublePref( prefs::kMinSwipeSpeed, GestureConfiguration::min_swipe_speed(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDoublePref( prefs::kMinTouchDownDurationInSecondsForClick, GestureConfiguration::min_touch_down_duration_in_seconds_for_click(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterIntegerPref( prefs::kPointsBufferedForVelocity, GestureConfiguration::points_buffered_for_velocity(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDoublePref( prefs::kRailBreakProportion, GestureConfiguration::rail_break_proportion(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDoublePref( prefs::kRailStartProportion, GestureConfiguration::rail_start_proportion(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); // TODO(rjkroege): Remove this in M29. http://crbug.com/160243. const char kTouchScreenFlingAccelerationAdjustment[] = "gesture.touchscreen_fling_acceleration_adjustment"; prefs->RegisterDoublePref(kTouchScreenFlingAccelerationAdjustment, 0.0, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->ClearPref(kTouchScreenFlingAccelerationAdjustment); RegisterOverscrollPrefs(prefs); diff --git a/chrome/browser/ui/gesture_prefs_observer_factory_aura.h b/chrome/browser/ui/gesture_prefs_observer_factory_aura.h index 686e0c6..9988b6e 100644 --- a/chrome/browser/ui/gesture_prefs_observer_factory_aura.h +++ b/chrome/browser/ui/gesture_prefs_observer_factory_aura.h @@ -9,7 +9,7 @@ #include "base/memory/singleton.h" #include "chrome/browser/profiles/profile_keyed_service_factory.h" -class PrefService; +class PrefServiceSyncable; class Profile; // Create an observer per Profile that listens for gesture preferences updates. @@ -23,12 +23,12 @@ class GesturePrefsObserverFactoryAura : public ProfileKeyedServiceFactory { GesturePrefsObserverFactoryAura(); virtual ~GesturePrefsObserverFactoryAura(); - void RegisterOverscrollPrefs(PrefService* prefs); + void RegisterOverscrollPrefs(PrefServiceSyncable* prefs); // ProfileKeyedServiceFactory: virtual ProfileKeyedService* BuildServiceInstanceFor( Profile* profile) const OVERRIDE; - virtual void RegisterUserPrefs(PrefService* prefs) OVERRIDE; + virtual void RegisterUserPrefs(PrefServiceSyncable* prefs) OVERRIDE; virtual bool ServiceIsCreatedWithProfile() const OVERRIDE; virtual bool ServiceRedirectedInIncognito() const OVERRIDE; virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; diff --git a/chrome/browser/ui/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc index 98be394..9805f8d 100644 --- a/chrome/browser/ui/gtk/browser_window_gtk.cc +++ b/chrome/browser/ui/gtk/browser_window_gtk.cc @@ -1496,7 +1496,7 @@ GtkWidget* BrowserWindowGtk::titlebar_widget() const { } // static -void BrowserWindowGtk::RegisterUserPrefs(PrefService* prefs) { +void BrowserWindowGtk::RegisterUserPrefs(PrefServiceSyncable* prefs) { bool custom_frame_default = false; // Avoid checking the window manager if we're not connected to an X server (as // is the case in Valgrind tests). @@ -1506,7 +1506,7 @@ void BrowserWindowGtk::RegisterUserPrefs(PrefService* prefs) { } prefs->RegisterBooleanPref(prefs::kUseCustomChromeFrame, custom_frame_default, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); } WebContents* BrowserWindowGtk::GetDisplayedTab() { diff --git a/chrome/browser/ui/gtk/browser_window_gtk.h b/chrome/browser/ui/gtk/browser_window_gtk.h index c11659a..691fff1 100644 --- a/chrome/browser/ui/gtk/browser_window_gtk.h +++ b/chrome/browser/ui/gtk/browser_window_gtk.h @@ -40,7 +40,7 @@ class GlobalMenuBar; class InfoBarContainerGtk; class InstantPreviewControllerGtk; class LocationBar; -class PrefService; +class PrefServiceSyncable; class StatusBubbleGtk; class TabContentsContainerGtk; class TabStripGtk; @@ -252,7 +252,7 @@ class BrowserWindowGtk // Returns the tab we're currently displaying in the tab contents container. content::WebContents* GetDisplayedTab(); - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); // Tells GTK that the toolbar area is invalidated and needs redrawing. We // have this method as a hack because GTK doesn't queue the toolbar area for diff --git a/chrome/browser/ui/network_profile_bubble.cc b/chrome/browser/ui/network_profile_bubble.cc index 7f1ec3c..c9abc34 100644 --- a/chrome/browser/ui/network_profile_bubble.cc +++ b/chrome/browser/ui/network_profile_bubble.cc @@ -155,13 +155,11 @@ void NetworkProfileBubble::SetNotificationShown(bool shown) { } // static -void NetworkProfileBubble::RegisterPrefs(PrefService* prefs) { - prefs->RegisterIntegerPref(prefs::kNetworkProfileWarningsLeft, - kMaxWarnings, - PrefService::UNSYNCABLE_PREF); - prefs->RegisterInt64Pref(prefs::kNetworkProfileLastWarningTime, - 0, - PrefService::UNSYNCABLE_PREF); +void NetworkProfileBubble::RegisterUserPrefs(PrefServiceSyncable* prefs) { + prefs->RegisterIntegerPref(prefs::kNetworkProfileWarningsLeft, kMaxWarnings, + PrefServiceSyncable::UNSYNCABLE_PREF); + prefs->RegisterInt64Pref(prefs::kNetworkProfileLastWarningTime, 0, + PrefServiceSyncable::UNSYNCABLE_PREF); } // static diff --git a/chrome/browser/ui/network_profile_bubble.h b/chrome/browser/ui/network_profile_bubble.h index 8edf706..7829539b 100644 --- a/chrome/browser/ui/network_profile_bubble.h +++ b/chrome/browser/ui/network_profile_bubble.h @@ -9,7 +9,7 @@ class Browser; class FilePath; -class PrefService; +class PrefServiceSyncable; class Profile; // This class will try to detect if the profile is on a network share and if @@ -55,7 +55,7 @@ class NetworkProfileBubble { static void SetNotificationShown(bool shown); // Register the pref that controls whether the bubble should be shown anymore. - static void RegisterPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); // Helper function wrapping the UMA_HISTOGRAM_ENUMERATION macro. static void RecordUmaEvent(MetricNetworkedProfileCheck event); diff --git a/chrome/browser/ui/prefs/prefs_tab_helper.cc b/chrome/browser/ui/prefs/prefs_tab_helper.cc index 78dd367..9dde066 100644 --- a/chrome/browser/ui/prefs/prefs_tab_helper.cc +++ b/chrome/browser/ui/prefs/prefs_tab_helper.cc @@ -40,59 +40,59 @@ DEFINE_WEB_CONTENTS_USER_DATA_KEY(PrefsTabHelper) namespace { // Registers prefs only used for migration. -void RegisterPrefsToMigrate(PrefService* prefs) { +void RegisterPrefsToMigrate(PrefServiceSyncable* prefs) { prefs->RegisterLocalizedStringPref(prefs::kWebKitOldStandardFontFamily, IDS_STANDARD_FONT_FAMILY, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterLocalizedStringPref(prefs::kWebKitOldFixedFontFamily, IDS_FIXED_FONT_FAMILY, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterLocalizedStringPref(prefs::kWebKitOldSerifFontFamily, IDS_SERIF_FONT_FAMILY, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterLocalizedStringPref(prefs::kWebKitOldSansSerifFontFamily, IDS_SANS_SERIF_FONT_FAMILY, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterLocalizedStringPref(prefs::kWebKitOldCursiveFontFamily, IDS_CURSIVE_FONT_FAMILY, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterLocalizedStringPref(prefs::kWebKitOldFantasyFontFamily, IDS_FANTASY_FONT_FAMILY, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterLocalizedStringPref(prefs::kGlobalDefaultCharset, IDS_DEFAULT_ENCODING, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterLocalizedIntegerPref(prefs::kWebKitGlobalDefaultFontSize, IDS_DEFAULT_FONT_SIZE, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterLocalizedIntegerPref(prefs::kWebKitGlobalDefaultFixedFontSize, IDS_DEFAULT_FIXED_FONT_SIZE, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterLocalizedIntegerPref(prefs::kWebKitGlobalMinimumFontSize, IDS_MINIMUM_FONT_SIZE, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterLocalizedIntegerPref( prefs::kWebKitGlobalMinimumLogicalFontSize, IDS_MINIMUM_LOGICAL_FONT_SIZE, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterLocalizedStringPref(prefs::kWebKitGlobalStandardFontFamily, IDS_STANDARD_FONT_FAMILY, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterLocalizedStringPref(prefs::kWebKitGlobalFixedFontFamily, IDS_FIXED_FONT_FAMILY, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterLocalizedStringPref(prefs::kWebKitGlobalSerifFontFamily, IDS_SERIF_FONT_FAMILY, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterLocalizedStringPref(prefs::kWebKitGlobalSansSerifFontFamily, IDS_SANS_SERIF_FONT_FAMILY, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterLocalizedStringPref(prefs::kWebKitGlobalCursiveFontFamily, IDS_CURSIVE_FONT_FAMILY, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterLocalizedStringPref(prefs::kWebKitGlobalFantasyFontFamily, IDS_FANTASY_FONT_FAMILY, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } // The list of prefs we want to observe. @@ -121,7 +121,7 @@ const int kPrefsToObserveLength = arraysize(kPrefsToObserve); // Registers a preference under the path |map_name| for each script used for // per-script font prefs. For example, if |map_name| is "fonts.serif", then // "fonts.serif.Arab", "fonts.serif.Hang", etc. are registered. -void RegisterFontFamilyMap(PrefService* prefs, +void RegisterFontFamilyMap(PrefServiceSyncable* prefs, const char* map_name, const std::set<std::string>& fonts_with_defaults) { for (size_t i = 0; i < prefs::kWebKitScriptsForFontFamilyMapsLength; ++i) { @@ -131,7 +131,8 @@ void RegisterFontFamilyMap(PrefService* prefs, if (fonts_with_defaults.find(pref_name) == fonts_with_defaults.end()) { // We haven't already set a default value for this font preference, so set // an empty string as the default. - prefs->RegisterStringPref(pref_name, "", PrefService::UNSYNCABLE_PREF); + prefs->RegisterStringPref( + pref_name, "", PrefServiceSyncable::UNSYNCABLE_PREF); } } } @@ -338,7 +339,7 @@ const struct { const int kPrefsToMigrateLength = ARRAYSIZE_UNSAFE(kPrefNamesToMigrate); -void MigratePreferences(PrefService* prefs) { +void MigratePreferences(PrefServiceSyncable* prefs) { RegisterPrefsToMigrate(prefs); for (int i = 0; i < kPrefsToMigrateLength; ++i) { const PrefService::Preference* pref = @@ -450,72 +451,72 @@ void PrefsTabHelper::InitIncognitoUserPrefStore( } // static -void PrefsTabHelper::RegisterUserPrefs(PrefService* prefs) { +void PrefsTabHelper::RegisterUserPrefs(PrefServiceSyncable* prefs) { WebPreferences pref_defaults; prefs->RegisterBooleanPref(prefs::kWebKitJavascriptEnabled, pref_defaults.javascript_enabled, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kWebKitWebSecurityEnabled, pref_defaults.web_security_enabled, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref( prefs::kWebKitJavascriptCanOpenWindowsAutomatically, true, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kWebKitLoadsImagesAutomatically, pref_defaults.loads_images_automatically, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kWebKitPluginsEnabled, pref_defaults.plugins_enabled, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kWebKitDomPasteEnabled, pref_defaults.dom_paste_enabled, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kWebKitShrinksStandaloneImagesToFit, pref_defaults.shrinks_standalone_images_to_fit, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDictionaryPref(prefs::kWebKitInspectorSettings, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kWebKitTextAreasAreResizable, pref_defaults.text_areas_are_resizable, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kWebKitJavaEnabled, pref_defaults.java_enabled, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kWebkitTabsToLinks, pref_defaults.tabs_to_links, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kWebKitAllowRunningInsecureContent, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kWebKitAllowDisplayingInsecureContent, true, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kEnableReferrers, true, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); #if defined(OS_ANDROID) prefs->RegisterDoublePref(prefs::kWebKitFontScaleFactor, pref_defaults.font_scale_factor, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kWebKitForceEnableZoom, pref_defaults.force_enable_zoom, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); #endif #if !defined(OS_MACOSX) prefs->RegisterLocalizedStringPref(prefs::kAcceptLanguages, IDS_ACCEPT_LANGUAGES, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); #else // Not used in OSX. prefs->RegisterLocalizedStringPref(prefs::kAcceptLanguages, IDS_ACCEPT_LANGUAGES, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); #endif prefs->RegisterLocalizedStringPref(prefs::kDefaultCharset, IDS_DEFAULT_ENCODING, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); // Register font prefs that have defaults. std::set<std::string> fonts_with_defaults; @@ -539,7 +540,7 @@ void PrefsTabHelper::RegisterUserPrefs(PrefService* prefs) { if (browser_script != pref_script) { prefs->RegisterLocalizedStringPref(pref.pref_name, pref.resource_id, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); fonts_with_defaults.insert(pref.pref_name); } } @@ -562,26 +563,26 @@ void PrefsTabHelper::RegisterUserPrefs(PrefService* prefs) { prefs->RegisterLocalizedIntegerPref(prefs::kWebKitDefaultFontSize, IDS_DEFAULT_FONT_SIZE, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterLocalizedIntegerPref(prefs::kWebKitDefaultFixedFontSize, IDS_DEFAULT_FIXED_FONT_SIZE, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterLocalizedIntegerPref(prefs::kWebKitMinimumFontSize, IDS_MINIMUM_FONT_SIZE, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterLocalizedIntegerPref( prefs::kWebKitMinimumLogicalFontSize, IDS_MINIMUM_LOGICAL_FONT_SIZE, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterLocalizedBooleanPref(prefs::kWebKitUsesUniversalDetector, IDS_USES_UNIVERSAL_DETECTOR, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); prefs->RegisterLocalizedStringPref(prefs::kStaticEncodings, IDS_STATIC_ENCODING_LIST, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterStringPref(prefs::kRecentlySelectedEncoding, "", - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); MigratePreferences(prefs); } diff --git a/chrome/browser/ui/prefs/prefs_tab_helper.h b/chrome/browser/ui/prefs/prefs_tab_helper.h index cfb808b..f2a3d3e 100644 --- a/chrome/browser/ui/prefs/prefs_tab_helper.h +++ b/chrome/browser/ui/prefs/prefs_tab_helper.h @@ -12,7 +12,7 @@ #include "content/public/browser/web_contents_user_data.h" class OverlayUserPrefStore; -class PrefService; +class PrefServiceSyncable; class Profile; namespace content { @@ -26,7 +26,7 @@ class PrefsTabHelper : public content::NotificationObserver, virtual ~PrefsTabHelper(); static void InitIncognitoUserPrefStore(OverlayUserPrefStore* pref_store); - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); protected: // Update the RenderView's WebPreferences. Exposed as protected for testing. diff --git a/chrome/browser/ui/search_engines/keyword_editor_controller.cc b/chrome/browser/ui/search_engines/keyword_editor_controller.cc index 6118b76..592c125 100644 --- a/chrome/browser/ui/search_engines/keyword_editor_controller.cc +++ b/chrome/browser/ui/search_engines/keyword_editor_controller.cc @@ -28,7 +28,7 @@ KeywordEditorController::~KeywordEditorController() { // static // TODO(rsesek): Other platforms besides Mac should remember window // placement. http://crbug.com/22269 -void KeywordEditorController::RegisterPrefs(PrefService* prefs) { +void KeywordEditorController::RegisterPrefs(PrefServiceSimple* prefs) { prefs->RegisterDictionaryPref(prefs::kKeywordEditorWindowPlacement); } diff --git a/chrome/browser/ui/search_engines/keyword_editor_controller.h b/chrome/browser/ui/search_engines/keyword_editor_controller.h index 7321632..912b306 100644 --- a/chrome/browser/ui/search_engines/keyword_editor_controller.h +++ b/chrome/browser/ui/search_engines/keyword_editor_controller.h @@ -11,7 +11,7 @@ #include "base/memory/scoped_ptr.h" #include "base/string16.h" -class PrefService; +class PrefServiceSimple; class Profile; class TemplateURL; class TemplateURLService; @@ -22,7 +22,7 @@ class KeywordEditorController { explicit KeywordEditorController(Profile* profile); ~KeywordEditorController(); - static void RegisterPrefs(PrefService* prefs); + static void RegisterPrefs(PrefServiceSimple* prefs); // Invoked when the user succesfully fills out the add keyword dialog. // Propagates the change to the TemplateURLService and updates the table diff --git a/chrome/browser/ui/search_engines/keyword_editor_controller_unittest.cc b/chrome/browser/ui/search_engines/keyword_editor_controller_unittest.cc index 5bc0905..4c3c9d8 100644 --- a/chrome/browser/ui/search_engines/keyword_editor_controller_unittest.cc +++ b/chrome/browser/ui/search_engines/keyword_editor_controller_unittest.cc @@ -68,7 +68,7 @@ class KeywordEditorControllerTest : public testing::Test, void SimulateDefaultSearchIsManaged(const std::string& url) { ASSERT_FALSE(url.empty()); - TestingPrefService* service = profile_->GetTestingPrefService(); + TestingPrefServiceSyncable* service = profile_->GetTestingPrefService(); service->SetManagedPref(prefs::kDefaultSearchProviderEnabled, new base::FundamentalValue(true)); service->SetManagedPref(prefs::kDefaultSearchProviderSearchURL, diff --git a/chrome/browser/ui/startup/autolaunch_prompt.cc b/chrome/browser/ui/startup/autolaunch_prompt.cc index 5584998..8e97363 100644 --- a/chrome/browser/ui/startup/autolaunch_prompt.cc +++ b/chrome/browser/ui/startup/autolaunch_prompt.cc @@ -11,7 +11,7 @@ bool ShowAutolaunchPrompt(Browser* browser) { return false; } -void RegisterAutolaunchPrefs(PrefService* prefs) { +void RegisterAutolaunchUserPrefs(PrefServiceSyncable* prefs) { // Autolaunch is only implemented on Windows right now. } diff --git a/chrome/browser/ui/startup/autolaunch_prompt.h b/chrome/browser/ui/startup/autolaunch_prompt.h index 5147332..ed0ba3d 100644 --- a/chrome/browser/ui/startup/autolaunch_prompt.h +++ b/chrome/browser/ui/startup/autolaunch_prompt.h @@ -5,7 +5,7 @@ #ifndef CHROME_BROWSER_UI_STARTUP_AUTOLAUNCH_PROMPT_H_ #define CHROME_BROWSER_UI_STARTUP_AUTOLAUNCH_PROMPT_H_ -class PrefService; +class PrefServiceSyncable; class Browser; namespace chrome { @@ -15,7 +15,7 @@ namespace chrome { bool ShowAutolaunchPrompt(Browser* browser); // Registers auto-launch specific prefs. -void RegisterAutolaunchPrefs(PrefService* prefs); +void RegisterAutolaunchUserPrefs(PrefServiceSyncable* prefs); } // namespace chrome diff --git a/chrome/browser/ui/startup/autolaunch_prompt_win.cc b/chrome/browser/ui/startup/autolaunch_prompt_win.cc index 07e442c..d8179ac 100644 --- a/chrome/browser/ui/startup/autolaunch_prompt_win.cc +++ b/chrome/browser/ui/startup/autolaunch_prompt_win.cc @@ -189,9 +189,9 @@ bool ShowAutolaunchPrompt(Browser* browser) { return true; } -void RegisterAutolaunchPrefs(PrefService* prefs) { +void RegisterAutolaunchUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterIntegerPref( - prefs::kShownAutoLaunchInfobar, 0, PrefService::UNSYNCABLE_PREF); + prefs::kShownAutoLaunchInfobar, 0, PrefServiceSyncable::UNSYNCABLE_PREF); } } // namespace chrome diff --git a/chrome/browser/ui/sync/one_click_signin_sync_starter.cc b/chrome/browser/ui/sync/one_click_signin_sync_starter.cc index a6d6dc8..295df44 100644 --- a/chrome/browser/ui/sync/one_click_signin_sync_starter.cc +++ b/chrome/browser/ui/sync/one_click_signin_sync_starter.cc @@ -4,6 +4,7 @@ #include "chrome/browser/ui/sync/one_click_signin_sync_starter.h" +#include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/signin/signin_manager.h" #include "chrome/browser/signin/signin_manager_factory.h" diff --git a/chrome/browser/ui/tab_contents/tab_contents_iterator_unittest.cc b/chrome/browser/ui/tab_contents/tab_contents_iterator_unittest.cc index 69752ff..634bdbe 100644 --- a/chrome/browser/ui/tab_contents/tab_contents_iterator_unittest.cc +++ b/chrome/browser/ui/tab_contents/tab_contents_iterator_unittest.cc @@ -148,7 +148,7 @@ TEST_F(BrowserListTest, TabContentsIteratorVerifyBrowser) { TEST_F(BrowserListTest, MAYBE_AttemptRestart) { ASSERT_TRUE(g_browser_process); - TestingPrefService testing_pref_service; + TestingPrefServiceSimple testing_pref_service; testing_pref_service.RegisterBooleanPref(prefs::kWasRestarted, false); testing_pref_service.RegisterBooleanPref(prefs::kRestartLastSessionOnShutdown, false); diff --git a/chrome/browser/ui/tabs/pinned_tab_codec.cc b/chrome/browser/ui/tabs/pinned_tab_codec.cc index 3fe52f3..6805910 100644 --- a/chrome/browser/ui/tabs/pinned_tab_codec.cc +++ b/chrome/browser/ui/tabs/pinned_tab_codec.cc @@ -97,8 +97,9 @@ static bool DecodeTab(const DictionaryValue& value, StartupTab* tab) { } // static -void PinnedTabCodec::RegisterUserPrefs(PrefService* prefs) { - prefs->RegisterListPref(prefs::kPinnedTabs, PrefService::UNSYNCABLE_PREF); +void PinnedTabCodec::RegisterUserPrefs(PrefServiceSyncable* prefs) { + prefs->RegisterListPref(prefs::kPinnedTabs, + PrefServiceSyncable::UNSYNCABLE_PREF); } // static diff --git a/chrome/browser/ui/tabs/pinned_tab_codec.h b/chrome/browser/ui/tabs/pinned_tab_codec.h index 8492f76..0b87e76 100644 --- a/chrome/browser/ui/tabs/pinned_tab_codec.h +++ b/chrome/browser/ui/tabs/pinned_tab_codec.h @@ -14,7 +14,7 @@ namespace base { class Value; } -class PrefService; +class PrefServiceSyncable; class Profile; // PinnedTabCodec is used to read and write the set of pinned tabs to @@ -27,7 +27,7 @@ class Profile; class PinnedTabCodec { public: // Registers the preference used by this class. - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); // Resets the preferences state. static void WritePinnedTabs(Profile* profile); diff --git a/chrome/browser/ui/tabs/tab_strip_layout_type_prefs.cc b/chrome/browser/ui/tabs/tab_strip_layout_type_prefs.cc index 8362f20..ef380d5 100644 --- a/chrome/browser/ui/tabs/tab_strip_layout_type_prefs.cc +++ b/chrome/browser/ui/tabs/tab_strip_layout_type_prefs.cc @@ -10,9 +10,9 @@ namespace chrome { -void RegisterTabStripLayoutTypePrefs(PrefService* prefs) { +void RegisterTabStripLayoutTypePrefs(PrefServiceSimple* local_state) { // This value is device dependant, so it goes in local state. - prefs->RegisterIntegerPref( + local_state->RegisterIntegerPref( prefs::kTabStripLayoutType, static_cast<int>(TAB_STRIP_LAYOUT_SHRINK)); } diff --git a/chrome/browser/ui/tabs/tab_strip_layout_type_prefs.h b/chrome/browser/ui/tabs/tab_strip_layout_type_prefs.h index 7d33e57..f2dc3f4 100644 --- a/chrome/browser/ui/tabs/tab_strip_layout_type_prefs.h +++ b/chrome/browser/ui/tabs/tab_strip_layout_type_prefs.h @@ -5,12 +5,12 @@ #ifndef CHROME_BROWSER_UI_TABS_TAB_STRIP_LAYOUT_TYPE_PREFS_H_ #define CHROME_BROWSER_UI_TABS_TAB_STRIP_LAYOUT_TYPE_PREFS_H_ -class PrefService; +class PrefServiceSimple; namespace chrome { // Register local state preferences specific to the TabStrip. -void RegisterTabStripLayoutTypePrefs(PrefService* prefs); +void RegisterTabStripLayoutTypePrefs(PrefServiceSimple* local_state); } // namespace chrome diff --git a/chrome/browser/ui/views/browser_actions_container.cc b/chrome/browser/ui/views/browser_actions_container.cc index f312c19..212c847 100644 --- a/chrome/browser/ui/views/browser_actions_container.cc +++ b/chrome/browser/ui/views/browser_actions_container.cc @@ -46,10 +46,10 @@ const int kItemSpacing = ToolbarView::kStandardSpacing; // Horizontal spacing before the chevron (if visible). const int kChevronSpacing = kItemSpacing - 2; -void RegisterUserPrefs(PrefService* prefs) { +void RegisterUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterIntegerPref(prefs::kBrowserActionContainerWidth, 0, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } } // namespace @@ -118,6 +118,9 @@ BrowserActionsContainer::~BrowserActionsContainer() { void BrowserActionsContainer::Init() { LoadImages(); + // TODO(joi): Switch to official way of registering user prefs for + // this class, i.e. in a function called from + // browser_prefs::RegisterUserPrefs. if (!profile_->GetPrefs()->FindPreference( prefs::kBrowserActionContainerWidth)) RegisterUserPrefs(profile_->GetPrefs()); diff --git a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc index fef8fa1..9071294 100644 --- a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc +++ b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc @@ -106,10 +106,10 @@ ExtensionSettingsHandler::ExtensionSettingsHandler(ExtensionService* service, } // static -void ExtensionSettingsHandler::RegisterUserPrefs(PrefService* prefs) { +void ExtensionSettingsHandler::RegisterUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterBooleanPref(prefs::kExtensionsUIDeveloperMode, false, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); } DictionaryValue* ExtensionSettingsHandler::CreateExtensionDetailValue( diff --git a/chrome/browser/ui/webui/extensions/extension_settings_handler.h b/chrome/browser/ui/webui/extensions/extension_settings_handler.h index 8a3de1e..f94cbd9 100644 --- a/chrome/browser/ui/webui/extensions/extension_settings_handler.h +++ b/chrome/browser/ui/webui/extensions/extension_settings_handler.h @@ -28,7 +28,7 @@ class ExtensionService; class FilePath; -class PrefService; +class PrefServiceSyncable; namespace base { class DictionaryValue; @@ -69,7 +69,7 @@ class ExtensionSettingsHandler ExtensionSettingsHandler(); virtual ~ExtensionSettingsHandler(); - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); // Extension Detail JSON Struct for page. |pages| is injected for unit // testing. diff --git a/chrome/browser/ui/webui/flags_ui.cc b/chrome/browser/ui/webui/flags_ui.cc index 99827e4..b1f411e 100644 --- a/chrome/browser/ui/webui/flags_ui.cc +++ b/chrome/browser/ui/webui/flags_ui.cc @@ -173,6 +173,6 @@ base::RefCountedMemory* FlagsUI::GetFaviconResourceBytes( } // static -void FlagsUI::RegisterPrefs(PrefService* prefs) { +void FlagsUI::RegisterPrefs(PrefServiceSimple* prefs) { prefs->RegisterListPref(prefs::kEnabledLabsExperiments); } diff --git a/chrome/browser/ui/webui/flags_ui.h b/chrome/browser/ui/webui/flags_ui.h index 455bdab..68779894 100644 --- a/chrome/browser/ui/webui/flags_ui.h +++ b/chrome/browser/ui/webui/flags_ui.h @@ -8,7 +8,7 @@ #include "content/public/browser/web_ui_controller.h" #include "ui/base/layout.h" -class PrefService; +class PrefServiceSimple; namespace base { class RefCountedMemory; @@ -20,7 +20,7 @@ class FlagsUI : public content::WebUIController { static base::RefCountedMemory* GetFaviconResourceBytes( ui::ScaleFactor scale_factor); - static void RegisterPrefs(PrefService* prefs); + static void RegisterPrefs(PrefServiceSimple* prefs); private: DISALLOW_COPY_AND_ASSIGN(FlagsUI); diff --git a/chrome/browser/ui/webui/instant_ui.cc b/chrome/browser/ui/webui/instant_ui.cc index 401fa32..7ba94ad 100644 --- a/chrome/browser/ui/webui/instant_ui.cc +++ b/chrome/browser/ui/webui/instant_ui.cc @@ -102,7 +102,7 @@ InstantUI::InstantUI(content::WebUI* web_ui) : WebUIController(web_ui) { } // static -void InstantUI::RegisterUserPrefs(PrefService* user_prefs) { +void InstantUI::RegisterUserPrefs(PrefServiceSyncable* user_prefs) { user_prefs->RegisterStringPref(prefs::kInstantUIZeroSuggestUrlPrefix, "", - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } diff --git a/chrome/browser/ui/webui/instant_ui.h b/chrome/browser/ui/webui/instant_ui.h index 5750c43..8a5cbae 100644 --- a/chrome/browser/ui/webui/instant_ui.h +++ b/chrome/browser/ui/webui/instant_ui.h @@ -7,7 +7,7 @@ #include "content/public/browser/web_ui_controller.h" -class PrefService; +class PrefServiceSyncable; namespace content { class BrowserContext; @@ -20,7 +20,7 @@ class InstantUI : public content::WebUIController { // handlers. explicit InstantUI(content::WebUI* web_ui); - static void RegisterUserPrefs(PrefService* user_prefs); + static void RegisterUserPrefs(PrefServiceSyncable* user_prefs); private: DISALLOW_COPY_AND_ASSIGN(InstantUI); diff --git a/chrome/browser/ui/webui/ntp/android/promo_handler.cc b/chrome/browser/ui/webui/ntp/android/promo_handler.cc index 6fd44c7..64d4216 100644 --- a/chrome/browser/ui/webui/ntp/android/promo_handler.cc +++ b/chrome/browser/ui/webui/ntp/android/promo_handler.cc @@ -122,10 +122,10 @@ void PromoHandler::RegisterMessages() { } // static -void PromoHandler::RegisterUserPrefs(PrefService* prefs) { +void PromoHandler::RegisterUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterBooleanPref(prefs::kNtpPromoDesktopSessionFound, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } void PromoHandler::Observe(int type, diff --git a/chrome/browser/ui/webui/ntp/android/promo_handler.h b/chrome/browser/ui/webui/ntp/android/promo_handler.h index 4cd5271..9d44150 100644 --- a/chrome/browser/ui/webui/ntp/android/promo_handler.h +++ b/chrome/browser/ui/webui/ntp/android/promo_handler.h @@ -9,7 +9,7 @@ #include "content/public/browser/notification_registrar.h" #include "content/public/browser/web_ui_message_handler.h" -class PrefService; +class PrefServiceSyncable; namespace base { class DictionaryValue; @@ -27,7 +27,7 @@ class PromoHandler : public content::WebUIMessageHandler, virtual void RegisterMessages() OVERRIDE; // Register preferences. - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); private: // NotificationObserver override and implementation. diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc index 51d7799..b7b193a 100644 --- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc +++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc @@ -779,9 +779,9 @@ void AppLauncherHandler::OnPreferenceChanged() { } // static -void AppLauncherHandler::RegisterUserPrefs(PrefServiceBase* pref_service) { +void AppLauncherHandler::RegisterUserPrefs(PrefServiceSyncable* pref_service) { pref_service->RegisterListPref(prefs::kNtpAppPageNames, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); } void AppLauncherHandler::CleanupAfterUninstall() { diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.h b/chrome/browser/ui/webui/ntp/app_launcher_handler.h index 44d1c32..ba8c232 100644 --- a/chrome/browser/ui/webui/ntp/app_launcher_handler.h +++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.h @@ -22,6 +22,7 @@ class ExtensionService; class PrefChangeRegistrar; +class PrefServiceSyncable; class Profile; namespace extensions { @@ -102,7 +103,7 @@ class AppLauncherHandler : public content::WebUIMessageHandler, void HandleSetNotificationsDisabled(const base::ListValue* args); // Register app launcher preferences. - static void RegisterUserPrefs(PrefServiceBase* pref_service); + static void RegisterUserPrefs(PrefServiceSyncable* pref_service); // Records the given type of app launch for UMA. static void RecordAppLaunchType(extension_misc::AppLaunchBucket bucket); diff --git a/chrome/browser/ui/webui/ntp/foreign_session_handler.cc b/chrome/browser/ui/webui/ntp/foreign_session_handler.cc index c7e1e3f..5e856cf 100644 --- a/chrome/browser/ui/webui/ntp/foreign_session_handler.cc +++ b/chrome/browser/ui/webui/ntp/foreign_session_handler.cc @@ -56,9 +56,9 @@ ForeignSessionHandler::ForeignSessionHandler() { } // static -void ForeignSessionHandler::RegisterUserPrefs(PrefService* prefs) { +void ForeignSessionHandler::RegisterUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterDictionaryPref(prefs::kNtpCollapsedForeignSessions, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } // static diff --git a/chrome/browser/ui/webui/ntp/foreign_session_handler.h b/chrome/browser/ui/webui/ntp/foreign_session_handler.h index 604241a..3287f4e 100644 --- a/chrome/browser/ui/webui/ntp/foreign_session_handler.h +++ b/chrome/browser/ui/webui/ntp/foreign_session_handler.h @@ -15,6 +15,8 @@ #include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui_message_handler.h" +class PrefServiceSyncable; + namespace browser_sync { class ForeignSessionHandler : public content::WebUIMessageHandler, @@ -29,7 +31,7 @@ class ForeignSessionHandler : public content::WebUIMessageHandler, ForeignSessionHandler(); virtual ~ForeignSessionHandler() {} - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); static void OpenForeignSessionTab(content::WebUI* web_ui, const std::string& session_string_value, diff --git a/chrome/browser/ui/webui/ntp/most_visited_handler.cc b/chrome/browser/ui/webui/ntp/most_visited_handler.cc index 57b292c..8501479 100644 --- a/chrome/browser/ui/webui/ntp/most_visited_handler.cc +++ b/chrome/browser/ui/webui/ntp/most_visited_handler.cc @@ -257,7 +257,7 @@ std::string MostVisitedHandler::GetDictionaryKeyForUrl(const std::string& url) { } // static -void MostVisitedHandler::RegisterUserPrefs(PrefService* prefs) { +void MostVisitedHandler::RegisterUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterDictionaryPref(prefs::kNtpMostVisitedURLsBlacklist, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } diff --git a/chrome/browser/ui/webui/ntp/most_visited_handler.h b/chrome/browser/ui/webui/ntp/most_visited_handler.h index 4ba6801..e60b81c 100644 --- a/chrome/browser/ui/webui/ntp/most_visited_handler.h +++ b/chrome/browser/ui/webui/ntp/most_visited_handler.h @@ -17,7 +17,7 @@ class GURL; class PageUsageData; -class PrefService; +class PrefServiceSyncable; namespace base { class ListValue; @@ -67,7 +67,7 @@ class MostVisitedHandler : public content::WebUIMessageHandler, return most_visited_urls_; } - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); private: struct MostVisitedPage; 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 d29da39..e2b8f37 100644 --- a/chrome/browser/ui/webui/ntp/new_tab_page_handler.cc +++ b/chrome/browser/ui/webui/ntp/new_tab_page_handler.cc @@ -173,10 +173,10 @@ void NewTabPageHandler::HandleLogTimeToClick(const ListValue* args) { } // static -void NewTabPageHandler::RegisterUserPrefs(PrefService* prefs) { +void NewTabPageHandler::RegisterUserPrefs(PrefServiceSyncable* prefs) { // TODO(estade): should be syncable. prefs->RegisterIntegerPref(prefs::kNtpShownPage, APPS_PAGE_ID, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } // static diff --git a/chrome/browser/ui/webui/ntp/new_tab_page_handler.h b/chrome/browser/ui/webui/ntp/new_tab_page_handler.h index 2a580105..9db1182 100644 --- a/chrome/browser/ui/webui/ntp/new_tab_page_handler.h +++ b/chrome/browser/ui/webui/ntp/new_tab_page_handler.h @@ -9,7 +9,8 @@ #include "chrome/common/chrome_notification_types.h" #include "content/public/browser/web_ui_message_handler.h" -class PrefService; +class PrefServiceSimple; +class PrefServiceSyncable; class Profile; // Handler for general New Tab Page functionality that does not belong in a @@ -19,10 +20,7 @@ class NewTabPageHandler : public content::WebUIMessageHandler { NewTabPageHandler(); // Register NTP per-profile preferences. - static void RegisterUserPrefs(PrefService* prefs); - - // Register NTP profile-independent preferences. - static void RegisterPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); // Registers values (strings etc.) for the page. static void GetLocalizedValues(Profile* profile, DictionaryValue* values); diff --git a/chrome/browser/ui/webui/ntp/new_tab_ui.cc b/chrome/browser/ui/webui/ntp/new_tab_ui.cc index fcd7520..4d750b3 100644 --- a/chrome/browser/ui/webui/ntp/new_tab_ui.cc +++ b/chrome/browser/ui/webui/ntp/new_tab_ui.cc @@ -281,7 +281,7 @@ void NewTabUI::InitializeCSSCaches() { } // static -void NewTabUI::RegisterUserPrefs(PrefService* prefs) { +void NewTabUI::RegisterUserPrefs(PrefServiceSyncable* prefs) { #if !defined(OS_ANDROID) AppLauncherHandler::RegisterUserPrefs(prefs); NewTabPageHandler::RegisterUserPrefs(prefs); diff --git a/chrome/browser/ui/webui/ntp/new_tab_ui.h b/chrome/browser/ui/webui/ntp/new_tab_ui.h index d13091d..58fbb77 100644 --- a/chrome/browser/ui/webui/ntp/new_tab_ui.h +++ b/chrome/browser/ui/webui/ntp/new_tab_ui.h @@ -19,7 +19,7 @@ #include "content/public/browser/web_ui_controller.h" class GURL; -class PrefService; +class PrefServiceSyncable; class Profile; // The WebContents used for the New Tab page. @@ -29,7 +29,7 @@ class NewTabUI : public content::WebUIController, explicit NewTabUI(content::WebUI* web_ui); virtual ~NewTabUI(); - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); // Returns whether or not to show apps pages. static bool ShouldShowApps(); diff --git a/chrome/browser/ui/webui/ntp/suggestions_page_handler.cc b/chrome/browser/ui/webui/ntp/suggestions_page_handler.cc index 30b5808..72bd85b 100644 --- a/chrome/browser/ui/webui/ntp/suggestions_page_handler.cc +++ b/chrome/browser/ui/webui/ntp/suggestions_page_handler.cc @@ -192,6 +192,6 @@ std::string SuggestionsHandler::GetDictionaryKeyForURL(const std::string& url) { } // static -void SuggestionsHandler::RegisterUserPrefs(PrefService* prefs) { +void SuggestionsHandler::RegisterUserPrefs(PrefServiceSyncable* prefs) { // TODO(georgey) add user preferences (such as own blacklist) as needed. } diff --git a/chrome/browser/ui/webui/ntp/suggestions_page_handler.h b/chrome/browser/ui/webui/ntp/suggestions_page_handler.h index fc1b09d..a408f38 100644 --- a/chrome/browser/ui/webui/ntp/suggestions_page_handler.h +++ b/chrome/browser/ui/webui/ntp/suggestions_page_handler.h @@ -16,7 +16,7 @@ class GURL; class PageUsageData; -class PrefService; +class PrefServiceSyncable; namespace base { class ListValue; @@ -65,7 +65,7 @@ class SuggestionsHandler : public content::WebUIMessageHandler, // SuggestionsCombiner::Delegate implementation. virtual void OnSuggestionsReady() OVERRIDE; - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); private: // Puts the passed URL in the blacklist (so it does not show as a thumbnail). diff --git a/chrome/browser/ui/webui/plugins_ui.cc b/chrome/browser/ui/webui/plugins_ui.cc index 059d1a5..eee3673 100644 --- a/chrome/browser/ui/webui/plugins_ui.cc +++ b/chrome/browser/ui/webui/plugins_ui.cc @@ -491,10 +491,10 @@ base::RefCountedMemory* PluginsUI::GetFaviconResourceBytes( } // static -void PluginsUI::RegisterUserPrefs(PrefService* prefs) { +void PluginsUI::RegisterUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterBooleanPref(prefs::kPluginsShowDetails, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterDictionaryPref(prefs::kContentSettingsPluginWhitelist, - PrefService::SYNCABLE_PREF); + PrefServiceSyncable::SYNCABLE_PREF); } diff --git a/chrome/browser/ui/webui/plugins_ui.h b/chrome/browser/ui/webui/plugins_ui.h index a4b5dd7..8ad24a4 100644 --- a/chrome/browser/ui/webui/plugins_ui.h +++ b/chrome/browser/ui/webui/plugins_ui.h @@ -8,7 +8,7 @@ #include "content/public/browser/web_ui_controller.h" #include "ui/base/layout.h" -class PrefService; +class PrefServiceSyncable; namespace base { class RefCountedMemory; @@ -20,7 +20,7 @@ class PluginsUI : public content::WebUIController { static base::RefCountedMemory* GetFaviconResourceBytes( ui::ScaleFactor scale_factor); - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); private: DISALLOW_COPY_AND_ASSIGN(PluginsUI); diff --git a/chrome/browser/ui/webui/print_preview/sticky_settings.cc b/chrome/browser/ui/webui/print_preview/sticky_settings.cc index 6720edc1..ac30dfd 100644 --- a/chrome/browser/ui/webui/print_preview/sticky_settings.cc +++ b/chrome/browser/ui/webui/print_preview/sticky_settings.cc @@ -58,9 +58,9 @@ void StickySettings::RestoreFromPrefs(PrefService* prefs) { } } -void StickySettings::RegisterUserPrefs(PrefService* prefs) { +void StickySettings::RegisterUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterDictionaryPref(prefs::kPrintPreviewStickySettings, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } std::string* StickySettings::printer_app_state() { diff --git a/chrome/browser/ui/webui/print_preview/sticky_settings.h b/chrome/browser/ui/webui/print_preview/sticky_settings.h index f34d4bf..ab3395d 100644 --- a/chrome/browser/ui/webui/print_preview/sticky_settings.h +++ b/chrome/browser/ui/webui/print_preview/sticky_settings.h @@ -14,6 +14,7 @@ class FilePath; class PrintPreviewHandlerTest; class PrefService; +class PrefServiceSyncable; namespace base { class DictionaryValue; @@ -39,7 +40,7 @@ class StickySettings { void SaveInPrefs(PrefService* profile); void RestoreFromPrefs(PrefService* profile); - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); private: scoped_ptr<FilePath> save_path_; 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 8201d3a..8d6a76a 100644 --- a/chrome/browser/ui/webui/sync_promo/sync_promo_handler.cc +++ b/chrome/browser/ui/webui/sync_promo/sync_promo_handler.cc @@ -75,13 +75,13 @@ SyncPromoHandler::~SyncPromoHandler() { } // static -void SyncPromoHandler::RegisterUserPrefs(PrefService* prefs) { +void SyncPromoHandler::RegisterUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterIntegerPref(prefs::kSyncPromoViewCount, 0, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kSyncPromoShowNTPBubble, false, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterStringPref(prefs::kSyncPromoErrorMessage, std::string(), - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } void SyncPromoHandler::RegisterMessages() { diff --git a/chrome/browser/ui/webui/sync_promo/sync_promo_handler.h b/chrome/browser/ui/webui/sync_promo/sync_promo_handler.h index d9c7b59..d33dd11 100644 --- a/chrome/browser/ui/webui/sync_promo/sync_promo_handler.h +++ b/chrome/browser/ui/webui/sync_promo/sync_promo_handler.h @@ -8,6 +8,7 @@ #include "chrome/browser/ui/webui/sync_setup_handler.h" class PrefService; +class PrefServiceSyncable; // The handler for JavaScript messages related to the "sync promo" page. class SyncPromoHandler : public SyncSetupHandler { @@ -17,7 +18,7 @@ class SyncPromoHandler : public SyncSetupHandler { // Called to register our preferences before we use them (so there will be a // default if not present yet). - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); // WebUIMessageHandler implementation. virtual void RegisterMessages() OVERRIDE; 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 cdedf44..7b46c80 100644 --- a/chrome/browser/ui/webui/sync_promo/sync_promo_ui.cc +++ b/chrome/browser/ui/webui/sync_promo/sync_promo_ui.cc @@ -147,13 +147,13 @@ bool SyncPromoUI::ShouldShowSyncPromo(Profile* profile) { } // static -void SyncPromoUI::RegisterUserPrefs(PrefService* prefs) { - prefs->RegisterIntegerPref( - prefs::kSyncPromoStartupCount, 0, PrefService::UNSYNCABLE_PREF); - prefs->RegisterBooleanPref( - prefs::kSyncPromoUserSkipped, false, PrefService::UNSYNCABLE_PREF); +void SyncPromoUI::RegisterUserPrefs(PrefServiceSyncable* prefs) { + prefs->RegisterIntegerPref(prefs::kSyncPromoStartupCount, 0, + PrefServiceSyncable::UNSYNCABLE_PREF); + prefs->RegisterBooleanPref(prefs::kSyncPromoUserSkipped, false, + PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterBooleanPref(prefs::kSyncPromoShowOnFirstRunAllowed, true, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); SyncPromoHandler::RegisterUserPrefs(prefs); } diff --git a/chrome/browser/ui/webui/sync_promo/sync_promo_ui.h b/chrome/browser/ui/webui/sync_promo/sync_promo_ui.h index 59f9876..e5f7da0 100644 --- a/chrome/browser/ui/webui/sync_promo/sync_promo_ui.h +++ b/chrome/browser/ui/webui/sync_promo/sync_promo_ui.h @@ -8,7 +8,7 @@ #include "content/public/browser/web_ui_controller.h" class Profile; -class PrefService; +class PrefServiceSyncable; // The Web UI handler for chrome://signin. class SyncPromoUI : public content::WebUIController { @@ -46,7 +46,7 @@ class SyncPromoUI : public content::WebUIController { static void SetUserSkippedSyncPromo(Profile* profile); // Registers the preferences the Sync Promo UI needs. - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); // Returns the sync promo URL wth the given arguments in the query. // |next_page| is the URL to navigate to when the user completes or skips the diff --git a/chrome/browser/ui/window_snapshot/window_snapshot.cc b/chrome/browser/ui/window_snapshot/window_snapshot.cc index 2b338f4..9d440ba 100644 --- a/chrome/browser/ui/window_snapshot/window_snapshot.cc +++ b/chrome/browser/ui/window_snapshot/window_snapshot.cc @@ -21,7 +21,7 @@ bool GrabWindowSnapshotForUser( snapshot_bounds); } -void RegisterScreenshotPrefs(PrefService* service) { +void RegisterScreenshotPrefs(PrefServiceSimple* service) { service->RegisterBooleanPref(prefs::kDisableScreenshots, false); } diff --git a/chrome/browser/ui/window_snapshot/window_snapshot.h b/chrome/browser/ui/window_snapshot/window_snapshot.h index 3259983..4065770 100644 --- a/chrome/browser/ui/window_snapshot/window_snapshot.h +++ b/chrome/browser/ui/window_snapshot/window_snapshot.h @@ -9,7 +9,7 @@ #include "ui/gfx/native_widget_types.h" -class PrefService; +class PrefServiceSimple; namespace gfx { class Rect; @@ -17,7 +17,7 @@ class Rect; namespace chrome { -void RegisterScreenshotPrefs(PrefService* service); +void RegisterScreenshotPrefs(PrefServiceSimple* service); // Grabs a snapshot of the rectangle area |snapshot_bounds| with respect to the // top left corner of the designated window and stores a PNG representation diff --git a/chrome/browser/upgrade_detector.cc b/chrome/browser/upgrade_detector.cc index a25a547..acb742f 100644 --- a/chrome/browser/upgrade_detector.cc +++ b/chrome/browser/upgrade_detector.cc @@ -32,7 +32,7 @@ bool UseTestingIntervals() { } // static -void UpgradeDetector::RegisterPrefs(PrefService* prefs) { +void UpgradeDetector::RegisterPrefs(PrefServiceSimple* prefs) { prefs->RegisterBooleanPref(prefs::kRestartLastSessionOnShutdown, false); prefs->RegisterBooleanPref(prefs::kWasRestarted, false); } diff --git a/chrome/browser/upgrade_detector.h b/chrome/browser/upgrade_detector.h index 7782687..c05f88a 100644 --- a/chrome/browser/upgrade_detector.h +++ b/chrome/browser/upgrade_detector.h @@ -9,7 +9,7 @@ #include "chrome/browser/idle.h" #include "ui/gfx/image/image.h" -class PrefService; +class PrefServiceSimple; /////////////////////////////////////////////////////////////////////////////// // UpgradeDetector @@ -44,7 +44,7 @@ class UpgradeDetector { virtual ~UpgradeDetector(); - static void RegisterPrefs(PrefService* prefs); + static void RegisterPrefs(PrefServiceSimple* prefs); // Whether the user should be notified about an upgrade. bool notify_upgrade() const { return notify_upgrade_; } diff --git a/chrome/browser/web_resource/notification_promo.cc b/chrome/browser/web_resource/notification_promo.cc index 86687f5..692d305 100644 --- a/chrome/browser/web_resource/notification_promo.cc +++ b/chrome/browser/web_resource/notification_promo.cc @@ -316,10 +316,10 @@ void NotificationPromo::OnNewNotification() { } // static -void NotificationPromo::RegisterUserPrefs(PrefService* prefs) { +void NotificationPromo::RegisterUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterDictionaryPref(kPrefPromoObject, new base::DictionaryValue, - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); } void NotificationPromo::WritePrefs() { diff --git a/chrome/browser/web_resource/notification_promo.h b/chrome/browser/web_resource/notification_promo.h index efe5bbd..f3b2c5b 100644 --- a/chrome/browser/web_resource/notification_promo.h +++ b/chrome/browser/web_resource/notification_promo.h @@ -19,6 +19,7 @@ class ListValue; } class PrefService; +class PrefServiceSyncable; class Profile; // Helper class for PromoResourceService that parses promo notification info @@ -65,7 +66,7 @@ class NotificationPromo { } // Register preferences. - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); private: // For testing. diff --git a/chrome/browser/web_resource/plugins_resource_service.cc b/chrome/browser/web_resource/plugins_resource_service.cc index e54776ca..77777d8 100644 --- a/chrome/browser/web_resource/plugins_resource_service.cc +++ b/chrome/browser/web_resource/plugins_resource_service.cc @@ -65,7 +65,7 @@ PluginsResourceService::~PluginsResourceService() { } // static -void PluginsResourceService::RegisterPrefs(PrefService* local_state) { +void PluginsResourceService::RegisterPrefs(PrefServiceSimple* local_state) { local_state->RegisterDictionaryPref( prefs::kPluginsMetadata, new base::DictionaryValue()); local_state->RegisterStringPref(prefs::kPluginsResourceCacheUpdate, "0"); diff --git a/chrome/browser/web_resource/plugins_resource_service.h b/chrome/browser/web_resource/plugins_resource_service.h index 7114cc7..d01597e 100644 --- a/chrome/browser/web_resource/plugins_resource_service.h +++ b/chrome/browser/web_resource/plugins_resource_service.h @@ -7,13 +7,16 @@ #include "chrome/browser/web_resource/web_resource_service.h" +class PrefService; +class PrefServiceSimple; + // This resource service periodically fetches plug-in metadata // from a remote server and updates local state and PluginFinder. class PluginsResourceService : public WebResourceService { public: explicit PluginsResourceService(PrefService* local_state); - static void RegisterPrefs(PrefService* local_state); + static void RegisterPrefs(PrefServiceSimple* local_state); private: virtual ~PluginsResourceService(); diff --git a/chrome/browser/web_resource/promo_resource_service.cc b/chrome/browser/web_resource/promo_resource_service.cc index 48c6388..ad4c185 100644 --- a/chrome/browser/web_resource/promo_resource_service.cc +++ b/chrome/browser/web_resource/promo_resource_service.cc @@ -62,7 +62,7 @@ int GetCacheUpdateDelay() { } // namespace // static -void PromoResourceService::RegisterPrefs(PrefService* local_state) { +void PromoResourceService::RegisterPrefs(PrefServiceSimple* local_state) { // TODO(achuith): Delete this in M26. http://crbug.com/143773 // The promo service version number, and last locale. const char kNtpPromoVersion[] = "ntp.promo_version"; @@ -74,10 +74,10 @@ void PromoResourceService::RegisterPrefs(PrefService* local_state) { } // static -void PromoResourceService::RegisterUserPrefs(PrefService* prefs) { +void PromoResourceService::RegisterUserPrefs(PrefServiceSyncable* prefs) { prefs->RegisterStringPref(prefs::kNtpPromoResourceCacheUpdate, "0", - PrefService::UNSYNCABLE_PREF); + PrefServiceSyncable::UNSYNCABLE_PREF); NotificationPromo::RegisterUserPrefs(prefs); } diff --git a/chrome/browser/web_resource/promo_resource_service.h b/chrome/browser/web_resource/promo_resource_service.h index fa4668b..e55e59a 100644 --- a/chrome/browser/web_resource/promo_resource_service.h +++ b/chrome/browser/web_resource/promo_resource_service.h @@ -15,7 +15,8 @@ class DictionaryValue; } class NotificationPromo; -class PrefService; +class PrefServiceSimple; +class PrefServiceSyncable; class Profile; // A PromoResourceService fetches data from a web resource server to be used to @@ -24,9 +25,9 @@ class Profile; // promotional messages to certain groups of Chrome users. class PromoResourceService : public WebResourceService { public: - static void RegisterPrefs(PrefService* local_state); + static void RegisterPrefs(PrefServiceSimple* local_state); - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefServiceSyncable* prefs); explicit PromoResourceService(Profile* profile); |