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

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

Issue 388963002: Get rid of the rest of CreateStringValue (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix bad rebase Created 6 years, 5 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 | Annotate | Revision Log
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 "chromeos/network/onc/onc_translator.h" 5 #include "chromeos/network/onc/onc_translator.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 12 matching lines...) Expand all
23 namespace onc { 23 namespace onc {
24 24
25 namespace { 25 namespace {
26 26
27 // Converts |str| to a base::Value of the given |type|. If the conversion fails, 27 // Converts |str| to a base::Value of the given |type|. If the conversion fails,
28 // returns NULL. 28 // returns NULL.
29 scoped_ptr<base::Value> ConvertStringToValue(const std::string& str, 29 scoped_ptr<base::Value> ConvertStringToValue(const std::string& str,
30 base::Value::Type type) { 30 base::Value::Type type) {
31 base::Value* value; 31 base::Value* value;
32 if (type == base::Value::TYPE_STRING) { 32 if (type == base::Value::TYPE_STRING) {
33 value = base::Value::CreateStringValue(str); 33 value = new base::StringValue(str);
34 } else { 34 } else {
35 value = base::JSONReader::Read(str); 35 value = base::JSONReader::Read(str);
36 } 36 }
37 37
38 if (value == NULL || value->GetType() != type) { 38 if (value == NULL || value->GetType() != type) {
39 delete value; 39 delete value;
40 value = NULL; 40 value = NULL;
41 } 41 }
42 return make_scoped_ptr(value); 42 return make_scoped_ptr(value);
43 } 43 }
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 const base::DictionaryValue& shill_dictionary, 493 const base::DictionaryValue& shill_dictionary,
494 const OncValueSignature* onc_signature) { 494 const OncValueSignature* onc_signature) {
495 CHECK(onc_signature != NULL); 495 CHECK(onc_signature != NULL);
496 496
497 ShillToONCTranslator translator(shill_dictionary, *onc_signature); 497 ShillToONCTranslator translator(shill_dictionary, *onc_signature);
498 return translator.CreateTranslatedONCObject(); 498 return translator.CreateTranslatedONCObject();
499 } 499 }
500 500
501 } // namespace onc 501 } // namespace onc
502 } // namespace chromeos 502 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/onc/onc_translator_onc_to_shill.cc ('k') | chromeos/network/shill_property_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698