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

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

Issue 64193003: Clean up PrefServiceBuilder (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix memory ownership bug in ProxyPolicyTest Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/prefs/pref_service_syncable_builder.h"
6
7 #include "base/debug/trace_event.h"
8 #include "base/prefs/default_pref_store.h"
9 #include "base/prefs/pref_notifier_impl.h"
10 #include "base/prefs/pref_value_store.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"
14 #include "components/user_prefs/pref_registry_syncable.h"
15
16 #if defined(ENABLE_CONFIGURATION_POLICY)
17 #include "chrome/browser/policy/browser_policy_connector.h"
18 #include "chrome/browser/policy/configuration_policy_pref_store.h"
19 #include "chrome/browser/policy/policy_service.h"
20 #include "chrome/browser/policy/policy_types.h"
21 #endif
22
23 PrefServiceSyncableBuilder::PrefServiceSyncableBuilder() {
24 }
25
26 PrefServiceSyncableBuilder::~PrefServiceSyncableBuilder() {
27 }
28
29 #if defined(ENABLE_CONFIGURATION_POLICY)
30 PrefServiceSyncableBuilder& PrefServiceSyncableBuilder::WithManagedPolicies(
31 policy::PolicyService* service) {
32 WithManagedPrefs(new policy::ConfigurationPolicyPrefStore(
33 service,
34 g_browser_process->browser_policy_connector()->GetHandlerList(),
35 policy::POLICY_LEVEL_MANDATORY));
36 return *this;
37 }
38
39 PrefServiceSyncableBuilder& PrefServiceSyncableBuilder::WithRecommendedPolicies(
40 policy::PolicyService* service) {
41 WithRecommendedPrefs(new policy::ConfigurationPolicyPrefStore(
42 service,
43 g_browser_process->browser_policy_connector()->GetHandlerList(),
44 policy::POLICY_LEVEL_RECOMMENDED));
45 return *this;
46 }
47 #endif
48
49 PrefServiceSyncableBuilder&
50 PrefServiceSyncableBuilder::WithCommandLine(CommandLine* command_line) {
51 WithCommandLinePrefs(new CommandLinePrefStore(command_line));
52 return *this;
53 }
54
55 PrefServiceSyncable* PrefServiceSyncableBuilder::CreateSyncable(
56 user_prefs::PrefRegistrySyncable* pref_registry) {
57 TRACE_EVENT0("browser", "PrefServiceSyncableBuilder::CreateSyncable");
58 PrefNotifierImpl* pref_notifier = new PrefNotifierImpl();
59 PrefServiceSyncable* pref_service = new PrefServiceSyncable(
60 pref_notifier,
61 new PrefValueStore(managed_prefs_.get(),
62 supervised_user_prefs_.get(),
63 extension_prefs_.get(),
64 command_line_prefs_.get(),
65 user_prefs_.get(),
66 recommended_prefs_.get(),
67 pref_registry->defaults().get(),
68 pref_notifier),
69 user_prefs_.get(),
70 pref_registry,
71 read_error_callback_,
72 async_);
73 ResetDefaultState();
74 return pref_service;
75 }
OLDNEW
« no previous file with comments | « chrome/browser/prefs/pref_service_syncable_builder.h ('k') | chrome/browser/prefs/pref_service_syncable_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698