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

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

Issue 540333002: ONC: Fix Static-/Saved-/IPConfig. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 6 years, 3 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
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 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 if (Tokenize(shill_nameservers, ",", &onc_nameserver_vector) > 0) { 459 if (Tokenize(shill_nameservers, ",", &onc_nameserver_vector) > 0) {
460 scoped_ptr<base::ListValue> onc_nameservers(new base::ListValue); 460 scoped_ptr<base::ListValue> onc_nameservers(new base::ListValue);
461 for (std::vector<std::string>::iterator iter = 461 for (std::vector<std::string>::iterator iter =
462 onc_nameserver_vector.begin(); 462 onc_nameserver_vector.begin();
463 iter != onc_nameserver_vector.end(); ++iter) { 463 iter != onc_nameserver_vector.end(); ++iter) {
464 onc_nameservers->AppendString(*iter); 464 onc_nameservers->AppendString(*iter);
465 } 465 }
466 onc_object_->SetWithoutPathExpansion(::onc::ipconfig::kNameServers, 466 onc_object_->SetWithoutPathExpansion(::onc::ipconfig::kNameServers,
467 onc_nameservers.release()); 467 onc_nameservers.release());
468 } 468 }
469 // Static and Saved IPConfig in Shill are always of type IPv4. Set this type
470 // in ONC, but not if the object would be empty except the type.
471 if (!onc_object_->empty()) {
472 onc_object_->SetStringWithoutPathExpansion(::onc::ipconfig::kType,
473 ::onc::ipconfig::kIPv4);
474 }
469 } 475 }
470 476
471 void ShillToONCTranslator::TranslateSavedIPConfig() { 477 void ShillToONCTranslator::TranslateSavedIPConfig() {
472 TranslateSavedOrStaticIPConfig(shill::kSavedIPNameServersProperty); 478 TranslateSavedOrStaticIPConfig(shill::kSavedIPNameServersProperty);
473 } 479 }
474 480
475 void ShillToONCTranslator::TranslateStaticIPConfig() { 481 void ShillToONCTranslator::TranslateStaticIPConfig() {
476 TranslateSavedOrStaticIPConfig(shill::kStaticIPNameServersProperty); 482 TranslateSavedOrStaticIPConfig(shill::kStaticIPNameServersProperty);
477 } 483 }
478 484
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 const base::DictionaryValue& shill_dictionary, 627 const base::DictionaryValue& shill_dictionary,
622 const OncValueSignature* onc_signature) { 628 const OncValueSignature* onc_signature) {
623 CHECK(onc_signature != NULL); 629 CHECK(onc_signature != NULL);
624 630
625 ShillToONCTranslator translator(shill_dictionary, *onc_signature); 631 ShillToONCTranslator translator(shill_dictionary, *onc_signature);
626 return translator.CreateTranslatedONCObject(); 632 return translator.CreateTranslatedONCObject();
627 } 633 }
628 634
629 } // namespace onc 635 } // namespace onc
630 } // namespace chromeos 636 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698