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

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

Issue 12541007: This adds the setProperties and getState functions to the networking API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed flag usage Created 7 years, 9 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 std::string shill_value; 212 std::string shill_value;
213 if (TranslateStringToShill(table, onc_value, &shill_value)) { 213 if (TranslateStringToShill(table, onc_value, &shill_value)) {
214 shill_dictionary_->SetStringWithoutPathExpansion(shill_property_name, 214 shill_dictionary_->SetStringWithoutPathExpansion(shill_property_name,
215 shill_value); 215 shill_value);
216 return; 216 return;
217 } 217 }
218 // As we previously validate ONC, this case should never occur. If it still 218 // As we previously validate ONC, this case should never occur. If it still
219 // occurs, we should check here. Otherwise the failure will only show up much 219 // occurs, we should check here. Otherwise the failure will only show up much
220 // later in Shill. 220 // later in Shill.
221 LOG(ERROR) << "Value '" << onc_value 221 LOG(ERROR) << "Value '" << onc_value
222 << " cannot be translated to Shill property " 222 << "' cannot be translated to Shill property "
223 << shill_property_name; 223 << shill_property_name;
224 } 224 }
225 225
226 // Iterates recursively over |onc_object| and its |signature|. At each object 226 // Iterates recursively over |onc_object| and its |signature|. At each object
227 // applies the local translation using LocalTranslator::TranslateFields. The 227 // applies the local translation using LocalTranslator::TranslateFields. The
228 // results are written to |shill_dictionary|. 228 // results are written to |shill_dictionary|.
229 void TranslateONCHierarchy(const OncValueSignature& signature, 229 void TranslateONCHierarchy(const OncValueSignature& signature,
230 const base::DictionaryValue& onc_object, 230 const base::DictionaryValue& onc_object,
231 base::DictionaryValue* shill_dictionary) { 231 base::DictionaryValue* shill_dictionary) {
232 // Translates fields of |onc_object| and writes them to |shill_dictionary_|. 232 // Translates fields of |onc_object| and writes them to |shill_dictionary_|.
(...skipping 21 matching lines...) Expand all
254 const OncValueSignature* onc_signature, 254 const OncValueSignature* onc_signature,
255 const base::DictionaryValue& onc_object) { 255 const base::DictionaryValue& onc_object) {
256 CHECK(onc_signature != NULL); 256 CHECK(onc_signature != NULL);
257 scoped_ptr<base::DictionaryValue> shill_dictionary(new base::DictionaryValue); 257 scoped_ptr<base::DictionaryValue> shill_dictionary(new base::DictionaryValue);
258 TranslateONCHierarchy(*onc_signature, onc_object, shill_dictionary.get()); 258 TranslateONCHierarchy(*onc_signature, onc_object, shill_dictionary.get());
259 return shill_dictionary.Pass(); 259 return shill_dictionary.Pass();
260 } 260 }
261 261
262 } // namespace onc 262 } // namespace onc
263 } // namespace chromeos 263 } // namespace chromeos
OLDNEW
« chromeos/dbus/shill_manager_client_stub.cc ('K') | « chromeos/dbus/shill_manager_client_stub.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698