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

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

Issue 838043003: Fix onc_to_shill translation logic error (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_448445_onc_guid
Patch Set: Created 5 years, 11 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 | « no previous file | no next file » | 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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 base::DictionaryValue* target_shill_dictionary = shill_dictionary; 346 base::DictionaryValue* target_shill_dictionary = shill_dictionary;
347 std::vector<std::string> path_to_shill_dictionary = 347 std::vector<std::string> path_to_shill_dictionary =
348 GetPathToNestedShillDictionary(signature); 348 GetPathToNestedShillDictionary(signature);
349 for (std::vector<std::string>::const_iterator it = 349 for (std::vector<std::string>::const_iterator it =
350 path_to_shill_dictionary.begin(); 350 path_to_shill_dictionary.begin();
351 it != path_to_shill_dictionary.end(); 351 it != path_to_shill_dictionary.end();
352 ++it) { 352 ++it) {
353 base::DictionaryValue* nested_shill_dict = NULL; 353 base::DictionaryValue* nested_shill_dict = NULL;
354 target_shill_dictionary->GetDictionaryWithoutPathExpansion( 354 target_shill_dictionary->GetDictionaryWithoutPathExpansion(
355 *it, &nested_shill_dict); 355 *it, &nested_shill_dict);
356 if (!nested_shill_dict) 356 if (!nested_shill_dict) {
357 nested_shill_dict = new base::DictionaryValue; 357 nested_shill_dict = new base::DictionaryValue;
358 target_shill_dictionary->SetWithoutPathExpansion(*it, nested_shill_dict); 358 target_shill_dictionary->SetWithoutPathExpansion(*it, nested_shill_dict);
359 }
359 target_shill_dictionary = nested_shill_dict; 360 target_shill_dictionary = nested_shill_dict;
360 } 361 }
361 // Translates fields of |onc_object| and writes them to 362 // Translates fields of |onc_object| and writes them to
362 // |target_shill_dictionary_| nested in |shill_dictionary|. 363 // |target_shill_dictionary_| nested in |shill_dictionary|.
363 LocalTranslator translator(signature, onc_object, target_shill_dictionary); 364 LocalTranslator translator(signature, onc_object, target_shill_dictionary);
364 translator.TranslateFields(); 365 translator.TranslateFields();
365 366
366 // Recurse into nested objects. 367 // Recurse into nested objects.
367 for (base::DictionaryValue::Iterator it(onc_object); !it.IsAtEnd(); 368 for (base::DictionaryValue::Iterator it(onc_object); !it.IsAtEnd();
368 it.Advance()) { 369 it.Advance()) {
(...skipping 15 matching lines...) Expand all
384 const OncValueSignature* onc_signature, 385 const OncValueSignature* onc_signature,
385 const base::DictionaryValue& onc_object) { 386 const base::DictionaryValue& onc_object) {
386 CHECK(onc_signature != NULL); 387 CHECK(onc_signature != NULL);
387 scoped_ptr<base::DictionaryValue> shill_dictionary(new base::DictionaryValue); 388 scoped_ptr<base::DictionaryValue> shill_dictionary(new base::DictionaryValue);
388 TranslateONCHierarchy(*onc_signature, onc_object, shill_dictionary.get()); 389 TranslateONCHierarchy(*onc_signature, onc_object, shill_dictionary.get());
389 return shill_dictionary.Pass(); 390 return shill_dictionary.Pass();
390 } 391 }
391 392
392 } // namespace onc 393 } // namespace onc
393 } // namespace chromeos 394 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698