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 | 129 |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 | 478 |
479 value = GetValue(dict, kScreenLockDelayAC); | 479 value = GetValue(dict, kScreenLockDelayAC); |
480 if (value) | 480 if (value) |
481 prefs->SetValue(prefs::kPowerAcScreenLockDelayMs, std::move(value)); | 481 prefs->SetValue(prefs::kPowerAcScreenLockDelayMs, std::move(value)); |
482 value = GetValue(dict, kScreenLockDelayBattery); | 482 value = GetValue(dict, kScreenLockDelayBattery); |
483 if (value) | 483 if (value) |
484 prefs->SetValue(prefs::kPowerBatteryScreenLockDelayMs, std::move(value)); | 484 prefs->SetValue(prefs::kPowerBatteryScreenLockDelayMs, std::move(value)); |
485 } | 485 } |
486 | 486 |
487 } // namespace policy | 487 } // namespace policy |
OLD | NEW |