Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #ifndef CHROMEOS_NETWORK_NETWORK_CONNECTION_HANDLER_H_ | 5 #ifndef CHROMEOS_NETWORK_NETWORK_CONNECTION_HANDLER_H_ |
| 6 #define CHROMEOS_NETWORK_NETWORK_CONNECTION_HANDLER_H_ | 6 #define CHROMEOS_NETWORK_NETWORK_CONNECTION_HANDLER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 51 static const char kErrorNotFound[]; | 51 static const char kErrorNotFound[]; |
| 52 static const char kErrorConnected[]; | 52 static const char kErrorConnected[]; |
| 53 static const char kErrorConnecting[]; | 53 static const char kErrorConnecting[]; |
| 54 static const char kErrorPassphraseRequired[]; | 54 static const char kErrorPassphraseRequired[]; |
| 55 static const char kErrorActivationRequired[]; | 55 static const char kErrorActivationRequired[]; |
| 56 static const char kErrorCertificateRequired[]; | 56 static const char kErrorCertificateRequired[]; |
| 57 static const char kErrorAuthenticationRequired[]; | 57 static const char kErrorAuthenticationRequired[]; |
| 58 static const char kErrorConfigurationRequired[]; | 58 static const char kErrorConfigurationRequired[]; |
| 59 static const char kErrorShillError[]; | 59 static const char kErrorShillError[]; |
| 60 static const char kErrorConnectFailed[]; | 60 static const char kErrorConnectFailed[]; |
| 61 static const char kErrorDisconnectFailed[]; | |
| 62 static const char kErrorMissingProviderType[]; | 61 static const char kErrorMissingProviderType[]; |
| 63 static const char kErrorUnknown[]; | 62 static const char kErrorUnknown[]; |
| 64 | 63 |
| 65 // Constants for |error_name| from |error_callback| for Disconnect. | 64 // Constants for |error_name| from |error_callback| for Disconnect. |
| 66 static const char kErrorNotConnected[]; | 65 static const char kErrorNotConnected[]; |
| 67 | 66 |
| 68 virtual ~NetworkConnectionHandler(); | 67 virtual ~NetworkConnectionHandler(); |
| 69 | 68 |
| 70 // ConnectToNetwork() will start an asynchronous connection attempt. | 69 // ConnectToNetwork() will start an asynchronous connection attempt. |
| 71 // On success, |success_callback| will be called. | 70 // On success, |success_callback| will be called. |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 92 // On success, |success_callback| will be called. | 91 // On success, |success_callback| will be called. |
| 93 // On failure, |error_callback| will be called with |error_name| one of: | 92 // On failure, |error_callback| will be called with |error_name| one of: |
| 94 // kErrorNotFound if no network matching |service_path| is found. | 93 // kErrorNotFound if no network matching |service_path| is found. |
| 95 // kErrorNotConnected if not connected to the network. | 94 // kErrorNotConnected if not connected to the network. |
| 96 // kErrorShillError if a DBus or Shill error occurred. | 95 // kErrorShillError if a DBus or Shill error occurred. |
| 97 // |error_message| will contain and additional error string for debugging. | 96 // |error_message| will contain and additional error string for debugging. |
| 98 void DisconnectNetwork(const std::string& service_path, | 97 void DisconnectNetwork(const std::string& service_path, |
| 99 const base::Closure& success_callback, | 98 const base::Closure& success_callback, |
| 100 const network_handler::ErrorCallback& error_callback); | 99 const network_handler::ErrorCallback& error_callback); |
| 101 | 100 |
| 101 // ActivateNetwork() will start an asynchronous activation attempt. | |
| 102 // |carrier| may be empty or may specify a carrier to activate. | |
| 103 // On success, |success_callback| will be called. | |
| 104 // On failure, |error_callback| will be called with |error_name| one of: | |
| 105 // kErrorNotFound if no network matching |service_path| is found. | |
| 106 // kErrorShillError if a DBus or Shill error occurred. | |
| 107 void ActivateNetwork(const std::string& service_path, | |
| 108 const std::string& carrier, | |
| 109 const base::Closure& success_callback, | |
| 110 const network_handler::ErrorCallback& error_callback); | |
| 111 | |
| 102 // Returns true if ConnectToNetwork has been called with |service_path| and | 112 // Returns true if ConnectToNetwork has been called with |service_path| and |
| 103 // has not completed (i.e. success or error callback has been called). | 113 // has not completed (i.e. success or error callback has been called). |
| 104 bool HasConnectingNetwork(const std::string& service_path); | 114 bool HasConnectingNetwork(const std::string& service_path); |
| 105 | 115 |
| 106 // NetworkStateHandlerObserver | 116 // NetworkStateHandlerObserver |
| 107 virtual void NetworkListChanged() OVERRIDE; | 117 virtual void NetworkListChanged() OVERRIDE; |
| 108 virtual void NetworkPropertiesUpdated(const NetworkState* network) OVERRIDE; | 118 virtual void NetworkPropertiesUpdated(const NetworkState* network) OVERRIDE; |
| 109 | 119 |
| 110 // LoginState::Observer | 120 // LoginState::Observer |
| 111 virtual void LoggedInStateChanged(LoginState::LoggedInState state) OVERRIDE; | 121 virtual void LoggedInStateChanged(LoginState::LoggedInState state) OVERRIDE; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 // Calls Shill.Manager.Disconnect asynchronously. | 170 // Calls Shill.Manager.Disconnect asynchronously. |
| 161 void CallShillDisconnect( | 171 void CallShillDisconnect( |
| 162 const std::string& service_path, | 172 const std::string& service_path, |
| 163 const base::Closure& success_callback, | 173 const base::Closure& success_callback, |
| 164 const network_handler::ErrorCallback& error_callback); | 174 const network_handler::ErrorCallback& error_callback); |
| 165 | 175 |
| 166 // Handle success or failure from Shill.Service.Disconnect. | 176 // Handle success or failure from Shill.Service.Disconnect. |
| 167 void HandleShillDisconnectSuccess(const std::string& service_path, | 177 void HandleShillDisconnectSuccess(const std::string& service_path, |
| 168 const base::Closure& success_callback); | 178 const base::Closure& success_callback); |
| 169 | 179 |
| 180 // Calls Shill.Manager.Activate asynchronously. | |
| 181 void CallShillActivate( | |
| 182 const std::string& service_path, | |
| 183 const std::string& carrier, | |
| 184 const base::Closure& success_callback, | |
| 185 const network_handler::ErrorCallback& error_callback); | |
| 186 | |
| 187 // Handle success or failure from Shill.Service.ActivateCellularModem. | |
|
gauravsh
2013/08/02 23:40:22
NIT: s/or failure//
stevenjb
2013/08/06 00:32:48
Done.
| |
| 188 void HandleShillActivateSuccess(const std::string& service_path, | |
| 189 const base::Closure& success_callback); | |
| 190 | |
| 170 // Local references to the associated handler instances. | 191 // Local references to the associated handler instances. |
| 171 CertLoader* cert_loader_; | 192 CertLoader* cert_loader_; |
| 172 NetworkStateHandler* network_state_handler_; | 193 NetworkStateHandler* network_state_handler_; |
| 173 NetworkConfigurationHandler* network_configuration_handler_; | 194 NetworkConfigurationHandler* network_configuration_handler_; |
| 174 | 195 |
| 175 // Map of pending connect requests, used to prevent repeated attempts while | 196 // Map of pending connect requests, used to prevent repeated attempts while |
| 176 // waiting for Shill and to trigger callbacks on eventual success or failure. | 197 // waiting for Shill and to trigger callbacks on eventual success or failure. |
| 177 std::map<std::string, ConnectRequest> pending_requests_; | 198 std::map<std::string, ConnectRequest> pending_requests_; |
| 178 scoped_ptr<ConnectRequest> queued_connect_; | 199 scoped_ptr<ConnectRequest> queued_connect_; |
| 179 | 200 |
| 180 // Track certificate loading state. | 201 // Track certificate loading state. |
| 181 bool logged_in_; | 202 bool logged_in_; |
| 182 bool certificates_loaded_; | 203 bool certificates_loaded_; |
| 183 | 204 |
| 184 DISALLOW_COPY_AND_ASSIGN(NetworkConnectionHandler); | 205 DISALLOW_COPY_AND_ASSIGN(NetworkConnectionHandler); |
| 185 }; | 206 }; |
| 186 | 207 |
| 187 } // namespace chromeos | 208 } // namespace chromeos |
| 188 | 209 |
| 189 #endif // CHROMEOS_NETWORK_NETWORK_CONNECTION_HANDLER_H_ | 210 #endif // CHROMEOS_NETWORK_NETWORK_CONNECTION_HANDLER_H_ |
| OLD | NEW |