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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 errors->AddError(policy, subkey, IDS_POLICY_NOT_SPECIFIED_ERROR); | 59 errors->AddError(policy, subkey, IDS_POLICY_NOT_SPECIFIED_ERROR); |
60 return false; | 60 return false; |
61 } | 61 } |
62 *value = string_value; | 62 *value = string_value; |
63 return true; | 63 return true; |
64 } | 64 } |
65 | 65 |
66 } // namespace | 66 } // namespace |
67 | 67 |
68 ExternalDataPolicyHandler::ExternalDataPolicyHandler(const char* policy_name) | 68 ExternalDataPolicyHandler::ExternalDataPolicyHandler(const char* policy_name) |
69 : TypeCheckingPolicyHandler(policy_name, Value::TYPE_DICTIONARY) { | 69 : TypeCheckingPolicyHandler(policy_name, base::Value::TYPE_DICTIONARY) { |
70 } | 70 } |
71 | 71 |
72 ExternalDataPolicyHandler::~ExternalDataPolicyHandler() { | 72 ExternalDataPolicyHandler::~ExternalDataPolicyHandler() { |
73 } | 73 } |
74 | 74 |
75 bool ExternalDataPolicyHandler::CheckPolicySettings(const PolicyMap& policies, | 75 bool ExternalDataPolicyHandler::CheckPolicySettings(const PolicyMap& policies, |
76 PolicyErrorMap* errors) { | 76 PolicyErrorMap* errors) { |
77 if (!TypeCheckingPolicyHandler::CheckPolicySettings(policies, errors)) | 77 if (!TypeCheckingPolicyHandler::CheckPolicySettings(policies, errors)) |
78 return false; | 78 return false; |
79 | 79 |
80 const std::string policy = policy_name(); | 80 const std::string policy = policy_name(); |
81 const base::Value* value = policies.GetValue(policy); | 81 const base::Value* value = policies.GetValue(policy); |
82 if (!value) | 82 if (!value) |
83 return true; | 83 return true; |
84 | 84 |
85 const DictionaryValue* dict = NULL; | 85 const base::DictionaryValue* dict = NULL; |
86 value->GetAsDictionary(&dict); | 86 value->GetAsDictionary(&dict); |
87 if (!dict) { | 87 if (!dict) { |
88 NOTREACHED(); | 88 NOTREACHED(); |
89 return false; | 89 return false; |
90 } | 90 } |
91 std::string url_string; | 91 std::string url_string; |
92 std::string hash_string; | 92 std::string hash_string; |
93 if (!GetSubkeyString(*dict, errors, policy, kSubkeyURL, &url_string) || | 93 if (!GetSubkeyString(*dict, errors, policy, kSubkeyURL, &url_string) || |
94 !GetSubkeyString(*dict, errors, policy, kSubkeyHash, &hash_string)) { | 94 !GetSubkeyString(*dict, errors, policy, kSubkeyHash, &hash_string)) { |
95 return false; | 95 return false; |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 const base::Value* value = policies.GetValue(policy_name()); | 344 const base::Value* value = policies.GetValue(policy_name()); |
345 if (value && EnsureInRange(value, NULL, NULL)) { | 345 if (value && EnsureInRange(value, NULL, NULL)) { |
346 if (!prefs->GetValue(prefs::kPowerAcIdleAction, NULL)) | 346 if (!prefs->GetValue(prefs::kPowerAcIdleAction, NULL)) |
347 prefs->SetValue(prefs::kPowerAcIdleAction, value->DeepCopy()); | 347 prefs->SetValue(prefs::kPowerAcIdleAction, value->DeepCopy()); |
348 if (!prefs->GetValue(prefs::kPowerBatteryIdleAction, NULL)) | 348 if (!prefs->GetValue(prefs::kPowerBatteryIdleAction, NULL)) |
349 prefs->SetValue(prefs::kPowerBatteryIdleAction, value->DeepCopy()); | 349 prefs->SetValue(prefs::kPowerBatteryIdleAction, value->DeepCopy()); |
350 } | 350 } |
351 } | 351 } |
352 | 352 |
353 } // namespace policy | 353 } // namespace policy |
OLD | NEW |