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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 // On success, |success_callback| will be called. | 94 // On success, |success_callback| will be called. |
95 // On failure, |error_callback| will be called with |error_name| one of: | 95 // On failure, |error_callback| will be called with |error_name| one of: |
96 // kErrorNotFound if no network matching |service_path| is found. | 96 // kErrorNotFound if no network matching |service_path| is found. |
97 // kErrorNotConnected if not connected to the network. | 97 // kErrorNotConnected if not connected to the network. |
98 // kErrorShillError if a DBus or Shill error occurred. | 98 // kErrorShillError if a DBus or Shill error occurred. |
99 // |error_message| will contain and additional error string for debugging. | 99 // |error_message| will contain and additional error string for debugging. |
100 void DisconnectNetwork(const std::string& service_path, | 100 void DisconnectNetwork(const std::string& service_path, |
101 const base::Closure& success_callback, | 101 const base::Closure& success_callback, |
102 const network_handler::ErrorCallback& error_callback); | 102 const network_handler::ErrorCallback& error_callback); |
103 | 103 |
104 // ActivateNetwork() will start an asynchronous activation attempt. | |
105 // |carrier| may be empty or may specify a carrier to activate. | |
106 // On success, |success_callback| will be called. | |
107 // On failure, |error_callback| will be called with |error_name| one of: | |
108 // kErrorNotFound if no network matching |service_path| is found. | |
109 // kErrorShillError if a DBus or Shill error occurred. | |
110 // TODO(stevenjb/armansito): Move this to a separate NetworkActivationHandler. | |
111 void ActivateNetwork(const std::string& service_path, | |
112 const std::string& carrier, | |
113 const base::Closure& success_callback, | |
114 const network_handler::ErrorCallback& error_callback); | |
115 | |
116 // Returns true if ConnectToNetwork has been called with |service_path| and | 104 // Returns true if ConnectToNetwork has been called with |service_path| and |
117 // has not completed (i.e. success or error callback has been called). | 105 // has not completed (i.e. success or error callback has been called). |
118 bool HasConnectingNetwork(const std::string& service_path); | 106 bool HasConnectingNetwork(const std::string& service_path); |
119 | 107 |
120 // Returns true if there are any pending connect requests. | 108 // Returns true if there are any pending connect requests. |
121 bool HasPendingConnectRequest(); | 109 bool HasPendingConnectRequest(); |
122 | 110 |
123 // NetworkStateHandlerObserver | 111 // NetworkStateHandlerObserver |
124 virtual void NetworkListChanged() OVERRIDE; | 112 virtual void NetworkListChanged() OVERRIDE; |
125 virtual void NetworkPropertiesUpdated(const NetworkState* network) OVERRIDE; | 113 virtual void NetworkPropertiesUpdated(const NetworkState* network) OVERRIDE; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 // Calls Shill.Manager.Disconnect asynchronously. | 168 // Calls Shill.Manager.Disconnect asynchronously. |
181 void CallShillDisconnect( | 169 void CallShillDisconnect( |
182 const std::string& service_path, | 170 const std::string& service_path, |
183 const base::Closure& success_callback, | 171 const base::Closure& success_callback, |
184 const network_handler::ErrorCallback& error_callback); | 172 const network_handler::ErrorCallback& error_callback); |
185 | 173 |
186 // Handle success from Shill.Service.Disconnect. | 174 // Handle success from Shill.Service.Disconnect. |
187 void HandleShillDisconnectSuccess(const std::string& service_path, | 175 void HandleShillDisconnectSuccess(const std::string& service_path, |
188 const base::Closure& success_callback); | 176 const base::Closure& success_callback); |
189 | 177 |
190 // Calls Shill.Manager.Activate asynchronously. | |
191 void CallShillActivate( | |
192 const std::string& service_path, | |
193 const std::string& carrier, | |
194 const base::Closure& success_callback, | |
195 const network_handler::ErrorCallback& error_callback); | |
196 | |
197 // Handle success from Shill.Service.ActivateCellularModem. | |
198 void HandleShillActivateSuccess(const std::string& service_path, | |
199 const base::Closure& success_callback); | |
200 | 178 |
201 // Local references to the associated handler instances. | 179 // Local references to the associated handler instances. |
202 CertLoader* cert_loader_; | 180 CertLoader* cert_loader_; |
203 NetworkStateHandler* network_state_handler_; | 181 NetworkStateHandler* network_state_handler_; |
204 NetworkConfigurationHandler* network_configuration_handler_; | 182 NetworkConfigurationHandler* network_configuration_handler_; |
205 | 183 |
206 // Map of pending connect requests, used to prevent repeated attempts while | 184 // Map of pending connect requests, used to prevent repeated attempts while |
207 // waiting for Shill and to trigger callbacks on eventual success or failure. | 185 // waiting for Shill and to trigger callbacks on eventual success or failure. |
208 std::map<std::string, ConnectRequest> pending_requests_; | 186 std::map<std::string, ConnectRequest> pending_requests_; |
209 scoped_ptr<ConnectRequest> queued_connect_; | 187 scoped_ptr<ConnectRequest> queued_connect_; |
210 | 188 |
211 // Track certificate loading state. | 189 // Track certificate loading state. |
212 bool logged_in_; | 190 bool logged_in_; |
213 bool certificates_loaded_; | 191 bool certificates_loaded_; |
214 | 192 |
215 DISALLOW_COPY_AND_ASSIGN(NetworkConnectionHandler); | 193 DISALLOW_COPY_AND_ASSIGN(NetworkConnectionHandler); |
216 }; | 194 }; |
217 | 195 |
218 } // namespace chromeos | 196 } // namespace chromeos |
219 | 197 |
220 #endif // CHROMEOS_NETWORK_NETWORK_CONNECTION_HANDLER_H_ | 198 #endif // CHROMEOS_NETWORK_NETWORK_CONNECTION_HANDLER_H_ |
OLD | NEW |