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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/prefs/DEPS ('k') | chrome/browser/prefs/pref_hash_filter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/prefs/chrome_pref_service_factory.h" 5 #include "chrome/browser/prefs/chrome_pref_service_factory.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 16 matching lines...) Expand all
27 #include "chrome/browser/browser_process.h" 27 #include "chrome/browser/browser_process.h"
28 #include "chrome/browser/prefs/command_line_pref_store.h" 28 #include "chrome/browser/prefs/command_line_pref_store.h"
29 #include "chrome/browser/prefs/pref_hash_filter.h" 29 #include "chrome/browser/prefs/pref_hash_filter.h"
30 #include "chrome/browser/prefs/pref_model_associator.h" 30 #include "chrome/browser/prefs/pref_model_associator.h"
31 #include "chrome/browser/prefs/pref_service_syncable.h" 31 #include "chrome/browser/prefs/pref_service_syncable.h"
32 #include "chrome/browser/prefs/pref_service_syncable_factory.h" 32 #include "chrome/browser/prefs/pref_service_syncable_factory.h"
33 #include "chrome/browser/prefs/profile_pref_store_manager.h" 33 #include "chrome/browser/prefs/profile_pref_store_manager.h"
34 #include "chrome/browser/profiles/file_path_verifier_win.h" 34 #include "chrome/browser/profiles/file_path_verifier_win.h"
35 #include "chrome/browser/profiles/profile.h" 35 #include "chrome/browser/profiles/profile.h"
36 #include "chrome/browser/search_engines/default_search_pref_migration.h" 36 #include "chrome/browser/search_engines/default_search_pref_migration.h"
37 #include "chrome/browser/sync/glue/sync_start_util.h"
37 #include "chrome/browser/ui/profile_error_dialog.h" 38 #include "chrome/browser/ui/profile_error_dialog.h"
38 #include "chrome/common/chrome_constants.h" 39 #include "chrome/common/chrome_constants.h"
39 #include "chrome/common/pref_names.h" 40 #include "chrome/common/pref_names.h"
40 #include "components/pref_registry/pref_registry_syncable.h" 41 #include "components/pref_registry/pref_registry_syncable.h"
41 #include "components/search_engines/default_search_manager.h" 42 #include "components/search_engines/default_search_manager.h"
42 #include "components/search_engines/search_engines_pref_names.h" 43 #include "components/search_engines/search_engines_pref_names.h"
43 #include "components/sync_driver/pref_names.h" 44 #include "components/sync_driver/pref_names.h"
44 #include "content/public/browser/browser_context.h" 45 #include "content/public/browser/browser_context.h"
45 #include "content/public/browser/browser_thread.h" 46 #include "content/public/browser/browser_thread.h"
46 #include "grit/browser_resources.h" 47 #include "grit/browser_resources.h"
47 #include "grit/chromium_strings.h" 48 #include "grit/chromium_strings.h"
48 #include "grit/generated_resources.h" 49 #include "grit/generated_resources.h"
50 #include "sync/internal_api/public/base/model_type.h"
49 #include "ui/base/resource/resource_bundle.h" 51 #include "ui/base/resource/resource_bundle.h"
50 52
51 #if defined(ENABLE_CONFIGURATION_POLICY) 53 #if defined(ENABLE_CONFIGURATION_POLICY)
52 #include "components/policy/core/browser/browser_policy_connector.h" 54 #include "components/policy/core/browser/browser_policy_connector.h"
53 #include "components/policy/core/browser/configuration_policy_pref_store.h" 55 #include "components/policy/core/browser/configuration_policy_pref_store.h"
54 #include "components/policy/core/common/policy_types.h" 56 #include "components/policy/core/common/policy_types.h"
55 #endif 57 #endif
56 58
57 #if defined(ENABLE_EXTENSIONS) 59 #if defined(ENABLE_EXTENSIONS)
58 #include "extensions/browser/pref_names.h" 60 #include "extensions/browser/pref_names.h"
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 scoped_ptr<PrefServiceSyncable> CreateProfilePrefs( 446 scoped_ptr<PrefServiceSyncable> CreateProfilePrefs(
445 const base::FilePath& profile_path, 447 const base::FilePath& profile_path,
446 base::SequencedTaskRunner* pref_io_task_runner, 448 base::SequencedTaskRunner* pref_io_task_runner,
447 TrackedPreferenceValidationDelegate* validation_delegate, 449 TrackedPreferenceValidationDelegate* validation_delegate,
448 policy::PolicyService* policy_service, 450 policy::PolicyService* policy_service,
449 SupervisedUserSettingsService* supervised_user_settings, 451 SupervisedUserSettingsService* supervised_user_settings,
450 const scoped_refptr<PrefStore>& extension_prefs, 452 const scoped_refptr<PrefStore>& extension_prefs,
451 const scoped_refptr<user_prefs::PrefRegistrySyncable>& pref_registry, 453 const scoped_refptr<user_prefs::PrefRegistrySyncable>& pref_registry,
452 bool async) { 454 bool async) {
453 TRACE_EVENT0("browser", "chrome_prefs::CreateProfilePrefs"); 455 TRACE_EVENT0("browser", "chrome_prefs::CreateProfilePrefs");
456
457 // A StartSyncFlare used to kick sync early in case of a reset event. This is
458 // done since sync may bring back the user's server value post-reset which
459 // could potentially cause a "settings flash" between the factory default and
460 // the re-instantiated server value. Starting sync ASAP minimizes the window
461 // before the server value is re-instantiated (this window can otherwise be
462 // as long as 10 seconds by default).
463 const base::Closure start_sync_flare_for_prefs =
464 base::Bind(sync_start_util::GetFlareForSyncableService(profile_path),
465 syncer::PREFERENCES);
466
454 PrefServiceSyncableFactory factory; 467 PrefServiceSyncableFactory factory;
455 PrepareFactory( 468 PrepareFactory(&factory,
456 &factory, 469 policy_service,
457 policy_service, 470 supervised_user_settings,
458 supervised_user_settings, 471 scoped_refptr<PersistentPrefStore>(
459 scoped_refptr<PersistentPrefStore>( 472 CreateProfilePrefStoreManager(profile_path)
460 CreateProfilePrefStoreManager(profile_path)->CreateProfilePrefStore( 473 ->CreateProfilePrefStore(pref_io_task_runner,
461 pref_io_task_runner, validation_delegate)), 474 start_sync_flare_for_prefs,
462 extension_prefs, 475 validation_delegate)),
463 async); 476 extension_prefs,
477 async);
464 scoped_ptr<PrefServiceSyncable> pref_service = 478 scoped_ptr<PrefServiceSyncable> pref_service =
465 factory.CreateSyncable(pref_registry.get()); 479 factory.CreateSyncable(pref_registry.get());
466 480
467 ConfigureDefaultSearchPrefMigrationToDictionaryValue(pref_service.get()); 481 ConfigureDefaultSearchPrefMigrationToDictionaryValue(pref_service.get());
468 482
469 return pref_service.Pass(); 483 return pref_service.Pass();
470 } 484 }
471 485
472 void SchedulePrefsFilePathVerification(const base::FilePath& profile_path) { 486 void SchedulePrefsFilePathVerification(const base::FilePath& profile_path) {
473 #if defined(OS_WIN) 487 #if defined(OS_WIN)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 519
506 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { 520 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
507 ProfilePrefStoreManager::RegisterProfilePrefs(registry); 521 ProfilePrefStoreManager::RegisterProfilePrefs(registry);
508 } 522 }
509 523
510 void RegisterPrefs(PrefRegistrySimple* registry) { 524 void RegisterPrefs(PrefRegistrySimple* registry) {
511 ProfilePrefStoreManager::RegisterPrefs(registry); 525 ProfilePrefStoreManager::RegisterPrefs(registry);
512 } 526 }
513 527
514 } // namespace chrome_prefs 528 } // namespace chrome_prefs
OLDNEW
« 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