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

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

Issue 22611005: Switch over MobileActivator to use Network*Handler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add activation handler files Created 7 years, 4 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) 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
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 // NetworkStateHandlerObserver 108 // NetworkStateHandlerObserver
121 virtual void NetworkListChanged() OVERRIDE; 109 virtual void NetworkListChanged() OVERRIDE;
122 virtual void NetworkPropertiesUpdated(const NetworkState* network) OVERRIDE; 110 virtual void NetworkPropertiesUpdated(const NetworkState* network) OVERRIDE;
123 111
124 // LoginState::Observer 112 // LoginState::Observer
125 virtual void LoggedInStateChanged(LoginState::LoggedInState state) OVERRIDE; 113 virtual void LoggedInStateChanged(LoginState::LoggedInState state) OVERRIDE;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 // Calls Shill.Manager.Disconnect asynchronously. 165 // Calls Shill.Manager.Disconnect asynchronously.
178 void CallShillDisconnect( 166 void CallShillDisconnect(
179 const std::string& service_path, 167 const std::string& service_path,
180 const base::Closure& success_callback, 168 const base::Closure& success_callback,
181 const network_handler::ErrorCallback& error_callback); 169 const network_handler::ErrorCallback& error_callback);
182 170
183 // Handle success from Shill.Service.Disconnect. 171 // Handle success from Shill.Service.Disconnect.
184 void HandleShillDisconnectSuccess(const std::string& service_path, 172 void HandleShillDisconnectSuccess(const std::string& service_path,
185 const base::Closure& success_callback); 173 const base::Closure& success_callback);
186 174
187 // Calls Shill.Manager.Activate asynchronously.
188 void CallShillActivate(
189 const std::string& service_path,
190 const std::string& carrier,
191 const base::Closure& success_callback,
192 const network_handler::ErrorCallback& error_callback);
193
194 // Handle success from Shill.Service.ActivateCellularModem.
195 void HandleShillActivateSuccess(const std::string& service_path,
196 const base::Closure& success_callback);
197 175
198 // Local references to the associated handler instances. 176 // Local references to the associated handler instances.
199 CertLoader* cert_loader_; 177 CertLoader* cert_loader_;
200 NetworkStateHandler* network_state_handler_; 178 NetworkStateHandler* network_state_handler_;
201 NetworkConfigurationHandler* network_configuration_handler_; 179 NetworkConfigurationHandler* network_configuration_handler_;
202 180
203 // Map of pending connect requests, used to prevent repeated attempts while 181 // Map of pending connect requests, used to prevent repeated attempts while
204 // waiting for Shill and to trigger callbacks on eventual success or failure. 182 // waiting for Shill and to trigger callbacks on eventual success or failure.
205 std::map<std::string, ConnectRequest> pending_requests_; 183 std::map<std::string, ConnectRequest> pending_requests_;
206 scoped_ptr<ConnectRequest> queued_connect_; 184 scoped_ptr<ConnectRequest> queued_connect_;
207 185
208 // Track certificate loading state. 186 // Track certificate loading state.
209 bool logged_in_; 187 bool logged_in_;
210 bool certificates_loaded_; 188 bool certificates_loaded_;
211 189
212 DISALLOW_COPY_AND_ASSIGN(NetworkConnectionHandler); 190 DISALLOW_COPY_AND_ASSIGN(NetworkConnectionHandler);
213 }; 191 };
214 192
215 } // namespace chromeos 193 } // namespace chromeos
216 194
217 #endif // CHROMEOS_NETWORK_NETWORK_CONNECTION_HANDLER_H_ 195 #endif // CHROMEOS_NETWORK_NETWORK_CONNECTION_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698