OLD | NEW |
(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/prefs/default_pref_store.h" |
| 8 #include "chrome/browser/policy/configuration_policy_pref_store.h" |
| 9 #include "chrome/browser/policy/policy_service.h" |
| 10 #include "chrome/browser/prefs/command_line_pref_store.h" |
| 11 #include "chrome/browser/prefs/pref_notifier_impl.h" |
| 12 #include "chrome/browser/prefs/pref_service_syncable.h" |
| 13 #include "chrome/browser/prefs/pref_value_store.h" |
| 14 |
| 15 PrefServiceSyncableBuilder::PrefServiceSyncableBuilder() { |
| 16 } |
| 17 |
| 18 PrefServiceSyncableBuilder::~PrefServiceSyncableBuilder() { |
| 19 } |
| 20 |
| 21 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 22 PrefServiceSyncableBuilder& PrefServiceSyncableBuilder::WithManagedPolicies( |
| 23 policy::PolicyService* service) { |
| 24 WithManagedPrefs(new policy::ConfigurationPolicyPrefStore( |
| 25 service, policy::POLICY_LEVEL_MANDATORY)); |
| 26 return *this; |
| 27 } |
| 28 |
| 29 PrefServiceSyncableBuilder& PrefServiceSyncableBuilder::WithRecommendedPolicies( |
| 30 policy::PolicyService* service) { |
| 31 WithRecommendedPrefs(new policy::ConfigurationPolicyPrefStore( |
| 32 service, policy::POLICY_LEVEL_RECOMMENDED)); |
| 33 return *this; |
| 34 } |
| 35 #endif |
| 36 |
| 37 PrefServiceSyncableBuilder& |
| 38 PrefServiceSyncableBuilder::WithCommandLine(CommandLine* command_line) { |
| 39 WithCommandLinePrefs(new CommandLinePrefStore(command_line)); |
| 40 return *this; |
| 41 } |
| 42 |
| 43 PrefServiceSyncable* PrefServiceSyncableBuilder::CreateSyncable() { |
| 44 DefaultPrefStore* default_pref_store = new DefaultPrefStore(); |
| 45 PrefNotifierImpl* pref_notifier = new PrefNotifierImpl(); |
| 46 PrefServiceSyncable* pref_service = new PrefServiceSyncable( |
| 47 pref_notifier, |
| 48 new PrefValueStore( |
| 49 managed_prefs_.get(), |
| 50 extension_prefs_.get(), |
| 51 command_line_prefs_.get(), |
| 52 user_prefs_.get(), |
| 53 recommended_prefs_.get(), |
| 54 default_pref_store, |
| 55 pref_notifier), |
| 56 user_prefs_.get(), |
| 57 default_pref_store, |
| 58 read_error_callback_, |
| 59 async_); |
| 60 ResetDefaultState(); |
| 61 return pref_service; |
| 62 } |
OLD | NEW |