| 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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 sync_preferences::PrefServiceSyncableFactory factory; | 441 sync_preferences::PrefServiceSyncableFactory factory; |
| 442 PrepareFactory(&factory, pref_filename, policy_service, | 442 PrepareFactory(&factory, pref_filename, policy_service, |
| 443 NULL, // supervised_user_settings | 443 NULL, // supervised_user_settings |
| 444 new JsonPrefStore(pref_filename, pref_io_task_runner, | 444 new JsonPrefStore(pref_filename, pref_io_task_runner, |
| 445 std::unique_ptr<PrefFilter>()), | 445 std::unique_ptr<PrefFilter>()), |
| 446 NULL, // extension_prefs | 446 NULL, // extension_prefs |
| 447 async); | 447 async); |
| 448 return factory.Create(pref_registry.get()); | 448 return factory.Create(pref_registry.get()); |
| 449 } | 449 } |
| 450 | 450 |
| 451 std::unique_ptr<sync_preferences::PrefServiceSyncable> CreateProfilePrefs( | 451 std::unique_ptr<sync_preferences::PrefServiceSyncableFactory> |
| 452 CreateProfilePrefs( |
| 452 const base::FilePath& profile_path, | 453 const base::FilePath& profile_path, |
| 453 prefs::mojom::TrackedPreferenceValidationDelegatePtr validation_delegate, | 454 prefs::mojom::TrackedPreferenceValidationDelegatePtr validation_delegate, |
| 454 policy::PolicyService* policy_service, | 455 policy::PolicyService* policy_service, |
| 455 SupervisedUserSettingsService* supervised_user_settings, | 456 SupervisedUserSettingsService* supervised_user_settings, |
| 456 const scoped_refptr<PrefStore>& extension_prefs, | 457 const scoped_refptr<PrefStore>& extension_prefs, |
| 457 const scoped_refptr<user_prefs::PrefRegistrySyncable>& pref_registry, | 458 const scoped_refptr<user_prefs::PrefRegistrySyncable>& pref_registry, |
| 458 bool async, | 459 bool async, |
| 459 service_manager::Connector* connector) { | 460 service_manager::Connector* connector) { |
| 460 TRACE_EVENT0("browser", "chrome_prefs::CreateProfilePrefs"); | 461 TRACE_EVENT0("browser", "chrome_prefs::CreateProfilePrefs"); |
| 461 SCOPED_UMA_HISTOGRAM_TIMER("PrefService.CreateProfilePrefsTime"); | 462 SCOPED_UMA_HISTOGRAM_TIMER("PrefService.CreateProfilePrefsTime"); |
| 462 | 463 |
| 463 prefs::mojom::ResetOnLoadObserverPtr reset_on_load_observer; | 464 prefs::mojom::ResetOnLoadObserverPtr reset_on_load_observer; |
| 464 mojo::MakeStrongBinding( | 465 mojo::MakeStrongBinding( |
| 465 base::MakeUnique<ResetOnLoadObserverImpl>(profile_path), | 466 base::MakeUnique<ResetOnLoadObserverImpl>(profile_path), |
| 466 mojo::MakeRequest(&reset_on_load_observer)); | 467 mojo::MakeRequest(&reset_on_load_observer)); |
| 467 sync_preferences::PrefServiceSyncableFactory factory; | 468 auto factory = |
| 469 base::MakeUnique<sync_preferences::PrefServiceSyncableFactory>(); |
| 468 scoped_refptr<PersistentPrefStore> user_pref_store( | 470 scoped_refptr<PersistentPrefStore> user_pref_store( |
| 469 CreateProfilePrefStoreManager(profile_path) | 471 CreateProfilePrefStoreManager(profile_path) |
| 470 ->CreateProfilePrefStore( | 472 ->CreateProfilePrefStore( |
| 471 GetTrackingConfiguration(), kTrackedPrefsReportingIDsCount, | 473 GetTrackingConfiguration(), kTrackedPrefsReportingIDsCount, |
| 472 content::BrowserThread::GetBlockingPool(), | 474 content::BrowserThread::GetBlockingPool(), |
| 473 std::move(reset_on_load_observer), std::move(validation_delegate), | 475 std::move(reset_on_load_observer), std::move(validation_delegate), |
| 474 connector, pref_registry)); | 476 connector, pref_registry)); |
| 475 PrepareFactory(&factory, profile_path, policy_service, | 477 PrepareFactory(factory.get(), profile_path, policy_service, |
| 476 supervised_user_settings, user_pref_store, extension_prefs, | 478 supervised_user_settings, user_pref_store, extension_prefs, |
| 477 async); | 479 async); |
| 478 std::unique_ptr<sync_preferences::PrefServiceSyncable> pref_service = | 480 return factory; |
| 479 factory.CreateSyncable(pref_registry.get(), connector); | |
| 480 | |
| 481 return pref_service; | |
| 482 } | 481 } |
| 483 | 482 |
| 484 void DisableDomainCheckForTesting() { | 483 void DisableDomainCheckForTesting() { |
| 485 #if defined(OS_WIN) | 484 #if defined(OS_WIN) |
| 486 g_disable_domain_check_for_testing = true; | 485 g_disable_domain_check_for_testing = true; |
| 487 #endif // OS_WIN | 486 #endif // OS_WIN |
| 488 } | 487 } |
| 489 | 488 |
| 490 bool InitializePrefsFromMasterPrefs( | 489 bool InitializePrefsFromMasterPrefs( |
| 491 const base::FilePath& profile_path, | 490 const base::FilePath& profile_path, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 502 | 501 |
| 503 void ClearResetTime(Profile* profile) { | 502 void ClearResetTime(Profile* profile) { |
| 504 ProfilePrefStoreManager::ClearResetTime(profile->GetPrefs()); | 503 ProfilePrefStoreManager::ClearResetTime(profile->GetPrefs()); |
| 505 } | 504 } |
| 506 | 505 |
| 507 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { | 506 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { |
| 508 ProfilePrefStoreManager::RegisterProfilePrefs(registry); | 507 ProfilePrefStoreManager::RegisterProfilePrefs(registry); |
| 509 } | 508 } |
| 510 | 509 |
| 511 } // namespace chrome_prefs | 510 } // namespace chrome_prefs |
| OLD | NEW |