diff options
author | zea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-09 06:19:16 +0000 |
---|---|---|
committer | zea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-09 06:19:16 +0000 |
commit | d36f941bbea3e9fa6d13829626a1911008b37f17 (patch) | |
tree | d7b3e6a109c39557bd30154407c000f0bb730339 /chrome/browser/password_manager | |
parent | 838dd914a5bd6a049915984c9619d69ef160b82e (diff) | |
download | chromium_src-d36f941bbea3e9fa6d13829626a1911008b37f17.zip chromium_src-d36f941bbea3e9fa6d13829626a1911008b37f17.tar.gz chromium_src-d36f941bbea3e9fa6d13829626a1911008b37f17.tar.bz2 |
Refactor preference syncing.
The following are the primary changes:
1. Whenever a profile preference is registered, it must specify whether that
preference should be synced or not. Local state preferences do not require this.
However, we DCHECK that local state preferences are in fact registered to the
local state.
2. We've created a new sync model associator interface, which all datatypes
will eventually implement. This new model associator is designed to be
decoupled from much of the sync internals, and to be owned by the chrome service
being synced. It also implements most of the functionality previous handled by
the change processor.
3. The PrefService now owns its sync model associator
(pref_model_associator), which partially implements the new model associator
functionality. Further work will be done to remove the use of sync
transactions from the model associator, as well as to migrate other datatypes.
BUG=76232
TEST=
Review URL: http://codereview.chromium.org/6905044
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84603 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/password_manager')
5 files changed, 26 insertions, 12 deletions
diff --git a/chrome/browser/password_manager/password_manager.cc b/chrome/browser/password_manager/password_manager.cc index b5dc14c..b08330fd 100644 --- a/chrome/browser/password_manager/password_manager.cc +++ b/chrome/browser/password_manager/password_manager.cc @@ -24,8 +24,12 @@ using webkit_glue::PasswordFormMap; // static void PasswordManager::RegisterUserPrefs(PrefService* prefs) { - prefs->RegisterBooleanPref(prefs::kPasswordManagerEnabled, true); - prefs->RegisterBooleanPref(prefs::kPasswordManagerAllowShowPasswords, true); + prefs->RegisterBooleanPref(prefs::kPasswordManagerEnabled, + true, + PrefService::SYNCABLE_PREF); + prefs->RegisterBooleanPref(prefs::kPasswordManagerAllowShowPasswords, + true, + PrefService::UNSYNCABLE_PREF); } // This routine is called when PasswordManagers are constructed. diff --git a/chrome/browser/password_manager/password_store_default.cc b/chrome/browser/password_manager/password_store_default.cc index d99ba4a..0adf126 100644 --- a/chrome/browser/password_manager/password_store_default.cc +++ b/chrome/browser/password_manager/password_store_default.cc @@ -94,7 +94,8 @@ void PasswordStoreDefault::MigrateHelper::OnWebDataServiceRequestDone( } if (handles_.empty()) { profile_->GetPrefs()->RegisterBooleanPref(prefs::kLoginDatabaseMigrated, - true); + true, + PrefService::UNSYNCABLE_PREF); } } diff --git a/chrome/browser/password_manager/password_store_default_unittest.cc b/chrome/browser/password_manager/password_store_default_unittest.cc index 212de2f..1b6bd8d 100644 --- a/chrome/browser/password_manager/password_store_default_unittest.cc +++ b/chrome/browser/password_manager/password_store_default_unittest.cc @@ -152,7 +152,8 @@ MATCHER(EmptyWDResult, "") { TEST_F(PasswordStoreDefaultTest, NonASCIIData) { // Prentend that the migration has already taken place. profile_->GetPrefs()->RegisterBooleanPref(prefs::kLoginDatabaseMigrated, - true); + true, + PrefService::UNSYNCABLE_PREF); // Initializing the PasswordStore shouldn't trigger a migration. scoped_refptr<PasswordStoreDefault> store( @@ -399,7 +400,8 @@ TEST_F(PasswordStoreDefaultTest, MigrationAlreadyDone) { // Prentend that the migration has already taken place. profile_->GetPrefs()->RegisterBooleanPref(prefs::kLoginDatabaseMigrated, - true); + true, + PrefService::UNSYNCABLE_PREF); // Initializing the PasswordStore shouldn't trigger a migration. scoped_refptr<PasswordStore> store( @@ -430,7 +432,8 @@ TEST_F(PasswordStoreDefaultTest, MigrationAlreadyDone) { TEST_F(PasswordStoreDefaultTest, Notifications) { // Prentend that the migration has already taken place. profile_->GetPrefs()->RegisterBooleanPref(prefs::kLoginDatabaseMigrated, - true); + true, + PrefService::UNSYNCABLE_PREF); // Initializing the PasswordStore shouldn't trigger a migration. scoped_refptr<PasswordStore> store( diff --git a/chrome/browser/password_manager/password_store_win_unittest.cc b/chrome/browser/password_manager/password_store_win_unittest.cc index 6477b12..310b9e2 100644 --- a/chrome/browser/password_manager/password_store_win_unittest.cc +++ b/chrome/browser/password_manager/password_store_win_unittest.cc @@ -169,7 +169,8 @@ TEST_F(PasswordStoreWinTest, DISABLED_ConvertIE7Login) { // Prentend that the migration has already taken place. profile_->GetPrefs()->RegisterBooleanPref(prefs::kLoginDatabaseMigrated, - true); + true, + PrefService::UNSYNCABLE_PREF); // Initializing the PasswordStore shouldn't trigger a migration. scoped_refptr<PasswordStore> store( @@ -228,7 +229,8 @@ TEST_F(PasswordStoreWinTest, DISABLED_ConvertIE7Login) { TEST_F(PasswordStoreWinTest, OutstandingWDSQueries) { // Prentend that the migration has already taken place. profile_->GetPrefs()->RegisterBooleanPref(prefs::kLoginDatabaseMigrated, - true); + true, + PrefService::UNSYNCABLE_PREF); // Initializing the PasswordStore shouldn't trigger a migration. scoped_refptr<PasswordStore> store( @@ -278,7 +280,8 @@ TEST_F(PasswordStoreWinTest, DISABLED_MultipleWDSQueriesOnDifferentThreads) { // Prentend that the migration has already taken place. profile_->GetPrefs()->RegisterBooleanPref(prefs::kLoginDatabaseMigrated, - true); + true, + PrefService::UNSYNCABLE_PREF); // Initializing the PasswordStore shouldn't trigger a migration. scoped_refptr<PasswordStore> store( diff --git a/chrome/browser/password_manager/password_store_x_unittest.cc b/chrome/browser/password_manager/password_store_x_unittest.cc index 721368d..7e6ed72 100644 --- a/chrome/browser/password_manager/password_store_x_unittest.cc +++ b/chrome/browser/password_manager/password_store_x_unittest.cc @@ -475,7 +475,8 @@ TEST_P(PasswordStoreXTest, WDSMigrationAlreadyDone) { // Prentend that the migration has already taken place. profile_->GetPrefs()->RegisterBooleanPref(prefs::kLoginDatabaseMigrated, - true); + true, + PrefService::UNSYNCABLE_PREF); // Initializing the PasswordStore shouldn't trigger a migration. scoped_refptr<PasswordStoreX> store( @@ -508,7 +509,8 @@ TEST_P(PasswordStoreXTest, WDSMigrationAlreadyDone) { TEST_P(PasswordStoreXTest, Notifications) { // Pretend that the migration has already taken place. profile_->GetPrefs()->RegisterBooleanPref(prefs::kLoginDatabaseMigrated, - true); + true, + PrefService::UNSYNCABLE_PREF); // Initializing the PasswordStore shouldn't trigger a migration. scoped_refptr<PasswordStoreX> store( @@ -646,7 +648,8 @@ TEST_P(PasswordStoreXTest, NativeMigration) { // Pretend that the WDS migration has already taken place. profile_->GetPrefs()->RegisterBooleanPref(prefs::kLoginDatabaseMigrated, - true); + true, + PrefService::UNSYNCABLE_PREF); // Initializing the PasswordStore shouldn't trigger a native migration (yet). scoped_refptr<PasswordStoreX> store( |