OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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.h" | 5 #include "chrome/browser/prefs/pref_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 116 |
117 } // namespace | 117 } // namespace |
118 | 118 |
119 PrefServiceBase* PrefServiceBase::FromBrowserContext(BrowserContext* context) { | 119 PrefServiceBase* PrefServiceBase::FromBrowserContext(BrowserContext* context) { |
120 return static_cast<Profile*>(context)->GetPrefs(); | 120 return static_cast<Profile*>(context)->GetPrefs(); |
121 } | 121 } |
122 | 122 |
123 // static | 123 // static |
124 PrefService* PrefService::CreatePrefService( | 124 PrefService* PrefService::CreatePrefService( |
125 const FilePath& pref_filename, | 125 const FilePath& pref_filename, |
| 126 base::SequencedTaskRunner* pref_io_task_runner, |
126 policy::PolicyService* policy_service, | 127 policy::PolicyService* policy_service, |
127 PrefStore* extension_prefs, | 128 PrefStore* extension_prefs, |
128 bool async) { | 129 bool async) { |
129 using policy::ConfigurationPolicyPrefStore; | 130 using policy::ConfigurationPolicyPrefStore; |
130 | 131 |
131 #if defined(OS_LINUX) | 132 #if defined(OS_LINUX) |
132 // We'd like to see what fraction of our users have the preferences | 133 // We'd like to see what fraction of our users have the preferences |
133 // stored on a network file system, as we've had no end of troubles | 134 // stored on a network file system, as we've had no end of troubles |
134 // with NFS/AFS. | 135 // with NFS/AFS. |
135 // TODO(evanm): remove this once we've collected state. | 136 // TODO(evanm): remove this once we've collected state. |
(...skipping 13 matching lines...) Expand all Loading... |
149 ConfigurationPolicyPrefStore::CreateRecommendedPolicyPrefStore( | 150 ConfigurationPolicyPrefStore::CreateRecommendedPolicyPrefStore( |
150 policy_service); | 151 policy_service); |
151 #else | 152 #else |
152 ConfigurationPolicyPrefStore* managed = NULL; | 153 ConfigurationPolicyPrefStore* managed = NULL; |
153 ConfigurationPolicyPrefStore* recommended = NULL; | 154 ConfigurationPolicyPrefStore* recommended = NULL; |
154 #endif // ENABLE_CONFIGURATION_POLICY | 155 #endif // ENABLE_CONFIGURATION_POLICY |
155 | 156 |
156 CommandLinePrefStore* command_line = | 157 CommandLinePrefStore* command_line = |
157 new CommandLinePrefStore(CommandLine::ForCurrentProcess()); | 158 new CommandLinePrefStore(CommandLine::ForCurrentProcess()); |
158 JsonPrefStore* user = new JsonPrefStore( | 159 JsonPrefStore* user = new JsonPrefStore( |
159 pref_filename, | 160 pref_filename, pref_io_task_runner); |
160 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); | |
161 DefaultPrefStore* default_pref_store = new DefaultPrefStore(); | 161 DefaultPrefStore* default_pref_store = new DefaultPrefStore(); |
162 | 162 |
163 PrefNotifierImpl* pref_notifier = new PrefNotifierImpl(); | 163 PrefNotifierImpl* pref_notifier = new PrefNotifierImpl(); |
164 PrefModelAssociator* pref_sync_associator = new PrefModelAssociator(); | 164 PrefModelAssociator* pref_sync_associator = new PrefModelAssociator(); |
165 | 165 |
166 return new PrefService( | 166 return new PrefService( |
167 pref_notifier, | 167 pref_notifier, |
168 new PrefValueStore( | 168 new PrefValueStore( |
169 managed, | 169 managed, |
170 extension_prefs, | 170 extension_prefs, |
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1059 return pref_value_store()->PrefValueFromDefaultStore(name_.c_str()); | 1059 return pref_value_store()->PrefValueFromDefaultStore(name_.c_str()); |
1060 } | 1060 } |
1061 | 1061 |
1062 bool PrefService::Preference::IsUserModifiable() const { | 1062 bool PrefService::Preference::IsUserModifiable() const { |
1063 return pref_value_store()->PrefValueUserModifiable(name_.c_str()); | 1063 return pref_value_store()->PrefValueUserModifiable(name_.c_str()); |
1064 } | 1064 } |
1065 | 1065 |
1066 bool PrefService::Preference::IsExtensionModifiable() const { | 1066 bool PrefService::Preference::IsExtensionModifiable() const { |
1067 return pref_value_store()->PrefValueExtensionModifiable(name_.c_str()); | 1067 return pref_value_store()->PrefValueExtensionModifiable(name_.c_str()); |
1068 } | 1068 } |
OLD | NEW |