OLD | NEW |
| (Empty) |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/prefs/pref_service_syncable_factory.h" | |
6 | |
7 #include "base/prefs/default_pref_store.h" | |
8 #include "base/prefs/pref_notifier_impl.h" | |
9 #include "base/prefs/pref_value_store.h" | |
10 #include "base/trace_event/trace_event.h" | |
11 #include "chrome/browser/prefs/pref_service_syncable.h" | |
12 #include "components/pref_registry/pref_registry_syncable.h" | |
13 | |
14 #if defined(ENABLE_CONFIGURATION_POLICY) | |
15 #include "components/policy/core/browser/browser_policy_connector.h" | |
16 #include "components/policy/core/browser/configuration_policy_pref_store.h" | |
17 #include "components/policy/core/common/policy_service.h" | |
18 #include "components/policy/core/common/policy_types.h" | |
19 #endif | |
20 | |
21 PrefServiceSyncableFactory::PrefServiceSyncableFactory() { | |
22 } | |
23 | |
24 PrefServiceSyncableFactory::~PrefServiceSyncableFactory() { | |
25 } | |
26 | |
27 #if defined(ENABLE_CONFIGURATION_POLICY) | |
28 void PrefServiceSyncableFactory::SetManagedPolicies( | |
29 policy::PolicyService* service, | |
30 policy::BrowserPolicyConnector* connector) { | |
31 set_managed_prefs(new policy::ConfigurationPolicyPrefStore( | |
32 service, connector->GetHandlerList(), policy::POLICY_LEVEL_MANDATORY)); | |
33 } | |
34 | |
35 void PrefServiceSyncableFactory::SetRecommendedPolicies( | |
36 policy::PolicyService* service, | |
37 policy::BrowserPolicyConnector* connector) { | |
38 set_recommended_prefs(new policy::ConfigurationPolicyPrefStore( | |
39 service, connector->GetHandlerList(), policy::POLICY_LEVEL_RECOMMENDED)); | |
40 } | |
41 #endif | |
42 | |
43 void PrefServiceSyncableFactory::SetPrefModelAssociatorClient( | |
44 PrefModelAssociatorClient* pref_model_associator_client) { | |
45 pref_model_associator_client_ = pref_model_associator_client; | |
46 } | |
47 | |
48 scoped_ptr<PrefServiceSyncable> PrefServiceSyncableFactory::CreateSyncable( | |
49 user_prefs::PrefRegistrySyncable* pref_registry) { | |
50 TRACE_EVENT0("browser", "PrefServiceSyncableFactory::CreateSyncable"); | |
51 PrefNotifierImpl* pref_notifier = new PrefNotifierImpl(); | |
52 scoped_ptr<PrefServiceSyncable> pref_service( | |
53 new PrefServiceSyncable( | |
54 pref_notifier, | |
55 new PrefValueStore(managed_prefs_.get(), | |
56 supervised_user_prefs_.get(), | |
57 extension_prefs_.get(), | |
58 command_line_prefs_.get(), | |
59 user_prefs_.get(), | |
60 recommended_prefs_.get(), | |
61 pref_registry->defaults().get(), | |
62 pref_notifier), | |
63 user_prefs_.get(), | |
64 pref_registry, | |
65 pref_model_associator_client_, | |
66 read_error_callback_, | |
67 async_)); | |
68 return pref_service.Pass(); | |
69 } | |
OLD | NEW |