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

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

Issue 1131113004: Convert JsonWriter::Write to taking a const ref for the in-param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another rebase Created 5 years, 7 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/network_state_handler.cc ('k') | chromeos/network/shill_property_util.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 // 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 #include "third_party/cros_system_api/dbus/service_constants.h" 24 #include "third_party/cros_system_api/dbus/service_constants.h"
25 25
26 namespace chromeos { 26 namespace chromeos {
27 namespace onc { 27 namespace onc {
28 28
29 namespace { 29 namespace {
30 30
31 scoped_ptr<base::StringValue> ConvertValueToString(const base::Value& value) { 31 scoped_ptr<base::StringValue> ConvertValueToString(const base::Value& value) {
32 std::string str; 32 std::string str;
33 if (!value.GetAsString(&str)) 33 if (!value.GetAsString(&str))
34 base::JSONWriter::Write(&value, &str); 34 base::JSONWriter::Write(value, &str);
35 return make_scoped_ptr(new base::StringValue(str)); 35 return make_scoped_ptr(new base::StringValue(str));
36 } 36 }
37 37
38 // This class is responsible to translate the local fields of the given 38 // This class is responsible to translate the local fields of the given
39 // |onc_object| according to |onc_signature| into |shill_dictionary|. This 39 // |onc_object| according to |onc_signature| into |shill_dictionary|. This
40 // translation should consider (if possible) only fields of this ONC object and 40 // translation should consider (if possible) only fields of this ONC object and
41 // not nested objects because recursion is handled by the calling function 41 // not nested objects because recursion is handled by the calling function
42 // TranslateONCHierarchy. 42 // TranslateONCHierarchy.
43 class LocalTranslator { 43 class LocalTranslator {
44 public: 44 public:
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 const OncValueSignature* onc_signature, 401 const OncValueSignature* onc_signature,
402 const base::DictionaryValue& onc_object) { 402 const base::DictionaryValue& onc_object) {
403 CHECK(onc_signature != NULL); 403 CHECK(onc_signature != NULL);
404 scoped_ptr<base::DictionaryValue> shill_dictionary(new base::DictionaryValue); 404 scoped_ptr<base::DictionaryValue> shill_dictionary(new base::DictionaryValue);
405 TranslateONCHierarchy(*onc_signature, onc_object, shill_dictionary.get()); 405 TranslateONCHierarchy(*onc_signature, onc_object, shill_dictionary.get());
406 return shill_dictionary.Pass(); 406 return shill_dictionary.Pass();
407 } 407 }
408 408
409 } // namespace onc 409 } // namespace onc
410 } // namespace chromeos 410 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/network_state_handler.cc ('k') | chromeos/network/shill_property_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698