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

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

Issue 1328233002: Ramove use of JSONReader::DeprecatedRead from chromeos/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
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 13 matching lines...) Expand all
24 24
25 namespace chromeos { 25 namespace chromeos {
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 scoped_ptr<base::Value> ConvertStringToValue(const std::string& str, 32 scoped_ptr<base::Value> ConvertStringToValue(const std::string& str,
33 base::Value::Type type) { 33 base::Value::Type type) {
34 base::Value* value; 34 scoped_ptr<base::Value> value;
35 if (type == base::Value::TYPE_STRING) { 35 if (type == base::Value::TYPE_STRING) {
36 value = new base::StringValue(str); 36 value = make_scoped_ptr(new base::StringValue(str));
pneubeck (no reviews) 2015/09/09 11:49:51 shouldn't this be value.reset(new ...) ?
37 } else { 37 } else {
38 value = base::JSONReader::DeprecatedRead(str); 38 value = base::JSONReader::Read(str);
39 } 39 }
40 40 return value;
pneubeck (no reviews) 2015/09/09 11:49:51 this must keep the type check: if (value && value
41 if (value == NULL || value->GetType() != type) {
42 delete value;
43 value = NULL;
44 }
45 return make_scoped_ptr(value);
46 } 41 }
47 42
48 // This class implements the translation of properties from the given 43 // This class implements the translation of properties from the given
49 // |shill_dictionary| to a new ONC object of signature |onc_signature|. Using 44 // |shill_dictionary| to a new ONC object of signature |onc_signature|. Using
50 // recursive calls to CreateTranslatedONCObject of new instances, nested objects 45 // recursive calls to CreateTranslatedONCObject of new instances, nested objects
51 // are translated. 46 // are translated.
52 class ShillToONCTranslator { 47 class ShillToONCTranslator {
53 public: 48 public:
54 ShillToONCTranslator(const base::DictionaryValue& shill_dictionary, 49 ShillToONCTranslator(const base::DictionaryValue& shill_dictionary,
55 ::onc::ONCSource onc_source, 50 ::onc::ONCSource onc_source,
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 const NetworkState* network_state) { 762 const NetworkState* network_state) {
768 CHECK(onc_signature != NULL); 763 CHECK(onc_signature != NULL);
769 764
770 ShillToONCTranslator translator(shill_dictionary, onc_source, *onc_signature, 765 ShillToONCTranslator translator(shill_dictionary, onc_source, *onc_signature,
771 network_state); 766 network_state);
772 return translator.CreateTranslatedONCObject(); 767 return translator.CreateTranslatedONCObject();
773 } 768 }
774 769
775 } // namespace onc 770 } // namespace onc
776 } // namespace chromeos 771 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698