1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/prefs/pref_service_syncable_builder.h"
#include "base/prefs/default_pref_store.h"
#include "chrome/browser/policy/configuration_policy_pref_store.h"
#include "chrome/browser/policy/policy_service.h"
#include "chrome/browser/prefs/command_line_pref_store.h"
#include "chrome/browser/prefs/pref_notifier_impl.h"
#include "chrome/browser/prefs/pref_service_syncable.h"
#include "chrome/browser/prefs/pref_value_store.h"
PrefServiceSyncableBuilder::PrefServiceSyncableBuilder() {
}
PrefServiceSyncableBuilder::~PrefServiceSyncableBuilder() {
}
#if defined(ENABLE_CONFIGURATION_POLICY)
PrefServiceSyncableBuilder& PrefServiceSyncableBuilder::WithManagedPolicies(
policy::PolicyService* service) {
WithManagedPrefs(new policy::ConfigurationPolicyPrefStore(
service, policy::POLICY_LEVEL_MANDATORY));
return *this;
}
PrefServiceSyncableBuilder& PrefServiceSyncableBuilder::WithRecommendedPolicies(
policy::PolicyService* service) {
WithRecommendedPrefs(new policy::ConfigurationPolicyPrefStore(
service, policy::POLICY_LEVEL_RECOMMENDED));
return *this;
}
#endif
PrefServiceSyncableBuilder&
PrefServiceSyncableBuilder::WithCommandLine(CommandLine* command_line) {
WithCommandLinePrefs(new CommandLinePrefStore(command_line));
return *this;
}
PrefServiceSyncable* PrefServiceSyncableBuilder::CreateSyncable() {
DefaultPrefStore* default_pref_store = new DefaultPrefStore();
PrefNotifierImpl* pref_notifier = new PrefNotifierImpl();
PrefServiceSyncable* pref_service = new PrefServiceSyncable(
pref_notifier,
new PrefValueStore(
managed_prefs_.get(),
extension_prefs_.get(),
command_line_prefs_.get(),
user_prefs_.get(),
recommended_prefs_.get(),
default_pref_store,
pref_notifier),
user_prefs_.get(),
default_pref_store,
read_error_callback_,
async_);
ResetDefaultState();
return pref_service;
}
|