| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/policy/core/common/registry_dict.h" | 5 #include "components/policy/core/common/registry_dict.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 return std::move(result); | 69 return std::move(result); |
| 70 } | 70 } |
| 71 return value.CreateDeepCopy(); | 71 return value.CreateDeepCopy(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 // Else, do some conversions to map windows registry data types to JSON types. | 74 // Else, do some conversions to map windows registry data types to JSON types. |
| 75 std::string string_value; | 75 std::string string_value; |
| 76 int int_value = 0; | 76 int int_value = 0; |
| 77 switch (schema.type()) { | 77 switch (schema.type()) { |
| 78 case base::Value::Type::NONE: { | 78 case base::Value::Type::NONE: { |
| 79 return base::Value::CreateNullValue(); | 79 return base::MakeUnique<base::Value>(); |
| 80 } | 80 } |
| 81 case base::Value::Type::BOOLEAN: { | 81 case base::Value::Type::BOOLEAN: { |
| 82 // Accept booleans encoded as either string or integer. | 82 // Accept booleans encoded as either string or integer. |
| 83 if (value.GetAsInteger(&int_value) || | 83 if (value.GetAsInteger(&int_value) || |
| 84 (value.GetAsString(&string_value) && | 84 (value.GetAsString(&string_value) && |
| 85 base::StringToInt(string_value, &int_value))) { | 85 base::StringToInt(string_value, &int_value))) { |
| 86 return std::unique_ptr<base::Value>(new base::Value(int_value != 0)); | 86 return std::unique_ptr<base::Value>(new base::Value(int_value != 0)); |
| 87 } | 87 } |
| 88 break; | 88 break; |
| 89 } | 89 } |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 return std::move(result); | 352 return std::move(result); |
| 353 } | 353 } |
| 354 default: | 354 default: |
| 355 LOG(WARNING) << "Can't convert registry key to schema type " << type; | 355 LOG(WARNING) << "Can't convert registry key to schema type " << type; |
| 356 } | 356 } |
| 357 | 357 |
| 358 return nullptr; | 358 return nullptr; |
| 359 } | 359 } |
| 360 #endif // #if defined(OS_WIN) | 360 #endif // #if defined(OS_WIN) |
| 361 } // namespace policy | 361 } // namespace policy |
| OLD | NEW |