Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: chrome/browser/prefs/chrome_pref_service_factory.cc

Issue 1326353002: Remove dependency of PrefSyncableService on Profile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pref_model_associator
Patch Set: Move files back to //chrome/browser/prefs & //chrome/test/base Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_pref_service_factory.h" 5 #include "chrome/browser/prefs/chrome_pref_service_factory.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/metrics/field_trial.h" 13 #include "base/metrics/field_trial.h"
14 #include "base/metrics/histogram_macros.h" 14 #include "base/metrics/histogram_macros.h"
15 #include "base/prefs/default_pref_store.h" 15 #include "base/prefs/default_pref_store.h"
16 #include "base/prefs/json_pref_store.h" 16 #include "base/prefs/json_pref_store.h"
17 #include "base/prefs/pref_filter.h" 17 #include "base/prefs/pref_filter.h"
18 #include "base/prefs/pref_notifier_impl.h" 18 #include "base/prefs/pref_notifier_impl.h"
19 #include "base/prefs/pref_registry.h" 19 #include "base/prefs/pref_registry.h"
20 #include "base/prefs/pref_registry_simple.h" 20 #include "base/prefs/pref_registry_simple.h"
21 #include "base/prefs/pref_service.h" 21 #include "base/prefs/pref_service.h"
22 #include "base/prefs/pref_store.h" 22 #include "base/prefs/pref_store.h"
23 #include "base/prefs/pref_value_store.h" 23 #include "base/prefs/pref_value_store.h"
24 #include "base/threading/sequenced_worker_pool.h" 24 #include "base/threading/sequenced_worker_pool.h"
25 #include "base/time/time.h" 25 #include "base/time/time.h"
26 #include "base/trace_event/trace_event.h" 26 #include "base/trace_event/trace_event.h"
27 #include "chrome/browser/browser_process.h" 27 #include "chrome/browser/browser_process.h"
28 #include "chrome/browser/prefs/chrome_pref_model_associator_client.h"
28 #include "chrome/browser/prefs/command_line_pref_store.h" 29 #include "chrome/browser/prefs/command_line_pref_store.h"
29 #include "chrome/browser/prefs/pref_model_associator.h" 30 #include "chrome/browser/prefs/pref_model_associator.h"
30 #include "chrome/browser/prefs/pref_service_syncable.h" 31 #include "chrome/browser/prefs/pref_service_syncable.h"
31 #include "chrome/browser/prefs/pref_service_syncable_factory.h" 32 #include "chrome/browser/prefs/pref_service_syncable_factory.h"
32 #include "chrome/browser/prefs/profile_pref_store_manager.h" 33 #include "chrome/browser/prefs/profile_pref_store_manager.h"
33 #include "chrome/browser/profiles/file_path_verifier_win.h" 34 #include "chrome/browser/profiles/file_path_verifier_win.h"
34 #include "chrome/browser/profiles/profile.h" 35 #include "chrome/browser/profiles/profile.h"
35 #include "chrome/browser/sync/glue/sync_start_util.h" 36 #include "chrome/browser/sync/glue/sync_start_util.h"
36 #include "chrome/browser/ui/profile_error_dialog.h" 37 #include "chrome/browser/ui/profile_error_dialog.h"
37 #include "chrome/common/chrome_constants.h" 38 #include "chrome/common/chrome_constants.h"
38 #include "chrome/common/pref_names.h" 39 #include "chrome/common/pref_names.h"
39 #include "chrome/grit/chromium_strings.h" 40 #include "chrome/grit/chromium_strings.h"
40 #include "chrome/grit/generated_resources.h" 41 #include "chrome/grit/generated_resources.h"
41 #include "components/component_updater/pref_names.h" 42 #include "components/component_updater/pref_names.h"
42 #include "components/pref_registry/pref_registry_syncable.h" 43 #include "components/pref_registry/pref_registry_syncable.h"
43 #include "components/search_engines/default_search_manager.h" 44 #include "components/search_engines/default_search_manager.h"
44 #include "components/search_engines/default_search_pref_migration.h" 45 #include "components/search_engines/default_search_pref_migration.h"
45 #include "components/search_engines/search_engines_pref_names.h" 46 #include "components/search_engines/search_engines_pref_names.h"
46 #include "components/sync_driver/pref_names.h" 47 #include "components/sync_driver/pref_names.h"
47 #include "components/user_prefs/tracked/pref_names.h" 48 #include "components/user_prefs/tracked/pref_names.h"
48 #include "content/public/browser/browser_context.h" 49 #include "content/public/browser/browser_context.h"
49 #include "content/public/browser/browser_thread.h" 50 #include "content/public/browser/browser_thread.h"
50 #include "grit/browser_resources.h" 51 #include "grit/browser_resources.h"
51 #include "sync/internal_api/public/base/model_type.h" 52 #include "sync/internal_api/public/base/model_type.h"
52 #include "ui/base/resource/resource_bundle.h" 53 #include "ui/base/resource/resource_bundle.h"
53 54
54 #if defined(ENABLE_CONFIGURATION_POLICY) 55 #if defined(ENABLE_CONFIGURATION_POLICY)
55 #include "components/policy/core/browser/browser_policy_connector.h" 56 #include "components/policy/core/browser/browser_policy_connector.h"
56 #include "components/policy/core/browser/configuration_policy_pref_store.h" 57 #include "components/policy/core/browser/configuration_policy_pref_store.h"
57 #include "components/policy/core/common/policy_types.h"
58 #endif 58 #endif
59 59
60 #if defined(ENABLE_EXTENSIONS) 60 #if defined(ENABLE_EXTENSIONS)
61 #include "extensions/browser/pref_names.h" 61 #include "extensions/browser/pref_names.h"
62 #endif 62 #endif
63 63
64 #if defined(ENABLE_SUPERVISED_USERS) 64 #if defined(ENABLE_SUPERVISED_USERS)
65 #include "chrome/browser/supervised_user/supervised_user_pref_store.h" 65 #include "chrome/browser/supervised_user/supervised_user_pref_store.h"
66 #endif 66 #endif
67 67
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 } 420 }
421 421
422 void PrepareFactory( 422 void PrepareFactory(
423 PrefServiceSyncableFactory* factory, 423 PrefServiceSyncableFactory* factory,
424 policy::PolicyService* policy_service, 424 policy::PolicyService* policy_service,
425 SupervisedUserSettingsService* supervised_user_settings, 425 SupervisedUserSettingsService* supervised_user_settings,
426 scoped_refptr<PersistentPrefStore> user_pref_store, 426 scoped_refptr<PersistentPrefStore> user_pref_store,
427 const scoped_refptr<PrefStore>& extension_prefs, 427 const scoped_refptr<PrefStore>& extension_prefs,
428 bool async) { 428 bool async) {
429 #if defined(ENABLE_CONFIGURATION_POLICY) 429 #if defined(ENABLE_CONFIGURATION_POLICY)
430 using policy::ConfigurationPolicyPrefStore; 430 policy::BrowserPolicyConnector* policy_connector =
431 factory->set_managed_prefs( 431 g_browser_process->browser_policy_connector();
432 make_scoped_refptr(new ConfigurationPolicyPrefStore( 432 factory->SetManagedPolicies(policy_service, policy_connector);
433 policy_service, 433 factory->SetRecommendedPolicies(policy_service, policy_connector);
434 g_browser_process->browser_policy_connector()->GetHandlerList(),
435 policy::POLICY_LEVEL_MANDATORY)));
436 factory->set_recommended_prefs(
437 make_scoped_refptr(new ConfigurationPolicyPrefStore(
438 policy_service,
439 g_browser_process->browser_policy_connector()->GetHandlerList(),
440 policy::POLICY_LEVEL_RECOMMENDED)));
441 #endif // ENABLE_CONFIGURATION_POLICY 434 #endif // ENABLE_CONFIGURATION_POLICY
442 435
443 #if defined(ENABLE_SUPERVISED_USERS) 436 #if defined(ENABLE_SUPERVISED_USERS)
444 if (supervised_user_settings) { 437 if (supervised_user_settings) {
445 scoped_refptr<PrefStore> supervised_user_prefs = make_scoped_refptr( 438 scoped_refptr<PrefStore> supervised_user_prefs = make_scoped_refptr(
446 new SupervisedUserPrefStore(supervised_user_settings)); 439 new SupervisedUserPrefStore(supervised_user_settings));
447 // TODO(bauerb): Temporary CHECK while investigating 440 // TODO(bauerb): Temporary CHECK while investigating
448 // https://crbug.com/425785. Remove when that bug is fixed. 441 // https://crbug.com/425785. Remove when that bug is fixed.
449 CHECK(async || supervised_user_prefs->IsInitializationComplete()); 442 CHECK(async || supervised_user_prefs->IsInitializationComplete());
450 factory->set_supervised_user_prefs(supervised_user_prefs); 443 factory->set_supervised_user_prefs(supervised_user_prefs);
451 } 444 }
452 #endif 445 #endif
453 446
447 factory->SetPrefModelAssociatorClient(
448 ChromePrefModelAssociatorClient::GetInstance());
449
454 factory->set_async(async); 450 factory->set_async(async);
455 factory->set_extension_prefs(extension_prefs); 451 factory->set_extension_prefs(extension_prefs);
456 factory->set_command_line_prefs(make_scoped_refptr( 452 factory->set_command_line_prefs(make_scoped_refptr(
457 new CommandLinePrefStore(base::CommandLine::ForCurrentProcess()))); 453 new CommandLinePrefStore(base::CommandLine::ForCurrentProcess())));
458 factory->set_read_error_callback(base::Bind(&HandleReadError)); 454 factory->set_read_error_callback(base::Bind(&HandleReadError));
459 factory->set_user_prefs(user_pref_store); 455 factory->set_user_prefs(user_pref_store);
460 } 456 }
461 457
462 } // namespace 458 } // namespace
463 459
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 569
574 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { 570 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
575 ProfilePrefStoreManager::RegisterProfilePrefs(registry); 571 ProfilePrefStoreManager::RegisterProfilePrefs(registry);
576 } 572 }
577 573
578 void RegisterPrefs(PrefRegistrySimple* registry) { 574 void RegisterPrefs(PrefRegistrySimple* registry) {
579 ProfilePrefStoreManager::RegisterPrefs(registry); 575 ProfilePrefStoreManager::RegisterPrefs(registry);
580 } 576 }
581 577
582 } // namespace chrome_prefs 578 } // namespace chrome_prefs
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698