OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/policy/device_management_policy_cache.h" | 5 #include "chrome/browser/policy/device_management_policy_cache.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 case em::GenericValue::VALUE_TYPE_INT64: | 178 case em::GenericValue::VALUE_TYPE_INT64: |
179 if (value.has_int64_value()) | 179 if (value.has_int64_value()) |
180 return DecodeIntegerValue(value.int64_value()); | 180 return DecodeIntegerValue(value.int64_value()); |
181 return NULL; | 181 return NULL; |
182 case em::GenericValue::VALUE_TYPE_STRING: | 182 case em::GenericValue::VALUE_TYPE_STRING: |
183 if (value.has_string_value()) | 183 if (value.has_string_value()) |
184 return Value::CreateStringValue(value.string_value()); | 184 return Value::CreateStringValue(value.string_value()); |
185 return NULL; | 185 return NULL; |
186 case em::GenericValue::VALUE_TYPE_DOUBLE: | 186 case em::GenericValue::VALUE_TYPE_DOUBLE: |
187 if (value.has_double_value()) | 187 if (value.has_double_value()) |
188 return Value::CreateRealValue(value.double_value()); | 188 return Value::CreateDoubleValue(value.double_value()); |
189 return NULL; | 189 return NULL; |
190 case em::GenericValue::VALUE_TYPE_BYTES: | 190 case em::GenericValue::VALUE_TYPE_BYTES: |
191 if (value.has_bytes_value()) { | 191 if (value.has_bytes_value()) { |
192 std::string bytes = value.bytes_value(); | 192 std::string bytes = value.bytes_value(); |
193 return BinaryValue::CreateWithCopiedBuffer(bytes.c_str(), bytes.size()); | 193 return BinaryValue::CreateWithCopiedBuffer(bytes.c_str(), bytes.size()); |
194 } | 194 } |
195 return NULL; | 195 return NULL; |
196 case em::GenericValue::VALUE_TYPE_BOOL_ARRAY: { | 196 case em::GenericValue::VALUE_TYPE_BOOL_ARRAY: { |
197 ListValue* list = new ListValue; | 197 ListValue* list = new ListValue; |
198 RepeatedField<bool>::const_iterator i; | 198 RepeatedField<bool>::const_iterator i; |
(...skipping 18 matching lines...) Expand all Loading... |
217 for (i = value.string_array().begin(); | 217 for (i = value.string_array().begin(); |
218 i != value.string_array().end(); ++i) | 218 i != value.string_array().end(); ++i) |
219 list->Append(Value::CreateStringValue(*i)); | 219 list->Append(Value::CreateStringValue(*i)); |
220 return list; | 220 return list; |
221 } | 221 } |
222 case em::GenericValue::VALUE_TYPE_DOUBLE_ARRAY: { | 222 case em::GenericValue::VALUE_TYPE_DOUBLE_ARRAY: { |
223 ListValue* list = new ListValue; | 223 ListValue* list = new ListValue; |
224 RepeatedField<double>::const_iterator i; | 224 RepeatedField<double>::const_iterator i; |
225 for (i = value.double_array().begin(); | 225 for (i = value.double_array().begin(); |
226 i != value.double_array().end(); ++i) | 226 i != value.double_array().end(); ++i) |
227 list->Append(Value::CreateRealValue(*i)); | 227 list->Append(Value::CreateDoubleValue(*i)); |
228 return list; | 228 return list; |
229 } | 229 } |
230 default: | 230 default: |
231 NOTREACHED() << "Unhandled value type"; | 231 NOTREACHED() << "Unhandled value type"; |
232 } | 232 } |
233 | 233 |
234 return NULL; | 234 return NULL; |
235 } | 235 } |
236 | 236 |
237 // static | 237 // static |
(...skipping 23 matching lines...) Expand all Loading... |
261 DeviceManagementPolicyCache::DecodeValue(named_value->value()); | 261 DeviceManagementPolicyCache::DecodeValue(named_value->value()); |
262 if (decoded_value) | 262 if (decoded_value) |
263 result->Set(named_value->name(), decoded_value); | 263 result->Set(named_value->name(), decoded_value); |
264 } | 264 } |
265 } | 265 } |
266 } | 266 } |
267 return result; | 267 return result; |
268 } | 268 } |
269 | 269 |
270 } // namespace policy | 270 } // namespace policy |
OLD | NEW |