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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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>(new base::FundamentalValue( |
119 chromeos::PowerPolicyController::ACTION_DO_NOTHING)); | 119 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 } | |
129 | 128 |
130 ExternalDataPolicyHandler::~ExternalDataPolicyHandler() { | 129 ExternalDataPolicyHandler::~ExternalDataPolicyHandler() { |
131 } | 130 } |
132 | 131 |
133 bool ExternalDataPolicyHandler::CheckPolicySettings(const PolicyMap& policies, | 132 bool ExternalDataPolicyHandler::CheckPolicySettings(const PolicyMap& policies, |
134 PolicyErrorMap* errors) { | 133 PolicyErrorMap* errors) { |
135 if (!TypeCheckingPolicyHandler::CheckPolicySettings(policies, errors)) | 134 if (!TypeCheckingPolicyHandler::CheckPolicySettings(policies, errors)) |
136 return false; | 135 return false; |
137 | 136 |
138 const std::string policy = policy_name(); | 137 const std::string policy = policy_name(); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 sanitized_config = base::Value::CreateNullValue(); | 269 sanitized_config = base::Value::CreateNullValue(); |
271 | 270 |
272 policies->Set(policy_name(), entry->level, entry->scope, entry->source, | 271 policies->Set(policy_name(), entry->level, entry->scope, entry->source, |
273 std::move(sanitized_config), nullptr); | 272 std::move(sanitized_config), nullptr); |
274 } | 273 } |
275 | 274 |
276 NetworkConfigurationPolicyHandler::NetworkConfigurationPolicyHandler( | 275 NetworkConfigurationPolicyHandler::NetworkConfigurationPolicyHandler( |
277 const char* policy_name, | 276 const char* policy_name, |
278 onc::ONCSource onc_source, | 277 onc::ONCSource onc_source, |
279 const char* pref_path) | 278 const char* pref_path) |
280 : TypeCheckingPolicyHandler(policy_name, base::Value::TYPE_STRING), | 279 : TypeCheckingPolicyHandler(policy_name, base::Value::Type::STRING), |
281 onc_source_(onc_source), | 280 onc_source_(onc_source), |
282 pref_path_(pref_path) { | 281 pref_path_(pref_path) {} |
283 } | |
284 | 282 |
285 // static | 283 // static |
286 std::unique_ptr<base::Value> | 284 std::unique_ptr<base::Value> |
287 NetworkConfigurationPolicyHandler::SanitizeNetworkConfig( | 285 NetworkConfigurationPolicyHandler::SanitizeNetworkConfig( |
288 const base::Value* config) { | 286 const base::Value* config) { |
289 std::string json_string; | 287 std::string json_string; |
290 if (!config->GetAsString(&json_string)) | 288 if (!config->GetAsString(&json_string)) |
291 return NULL; | 289 return NULL; |
292 | 290 |
293 std::unique_ptr<base::DictionaryValue> toplevel_dict = | 291 std::unique_ptr<base::DictionaryValue> toplevel_dict = |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 | 476 |
479 value = GetValue(dict, kScreenLockDelayAC); | 477 value = GetValue(dict, kScreenLockDelayAC); |
480 if (value) | 478 if (value) |
481 prefs->SetValue(prefs::kPowerAcScreenLockDelayMs, std::move(value)); | 479 prefs->SetValue(prefs::kPowerAcScreenLockDelayMs, std::move(value)); |
482 value = GetValue(dict, kScreenLockDelayBattery); | 480 value = GetValue(dict, kScreenLockDelayBattery); |
483 if (value) | 481 if (value) |
484 prefs->SetValue(prefs::kPowerBatteryScreenLockDelayMs, std::move(value)); | 482 prefs->SetValue(prefs::kPowerBatteryScreenLockDelayMs, std::move(value)); |
485 } | 483 } |
486 | 484 |
487 } // namespace policy | 485 } // namespace policy |
OLD | NEW |