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