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

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)
pneubeck (no reviews) 2014/05/02 09:57:43 Ok, I think we have a mismatch of the properties'
stevenjb 2014/05/02 17:22:34 Hm, I see, OK. We have to support multiple "IPv6"
324 LOG(ERROR) << "Unhandled IPConfig Method value " << shill_ip_method; 324 type == ::onc::ipconfig::kIPv4;
325 return; 325 else if (shill_ip_method == shill::kTypeIPv6)
326 } 326 type = ::onc::ipconfig::kIPv6;
327 else if (shill_ip_method == shill::kTypeDHCP)
328 type = ::onc::ipconfig::kDHCPv4;
329 else if (shill_ip_method == shill::kTypeDHCP6)
330 type = ::onc::ipconfig::kDHCPv6;
331 else
332 return; // Ignore unhandled IPConfig types, e.g. bootp, zeroconf, ppp
327 333
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); 334 onc_object_->SetStringWithoutPathExpansion(::onc::ipconfig::kType, type);
332 } 335 }
333 336
334 void ShillToONCTranslator::TranslateAndAddNestedObject( 337 void ShillToONCTranslator::TranslateAndAddNestedObject(
335 const std::string& onc_field_name) { 338 const std::string& onc_field_name) {
336 TranslateAndAddNestedObject(onc_field_name, *shill_dictionary_); 339 TranslateAndAddNestedObject(onc_field_name, *shill_dictionary_);
337 } 340 }
338 341
339 void ShillToONCTranslator::TranslateAndAddNestedObject( 342 void ShillToONCTranslator::TranslateAndAddNestedObject(
340 const std::string& onc_field_name, 343 const std::string& onc_field_name,
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 const base::DictionaryValue& shill_dictionary, 454 const base::DictionaryValue& shill_dictionary,
452 const OncValueSignature* onc_signature) { 455 const OncValueSignature* onc_signature) {
453 CHECK(onc_signature != NULL); 456 CHECK(onc_signature != NULL);
454 457
455 ShillToONCTranslator translator(shill_dictionary, *onc_signature); 458 ShillToONCTranslator translator(shill_dictionary, *onc_signature);
456 return translator.CreateTranslatedONCObject(); 459 return translator.CreateTranslatedONCObject();
457 } 460 }
458 461
459 } // namespace onc 462 } // namespace onc
460 } // namespace chromeos 463 } // 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