| // Copyright 2014 The Chromium Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| #include "base/json/json_value_converter.h" |
| #include "base/strings/utf_string_conversions.h" |
| bool BasicValueConverter<int>::Convert( |
| const base::Value& value, int* field) const { |
| bool BasicValueConverter<std::string>::Convert( |
| const base::Value& value, std::string* field) const { |
| *field = value.GetString(); |
| bool BasicValueConverter<std::u16string>::Convert(const base::Value& value, |
| std::u16string* field) const { |
| *field = base::UTF8ToUTF16(value.GetString()); |
| bool BasicValueConverter<double>::Convert( |
| const base::Value& value, double* field) const { |
| if (!value.is_double() && !value.is_int()) |
| *field = value.GetDouble(); |
| bool BasicValueConverter<bool>::Convert( |
| const base::Value& value, bool* field) const { |
| *field = value.GetBool(); |