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

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

Issue 873713004: Introduce NetworkState::is_captive_portal() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback, unit test Created 5 years, 10 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
« no previous file with comments | « chromeos/network/network_state_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 if (shill_dictionary_->GetStringWithoutPathExpansion(shill::kStateProperty, 427 if (shill_dictionary_->GetStringWithoutPathExpansion(shill::kStateProperty,
428 &state)) { 428 &state)) {
429 std::string onc_state = ::onc::connection_state::kNotConnected; 429 std::string onc_state = ::onc::connection_state::kNotConnected;
430 if (NetworkState::StateIsConnected(state)) { 430 if (NetworkState::StateIsConnected(state)) {
431 onc_state = ::onc::connection_state::kConnected; 431 onc_state = ::onc::connection_state::kConnected;
432 } else if (NetworkState::StateIsConnecting(state)) { 432 } else if (NetworkState::StateIsConnecting(state)) {
433 onc_state = ::onc::connection_state::kConnecting; 433 onc_state = ::onc::connection_state::kConnecting;
434 } 434 }
435 onc_object_->SetStringWithoutPathExpansion( 435 onc_object_->SetStringWithoutPathExpansion(
436 ::onc::network_config::kConnectionState, onc_state); 436 ::onc::network_config::kConnectionState, onc_state);
437 // Only set 'RestrictedConnectivity' if true. 437 // Only set 'RestrictedConnectivity' if captive portal state is true.
438 if (state == shill::kStatePortal) { 438 if (NetworkState::NetworkStateIsCaptivePortal(*shill_dictionary_)) {
439 onc_object_->SetBooleanWithoutPathExpansion( 439 onc_object_->SetBooleanWithoutPathExpansion(
440 ::onc::network_config::kRestrictedConnectivity, true); 440 ::onc::network_config::kRestrictedConnectivity, true);
441 } 441 }
442 } 442 }
443 443
444 std::string profile_path; 444 std::string profile_path;
445 if (onc_source_ != ::onc::ONC_SOURCE_UNKNOWN && 445 if (onc_source_ != ::onc::ONC_SOURCE_UNKNOWN &&
446 shill_dictionary_->GetStringWithoutPathExpansion(shill::kProfileProperty, 446 shill_dictionary_->GetStringWithoutPathExpansion(shill::kProfileProperty,
447 &profile_path)) { 447 &profile_path)) {
448 std::string source; 448 std::string source;
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 ::onc::ONCSource onc_source, 700 ::onc::ONCSource onc_source,
701 const OncValueSignature* onc_signature) { 701 const OncValueSignature* onc_signature) {
702 CHECK(onc_signature != NULL); 702 CHECK(onc_signature != NULL);
703 703
704 ShillToONCTranslator translator(shill_dictionary, onc_source, *onc_signature); 704 ShillToONCTranslator translator(shill_dictionary, onc_source, *onc_signature);
705 return translator.CreateTranslatedONCObject(); 705 return translator.CreateTranslatedONCObject();
706 } 706 }
707 707
708 } // namespace onc 708 } // namespace onc
709 } // namespace chromeos 709 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/network_state_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698