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

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

Issue 267433005: Provide IPConfigs in networkingPrivate.GetProperties (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 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 | 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 #include "chromeos/network/onc/onc_translator.h" 5 #include "chromeos/network/onc/onc_translator.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 TranslateAndAddListOfObjects(::onc::network_config::kIPConfigs, 312 TranslateAndAddListOfObjects(::onc::network_config::kIPConfigs,
313 *shill_ipconfigs); 313 *shill_ipconfigs);
314 } 314 }
315 } 315 }
316 316
317 void ShillToONCTranslator::TranslateIPConfig() { 317 void ShillToONCTranslator::TranslateIPConfig() {
318 CopyPropertiesAccordingToSignature(); 318 CopyPropertiesAccordingToSignature();
319 std::string shill_ip_method; 319 std::string shill_ip_method;
320 shill_dictionary_->GetStringWithoutPathExpansion(shill::kMethodProperty, 320 shill_dictionary_->GetStringWithoutPathExpansion(shill::kMethodProperty,
321 &shill_ip_method); 321 &shill_ip_method);
322 if (shill_ip_method != shill::kTypeIPv4 && 322 std::string type;
323 shill_ip_method != shill::kTypeIPv6) { 323 if (shill_ip_method == shill::kTypeIPv4 ||
324 LOG(ERROR) << "Unhandled IPConfig Method value " << shill_ip_method; 324 shill_ip_method == shill::kTypeDHCP) {
325 return; 325 type = ::onc::ipconfig::kIPv4;
326 } else if (shill_ip_method == shill::kTypeIPv6 ||
327 shill_ip_method == shill::kTypeDHCP6) {
328 type = ::onc::ipconfig::kIPv6;
329 } else {
330 return; // Ignore unhandled IPConfig types, e.g. bootp, zeroconf, ppp
326 } 331 }
327 332
328 std::string type = ::onc::ipconfig::kIPv4;
329 if (shill_ip_method == shill::kTypeIPv6)
330 type = ::onc::ipconfig::kIPv6;
331 onc_object_->SetStringWithoutPathExpansion(::onc::ipconfig::kType, type); 333 onc_object_->SetStringWithoutPathExpansion(::onc::ipconfig::kType, type);
332 } 334 }
333 335
334 void ShillToONCTranslator::TranslateAndAddNestedObject( 336 void ShillToONCTranslator::TranslateAndAddNestedObject(
335 const std::string& onc_field_name) { 337 const std::string& onc_field_name) {
336 TranslateAndAddNestedObject(onc_field_name, *shill_dictionary_); 338 TranslateAndAddNestedObject(onc_field_name, *shill_dictionary_);
337 } 339 }
338 340
339 void ShillToONCTranslator::TranslateAndAddNestedObject( 341 void ShillToONCTranslator::TranslateAndAddNestedObject(
340 const std::string& onc_field_name, 342 const std::string& onc_field_name,
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 const base::DictionaryValue& shill_dictionary, 453 const base::DictionaryValue& shill_dictionary,
452 const OncValueSignature* onc_signature) { 454 const OncValueSignature* onc_signature) {
453 CHECK(onc_signature != NULL); 455 CHECK(onc_signature != NULL);
454 456
455 ShillToONCTranslator translator(shill_dictionary, *onc_signature); 457 ShillToONCTranslator translator(shill_dictionary, *onc_signature);
456 return translator.CreateTranslatedONCObject(); 458 return translator.CreateTranslatedONCObject();
457 } 459 }
458 460
459 } // namespace onc 461 } // namespace onc
460 } // namespace chromeos 462 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/onc/onc_translation_tables.cc ('k') | chromeos/network/shill_property_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698