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

Side by Side Diff: chromeos/network/onc/onc_translator_onc_to_shill.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 // The implementation of TranslateONCObjectToShill is structured in two parts: 5 // The implementation of TranslateONCObjectToShill is structured in two parts:
6 // - The recursion through the existing ONC hierarchy 6 // - The recursion through the existing ONC hierarchy
7 // see TranslateONCHierarchy 7 // see TranslateONCHierarchy
8 // - The local translation of an object depending on the associated signature 8 // - The local translation of an object depending on the associated signature
9 // see LocalTranslator::TranslateFields 9 // see LocalTranslator::TranslateFields
10 10
(...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 scoped_ptr<base::StringValue> ConvertValueToString(const base::Value& value) { 30 scoped_ptr<base::StringValue> ConvertValueToString(const base::Value& value) {
31 std::string str; 31 std::string str;
32 if (!value.GetAsString(&str)) 32 if (!value.GetAsString(&str))
33 base::JSONWriter::Write(&value, &str); 33 base::JSONWriter::Write(&value, &str);
34 return make_scoped_ptr(base::Value::CreateStringValue(str)); 34 return make_scoped_ptr(new base::StringValue(str));
35 } 35 }
36 36
37 // This class is responsible to translate the local fields of the given 37 // This class is responsible to translate the local fields of the given
38 // |onc_object| according to |onc_signature| into |shill_dictionary|. This 38 // |onc_object| according to |onc_signature| into |shill_dictionary|. This
39 // translation should consider (if possible) only fields of this ONC object and 39 // translation should consider (if possible) only fields of this ONC object and
40 // not nested objects because recursion is handled by the calling function 40 // not nested objects because recursion is handled by the calling function
41 // TranslateONCHierarchy. 41 // TranslateONCHierarchy.
42 class LocalTranslator { 42 class LocalTranslator {
43 public: 43 public:
44 LocalTranslator(const OncValueSignature& onc_signature, 44 LocalTranslator(const OncValueSignature& onc_signature,
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 const OncValueSignature* onc_signature, 299 const OncValueSignature* onc_signature,
300 const base::DictionaryValue& onc_object) { 300 const base::DictionaryValue& onc_object) {
301 CHECK(onc_signature != NULL); 301 CHECK(onc_signature != NULL);
302 scoped_ptr<base::DictionaryValue> shill_dictionary(new base::DictionaryValue); 302 scoped_ptr<base::DictionaryValue> shill_dictionary(new base::DictionaryValue);
303 TranslateONCHierarchy(*onc_signature, onc_object, shill_dictionary.get()); 303 TranslateONCHierarchy(*onc_signature, onc_object, shill_dictionary.get());
304 return shill_dictionary.Pass(); 304 return shill_dictionary.Pass();
305 } 305 }
306 306
307 } // namespace onc 307 } // namespace onc
308 } // namespace chromeos 308 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/network_configuration_handler_unittest.cc ('k') | chromeos/network/onc/onc_translator_shill_to_onc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698