Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Unified Diff: chrome/browser/prefs/profile_pref_store_manager.cc

Issue 398893002: Invoke the StartSyncFlare for prefs when performing an automatic reset. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/prefs/pref_hash_filter_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f4264b78014f8d34676a41f65ded519f92d0aa01..edee0251e37f59799cc624f2d7e955928a8b074d 100644
--- a/chrome/browser/prefs/profile_pref_store_manager.cc
+++ b/chrome/browser/prefs/profile_pref_store_manager.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/prefs/profile_pref_store_manager.h"
#include "base/bind.h"
+#include "base/callback.h"
#include "base/file_util.h"
#include "base/json/json_file_value_serializer.h"
#include "base/logging.h"
@@ -16,9 +17,11 @@
#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/browser/sync/glue/sync_start_util.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/pref_names.h"
#include "components/pref_registry/pref_registry_syncable.h"
+#include "sync/internal_api/public/base/model_type.h"
// TODO(erikwright): Enable this on Chrome OS and Android once MACs are moved
// out of Local State. This will resolve a race condition on Android and a
@@ -108,15 +111,27 @@ PersistentPrefStore* ProfilePrefStoreManager::CreateProfilePrefStore(
}
}
+ // Used to kick sync early in case of a reset event. This is done since sync
+ // may bring back the user's server value post-reset which could potentially
+ // cause a "settings flash" between the factory default and the
+ // re-instantiated server value. Starting sync ASAP minimizes the window
+ // before the server value is re-instantiated (this window can otherwise be
+ // as long as 10 seconds by default).
+ const base::Closure start_sync_flare_for_prefs =
erikwright (departed) 2014/07/16 20:23:43 This should be a dependency passed in by chrome_pr
gab 2014/07/16 20:30:39 How is it more testable? I thought about it, but I
+ base::Bind(sync_start_util::GetFlareForSyncableService(profile_path_),
+ syncer::PREFERENCES);
+
scoped_ptr<PrefHashFilter> unprotected_pref_hash_filter(
new PrefHashFilter(GetPrefHashStore(false),
unprotected_configuration,
+ base::Closure(),
validation_delegate,
reporting_ids_count_,
false));
scoped_ptr<PrefHashFilter> protected_pref_hash_filter(
new PrefHashFilter(GetPrefHashStore(true),
protected_configuration,
+ start_sync_flare_for_prefs,
validation_delegate,
reporting_ids_count_,
true));
@@ -175,6 +190,7 @@ bool ProfilePrefStoreManager::InitializePrefsFromMasterPrefs(
to_serialize = copy.get();
PrefHashFilter(GetPrefHashStore(false),
tracking_configuration_,
+ base::Closure(),
NULL,
reporting_ids_count_,
false).Initialize(copy.get());
@@ -209,6 +225,7 @@ ProfilePrefStoreManager::CreateDeprecatedCombinedProfilePrefStore(
pref_filter.reset(
new PrefHashFilter(pref_hash_store_impl.PassAs<PrefHashStore>(),
tracking_configuration_,
+ base::Closure(),
NULL,
reporting_ids_count_,
false));
« no previous file with comments | « chrome/browser/prefs/pref_hash_filter_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698