OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/extensions/api/settings_private/prefs_util.h" | |
6 | |
5 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
6 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
7 #include "chrome/browser/extensions/api/settings_private/prefs_util.h" | |
8 #include "chrome/browser/extensions/chrome_extension_function.h" | 9 #include "chrome/browser/extensions/chrome_extension_function.h" |
9 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/common/pref_names.h" | 11 #include "chrome/common/pref_names.h" |
11 #include "components/proxy_config/proxy_config_pref_names.h" | 12 #include "components/proxy_config/proxy_config_pref_names.h" |
12 #include "components/url_formatter/url_fixer.h" | 13 #include "components/url_formatter/url_fixer.h" |
14 #include "extensions/browser/extension_pref_value_map.h" | |
15 #include "extensions/browser/extension_pref_value_map_factory.h" | |
16 #include "extensions/browser/extension_registry.h" | |
13 | 17 |
14 #if defined(OS_CHROMEOS) | 18 #if defined(OS_CHROMEOS) |
15 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h" | 19 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h" |
16 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos_fact ory.h" | 20 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos_fact ory.h" |
21 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | |
22 #include "chrome/browser/chromeos/profiles/profile_helper.h" | |
17 #include "chrome/browser/chromeos/settings/cros_settings.h" | 23 #include "chrome/browser/chromeos/settings/cros_settings.h" |
24 #include "chromeos/settings/cros_settings_names.h" | |
18 #endif | 25 #endif |
19 | 26 |
27 namespace { | |
28 | |
29 #if defined(OS_CHROMEOS) | |
30 bool IsPrivilegedCrosSetting(const std::string& pref_name) { | |
31 if (!chromeos::CrosSettings::IsCrosSettings(pref_name)) | |
32 return false; | |
33 // kSystemTimezone should be changeable by all users. | |
34 if (pref_name == chromeos::kSystemTimezone) | |
35 return false; | |
36 // All other Cros settings are considered privileged and are either policy | |
37 // controlled or owner controlled. | |
38 return true; | |
39 } | |
40 #endif | |
41 | |
42 } // namespace | |
43 | |
20 namespace extensions { | 44 namespace extensions { |
21 | 45 |
22 namespace settings_private = api::settings_private; | 46 namespace settings_private = api::settings_private; |
23 | 47 |
24 PrefsUtil::PrefsUtil(Profile* profile) : profile_(profile) { | 48 PrefsUtil::PrefsUtil(Profile* profile) : profile_(profile) {} |
25 } | |
26 | 49 |
27 PrefsUtil::~PrefsUtil() { | 50 PrefsUtil::~PrefsUtil() {} |
28 } | |
29 | 51 |
30 #if defined(OS_CHROMEOS) | 52 #if defined(OS_CHROMEOS) |
31 using CrosSettings = chromeos::CrosSettings; | 53 using CrosSettings = chromeos::CrosSettings; |
32 #endif | 54 #endif |
33 | 55 |
34 const PrefsUtil::TypedPrefMap& PrefsUtil::GetWhitelistedKeys() { | 56 const PrefsUtil::TypedPrefMap& PrefsUtil::GetWhitelistedKeys() { |
35 static PrefsUtil::TypedPrefMap* s_whitelist = nullptr; | 57 static PrefsUtil::TypedPrefMap* s_whitelist = nullptr; |
36 if (s_whitelist) | 58 if (s_whitelist) |
37 return *s_whitelist; | 59 return *s_whitelist; |
38 s_whitelist = new PrefsUtil::TypedPrefMap(); | 60 s_whitelist = new PrefsUtil::TypedPrefMap(); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
103 settings_private::PrefType::PREF_TYPE_BOOLEAN; | 125 settings_private::PrefType::PREF_TYPE_BOOLEAN; |
104 (*s_whitelist)["cros.device.attestation_for_content_protection_enabled"] = | 126 (*s_whitelist)["cros.device.attestation_for_content_protection_enabled"] = |
105 settings_private::PrefType::PREF_TYPE_BOOLEAN; | 127 settings_private::PrefType::PREF_TYPE_BOOLEAN; |
106 (*s_whitelist)["settings.internet.wake_on_wifi_ssid"] = | 128 (*s_whitelist)["settings.internet.wake_on_wifi_ssid"] = |
107 settings_private::PrefType::PREF_TYPE_BOOLEAN; | 129 settings_private::PrefType::PREF_TYPE_BOOLEAN; |
108 #endif | 130 #endif |
109 | 131 |
110 return *s_whitelist; | 132 return *s_whitelist; |
111 } | 133 } |
112 | 134 |
113 api::settings_private::PrefType PrefsUtil::GetType(const std::string& name, | 135 settings_private::PrefType PrefsUtil::GetType(const std::string& name, |
114 base::Value::Type type) { | 136 base::Value::Type type) { |
115 switch (type) { | 137 switch (type) { |
116 case base::Value::Type::TYPE_BOOLEAN: | 138 case base::Value::Type::TYPE_BOOLEAN: |
117 return api::settings_private::PrefType::PREF_TYPE_BOOLEAN; | 139 return settings_private::PrefType::PREF_TYPE_BOOLEAN; |
118 case base::Value::Type::TYPE_INTEGER: | 140 case base::Value::Type::TYPE_INTEGER: |
119 case base::Value::Type::TYPE_DOUBLE: | 141 case base::Value::Type::TYPE_DOUBLE: |
120 return api::settings_private::PrefType::PREF_TYPE_NUMBER; | 142 return settings_private::PrefType::PREF_TYPE_NUMBER; |
121 case base::Value::Type::TYPE_STRING: | 143 case base::Value::Type::TYPE_STRING: |
122 return IsPrefTypeURL(name) | 144 return IsPrefTypeURL(name) ? settings_private::PrefType::PREF_TYPE_URL |
123 ? api::settings_private::PrefType::PREF_TYPE_URL | 145 : settings_private::PrefType::PREF_TYPE_STRING; |
124 : api::settings_private::PrefType::PREF_TYPE_STRING; | |
125 case base::Value::Type::TYPE_LIST: | 146 case base::Value::Type::TYPE_LIST: |
126 return api::settings_private::PrefType::PREF_TYPE_LIST; | 147 return settings_private::PrefType::PREF_TYPE_LIST; |
127 default: | 148 default: |
128 return api::settings_private::PrefType::PREF_TYPE_NONE; | 149 return settings_private::PrefType::PREF_TYPE_NONE; |
129 } | 150 } |
130 } | 151 } |
131 | 152 |
132 scoped_ptr<api::settings_private::PrefObject> PrefsUtil::GetCrosSettingsPref( | 153 scoped_ptr<settings_private::PrefObject> PrefsUtil::GetCrosSettingsPref( |
133 const std::string& name) { | 154 const std::string& name) { |
134 scoped_ptr<api::settings_private::PrefObject> pref_object( | 155 scoped_ptr<settings_private::PrefObject> pref_object( |
135 new api::settings_private::PrefObject()); | 156 new settings_private::PrefObject()); |
136 | 157 |
137 #if defined(OS_CHROMEOS) | 158 #if defined(OS_CHROMEOS) |
138 const base::Value* value = CrosSettings::Get()->GetPref(name); | 159 const base::Value* value = CrosSettings::Get()->GetPref(name); |
160 if (!value) | |
161 return nullptr; | |
Dan Beam
2015/09/16 21:02:19
why not
return pref_object.Pass();
or
if (v
stevenjb
2015/09/16 21:33:53
Oh, yeah, I see, that is weird, we should return e
| |
139 pref_object->key = name; | 162 pref_object->key = name; |
140 pref_object->type = GetType(name, value->GetType()); | 163 pref_object->type = GetType(name, value->GetType()); |
141 pref_object->value.reset(value->DeepCopy()); | 164 pref_object->value.reset(value->DeepCopy()); |
142 #endif | 165 #endif |
143 | 166 |
144 return pref_object.Pass(); | 167 return pref_object.Pass(); |
145 } | 168 } |
146 | 169 |
147 scoped_ptr<api::settings_private::PrefObject> PrefsUtil::GetPref( | 170 scoped_ptr<settings_private::PrefObject> PrefsUtil::GetPref( |
148 const std::string& name) { | 171 const std::string& name) { |
149 if (IsCrosSetting(name)) | 172 const PrefService::Preference* pref = nullptr; |
150 return GetCrosSettingsPref(name); | 173 scoped_ptr<settings_private::PrefObject> pref_object; |
174 if (IsCrosSetting(name)) { | |
175 pref_object = GetCrosSettingsPref(name); | |
176 } else { | |
177 PrefService* pref_service = FindServiceForPref(name); | |
178 pref = pref_service->FindPreference(name); | |
179 if (!pref) | |
180 return nullptr; | |
181 pref_object.reset(new settings_private::PrefObject()); | |
182 pref_object->key = pref->name(); | |
183 pref_object->type = GetType(name, pref->GetType()); | |
184 pref_object->value.reset(pref->GetValue()->DeepCopy()); | |
185 } | |
151 | 186 |
152 PrefService* pref_service = FindServiceForPref(name); | 187 #if defined(OS_CHROMEOS) |
153 const PrefService::Preference* pref = pref_service->FindPreference(name); | 188 if (IsPrefPrimaryUserControlled(name)) { |
189 pref_object->policy_source = | |
190 settings_private::PolicySource::POLICY_SOURCE_PRIMARY_USER; | |
191 pref_object->policy_enforcement = | |
192 settings_private::PolicyEnforcement::POLICY_ENFORCEMENT_ENFORCED; | |
193 return pref_object.Pass(); | |
194 } | |
195 if (IsPrefOwnerControlled(name)) { | |
196 pref_object->policy_source = | |
197 settings_private::PolicySource::POLICY_SOURCE_OWNER; | |
198 pref_object->policy_enforcement = | |
199 settings_private::PolicyEnforcement::POLICY_ENFORCEMENT_ENFORCED; | |
200 return pref_object.Pass(); | |
201 } | |
202 if (IsPrefEnterpriseManaged(name)) { | |
203 // Enterprise managed prefs are treated the same as device policy restricted | |
204 // prefs in the UI. | |
205 pref_object->policy_source = | |
206 settings_private::PolicySource::POLICY_SOURCE_DEVICE_POLICY; | |
207 pref_object->policy_enforcement = | |
208 settings_private::PolicyEnforcement::POLICY_ENFORCEMENT_ENFORCED; | |
209 return pref_object.Pass(); | |
210 } | |
211 #endif | |
212 | |
154 if (!pref) | 213 if (!pref) |
155 return nullptr; | 214 return pref_object.Pass(); |
Dan Beam
2015/09/16 21:46:23
I think this was fine
stevenjb
2015/09/16 21:52:36
If IsCrosSetting() is true, we don't set |pref|, b
| |
156 | |
157 scoped_ptr<api::settings_private::PrefObject> pref_object( | |
158 new api::settings_private::PrefObject()); | |
159 pref_object->key = pref->name(); | |
160 pref_object->type = GetType(name, pref->GetType()); | |
161 pref_object->value.reset(pref->GetValue()->DeepCopy()); | |
162 | 215 |
163 if (pref->IsManaged()) { | 216 if (pref->IsManaged()) { |
164 if (pref->IsManagedByCustodian()) { | 217 pref_object->policy_source = |
165 pref_object->policy_source = | 218 settings_private::PolicySource::POLICY_SOURCE_USER_POLICY; |
166 api::settings_private::PolicySource::POLICY_SOURCE_DEVICE; | |
167 } else { | |
168 pref_object->policy_source = | |
169 api::settings_private::PolicySource::POLICY_SOURCE_USER; | |
170 } | |
171 pref_object->policy_enforcement = | 219 pref_object->policy_enforcement = |
172 pref->IsRecommended() ? api::settings_private::PolicyEnforcement:: | 220 settings_private::PolicyEnforcement::POLICY_ENFORCEMENT_ENFORCED; |
173 POLICY_ENFORCEMENT_RECOMMENDED | 221 return pref_object.Pass(); |
174 : api::settings_private::PolicyEnforcement:: | 222 } |
175 POLICY_ENFORCEMENT_ENFORCED; | 223 if (pref->IsRecommended()) { |
176 } else if (!IsPrefUserModifiable(name)) { | |
177 pref_object->policy_source = | 224 pref_object->policy_source = |
178 api::settings_private::PolicySource::POLICY_SOURCE_USER; | 225 settings_private::PolicySource::POLICY_SOURCE_USER_POLICY; |
179 pref_object->policy_enforcement = | 226 pref_object->policy_enforcement = |
180 api::settings_private::PolicyEnforcement::POLICY_ENFORCEMENT_ENFORCED; | 227 settings_private::PolicyEnforcement::POLICY_ENFORCEMENT_RECOMMENDED; |
228 pref_object->recommended_value.reset( | |
229 pref->GetRecommendedValue()->DeepCopy()); | |
230 return pref_object.Pass(); | |
231 } | |
232 if (pref->IsExtensionControlled()) { | |
233 pref_object->policy_source = | |
234 settings_private::PolicySource::POLICY_SOURCE_EXTENSION; | |
235 pref_object->policy_enforcement = | |
236 settings_private::PolicyEnforcement::POLICY_ENFORCEMENT_ENFORCED; | |
237 std::string extension_id = | |
238 ExtensionPrefValueMapFactory::GetForBrowserContext(profile_) | |
239 ->GetExtensionControllingPref(pref->name()); | |
240 pref_object->extension_id.reset(new std::string(extension_id)); | |
241 return pref_object.Pass(); | |
242 } | |
243 if (!pref->IsUserModifiable() || IsPrefSupervisorControlled(name)) { | |
244 // TODO(stevenjb): Investigate whether either of these should be badged. | |
245 pref_object->read_only.reset(new bool(true)); | |
246 return pref_object.Pass(); | |
181 } | 247 } |
182 | 248 |
183 return pref_object.Pass(); | 249 return pref_object.Pass(); |
184 } | 250 } |
185 | 251 |
186 PrefsUtil::SetPrefResult PrefsUtil::SetPref(const std::string& pref_name, | 252 PrefsUtil::SetPrefResult PrefsUtil::SetPref(const std::string& pref_name, |
187 const base::Value* value) { | 253 const base::Value* value) { |
188 if (IsCrosSetting(pref_name)) | 254 if (IsCrosSetting(pref_name)) |
189 return SetCrosSettingsPref(pref_name, value); | 255 return SetCrosSettingsPref(pref_name, value); |
190 | 256 |
191 PrefService* pref_service = FindServiceForPref(pref_name); | 257 PrefService* pref_service = FindServiceForPref(pref_name); |
192 | 258 |
193 if (!IsPrefUserModifiable(pref_name)) | 259 if (!IsPrefUserModifiable(pref_name)) |
194 return PREF_NOT_MODIFIABLE; | 260 return PREF_NOT_MODIFIABLE; |
195 | 261 |
196 const PrefService::Preference* pref = | 262 const PrefService::Preference* pref = pref_service->FindPreference(pref_name); |
197 pref_service->FindPreference(pref_name); | |
198 if (!pref) | 263 if (!pref) |
199 return PREF_NOT_FOUND; | 264 return PREF_NOT_FOUND; |
200 | 265 |
201 DCHECK_EQ(pref->GetType(), value->GetType()); | 266 DCHECK_EQ(pref->GetType(), value->GetType()); |
202 | 267 |
203 switch (pref->GetType()) { | 268 switch (pref->GetType()) { |
204 case base::Value::TYPE_BOOLEAN: | 269 case base::Value::TYPE_BOOLEAN: |
205 case base::Value::TYPE_DOUBLE: | 270 case base::Value::TYPE_DOUBLE: |
206 case base::Value::TYPE_LIST: | 271 case base::Value::TYPE_LIST: |
207 pref_service->Set(pref_name, *value); | 272 pref_service->Set(pref_name, *value); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
244 chromeos::OwnerSettingsServiceChromeOSFactory::GetForBrowserContext( | 309 chromeos::OwnerSettingsServiceChromeOSFactory::GetForBrowserContext( |
245 profile_); | 310 profile_); |
246 | 311 |
247 // Check if setting requires owner. | 312 // Check if setting requires owner. |
248 if (service && service->HandlesSetting(pref_name)) { | 313 if (service && service->HandlesSetting(pref_name)) { |
249 if (service->Set(pref_name, *value)) | 314 if (service->Set(pref_name, *value)) |
250 return SUCCESS; | 315 return SUCCESS; |
251 return PREF_NOT_MODIFIABLE; | 316 return PREF_NOT_MODIFIABLE; |
252 } | 317 } |
253 | 318 |
254 chromeos::CrosSettings::Get()->Set(pref_name, *value); | 319 CrosSettings::Get()->Set(pref_name, *value); |
255 return SUCCESS; | 320 return SUCCESS; |
256 #else | 321 #else |
257 return PREF_NOT_FOUND; | 322 return PREF_NOT_FOUND; |
258 #endif | 323 #endif |
259 } | 324 } |
260 | 325 |
261 bool PrefsUtil::AppendToListCrosSetting(const std::string& pref_name, | 326 bool PrefsUtil::AppendToListCrosSetting(const std::string& pref_name, |
262 const base::Value& value) { | 327 const base::Value& value) { |
263 #if defined(OS_CHROMEOS) | 328 #if defined(OS_CHROMEOS) |
264 chromeos::OwnerSettingsServiceChromeOS* service = | 329 chromeos::OwnerSettingsServiceChromeOS* service = |
265 chromeos::OwnerSettingsServiceChromeOSFactory::GetForBrowserContext( | 330 chromeos::OwnerSettingsServiceChromeOSFactory::GetForBrowserContext( |
266 profile_); | 331 profile_); |
267 | 332 |
268 // Returns false if not the owner, for settings requiring owner. | 333 // Returns false if not the owner, for settings requiring owner. |
269 if (service && service->HandlesSetting(pref_name)) { | 334 if (service && service->HandlesSetting(pref_name)) { |
270 return service->AppendToList(pref_name, value); | 335 return service->AppendToList(pref_name, value); |
271 } | 336 } |
272 | 337 |
273 chromeos::CrosSettings::Get()->AppendToList(pref_name, &value); | 338 CrosSettings::Get()->AppendToList(pref_name, &value); |
274 return true; | 339 return true; |
275 #else | 340 #else |
276 return false; | 341 return false; |
277 #endif | 342 #endif |
278 } | 343 } |
279 | 344 |
280 bool PrefsUtil::RemoveFromListCrosSetting(const std::string& pref_name, | 345 bool PrefsUtil::RemoveFromListCrosSetting(const std::string& pref_name, |
281 const base::Value& value) { | 346 const base::Value& value) { |
282 #if defined(OS_CHROMEOS) | 347 #if defined(OS_CHROMEOS) |
283 chromeos::OwnerSettingsServiceChromeOS* service = | 348 chromeos::OwnerSettingsServiceChromeOS* service = |
284 chromeos::OwnerSettingsServiceChromeOSFactory::GetForBrowserContext( | 349 chromeos::OwnerSettingsServiceChromeOSFactory::GetForBrowserContext( |
285 profile_); | 350 profile_); |
286 | 351 |
287 // Returns false if not the owner, for settings requiring owner. | 352 // Returns false if not the owner, for settings requiring owner. |
288 if (service && service->HandlesSetting(pref_name)) { | 353 if (service && service->HandlesSetting(pref_name)) { |
289 return service->RemoveFromList(pref_name, value); | 354 return service->RemoveFromList(pref_name, value); |
290 } | 355 } |
291 | 356 |
292 chromeos::CrosSettings::Get()->RemoveFromList(pref_name, &value); | 357 CrosSettings::Get()->RemoveFromList(pref_name, &value); |
293 return true; | 358 return true; |
294 #else | 359 #else |
295 return false; | 360 return false; |
296 #endif | 361 #endif |
297 } | 362 } |
298 | 363 |
299 bool PrefsUtil::IsPrefTypeURL(const std::string& pref_name) { | 364 bool PrefsUtil::IsPrefTypeURL(const std::string& pref_name) { |
300 settings_private::PrefType pref_type = | 365 settings_private::PrefType pref_type = |
301 settings_private::PrefType::PREF_TYPE_NONE; | 366 settings_private::PrefType::PREF_TYPE_NONE; |
302 | 367 |
303 const TypedPrefMap keys = GetWhitelistedKeys(); | 368 const TypedPrefMap keys = GetWhitelistedKeys(); |
304 const auto& iter = keys.find(pref_name); | 369 const auto& iter = keys.find(pref_name); |
305 if (iter != keys.end()) | 370 if (iter != keys.end()) |
306 pref_type = iter->second; | 371 pref_type = iter->second; |
307 | 372 |
308 return pref_type == settings_private::PrefType::PREF_TYPE_URL; | 373 return pref_type == settings_private::PrefType::PREF_TYPE_URL; |
309 } | 374 } |
310 | 375 |
311 bool PrefsUtil::IsPrefUserModifiable(const std::string& pref_name) { | 376 #if defined(OS_CHROMEOS) |
377 bool PrefsUtil::IsPrefEnterpriseManaged(const std::string& pref_name) { | |
378 if (IsPrivilegedCrosSetting(pref_name)) { | |
379 policy::BrowserPolicyConnectorChromeOS* connector = | |
380 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | |
381 if (connector->IsEnterpriseManaged()) | |
382 return true; | |
383 } | |
384 return false; | |
385 } | |
386 | |
387 bool PrefsUtil::IsPrefOwnerControlled(const std::string& pref_name) { | |
388 if (IsPrivilegedCrosSetting(pref_name)) { | |
389 if (!chromeos::ProfileHelper::IsOwnerProfile(profile_)) | |
390 return true; | |
391 } | |
392 return false; | |
393 } | |
394 | |
395 bool PrefsUtil::IsPrefPrimaryUserControlled(const std::string& pref_name) { | |
396 if (pref_name == prefs::kWakeOnWifiSsid) { | |
397 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); | |
398 const user_manager::User* user = | |
399 chromeos::ProfileHelper::Get()->GetUserByProfile(profile_); | |
400 if (user && user->email() != user_manager->GetPrimaryUser()->email()) | |
401 return true; | |
402 } | |
403 return false; | |
404 } | |
405 #endif | |
406 | |
407 bool PrefsUtil::IsPrefSupervisorControlled(const std::string& pref_name) { | |
312 if (pref_name != prefs::kBrowserGuestModeEnabled && | 408 if (pref_name != prefs::kBrowserGuestModeEnabled && |
313 pref_name != prefs::kBrowserAddPersonEnabled) { | 409 pref_name != prefs::kBrowserAddPersonEnabled) { |
314 return true; | 410 return false; |
315 } | 411 } |
412 return profile_->IsSupervised(); | |
413 } | |
316 | 414 |
415 bool PrefsUtil::IsPrefUserModifiable(const std::string& pref_name) { | |
317 PrefService* pref_service = profile_->GetPrefs(); | 416 PrefService* pref_service = profile_->GetPrefs(); |
318 const PrefService::Preference* pref = | 417 const PrefService::Preference* pref = |
319 pref_service->FindPreference(pref_name.c_str()); | 418 pref_service->FindPreference(pref_name.c_str()); |
320 if (!pref || !pref->IsUserModifiable() || profile_->IsSupervised()) | 419 return pref && pref->IsUserModifiable(); |
321 return false; | |
322 | |
323 return true; | |
324 } | 420 } |
325 | 421 |
326 PrefService* PrefsUtil::FindServiceForPref(const std::string& pref_name) { | 422 PrefService* PrefsUtil::FindServiceForPref(const std::string& pref_name) { |
327 PrefService* user_prefs = profile_->GetPrefs(); | 423 PrefService* user_prefs = profile_->GetPrefs(); |
328 | 424 |
329 // Proxy is a peculiar case: on ChromeOS, settings exist in both user | 425 // Proxy is a peculiar case: on ChromeOS, settings exist in both user |
330 // prefs and local state, but chrome://settings should affect only user prefs. | 426 // prefs and local state, but chrome://settings should affect only user prefs. |
331 // Elsewhere the proxy settings are stored in local state. | 427 // Elsewhere the proxy settings are stored in local state. |
332 // See http://crbug.com/157147 | 428 // See http://crbug.com/157147 |
333 | 429 |
(...skipping 19 matching lines...) Expand all Loading... | |
353 | 449 |
354 bool PrefsUtil::IsCrosSetting(const std::string& pref_name) { | 450 bool PrefsUtil::IsCrosSetting(const std::string& pref_name) { |
355 #if defined(OS_CHROMEOS) | 451 #if defined(OS_CHROMEOS) |
356 return CrosSettings::Get()->IsCrosSettings(pref_name); | 452 return CrosSettings::Get()->IsCrosSettings(pref_name); |
357 #else | 453 #else |
358 return false; | 454 return false; |
359 #endif | 455 #endif |
360 } | 456 } |
361 | 457 |
362 } // namespace extensions | 458 } // namespace extensions |
OLD | NEW |