OLD | NEW |
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_command_line_pref_store.h> | 5 #include <chrome/browser/prefs/chrome_command_line_pref_store.h> |
6 #include "chrome/browser/prefs/chrome_pref_service_factory.h" | 6 #include "chrome/browser/prefs/chrome_pref_service_factory.h" |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 } | 470 } |
471 | 471 |
472 std::unique_ptr<sync_preferences::PrefServiceSyncable> CreateProfilePrefs( | 472 std::unique_ptr<sync_preferences::PrefServiceSyncable> CreateProfilePrefs( |
473 const base::FilePath& profile_path, | 473 const base::FilePath& profile_path, |
474 base::SequencedTaskRunner* pref_io_task_runner, | 474 base::SequencedTaskRunner* pref_io_task_runner, |
475 TrackedPreferenceValidationDelegate* validation_delegate, | 475 TrackedPreferenceValidationDelegate* validation_delegate, |
476 policy::PolicyService* policy_service, | 476 policy::PolicyService* policy_service, |
477 SupervisedUserSettingsService* supervised_user_settings, | 477 SupervisedUserSettingsService* supervised_user_settings, |
478 const scoped_refptr<PrefStore>& extension_prefs, | 478 const scoped_refptr<PrefStore>& extension_prefs, |
479 const scoped_refptr<user_prefs::PrefRegistrySyncable>& pref_registry, | 479 const scoped_refptr<user_prefs::PrefRegistrySyncable>& pref_registry, |
480 bool async) { | 480 bool async, |
| 481 service_manager::Connector* connector) { |
481 TRACE_EVENT0("browser", "chrome_prefs::CreateProfilePrefs"); | 482 TRACE_EVENT0("browser", "chrome_prefs::CreateProfilePrefs"); |
482 SCOPED_UMA_HISTOGRAM_TIMER("PrefService.CreateProfilePrefsTime"); | 483 SCOPED_UMA_HISTOGRAM_TIMER("PrefService.CreateProfilePrefsTime"); |
483 | 484 |
484 // A StartSyncFlare used to kick sync early in case of a reset event. This is | 485 // A StartSyncFlare used to kick sync early in case of a reset event. This is |
485 // done since sync may bring back the user's server value post-reset which | 486 // done since sync may bring back the user's server value post-reset which |
486 // could potentially cause a "settings flash" between the factory default and | 487 // could potentially cause a "settings flash" between the factory default and |
487 // the re-instantiated server value. Starting sync ASAP minimizes the window | 488 // the re-instantiated server value. Starting sync ASAP minimizes the window |
488 // before the server value is re-instantiated (this window can otherwise be | 489 // before the server value is re-instantiated (this window can otherwise be |
489 // as long as 10 seconds by default). | 490 // as long as 10 seconds by default). |
490 const base::Closure start_sync_flare_for_prefs = | 491 const base::Closure start_sync_flare_for_prefs = |
491 base::Bind(sync_start_util::GetFlareForSyncableService(profile_path), | 492 base::Bind(sync_start_util::GetFlareForSyncableService(profile_path), |
492 syncer::PREFERENCES); | 493 syncer::PREFERENCES); |
493 | 494 |
494 sync_preferences::PrefServiceSyncableFactory factory; | 495 sync_preferences::PrefServiceSyncableFactory factory; |
495 scoped_refptr<PersistentPrefStore> user_pref_store( | 496 scoped_refptr<PersistentPrefStore> user_pref_store( |
496 CreateProfilePrefStoreManager(profile_path) | 497 CreateProfilePrefStoreManager(profile_path) |
497 ->CreateProfilePrefStore(pref_io_task_runner, | 498 ->CreateProfilePrefStore(pref_io_task_runner, |
498 start_sync_flare_for_prefs, | 499 start_sync_flare_for_prefs, |
499 validation_delegate)); | 500 validation_delegate)); |
500 PrepareFactory(&factory, profile_path, policy_service, | 501 PrepareFactory(&factory, profile_path, policy_service, |
501 supervised_user_settings, user_pref_store, extension_prefs, | 502 supervised_user_settings, user_pref_store, extension_prefs, |
502 async); | 503 async); |
503 std::unique_ptr<sync_preferences::PrefServiceSyncable> pref_service = | 504 std::unique_ptr<sync_preferences::PrefServiceSyncable> pref_service = |
504 factory.CreateSyncable(pref_registry.get()); | 505 factory.CreateSyncable(pref_registry.get(), connector); |
505 | 506 |
506 return pref_service; | 507 return pref_service; |
507 } | 508 } |
508 | 509 |
509 void DisableDomainCheckForTesting() { | 510 void DisableDomainCheckForTesting() { |
510 #if defined(OS_WIN) | 511 #if defined(OS_WIN) |
511 g_disable_domain_check_for_testing = true; | 512 g_disable_domain_check_for_testing = true; |
512 #endif // OS_WIN | 513 #endif // OS_WIN |
513 } | 514 } |
514 | 515 |
(...skipping 10 matching lines...) Expand all Loading... |
525 | 526 |
526 void ClearResetTime(Profile* profile) { | 527 void ClearResetTime(Profile* profile) { |
527 ProfilePrefStoreManager::ClearResetTime(profile->GetPrefs()); | 528 ProfilePrefStoreManager::ClearResetTime(profile->GetPrefs()); |
528 } | 529 } |
529 | 530 |
530 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { | 531 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { |
531 ProfilePrefStoreManager::RegisterProfilePrefs(registry); | 532 ProfilePrefStoreManager::RegisterProfilePrefs(registry); |
532 } | 533 } |
533 | 534 |
534 } // namespace chrome_prefs | 535 } // namespace chrome_prefs |
OLD | NEW |