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

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

Issue 422453006: Merge 284507 "Invoke the StartSyncFlare for prefs when performin..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/2062/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/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
===================================================================
--- chrome/browser/prefs/chrome_pref_service_factory.cc (revision 285907)
+++ chrome/browser/prefs/chrome_pref_service_factory.cc (working copy)
@@ -35,6 +35,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search_engines/default_search_manager.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)
@@ -442,16 +444,28 @@
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