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

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

Issue 1343743002: Remove dependency of PrefSyncableServiceFactory on //chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pref_service_syncable
Patch Set: Rebase 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 2013 The Chromium Authors. All rights reserved. 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 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/pref_service_syncable_factory.h" 5 #include "chrome/browser/prefs/pref_service_syncable_factory.h"
6 6
7 #include "base/prefs/default_pref_store.h" 7 #include "base/prefs/default_pref_store.h"
8 #include "base/prefs/pref_notifier_impl.h" 8 #include "base/prefs/pref_notifier_impl.h"
9 #include "base/prefs/pref_value_store.h" 9 #include "base/prefs/pref_value_store.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/prefs/command_line_pref_store.h"
13 #include "chrome/browser/prefs/pref_service_syncable.h" 11 #include "chrome/browser/prefs/pref_service_syncable.h"
14 #include "components/pref_registry/pref_registry_syncable.h" 12 #include "components/pref_registry/pref_registry_syncable.h"
15 13
16 #if defined(ENABLE_CONFIGURATION_POLICY) 14 #if defined(ENABLE_CONFIGURATION_POLICY)
17 #include "components/policy/core/browser/browser_policy_connector.h" 15 #include "components/policy/core/browser/browser_policy_connector.h"
18 #include "components/policy/core/browser/configuration_policy_pref_store.h" 16 #include "components/policy/core/browser/configuration_policy_pref_store.h"
19 #include "components/policy/core/common/policy_service.h" 17 #include "components/policy/core/common/policy_service.h"
20 #include "components/policy/core/common/policy_types.h" 18 #include "components/policy/core/common/policy_types.h"
21 #endif 19 #endif
22 20
23 PrefServiceSyncableFactory::PrefServiceSyncableFactory() { 21 PrefServiceSyncableFactory::PrefServiceSyncableFactory() {
24 } 22 }
25 23
26 PrefServiceSyncableFactory::~PrefServiceSyncableFactory() { 24 PrefServiceSyncableFactory::~PrefServiceSyncableFactory() {
27 } 25 }
28 26
29 #if defined(ENABLE_CONFIGURATION_POLICY) 27 #if defined(ENABLE_CONFIGURATION_POLICY)
30 void PrefServiceSyncableFactory::SetManagedPolicies( 28 void PrefServiceSyncableFactory::SetManagedPolicies(
31 policy::PolicyService* service) { 29 policy::PolicyService* service,
32 set_managed_prefs( 30 policy::BrowserPolicyConnector* connector) {
33 new policy::ConfigurationPolicyPrefStore( 31 set_managed_prefs(new policy::ConfigurationPolicyPrefStore(
34 service, 32 service, connector->GetHandlerList(), policy::POLICY_LEVEL_MANDATORY));
35 g_browser_process->browser_policy_connector()->GetHandlerList(),
36 policy::POLICY_LEVEL_MANDATORY));
37 } 33 }
38 34
39 void PrefServiceSyncableFactory::SetRecommendedPolicies( 35 void PrefServiceSyncableFactory::SetRecommendedPolicies(
40 policy::PolicyService* service) { 36 policy::PolicyService* service,
41 set_recommended_prefs( 37 policy::BrowserPolicyConnector* connector) {
42 new policy::ConfigurationPolicyPrefStore( 38 set_recommended_prefs(new policy::ConfigurationPolicyPrefStore(
43 service, 39 service, connector->GetHandlerList(), policy::POLICY_LEVEL_RECOMMENDED));
44 g_browser_process->browser_policy_connector()->GetHandlerList(),
45 policy::POLICY_LEVEL_RECOMMENDED));
46 } 40 }
47 #endif 41 #endif
48 42
49 void PrefServiceSyncableFactory::SetCommandLine(
50 base::CommandLine* command_line) {
51 set_command_line_prefs(new CommandLinePrefStore(command_line));
52 }
53
54 scoped_ptr<PrefServiceSyncable> PrefServiceSyncableFactory::CreateSyncable( 43 scoped_ptr<PrefServiceSyncable> PrefServiceSyncableFactory::CreateSyncable(
55 user_prefs::PrefRegistrySyncable* pref_registry) { 44 user_prefs::PrefRegistrySyncable* pref_registry) {
56 TRACE_EVENT0("browser", "PrefServiceSyncableFactory::CreateSyncable"); 45 TRACE_EVENT0("browser", "PrefServiceSyncableFactory::CreateSyncable");
57 PrefNotifierImpl* pref_notifier = new PrefNotifierImpl(); 46 PrefNotifierImpl* pref_notifier = new PrefNotifierImpl();
58 scoped_ptr<PrefServiceSyncable> pref_service( 47 scoped_ptr<PrefServiceSyncable> pref_service(
59 new PrefServiceSyncable( 48 new PrefServiceSyncable(
60 pref_notifier, 49 pref_notifier,
61 new PrefValueStore(managed_prefs_.get(), 50 new PrefValueStore(managed_prefs_.get(),
62 supervised_user_prefs_.get(), 51 supervised_user_prefs_.get(),
63 extension_prefs_.get(), 52 extension_prefs_.get(),
64 command_line_prefs_.get(), 53 command_line_prefs_.get(),
65 user_prefs_.get(), 54 user_prefs_.get(),
66 recommended_prefs_.get(), 55 recommended_prefs_.get(),
67 pref_registry->defaults().get(), 56 pref_registry->defaults().get(),
68 pref_notifier), 57 pref_notifier),
69 user_prefs_.get(), 58 user_prefs_.get(),
70 pref_registry, 59 pref_registry,
71 read_error_callback_, 60 read_error_callback_,
72 async_)); 61 async_));
73 return pref_service.Pass(); 62 return pref_service.Pass();
74 } 63 }
OLDNEW
« no previous file with comments | « chrome/browser/prefs/pref_service_syncable_factory.h ('k') | chrome/browser/prefs/proxy_policy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698