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 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 new JsonPrefStore(pref_filename, pref_io_task_runner, | 491 new JsonPrefStore(pref_filename, pref_io_task_runner, |
492 std::unique_ptr<PrefFilter>()), | 492 std::unique_ptr<PrefFilter>()), |
493 NULL, // extension_prefs | 493 NULL, // extension_prefs |
494 async); | 494 async); |
495 return factory.Create(pref_registry.get()); | 495 return factory.Create(pref_registry.get()); |
496 } | 496 } |
497 | 497 |
498 std::unique_ptr<sync_preferences::PrefServiceSyncable> CreateProfilePrefs( | 498 std::unique_ptr<sync_preferences::PrefServiceSyncable> CreateProfilePrefs( |
499 const base::FilePath& profile_path, | 499 const base::FilePath& profile_path, |
500 base::SequencedTaskRunner* pref_io_task_runner, | 500 base::SequencedTaskRunner* pref_io_task_runner, |
501 prefs::mojom::TrackedPreferenceValidationDelegate* validation_delegate, | 501 std::unique_ptr<prefs::mojom::TrackedPreferenceValidationDelegate>* |
| 502 validation_delegate, |
502 policy::PolicyService* policy_service, | 503 policy::PolicyService* policy_service, |
503 SupervisedUserSettingsService* supervised_user_settings, | 504 SupervisedUserSettingsService* supervised_user_settings, |
504 const scoped_refptr<PrefStore>& extension_prefs, | 505 const scoped_refptr<PrefStore>& extension_prefs, |
505 const scoped_refptr<user_prefs::PrefRegistrySyncable>& pref_registry, | 506 const scoped_refptr<user_prefs::PrefRegistrySyncable>& pref_registry, |
506 bool async) { | 507 bool async) { |
507 TRACE_EVENT0("browser", "chrome_prefs::CreateProfilePrefs"); | 508 TRACE_EVENT0("browser", "chrome_prefs::CreateProfilePrefs"); |
508 SCOPED_UMA_HISTOGRAM_TIMER("PrefService.CreateProfilePrefsTime"); | 509 SCOPED_UMA_HISTOGRAM_TIMER("PrefService.CreateProfilePrefsTime"); |
509 | 510 |
510 // A StartSyncFlare used to kick sync early in case of a reset event. This is | 511 // A StartSyncFlare used to kick sync early in case of a reset event. This is |
511 // done since sync may bring back the user's server value post-reset which | 512 // done since sync may bring back the user's server value post-reset which |
512 // could potentially cause a "settings flash" between the factory default and | 513 // could potentially cause a "settings flash" between the factory default and |
513 // the re-instantiated server value. Starting sync ASAP minimizes the window | 514 // the re-instantiated server value. Starting sync ASAP minimizes the window |
514 // before the server value is re-instantiated (this window can otherwise be | 515 // before the server value is re-instantiated (this window can otherwise be |
515 // as long as 10 seconds by default). | 516 // as long as 10 seconds by default). |
516 const base::Closure start_sync_flare_for_prefs = | 517 const base::Closure start_sync_flare_for_prefs = |
517 base::Bind(sync_start_util::GetFlareForSyncableService(profile_path), | 518 base::Bind(sync_start_util::GetFlareForSyncableService(profile_path), |
518 syncer::PREFERENCES); | 519 syncer::PREFERENCES); |
519 | 520 |
520 sync_preferences::PrefServiceSyncableFactory factory; | 521 sync_preferences::PrefServiceSyncableFactory factory; |
521 scoped_refptr<PersistentPrefStore> user_pref_store( | 522 scoped_refptr<PersistentPrefStore> user_pref_store( |
522 CreateProfilePrefStoreManager(profile_path) | 523 CreateProfilePrefStoreManager(profile_path) |
523 ->CreateProfilePrefStore(pref_io_task_runner, | 524 ->CreateProfilePrefStore( |
524 start_sync_flare_for_prefs, | 525 content::BrowserThread::GetTaskRunnerForThread( |
525 validation_delegate)); | 526 content::BrowserThread::IO), |
| 527 pref_io_task_runner, start_sync_flare_for_prefs, |
| 528 validation_delegate)); |
526 PrepareFactory(&factory, profile_path, policy_service, | 529 PrepareFactory(&factory, profile_path, policy_service, |
527 supervised_user_settings, user_pref_store, extension_prefs, | 530 supervised_user_settings, user_pref_store, extension_prefs, |
528 async); | 531 async); |
529 std::unique_ptr<sync_preferences::PrefServiceSyncable> pref_service = | 532 std::unique_ptr<sync_preferences::PrefServiceSyncable> pref_service = |
530 factory.CreateSyncable(pref_registry.get()); | 533 factory.CreateSyncable(pref_registry.get()); |
531 | 534 |
532 return pref_service; | 535 return pref_service; |
533 } | 536 } |
534 | 537 |
535 void DisableDomainCheckForTesting() { | 538 void DisableDomainCheckForTesting() { |
(...skipping 15 matching lines...) Expand all Loading... |
551 | 554 |
552 void ClearResetTime(Profile* profile) { | 555 void ClearResetTime(Profile* profile) { |
553 ProfilePrefStoreManager::ClearResetTime(profile->GetPrefs()); | 556 ProfilePrefStoreManager::ClearResetTime(profile->GetPrefs()); |
554 } | 557 } |
555 | 558 |
556 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { | 559 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { |
557 ProfilePrefStoreManager::RegisterProfilePrefs(registry); | 560 ProfilePrefStoreManager::RegisterProfilePrefs(registry); |
558 } | 561 } |
559 | 562 |
560 } // namespace chrome_prefs | 563 } // namespace chrome_prefs |
OLD | NEW |