| 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/chromeos/policy/configuration_policy_handler_chromeos.h
" | 5 #include "chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.h
" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/magnifier/magnifier_constants.h" | 10 #include "ash/magnifier/magnifier_constants.h" |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 chromeos::onc::kToplevelConfigurationSignature, | 297 chromeos::onc::kToplevelConfigurationSignature, |
| 298 *toplevel_dict, | 298 *toplevel_dict, |
| 299 kPlaceholder); | 299 kPlaceholder); |
| 300 | 300 |
| 301 base::JSONWriter::WriteWithOptions(toplevel_dict.get(), | 301 base::JSONWriter::WriteWithOptions(toplevel_dict.get(), |
| 302 base::JSONWriter::OPTIONS_PRETTY_PRINT, | 302 base::JSONWriter::OPTIONS_PRETTY_PRINT, |
| 303 &json_string); | 303 &json_string); |
| 304 return new base::StringValue(json_string); | 304 return new base::StringValue(json_string); |
| 305 } | 305 } |
| 306 | 306 |
| 307 PinnedLauncherAppsPolicyHandler::PinnedLauncherAppsPolicyHandler() | |
| 308 : ExtensionListPolicyHandler(key::kPinnedLauncherApps, | |
| 309 prefs::kPinnedLauncherApps, | |
| 310 false) {} | |
| 311 | |
| 312 PinnedLauncherAppsPolicyHandler::~PinnedLauncherAppsPolicyHandler() {} | |
| 313 | |
| 314 void PinnedLauncherAppsPolicyHandler::ApplyPolicySettings( | |
| 315 const PolicyMap& policies, | |
| 316 PrefValueMap* prefs) { | |
| 317 PolicyErrorMap errors; | |
| 318 const base::Value* policy_value = policies.GetValue(policy_name()); | |
| 319 const base::ListValue* policy_list = NULL; | |
| 320 if (policy_value && policy_value->GetAsList(&policy_list) && policy_list) { | |
| 321 base::ListValue* pinned_apps_list = new base::ListValue(); | |
| 322 for (base::ListValue::const_iterator entry(policy_list->begin()); | |
| 323 entry != policy_list->end(); ++entry) { | |
| 324 std::string id; | |
| 325 if ((*entry)->GetAsString(&id)) { | |
| 326 base::DictionaryValue* app_dict = new base::DictionaryValue(); | |
| 327 app_dict->SetString(ash::kPinnedAppsPrefAppIDPath, id); | |
| 328 pinned_apps_list->Append(app_dict); | |
| 329 } | |
| 330 } | |
| 331 prefs->SetValue(pref_path(), pinned_apps_list); | |
| 332 } | |
| 333 } | |
| 334 | |
| 335 ScreenMagnifierPolicyHandler::ScreenMagnifierPolicyHandler() | 307 ScreenMagnifierPolicyHandler::ScreenMagnifierPolicyHandler() |
| 336 : IntRangePolicyHandlerBase(key::kScreenMagnifierType, | 308 : IntRangePolicyHandlerBase(key::kScreenMagnifierType, |
| 337 0, ash::MAGNIFIER_FULL, false) { | 309 0, ash::MAGNIFIER_FULL, false) { |
| 338 } | 310 } |
| 339 | 311 |
| 340 ScreenMagnifierPolicyHandler::~ScreenMagnifierPolicyHandler() { | 312 ScreenMagnifierPolicyHandler::~ScreenMagnifierPolicyHandler() { |
| 341 } | 313 } |
| 342 | 314 |
| 343 void ScreenMagnifierPolicyHandler::ApplyPolicySettings( | 315 void ScreenMagnifierPolicyHandler::ApplyPolicySettings( |
| 344 const PolicyMap& policies, | 316 const PolicyMap& policies, |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 | 446 |
| 475 value = GetValue(dict, kScreenLockDelayAC); | 447 value = GetValue(dict, kScreenLockDelayAC); |
| 476 if (value) | 448 if (value) |
| 477 prefs->SetValue(prefs::kPowerAcScreenLockDelayMs, value.release()); | 449 prefs->SetValue(prefs::kPowerAcScreenLockDelayMs, value.release()); |
| 478 value = GetValue(dict, kScreenLockDelayBattery); | 450 value = GetValue(dict, kScreenLockDelayBattery); |
| 479 if (value) | 451 if (value) |
| 480 prefs->SetValue(prefs::kPowerBatteryScreenLockDelayMs, value.release()); | 452 prefs->SetValue(prefs::kPowerBatteryScreenLockDelayMs, value.release()); |
| 481 } | 453 } |
| 482 | 454 |
| 483 } // namespace policy | 455 } // namespace policy |
| OLD | NEW |