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

Side by Side 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, 4 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 17 matching lines...) Expand all
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_manager.h" 36 #include "chrome/browser/search_engines/default_search_manager.h"
37 #include "chrome/browser/search_engines/default_search_pref_migration.h" 37 #include "chrome/browser/search_engines/default_search_pref_migration.h"
38 #include "chrome/browser/sync/glue/sync_start_util.h"
38 #include "chrome/browser/ui/profile_error_dialog.h" 39 #include "chrome/browser/ui/profile_error_dialog.h"
39 #include "chrome/common/chrome_constants.h" 40 #include "chrome/common/chrome_constants.h"
40 #include "chrome/common/pref_names.h" 41 #include "chrome/common/pref_names.h"
41 #include "components/pref_registry/pref_registry_syncable.h" 42 #include "components/pref_registry/pref_registry_syncable.h"
42 #include "components/sync_driver/pref_names.h" 43 #include "components/sync_driver/pref_names.h"
43 #include "content/public/browser/browser_context.h" 44 #include "content/public/browser/browser_context.h"
44 #include "content/public/browser/browser_thread.h" 45 #include "content/public/browser/browser_thread.h"
45 #include "extensions/browser/pref_names.h" 46 #include "extensions/browser/pref_names.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_MANAGED_USERS) 59 #if defined(ENABLE_MANAGED_USERS)
58 #include "chrome/browser/supervised_user/supervised_user_pref_store.h" 60 #include "chrome/browser/supervised_user/supervised_user_pref_store.h"
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 scoped_ptr<PrefServiceSyncable> CreateProfilePrefs( 437 scoped_ptr<PrefServiceSyncable> CreateProfilePrefs(
436 const base::FilePath& profile_path, 438 const base::FilePath& profile_path,
437 base::SequencedTaskRunner* pref_io_task_runner, 439 base::SequencedTaskRunner* pref_io_task_runner,
438 TrackedPreferenceValidationDelegate* validation_delegate, 440 TrackedPreferenceValidationDelegate* validation_delegate,
439 policy::PolicyService* policy_service, 441 policy::PolicyService* policy_service,
440 SupervisedUserSettingsService* supervised_user_settings, 442 SupervisedUserSettingsService* supervised_user_settings,
441 const scoped_refptr<PrefStore>& extension_prefs, 443 const scoped_refptr<PrefStore>& extension_prefs,
442 const scoped_refptr<user_prefs::PrefRegistrySyncable>& pref_registry, 444 const scoped_refptr<user_prefs::PrefRegistrySyncable>& pref_registry,
443 bool async) { 445 bool async) {
444 TRACE_EVENT0("browser", "chrome_prefs::CreateProfilePrefs"); 446 TRACE_EVENT0("browser", "chrome_prefs::CreateProfilePrefs");
447
448 // A StartSyncFlare used to kick sync early in case of a reset event. This is
449 // done since sync may bring back the user's server value post-reset which
450 // could potentially cause a "settings flash" between the factory default and
451 // the re-instantiated server value. Starting sync ASAP minimizes the window
452 // before the server value is re-instantiated (this window can otherwise be
453 // as long as 10 seconds by default).
454 const base::Closure start_sync_flare_for_prefs =
455 base::Bind(sync_start_util::GetFlareForSyncableService(profile_path),
456 syncer::PREFERENCES);
457
445 PrefServiceSyncableFactory factory; 458 PrefServiceSyncableFactory factory;
446 PrepareFactory( 459 PrepareFactory(&factory,
447 &factory, 460 policy_service,
448 policy_service, 461 supervised_user_settings,
449 supervised_user_settings, 462 scoped_refptr<PersistentPrefStore>(
450 scoped_refptr<PersistentPrefStore>( 463 CreateProfilePrefStoreManager(profile_path)
451 CreateProfilePrefStoreManager(profile_path)->CreateProfilePrefStore( 464 ->CreateProfilePrefStore(pref_io_task_runner,
452 pref_io_task_runner, validation_delegate)), 465 start_sync_flare_for_prefs,
453 extension_prefs, 466 validation_delegate)),
454 async); 467 extension_prefs,
468 async);
455 scoped_ptr<PrefServiceSyncable> pref_service = 469 scoped_ptr<PrefServiceSyncable> pref_service =
456 factory.CreateSyncable(pref_registry.get()); 470 factory.CreateSyncable(pref_registry.get());
457 471
458 ConfigureDefaultSearchPrefMigrationToDictionaryValue(pref_service.get()); 472 ConfigureDefaultSearchPrefMigrationToDictionaryValue(pref_service.get());
459 473
460 return pref_service.Pass(); 474 return pref_service.Pass();
461 } 475 }
462 476
463 void SchedulePrefsFilePathVerification(const base::FilePath& profile_path) { 477 void SchedulePrefsFilePathVerification(const base::FilePath& profile_path) {
464 #if defined(OS_WIN) 478 #if defined(OS_WIN)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 510
497 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { 511 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
498 ProfilePrefStoreManager::RegisterProfilePrefs(registry); 512 ProfilePrefStoreManager::RegisterProfilePrefs(registry);
499 } 513 }
500 514
501 void RegisterPrefs(PrefRegistrySimple* registry) { 515 void RegisterPrefs(PrefRegistrySimple* registry) {
502 ProfilePrefStoreManager::RegisterPrefs(registry); 516 ProfilePrefStoreManager::RegisterPrefs(registry);
503 } 517 }
504 518
505 } // namespace chrome_prefs 519 } // 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