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

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

Issue 2255093003: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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_unittest.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 18 matching lines...) Expand all
29 namespace chromeos { 29 namespace chromeos {
30 namespace onc { 30 namespace onc {
31 31
32 namespace { 32 namespace {
33 33
34 std::unique_ptr<base::StringValue> ConvertValueToString( 34 std::unique_ptr<base::StringValue> ConvertValueToString(
35 const base::Value& value) { 35 const base::Value& value) {
36 std::string str; 36 std::string str;
37 if (!value.GetAsString(&str)) 37 if (!value.GetAsString(&str))
38 base::JSONWriter::Write(value, &str); 38 base::JSONWriter::Write(value, &str);
39 return base::WrapUnique(new base::StringValue(str)); 39 return base::MakeUnique<base::StringValue>(str);
40 } 40 }
41 41
42 // This class is responsible to translate the local fields of the given 42 // This class is responsible to translate the local fields of the given
43 // |onc_object| according to |onc_signature| into |shill_dictionary|. This 43 // |onc_object| according to |onc_signature| into |shill_dictionary|. This
44 // translation should consider (if possible) only fields of this ONC object and 44 // translation should consider (if possible) only fields of this ONC object and
45 // not nested objects because recursion is handled by the calling function 45 // not nested objects because recursion is handled by the calling function
46 // TranslateONCHierarchy. 46 // TranslateONCHierarchy.
47 class LocalTranslator { 47 class LocalTranslator {
48 public: 48 public:
49 LocalTranslator(const OncValueSignature& onc_signature, 49 LocalTranslator(const OncValueSignature& onc_signature,
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 const base::DictionaryValue& onc_object) { 422 const base::DictionaryValue& onc_object) {
423 CHECK(onc_signature != NULL); 423 CHECK(onc_signature != NULL);
424 std::unique_ptr<base::DictionaryValue> shill_dictionary( 424 std::unique_ptr<base::DictionaryValue> shill_dictionary(
425 new base::DictionaryValue); 425 new base::DictionaryValue);
426 TranslateONCHierarchy(*onc_signature, onc_object, shill_dictionary.get()); 426 TranslateONCHierarchy(*onc_signature, onc_object, shill_dictionary.get());
427 return shill_dictionary; 427 return shill_dictionary;
428 } 428 }
429 429
430 } // namespace onc 430 } // namespace onc
431 } // namespace chromeos 431 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/network_state_unittest.cc ('k') | chromeos/network/shill_property_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698