| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 return value->CreateDeepCopy(); | 96 return value->CreateDeepCopy(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 std::unique_ptr<base::Value> GetAction(const base::DictionaryValue* dict, | 99 std::unique_ptr<base::Value> GetAction(const base::DictionaryValue* dict, |
| 100 const char* key) { | 100 const char* key) { |
| 101 std::unique_ptr<base::Value> value = GetValue(dict, key); | 101 std::unique_ptr<base::Value> value = GetValue(dict, key); |
| 102 std::string action; | 102 std::string action; |
| 103 if (!value || !value->GetAsString(&action)) | 103 if (!value || !value->GetAsString(&action)) |
| 104 return std::unique_ptr<base::Value>(); | 104 return std::unique_ptr<base::Value>(); |
| 105 if (action == kActionSuspend) { | 105 if (action == kActionSuspend) { |
| 106 return std::unique_ptr<base::Value>(new base::FundamentalValue( | 106 return std::unique_ptr<base::Value>( |
| 107 chromeos::PowerPolicyController::ACTION_SUSPEND)); | 107 new base::Value(chromeos::PowerPolicyController::ACTION_SUSPEND)); |
| 108 } | 108 } |
| 109 if (action == kActionLogout) { | 109 if (action == kActionLogout) { |
| 110 return std::unique_ptr<base::Value>(new base::FundamentalValue( | 110 return std::unique_ptr<base::Value>( |
| 111 chromeos::PowerPolicyController::ACTION_STOP_SESSION)); | 111 new base::Value(chromeos::PowerPolicyController::ACTION_STOP_SESSION)); |
| 112 } | 112 } |
| 113 if (action == kActionShutdown) { | 113 if (action == kActionShutdown) { |
| 114 return std::unique_ptr<base::Value>(new base::FundamentalValue( | 114 return std::unique_ptr<base::Value>( |
| 115 chromeos::PowerPolicyController::ACTION_SHUT_DOWN)); | 115 new base::Value(chromeos::PowerPolicyController::ACTION_SHUT_DOWN)); |
| 116 } | 116 } |
| 117 if (action == kActionDoNothing) { | 117 if (action == kActionDoNothing) { |
| 118 return std::unique_ptr<base::Value>(new base::FundamentalValue( | 118 return std::unique_ptr<base::Value>( |
| 119 chromeos::PowerPolicyController::ACTION_DO_NOTHING)); | 119 new base::Value(chromeos::PowerPolicyController::ACTION_DO_NOTHING)); |
| 120 } | 120 } |
| 121 return std::unique_ptr<base::Value>(); | 121 return std::unique_ptr<base::Value>(); |
| 122 } | 122 } |
| 123 | 123 |
| 124 } // namespace | 124 } // namespace |
| 125 | 125 |
| 126 ExternalDataPolicyHandler::ExternalDataPolicyHandler(const char* policy_name) | 126 ExternalDataPolicyHandler::ExternalDataPolicyHandler(const char* policy_name) |
| 127 : TypeCheckingPolicyHandler(policy_name, base::Value::Type::DICTIONARY) {} | 127 : TypeCheckingPolicyHandler(policy_name, base::Value::Type::DICTIONARY) {} |
| 128 | 128 |
| 129 ExternalDataPolicyHandler::~ExternalDataPolicyHandler() { | 129 ExternalDataPolicyHandler::~ExternalDataPolicyHandler() { |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 | 476 |
| 477 value = GetValue(dict, kScreenLockDelayAC); | 477 value = GetValue(dict, kScreenLockDelayAC); |
| 478 if (value) | 478 if (value) |
| 479 prefs->SetValue(prefs::kPowerAcScreenLockDelayMs, std::move(value)); | 479 prefs->SetValue(prefs::kPowerAcScreenLockDelayMs, std::move(value)); |
| 480 value = GetValue(dict, kScreenLockDelayBattery); | 480 value = GetValue(dict, kScreenLockDelayBattery); |
| 481 if (value) | 481 if (value) |
| 482 prefs->SetValue(prefs::kPowerBatteryScreenLockDelayMs, std::move(value)); | 482 prefs->SetValue(prefs::kPowerBatteryScreenLockDelayMs, std::move(value)); |
| 483 } | 483 } |
| 484 | 484 |
| 485 } // namespace policy | 485 } // namespace policy |
| OLD | NEW |