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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "components/prefs/pref_registry_simple.h" | 44 #include "components/prefs/pref_registry_simple.h" |
45 #include "components/prefs/pref_service.h" | 45 #include "components/prefs/pref_service.h" |
46 #include "components/prefs/pref_store.h" | 46 #include "components/prefs/pref_store.h" |
47 #include "components/prefs/pref_value_store.h" | 47 #include "components/prefs/pref_value_store.h" |
48 #include "components/search_engines/default_search_manager.h" | 48 #include "components/search_engines/default_search_manager.h" |
49 #include "components/search_engines/default_search_pref_migration.h" | 49 #include "components/search_engines/default_search_pref_migration.h" |
50 #include "components/search_engines/search_engines_pref_names.h" | 50 #include "components/search_engines/search_engines_pref_names.h" |
51 #include "components/signin/core/common/signin_pref_names.h" | 51 #include "components/signin/core/common/signin_pref_names.h" |
52 #include "components/sync/base/model_type.h" | 52 #include "components/sync/base/model_type.h" |
53 #include "components/sync/base/pref_names.h" | 53 #include "components/sync/base/pref_names.h" |
54 #include "components/syncable_prefs/pref_model_associator.h" | 54 #include "components/sync_preferences/pref_model_associator.h" |
55 #include "components/syncable_prefs/pref_service_syncable.h" | 55 #include "components/sync_preferences/pref_service_syncable.h" |
56 #include "components/syncable_prefs/pref_service_syncable_factory.h" | 56 #include "components/sync_preferences/pref_service_syncable_factory.h" |
57 #include "components/user_prefs/tracked/pref_names.h" | 57 #include "components/user_prefs/tracked/pref_names.h" |
58 #include "content/public/browser/browser_context.h" | 58 #include "content/public/browser/browser_context.h" |
59 #include "content/public/browser/browser_thread.h" | 59 #include "content/public/browser/browser_thread.h" |
60 #include "sql/error_delegate_util.h" | 60 #include "sql/error_delegate_util.h" |
61 #include "ui/base/resource/resource_bundle.h" | 61 #include "ui/base/resource/resource_bundle.h" |
62 | 62 |
63 #if defined(ENABLE_EXTENSIONS) | 63 #if defined(ENABLE_EXTENSIONS) |
64 #include "extensions/browser/pref_names.h" | 64 #include "extensions/browser/pref_names.h" |
65 #endif | 65 #endif |
66 | 66 |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 std::string seed; | 409 std::string seed; |
410 #if defined(GOOGLE_CHROME_BUILD) | 410 #if defined(GOOGLE_CHROME_BUILD) |
411 seed = ResourceBundle::GetSharedInstance().GetRawDataResource( | 411 seed = ResourceBundle::GetSharedInstance().GetRawDataResource( |
412 IDR_PREF_HASH_SEED_BIN).as_string(); | 412 IDR_PREF_HASH_SEED_BIN).as_string(); |
413 #endif | 413 #endif |
414 return base::MakeUnique<ProfilePrefStoreManager>( | 414 return base::MakeUnique<ProfilePrefStoreManager>( |
415 profile_path, GetTrackingConfiguration(), kTrackedPrefsReportingIDsCount, | 415 profile_path, GetTrackingConfiguration(), kTrackedPrefsReportingIDsCount, |
416 seed, device_id, g_browser_process->local_state()); | 416 seed, device_id, g_browser_process->local_state()); |
417 } | 417 } |
418 | 418 |
419 void PrepareFactory(syncable_prefs::PrefServiceSyncableFactory* factory, | 419 void PrepareFactory(sync_preferences::PrefServiceSyncableFactory* factory, |
420 const base::FilePath& pref_filename, | 420 const base::FilePath& pref_filename, |
421 policy::PolicyService* policy_service, | 421 policy::PolicyService* policy_service, |
422 SupervisedUserSettingsService* supervised_user_settings, | 422 SupervisedUserSettingsService* supervised_user_settings, |
423 scoped_refptr<PersistentPrefStore> user_pref_store, | 423 scoped_refptr<PersistentPrefStore> user_pref_store, |
424 const scoped_refptr<PrefStore>& extension_prefs, | 424 const scoped_refptr<PrefStore>& extension_prefs, |
425 bool async) { | 425 bool async) { |
426 policy::BrowserPolicyConnector* policy_connector = | 426 policy::BrowserPolicyConnector* policy_connector = |
427 g_browser_process->browser_policy_connector(); | 427 g_browser_process->browser_policy_connector(); |
428 factory->SetManagedPolicies(policy_service, policy_connector); | 428 factory->SetManagedPolicies(policy_service, policy_connector); |
429 factory->SetRecommendedPolicies(policy_service, policy_connector); | 429 factory->SetRecommendedPolicies(policy_service, policy_connector); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 "enforce_always_with_extensions_and_dse"; | 464 "enforce_always_with_extensions_and_dse"; |
465 | 465 |
466 } // namespace internals | 466 } // namespace internals |
467 | 467 |
468 std::unique_ptr<PrefService> CreateLocalState( | 468 std::unique_ptr<PrefService> CreateLocalState( |
469 const base::FilePath& pref_filename, | 469 const base::FilePath& pref_filename, |
470 base::SequencedTaskRunner* pref_io_task_runner, | 470 base::SequencedTaskRunner* pref_io_task_runner, |
471 policy::PolicyService* policy_service, | 471 policy::PolicyService* policy_service, |
472 const scoped_refptr<PrefRegistry>& pref_registry, | 472 const scoped_refptr<PrefRegistry>& pref_registry, |
473 bool async) { | 473 bool async) { |
474 syncable_prefs::PrefServiceSyncableFactory factory; | 474 sync_preferences::PrefServiceSyncableFactory factory; |
475 PrepareFactory(&factory, pref_filename, policy_service, | 475 PrepareFactory(&factory, pref_filename, policy_service, |
476 NULL, // supervised_user_settings | 476 NULL, // supervised_user_settings |
477 new JsonPrefStore(pref_filename, pref_io_task_runner, | 477 new JsonPrefStore(pref_filename, pref_io_task_runner, |
478 std::unique_ptr<PrefFilter>()), | 478 std::unique_ptr<PrefFilter>()), |
479 NULL, // extension_prefs | 479 NULL, // extension_prefs |
480 async); | 480 async); |
481 return factory.Create(pref_registry.get()); | 481 return factory.Create(pref_registry.get()); |
482 } | 482 } |
483 | 483 |
484 std::unique_ptr<syncable_prefs::PrefServiceSyncable> CreateProfilePrefs( | 484 std::unique_ptr<sync_preferences::PrefServiceSyncable> CreateProfilePrefs( |
485 const base::FilePath& profile_path, | 485 const base::FilePath& profile_path, |
486 base::SequencedTaskRunner* pref_io_task_runner, | 486 base::SequencedTaskRunner* pref_io_task_runner, |
487 TrackedPreferenceValidationDelegate* validation_delegate, | 487 TrackedPreferenceValidationDelegate* validation_delegate, |
488 policy::PolicyService* policy_service, | 488 policy::PolicyService* policy_service, |
489 SupervisedUserSettingsService* supervised_user_settings, | 489 SupervisedUserSettingsService* supervised_user_settings, |
490 const scoped_refptr<PrefStore>& extension_prefs, | 490 const scoped_refptr<PrefStore>& extension_prefs, |
491 const scoped_refptr<user_prefs::PrefRegistrySyncable>& pref_registry, | 491 const scoped_refptr<user_prefs::PrefRegistrySyncable>& pref_registry, |
492 bool async) { | 492 bool async) { |
493 TRACE_EVENT0("browser", "chrome_prefs::CreateProfilePrefs"); | 493 TRACE_EVENT0("browser", "chrome_prefs::CreateProfilePrefs"); |
494 SCOPED_UMA_HISTOGRAM_TIMER("PrefService.CreateProfilePrefsTime"); | 494 SCOPED_UMA_HISTOGRAM_TIMER("PrefService.CreateProfilePrefsTime"); |
495 | 495 |
496 // A StartSyncFlare used to kick sync early in case of a reset event. This is | 496 // A StartSyncFlare used to kick sync early in case of a reset event. This is |
497 // done since sync may bring back the user's server value post-reset which | 497 // done since sync may bring back the user's server value post-reset which |
498 // could potentially cause a "settings flash" between the factory default and | 498 // could potentially cause a "settings flash" between the factory default and |
499 // the re-instantiated server value. Starting sync ASAP minimizes the window | 499 // the re-instantiated server value. Starting sync ASAP minimizes the window |
500 // before the server value is re-instantiated (this window can otherwise be | 500 // before the server value is re-instantiated (this window can otherwise be |
501 // as long as 10 seconds by default). | 501 // as long as 10 seconds by default). |
502 const base::Closure start_sync_flare_for_prefs = | 502 const base::Closure start_sync_flare_for_prefs = |
503 base::Bind(sync_start_util::GetFlareForSyncableService(profile_path), | 503 base::Bind(sync_start_util::GetFlareForSyncableService(profile_path), |
504 syncer::PREFERENCES); | 504 syncer::PREFERENCES); |
505 | 505 |
506 syncable_prefs::PrefServiceSyncableFactory factory; | 506 sync_preferences::PrefServiceSyncableFactory factory; |
507 scoped_refptr<PersistentPrefStore> user_pref_store( | 507 scoped_refptr<PersistentPrefStore> user_pref_store( |
508 CreateProfilePrefStoreManager(profile_path) | 508 CreateProfilePrefStoreManager(profile_path) |
509 ->CreateProfilePrefStore(pref_io_task_runner, | 509 ->CreateProfilePrefStore(pref_io_task_runner, |
510 start_sync_flare_for_prefs, | 510 start_sync_flare_for_prefs, |
511 validation_delegate)); | 511 validation_delegate)); |
512 PrepareFactory(&factory, profile_path, policy_service, | 512 PrepareFactory(&factory, profile_path, policy_service, |
513 supervised_user_settings, user_pref_store, extension_prefs, | 513 supervised_user_settings, user_pref_store, extension_prefs, |
514 async); | 514 async); |
515 std::unique_ptr<syncable_prefs::PrefServiceSyncable> pref_service = | 515 std::unique_ptr<sync_preferences::PrefServiceSyncable> pref_service = |
516 factory.CreateSyncable(pref_registry.get()); | 516 factory.CreateSyncable(pref_registry.get()); |
517 | 517 |
518 ConfigureDefaultSearchPrefMigrationToDictionaryValue(pref_service.get()); | 518 ConfigureDefaultSearchPrefMigrationToDictionaryValue(pref_service.get()); |
519 | 519 |
520 return pref_service; | 520 return pref_service; |
521 } | 521 } |
522 | 522 |
523 void DisableDomainCheckForTesting() { | 523 void DisableDomainCheckForTesting() { |
524 #if defined(OS_WIN) | 524 #if defined(OS_WIN) |
525 g_disable_domain_check_for_testing = true; | 525 g_disable_domain_check_for_testing = true; |
(...skipping 13 matching lines...) Expand all Loading... |
539 | 539 |
540 void ClearResetTime(Profile* profile) { | 540 void ClearResetTime(Profile* profile) { |
541 ProfilePrefStoreManager::ClearResetTime(profile->GetPrefs()); | 541 ProfilePrefStoreManager::ClearResetTime(profile->GetPrefs()); |
542 } | 542 } |
543 | 543 |
544 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { | 544 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { |
545 ProfilePrefStoreManager::RegisterProfilePrefs(registry); | 545 ProfilePrefStoreManager::RegisterProfilePrefs(registry); |
546 } | 546 } |
547 | 547 |
548 } // namespace chrome_prefs | 548 } // namespace chrome_prefs |
OLD | NEW |