OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ui/chromeos/network/network_connect.h" | 5 #include "ui/chromeos/network/network_connect.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 void NetworkConnectImpl::HandleUnconfiguredNetwork( | 129 void NetworkConnectImpl::HandleUnconfiguredNetwork( |
130 const std::string& service_path) { | 130 const std::string& service_path) { |
131 const NetworkState* network = GetNetworkState(service_path); | 131 const NetworkState* network = GetNetworkState(service_path); |
132 if (!network) { | 132 if (!network) { |
133 NET_LOG_ERROR("Configuring unknown network", service_path); | 133 NET_LOG_ERROR("Configuring unknown network", service_path); |
134 return; | 134 return; |
135 } | 135 } |
136 | 136 |
137 if (network->type() == shill::kTypeWifi) { | 137 if (network->type() == shill::kTypeWifi) { |
138 // Only show the config view for secure networks, otherwise do nothing. | 138 // Only show the config view for secure networks, otherwise do nothing. |
139 if (network->security() != shill::kSecurityNone) { | 139 if (network->security_class() != shill::kSecurityNone) { |
140 delegate_->ShowNetworkConfigure(service_path); | 140 delegate_->ShowNetworkConfigure(service_path); |
141 } | 141 } |
142 return; | 142 return; |
143 } | 143 } |
144 | 144 |
145 if (network->type() == shill::kTypeWimax || | 145 if (network->type() == shill::kTypeWimax || |
146 network->type() == shill::kTypeVPN) { | 146 network->type() == shill::kTypeVPN) { |
147 delegate_->ShowNetworkConfigure(service_path); | 147 delegate_->ShowNetworkConfigure(service_path); |
148 return; | 148 return; |
149 } | 149 } |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 base::Bind(&NetworkConnectImpl::SetPropertiesFailed, | 370 base::Bind(&NetworkConnectImpl::SetPropertiesFailed, |
371 weak_factory_.GetWeakPtr(), "SetProperties", service_path)); | 371 weak_factory_.GetWeakPtr(), "SetProperties", service_path)); |
372 } | 372 } |
373 | 373 |
374 // Public methods | 374 // Public methods |
375 | 375 |
376 void NetworkConnectImpl::ConnectToNetwork(const std::string& service_path) { | 376 void NetworkConnectImpl::ConnectToNetwork(const std::string& service_path) { |
377 NET_LOG_USER("ConnectToNetwork", service_path); | 377 NET_LOG_USER("ConnectToNetwork", service_path); |
378 const NetworkState* network = GetNetworkState(service_path); | 378 const NetworkState* network = GetNetworkState(service_path); |
379 if (network) { | 379 if (network) { |
380 if (!network->error().empty() && !network->security().empty()) { | 380 if (!network->error().empty() && !network->security_class().empty()) { |
381 NET_LOG_USER("Configure: " + network->error(), service_path); | 381 NET_LOG_USER("Configure: " + network->error(), service_path); |
382 // If the network is in an error state, show the configuration UI | 382 // If the network is in an error state, show the configuration UI |
383 // directly to avoid a spurious notification. | 383 // directly to avoid a spurious notification. |
384 HandleUnconfiguredNetwork(service_path); | 384 HandleUnconfiguredNetwork(service_path); |
385 return; | 385 return; |
386 } else if (network->RequiresActivation()) { | 386 } else if (network->RequiresActivation()) { |
387 ActivateCellular(service_path); | 387 ActivateCellular(service_path); |
388 return; | 388 return; |
389 } | 389 } |
390 } | 390 } |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 return g_network_connect; | 642 return g_network_connect; |
643 } | 643 } |
644 | 644 |
645 NetworkConnect::NetworkConnect() { | 645 NetworkConnect::NetworkConnect() { |
646 } | 646 } |
647 | 647 |
648 NetworkConnect::~NetworkConnect() { | 648 NetworkConnect::~NetworkConnect() { |
649 } | 649 } |
650 | 650 |
651 } // namespace ui | 651 } // namespace ui |
OLD | NEW |