Index: chrome/browser/prefs/profile_pref_store_manager.cc |
diff --git a/chrome/browser/prefs/profile_pref_store_manager.cc b/chrome/browser/prefs/profile_pref_store_manager.cc |
index e93cb8358117ec4bcf5c551f200ec899f4ef1a90..a0192ebaefe6cbb1e4350e0985f6e26065a71115 100644 |
--- a/chrome/browser/prefs/profile_pref_store_manager.cc |
+++ b/chrome/browser/prefs/profile_pref_store_manager.cc |
@@ -14,6 +14,7 @@ |
#include "chrome/browser/prefs/pref_hash_store_impl.h" |
#include "chrome/browser/prefs/tracked/pref_service_hash_store_contents.h" |
#include "chrome/browser/prefs/tracked/segregated_pref_store.h" |
+#include "chrome/browser/prefs/tracked/tracked_preferences_migration.h" |
#include "chrome/common/chrome_constants.h" |
#include "chrome/common/pref_names.h" |
#include "components/user_prefs/pref_registry_syncable.h" |
@@ -283,6 +284,7 @@ PersistentPrefStore* ProfilePrefStoreManager::CreateProfilePrefStore( |
std::vector<PrefHashFilter::TrackedPreferenceMetadata> |
protected_configuration; |
std::set<std::string> protected_pref_names; |
+ std::set<std::string> unprotected_pref_names; |
for (std::vector<PrefHashFilter::TrackedPreferenceMetadata>::const_iterator |
it = tracking_configuration_.begin(); |
it != tracking_configuration_.end(); |
@@ -292,6 +294,7 @@ PersistentPrefStore* ProfilePrefStoreManager::CreateProfilePrefStore( |
protected_pref_names.insert(it->name); |
} else { |
unprotected_configuration.push_back(*it); |
+ unprotected_pref_names.insert(it->name); |
} |
} |
@@ -304,29 +307,22 @@ PersistentPrefStore* ProfilePrefStoreManager::CreateProfilePrefStore( |
protected_configuration, |
reporting_ids_count_)); |
- scoped_refptr<PersistentPrefStore> unprotected_pref_store( |
+ scoped_refptr<JsonPrefStore> unprotected_pref_store( |
new JsonPrefStore(GetPrefFilePathFromProfilePath(profile_path_), |
io_task_runner, |
unprotected_pref_hash_filter.Pass())); |
- scoped_refptr<PersistentPrefStore> protected_pref_store(new JsonPrefStore( |
+ scoped_refptr<JsonPrefStore> protected_pref_store(new JsonPrefStore( |
profile_path_.Append(chrome::kProtectedPreferencesFilename), |
io_task_runner, |
protected_pref_hash_filter.Pass())); |
- // The on_initialized callback is used to migrate newly protected values from |
- // the main Preferences store to the Protected Preferences store. It is also |
- // responsible for the initial migration to a two-store model. |
- return new SegregatedPrefStore( |
- unprotected_pref_store, |
- protected_pref_store, |
- protected_pref_names, |
- base::Bind(&PrefHashFilter::MigrateValues, |
- base::Owned(new PrefHashFilter( |
- CopyPrefHashStore(), |
- protected_configuration, |
- reporting_ids_count_)), |
- unprotected_pref_store, |
- protected_pref_store)); |
+ SetupTrackedPreferencesMigration(unprotected_pref_names, |
+ protected_pref_names, |
+ unprotected_pref_store, |
+ protected_pref_store); |
+ |
+ return new SegregatedPrefStore(unprotected_pref_store, protected_pref_store, |
+ protected_pref_names); |
} |
void ProfilePrefStoreManager::UpdateProfileHashStoreIfRequired( |
@@ -410,15 +406,3 @@ scoped_ptr<PrefHashStoreImpl> ProfilePrefStoreManager::GetPrefHashStoreImpl() { |
scoped_ptr<HashStoreContents>(new PrefServiceHashStoreContents( |
profile_path_.AsUTF8Unsafe(), local_state_)))); |
} |
- |
-scoped_ptr<PrefHashStore> ProfilePrefStoreManager::CopyPrefHashStore() { |
- DCHECK(kPlatformSupportsPreferenceTracking); |
- |
- PrefServiceHashStoreContents real_contents(profile_path_.AsUTF8Unsafe(), |
- local_state_); |
- return scoped_ptr<PrefHashStore>(new PrefHashStoreImpl( |
- seed_, |
- device_id_, |
- scoped_ptr<HashStoreContents>( |
- new DictionaryHashStoreContents(real_contents)))); |
-} |