| 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" | 5 #include "chrome/browser/extensions/api/settings_private/prefs_util.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/extensions/chrome_extension_function.h" | 9 #include "chrome/browser/extensions/chrome_extension_function.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 (*s_whitelist)["settings.a11y.mono_audio"] = | 236 (*s_whitelist)["settings.a11y.mono_audio"] = |
| 237 settings_private::PrefType::PREF_TYPE_BOOLEAN; | 237 settings_private::PrefType::PREF_TYPE_BOOLEAN; |
| 238 (*s_whitelist)["settings.clock.use_24hour_clock"] = | 238 (*s_whitelist)["settings.clock.use_24hour_clock"] = |
| 239 settings_private::PrefType::PREF_TYPE_BOOLEAN; | 239 settings_private::PrefType::PREF_TYPE_BOOLEAN; |
| 240 (*s_whitelist)["settings.language.preferred_languages"] = | 240 (*s_whitelist)["settings.language.preferred_languages"] = |
| 241 settings_private::PrefType::PREF_TYPE_STRING; | 241 settings_private::PrefType::PREF_TYPE_STRING; |
| 242 (*s_whitelist)["settings.touchpad.enable_tap_dragging"] = | 242 (*s_whitelist)["settings.touchpad.enable_tap_dragging"] = |
| 243 settings_private::PrefType::PREF_TYPE_BOOLEAN; | 243 settings_private::PrefType::PREF_TYPE_BOOLEAN; |
| 244 (*s_whitelist)["cros.metrics.reportingEnabled"] = | 244 (*s_whitelist)["cros.metrics.reportingEnabled"] = |
| 245 settings_private::PrefType::PREF_TYPE_BOOLEAN; | 245 settings_private::PrefType::PREF_TYPE_BOOLEAN; |
| 246 (*s_whitelist)["cros.device.allow_bluetooth"] = |
| 247 settings_private::PrefType::PREF_TYPE_BOOLEAN; |
| 246 (*s_whitelist)["cros.device.attestation_for_content_protection_enabled"] = | 248 (*s_whitelist)["cros.device.attestation_for_content_protection_enabled"] = |
| 247 settings_private::PrefType::PREF_TYPE_BOOLEAN; | 249 settings_private::PrefType::PREF_TYPE_BOOLEAN; |
| 248 (*s_whitelist)["settings.internet.wake_on_wifi_darkconnect"] = | 250 (*s_whitelist)["settings.internet.wake_on_wifi_darkconnect"] = |
| 249 settings_private::PrefType::PREF_TYPE_BOOLEAN; | 251 settings_private::PrefType::PREF_TYPE_BOOLEAN; |
| 250 (*s_whitelist)["settings.enable_screen_lock"] = | 252 (*s_whitelist)["settings.enable_screen_lock"] = |
| 251 settings_private::PrefType::PREF_TYPE_BOOLEAN; | 253 settings_private::PrefType::PREF_TYPE_BOOLEAN; |
| 252 | 254 |
| 253 // Input method settings. | 255 // Input method settings. |
| 254 (*s_whitelist)["settings.language.preload_engines"] = | 256 (*s_whitelist)["settings.language.preload_engines"] = |
| 255 settings_private::PrefType::PREF_TYPE_STRING; | 257 settings_private::PrefType::PREF_TYPE_STRING; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 } | 326 } |
| 325 } | 327 } |
| 326 | 328 |
| 327 std::unique_ptr<settings_private::PrefObject> PrefsUtil::GetCrosSettingsPref( | 329 std::unique_ptr<settings_private::PrefObject> PrefsUtil::GetCrosSettingsPref( |
| 328 const std::string& name) { | 330 const std::string& name) { |
| 329 std::unique_ptr<settings_private::PrefObject> pref_object( | 331 std::unique_ptr<settings_private::PrefObject> pref_object( |
| 330 new settings_private::PrefObject()); | 332 new settings_private::PrefObject()); |
| 331 | 333 |
| 332 #if defined(OS_CHROMEOS) | 334 #if defined(OS_CHROMEOS) |
| 333 const base::Value* value = CrosSettings::Get()->GetPref(name); | 335 const base::Value* value = CrosSettings::Get()->GetPref(name); |
| 334 DCHECK(value); | 336 DCHECK(value) << "Pref not found: " << name; |
| 335 pref_object->key = name; | 337 pref_object->key = name; |
| 336 pref_object->type = GetType(name, value->GetType()); | 338 pref_object->type = GetType(name, value->GetType()); |
| 337 pref_object->value.reset(value->DeepCopy()); | 339 pref_object->value.reset(value->DeepCopy()); |
| 338 #endif | 340 #endif |
| 339 | 341 |
| 340 return pref_object; | 342 return pref_object; |
| 341 } | 343 } |
| 342 | 344 |
| 343 std::unique_ptr<settings_private::PrefObject> PrefsUtil::GetPref( | 345 std::unique_ptr<settings_private::PrefObject> PrefsUtil::GetPref( |
| 344 const std::string& name) { | 346 const std::string& name) { |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 | 649 |
| 648 bool PrefsUtil::IsCrosSetting(const std::string& pref_name) { | 650 bool PrefsUtil::IsCrosSetting(const std::string& pref_name) { |
| 649 #if defined(OS_CHROMEOS) | 651 #if defined(OS_CHROMEOS) |
| 650 return CrosSettings::Get()->IsCrosSettings(pref_name); | 652 return CrosSettings::Get()->IsCrosSettings(pref_name); |
| 651 #else | 653 #else |
| 652 return false; | 654 return false; |
| 653 #endif | 655 #endif |
| 654 } | 656 } |
| 655 | 657 |
| 656 } // namespace extensions | 658 } // namespace extensions |
| OLD | NEW |