Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: chromeos/network/onc/onc_translator_shill_to_onc.cc

Issue 2664753002: Remove base::StringValue (Closed)
Patch Set: Rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chromeos/network/onc/onc_translator_onc_to_shill.cc ('k') | chromeos/network/onc/onc_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <string> 5 #include <string>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 15 matching lines...) Expand all
26 namespace onc { 26 namespace onc {
27 27
28 namespace { 28 namespace {
29 29
30 // Converts |str| to a base::Value of the given |type|. If the conversion fails, 30 // Converts |str| to a base::Value of the given |type|. If the conversion fails,
31 // returns NULL. 31 // returns NULL.
32 std::unique_ptr<base::Value> ConvertStringToValue(const std::string& str, 32 std::unique_ptr<base::Value> ConvertStringToValue(const std::string& str,
33 base::Value::Type type) { 33 base::Value::Type type) {
34 std::unique_ptr<base::Value> value; 34 std::unique_ptr<base::Value> value;
35 if (type == base::Value::Type::STRING) { 35 if (type == base::Value::Type::STRING) {
36 value.reset(new base::StringValue(str)); 36 value.reset(new base::Value(str));
37 } else { 37 } else {
38 value = base::JSONReader::Read(str); 38 value = base::JSONReader::Read(str);
39 } 39 }
40 if (value && value->GetType() != type) 40 if (value && value->GetType() != type)
41 return nullptr; 41 return nullptr;
42 42
43 return value; 43 return value;
44 } 44 }
45 45
46 // This class implements the translation of properties from the given 46 // This class implements the translation of properties from the given
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 const NetworkState* network_state) { 778 const NetworkState* network_state) {
779 CHECK(onc_signature != NULL); 779 CHECK(onc_signature != NULL);
780 780
781 ShillToONCTranslator translator(shill_dictionary, onc_source, *onc_signature, 781 ShillToONCTranslator translator(shill_dictionary, onc_source, *onc_signature,
782 network_state); 782 network_state);
783 return translator.CreateTranslatedONCObject(); 783 return translator.CreateTranslatedONCObject();
784 } 784 }
785 785
786 } // namespace onc 786 } // namespace onc
787 } // namespace chromeos 787 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/onc/onc_translator_onc_to_shill.cc ('k') | chromeos/network/onc/onc_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698