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

Unified Diff: chrome/browser/prefs/chrome_pref_service_factory.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: review:zea 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/DEPS ('k') | chrome/browser/prefs/pref_hash_filter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prefs/chrome_pref_service_factory.cc
diff --git a/chrome/browser/prefs/chrome_pref_service_factory.cc b/chrome/browser/prefs/chrome_pref_service_factory.cc
index 4a974b42d9ca4dc316592ef359839aeaea2d5e0e..9a3df11caeb61b39729208dac670d1bdd0efb8a2 100644
--- a/chrome/browser/prefs/chrome_pref_service_factory.cc
+++ b/chrome/browser/prefs/chrome_pref_service_factory.cc
@@ -34,6 +34,7 @@
#include "chrome/browser/profiles/file_path_verifier_win.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search_engines/default_search_pref_migration.h"
+#include "chrome/browser/sync/glue/sync_start_util.h"
#include "chrome/browser/ui/profile_error_dialog.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/pref_names.h"
@@ -46,6 +47,7 @@
#include "grit/browser_resources.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
+#include "sync/internal_api/public/base/model_type.h"
#include "ui/base/resource/resource_bundle.h"
#if defined(ENABLE_CONFIGURATION_POLICY)
@@ -451,16 +453,28 @@ scoped_ptr<PrefServiceSyncable> CreateProfilePrefs(
const scoped_refptr<user_prefs::PrefRegistrySyncable>& pref_registry,
bool async) {
TRACE_EVENT0("browser", "chrome_prefs::CreateProfilePrefs");
+
+ // A StartSyncFlare 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 =
+ base::Bind(sync_start_util::GetFlareForSyncableService(profile_path),
+ syncer::PREFERENCES);
+
PrefServiceSyncableFactory factory;
- PrepareFactory(
- &factory,
- policy_service,
- supervised_user_settings,
- scoped_refptr<PersistentPrefStore>(
- CreateProfilePrefStoreManager(profile_path)->CreateProfilePrefStore(
- pref_io_task_runner, validation_delegate)),
- extension_prefs,
- async);
+ PrepareFactory(&factory,
+ policy_service,
+ supervised_user_settings,
+ scoped_refptr<PersistentPrefStore>(
+ CreateProfilePrefStoreManager(profile_path)
+ ->CreateProfilePrefStore(pref_io_task_runner,
+ start_sync_flare_for_prefs,
+ validation_delegate)),
+ extension_prefs,
+ async);
scoped_ptr<PrefServiceSyncable> pref_service =
factory.CreateSyncable(pref_registry.get());
« no previous file with comments | « chrome/browser/prefs/DEPS ('k') | chrome/browser/prefs/pref_hash_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698