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/password_manager | |
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/password_manager')
7 files changed, 17 insertions, 13 deletions
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); |