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

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: Fixed another unit test. 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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 if (Tokenize(shill_nameservers, ",", &onc_nameserver_vector) > 0) { 470 if (Tokenize(shill_nameservers, ",", &onc_nameserver_vector) > 0) {
471 scoped_ptr<base::ListValue> onc_nameservers(new base::ListValue); 471 scoped_ptr<base::ListValue> onc_nameservers(new base::ListValue);
472 for (std::vector<std::string>::iterator iter = 472 for (std::vector<std::string>::iterator iter =
473 onc_nameserver_vector.begin(); 473 onc_nameserver_vector.begin();
474 iter != onc_nameserver_vector.end(); ++iter) { 474 iter != onc_nameserver_vector.end(); ++iter) {
475 onc_nameservers->AppendString(*iter); 475 onc_nameservers->AppendString(*iter);
476 } 476 }
477 onc_object_->SetWithoutPathExpansion(::onc::ipconfig::kNameServers, 477 onc_object_->SetWithoutPathExpansion(::onc::ipconfig::kNameServers,
478 onc_nameservers.release()); 478 onc_nameservers.release());
479 } 479 }
480 // Static and Saved IPConfig in Shill are always of type IPv4. Set this type
481 // in ONC, but not if the object would be empty except the type.
482 if (!onc_object_->empty()) {
483 onc_object_->SetStringWithoutPathExpansion(::onc::ipconfig::kType,
484 ::onc::ipconfig::kIPv4);
485 }
480 } 486 }
481 487
482 void ShillToONCTranslator::TranslateSavedIPConfig() { 488 void ShillToONCTranslator::TranslateSavedIPConfig() {
483 TranslateSavedOrStaticIPConfig(shill::kSavedIPNameServersProperty); 489 TranslateSavedOrStaticIPConfig(shill::kSavedIPNameServersProperty);
484 } 490 }
485 491
486 void ShillToONCTranslator::TranslateStaticIPConfig() { 492 void ShillToONCTranslator::TranslateStaticIPConfig() {
487 TranslateSavedOrStaticIPConfig(shill::kStaticIPNameServersProperty); 493 TranslateSavedOrStaticIPConfig(shill::kStaticIPNameServersProperty);
488 } 494 }
489 495
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 const base::DictionaryValue& shill_dictionary, 638 const base::DictionaryValue& shill_dictionary,
633 const OncValueSignature* onc_signature) { 639 const OncValueSignature* onc_signature) {
634 CHECK(onc_signature != NULL); 640 CHECK(onc_signature != NULL);
635 641
636 ShillToONCTranslator translator(shill_dictionary, *onc_signature); 642 ShillToONCTranslator translator(shill_dictionary, *onc_signature);
637 return translator.CreateTranslatedONCObject(); 643 return translator.CreateTranslatedONCObject();
638 } 644 }
639 645
640 } // namespace onc 646 } // namespace onc
641 } // namespace chromeos 647 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/onc/onc_translator_onc_to_shill.cc ('k') | chromeos/network/onc/onc_validator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698