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.
5 #include "chrome/browser/prefs/pref_service_syncable_builder.h"
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 "chrome/browser/policy/configuration_policy_pref_store.h"
11 #include "chrome/browser/policy/policy_service.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"
16 PrefServiceSyncableBuilder::PrefServiceSyncableBuilder() {
19 PrefServiceSyncableBuilder::~PrefServiceSyncableBuilder() {
22 #if defined(ENABLE_CONFIGURATION_POLICY)
23 PrefServiceSyncableBuilder
& PrefServiceSyncableBuilder::WithManagedPolicies(
24 policy::PolicyService
* service
) {
25 WithManagedPrefs(new policy::ConfigurationPolicyPrefStore(
26 service
, policy::POLICY_LEVEL_MANDATORY
));
30 PrefServiceSyncableBuilder
& PrefServiceSyncableBuilder::WithRecommendedPolicies(
31 policy::PolicyService
* service
) {
32 WithRecommendedPrefs(new policy::ConfigurationPolicyPrefStore(
33 service
, policy::POLICY_LEVEL_RECOMMENDED
));
38 PrefServiceSyncableBuilder
&
39 PrefServiceSyncableBuilder::WithCommandLine(CommandLine
* command_line
) {
40 WithCommandLinePrefs(new CommandLinePrefStore(command_line
));
44 PrefServiceSyncable
* PrefServiceSyncableBuilder::CreateSyncable(
45 PrefRegistrySyncable
* pref_registry
) {
46 PrefNotifierImpl
* pref_notifier
= new PrefNotifierImpl();
47 PrefServiceSyncable
* pref_service
= new PrefServiceSyncable(
51 extension_prefs_
.get(),
52 command_line_prefs_
.get(),
54 recommended_prefs_
.get(),
55 pref_registry
->defaults(),