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

Side by Side Diff: chromeos/network/network_connection_handler.cc

Issue 23532065: Add NetworkState::RequiresActivation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 7 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 | Annotate | Revision Log
OLDNEW
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 "chromeos/network/network_connection_handler.h" 5 #include "chromeos/network/network_connection_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "chromeos/chromeos_switches.h" 10 #include "chromeos/chromeos_switches.h"
(...skipping 29 matching lines...) Expand all
40 } 40 }
41 41
42 bool IsAuthenticationError(const std::string& error) { 42 bool IsAuthenticationError(const std::string& error) {
43 return (error == flimflam::kErrorBadWEPKey || 43 return (error == flimflam::kErrorBadWEPKey ||
44 error == flimflam::kErrorPppAuthFailed || 44 error == flimflam::kErrorPppAuthFailed ||
45 error == shill::kErrorEapLocalTlsFailed || 45 error == shill::kErrorEapLocalTlsFailed ||
46 error == shill::kErrorEapRemoteTlsFailed || 46 error == shill::kErrorEapRemoteTlsFailed ||
47 error == shill::kErrorEapAuthenticationFailed); 47 error == shill::kErrorEapAuthenticationFailed);
48 } 48 }
49 49
50 bool NetworkRequiresActivation(const NetworkState* network) {
51 return (network->type() == flimflam::kTypeCellular &&
52 ((network->activation_state() != flimflam::kActivationStateActivated &&
53 network->activation_state() != flimflam::kActivationStateUnknown)));
54 }
55
56 bool VPNIsConfigured(const std::string& service_path, 50 bool VPNIsConfigured(const std::string& service_path,
57 const std::string& provider_type, 51 const std::string& provider_type,
58 const base::DictionaryValue& provider_properties) { 52 const base::DictionaryValue& provider_properties) {
59 if (provider_type == flimflam::kProviderOpenVpn) { 53 if (provider_type == flimflam::kProviderOpenVpn) {
60 std::string hostname; 54 std::string hostname;
61 provider_properties.GetStringWithoutPathExpansion( 55 provider_properties.GetStringWithoutPathExpansion(
62 flimflam::kHostProperty, &hostname); 56 flimflam::kHostProperty, &hostname);
63 if (hostname.empty()) { 57 if (hostname.empty()) {
64 NET_LOG_EVENT("OpenVPN: No hostname", service_path); 58 NET_LOG_EVENT("OpenVPN: No hostname", service_path);
65 return false; 59 return false;
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 if (network) { 217 if (network) {
224 // For existing networks, perform some immediate consistency checks. 218 // For existing networks, perform some immediate consistency checks.
225 if (network->IsConnectedState()) { 219 if (network->IsConnectedState()) {
226 InvokeErrorCallback(service_path, error_callback, kErrorConnected); 220 InvokeErrorCallback(service_path, error_callback, kErrorConnected);
227 return; 221 return;
228 } 222 }
229 if (network->IsConnectingState()) { 223 if (network->IsConnectingState()) {
230 InvokeErrorCallback(service_path, error_callback, kErrorConnecting); 224 InvokeErrorCallback(service_path, error_callback, kErrorConnecting);
231 return; 225 return;
232 } 226 }
233 if (NetworkRequiresActivation(network)) { 227 if (network->RequiresActivation()) {
234 InvokeErrorCallback(service_path, error_callback, 228 InvokeErrorCallback(service_path, error_callback,
235 kErrorActivationRequired); 229 kErrorActivationRequired);
236 return; 230 return;
237 } 231 }
238 232
239 if (check_error_state) { 233 if (check_error_state) {
240 const std::string& error = network->error(); 234 const std::string& error = network->error();
241 if (error == flimflam::kErrorBadPassphrase) { 235 if (error == flimflam::kErrorBadPassphrase) {
242 InvokeErrorCallback(service_path, error_callback, error); 236 InvokeErrorCallback(service_path, error_callback, error);
243 return; 237 return;
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 637
644 void NetworkConnectionHandler::HandleShillDisconnectSuccess( 638 void NetworkConnectionHandler::HandleShillDisconnectSuccess(
645 const std::string& service_path, 639 const std::string& service_path,
646 const base::Closure& success_callback) { 640 const base::Closure& success_callback) {
647 NET_LOG_EVENT("Disconnect Request Sent", service_path); 641 NET_LOG_EVENT("Disconnect Request Sent", service_path);
648 if (!success_callback.is_null()) 642 if (!success_callback.is_null())
649 success_callback.Run(); 643 success_callback.Run();
650 } 644 }
651 645
652 } // namespace chromeos 646 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/system/ash_system_tray_delegate.cc ('k') | chromeos/network/network_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698