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> |
| 8 |
7 #include <string> | 9 #include <string> |
8 #include <vector> | 10 #include <vector> |
9 | 11 |
10 #include "base/callback.h" | 12 #include "base/callback.h" |
11 #include "base/json/json_reader.h" | 13 #include "base/json/json_reader.h" |
12 #include "base/json/json_writer.h" | 14 #include "base/json/json_writer.h" |
13 #include "base/logging.h" | 15 #include "base/logging.h" |
14 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
15 #include "base/prefs/pref_value_map.h" | 17 #include "base/prefs/pref_value_map.h" |
16 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 !GetSubkeyString(*dict, errors, policy, kSubkeyHash, &hash_string)) { | 149 !GetSubkeyString(*dict, errors, policy, kSubkeyHash, &hash_string)) { |
148 return false; | 150 return false; |
149 } | 151 } |
150 | 152 |
151 const GURL url(url_string); | 153 const GURL url(url_string); |
152 if (!url.is_valid()) { | 154 if (!url.is_valid()) { |
153 errors->AddError(policy, kSubkeyURL, IDS_POLICY_VALUE_FORMAT_ERROR); | 155 errors->AddError(policy, kSubkeyURL, IDS_POLICY_VALUE_FORMAT_ERROR); |
154 return false; | 156 return false; |
155 } | 157 } |
156 | 158 |
157 std::vector<uint8> hash; | 159 std::vector<uint8_t> hash; |
158 if (!base::HexStringToBytes(hash_string, &hash) || | 160 if (!base::HexStringToBytes(hash_string, &hash) || |
159 hash.size() != crypto::kSHA256Length) { | 161 hash.size() != crypto::kSHA256Length) { |
160 errors->AddError(policy, kSubkeyHash, IDS_POLICY_VALUE_FORMAT_ERROR); | 162 errors->AddError(policy, kSubkeyHash, IDS_POLICY_VALUE_FORMAT_ERROR); |
161 return false; | 163 return false; |
162 } | 164 } |
163 | 165 |
164 return true; | 166 return true; |
165 } | 167 } |
166 | 168 |
167 void ExternalDataPolicyHandler::ApplyPolicySettings(const PolicyMap& policies, | 169 void ExternalDataPolicyHandler::ApplyPolicySettings(const PolicyMap& policies, |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 | 474 |
473 value = GetValue(dict, kScreenLockDelayAC); | 475 value = GetValue(dict, kScreenLockDelayAC); |
474 if (value) | 476 if (value) |
475 prefs->SetValue(prefs::kPowerAcScreenLockDelayMs, value.Pass()); | 477 prefs->SetValue(prefs::kPowerAcScreenLockDelayMs, value.Pass()); |
476 value = GetValue(dict, kScreenLockDelayBattery); | 478 value = GetValue(dict, kScreenLockDelayBattery); |
477 if (value) | 479 if (value) |
478 prefs->SetValue(prefs::kPowerBatteryScreenLockDelayMs, value.Pass()); | 480 prefs->SetValue(prefs::kPowerBatteryScreenLockDelayMs, value.Pass()); |
479 } | 481 } |
480 | 482 |
481 } // namespace policy | 483 } // namespace policy |
OLD | NEW |