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

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

Issue 21046008: Convert all connect code to use NetworkHandler instead of NetworkLibrary (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
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[]; 61 static const char kErrorMissingProvider[];
62 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.
72 // On failure, |error_callback| will be called with |error_name| one of: 71 // On failure, |error_callback| will be called with |error_name| one of:
(...skipping 19 matching lines...) Expand all
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 // TODO(stevenjb/armansito): Move this to a separate NetworkActivationHandler.
108 void ActivateNetwork(const std::string& service_path,
109 const std::string& carrier,
110 const base::Closure& success_callback,
111 const network_handler::ErrorCallback& error_callback);
112
102 // Returns true if ConnectToNetwork has been called with |service_path| and 113 // Returns true if ConnectToNetwork has been called with |service_path| and
103 // has not completed (i.e. success or error callback has been called). 114 // has not completed (i.e. success or error callback has been called).
104 bool HasConnectingNetwork(const std::string& service_path); 115 bool HasConnectingNetwork(const std::string& service_path);
105 116
106 // NetworkStateHandlerObserver 117 // NetworkStateHandlerObserver
107 virtual void NetworkListChanged() OVERRIDE; 118 virtual void NetworkListChanged() OVERRIDE;
108 virtual void NetworkPropertiesUpdated(const NetworkState* network) OVERRIDE; 119 virtual void NetworkPropertiesUpdated(const NetworkState* network) OVERRIDE;
109 120
110 // LoginState::Observer 121 // LoginState::Observer
111 virtual void LoggedInStateChanged(LoginState::LoggedInState state) OVERRIDE; 122 virtual void LoggedInStateChanged(LoginState::LoggedInState state) OVERRIDE;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 bool CertificateIsConfigured(NetworkUIData* ui_data, std::string* pkcs11_id); 167 bool CertificateIsConfigured(NetworkUIData* ui_data, std::string* pkcs11_id);
157 void ErrorCallbackForPendingRequest(const std::string& service_path, 168 void ErrorCallbackForPendingRequest(const std::string& service_path,
158 const std::string& error_name); 169 const std::string& error_name);
159 170
160 // Calls Shill.Manager.Disconnect asynchronously. 171 // Calls Shill.Manager.Disconnect asynchronously.
161 void CallShillDisconnect( 172 void CallShillDisconnect(
162 const std::string& service_path, 173 const std::string& service_path,
163 const base::Closure& success_callback, 174 const base::Closure& success_callback,
164 const network_handler::ErrorCallback& error_callback); 175 const network_handler::ErrorCallback& error_callback);
165 176
166 // Handle success or failure from Shill.Service.Disconnect. 177 // Handle success from Shill.Service.Disconnect.
167 void HandleShillDisconnectSuccess(const std::string& service_path, 178 void HandleShillDisconnectSuccess(const std::string& service_path,
168 const base::Closure& success_callback); 179 const base::Closure& success_callback);
169 180
181 // Calls Shill.Manager.Activate asynchronously.
182 void CallShillActivate(
183 const std::string& service_path,
184 const std::string& carrier,
185 const base::Closure& success_callback,
186 const network_handler::ErrorCallback& error_callback);
187
188 // Handle success from Shill.Service.ActivateCellularModem.
189 void HandleShillActivateSuccess(const std::string& service_path,
190 const base::Closure& success_callback);
191
170 // Local references to the associated handler instances. 192 // Local references to the associated handler instances.
171 CertLoader* cert_loader_; 193 CertLoader* cert_loader_;
172 NetworkStateHandler* network_state_handler_; 194 NetworkStateHandler* network_state_handler_;
173 NetworkConfigurationHandler* network_configuration_handler_; 195 NetworkConfigurationHandler* network_configuration_handler_;
174 196
175 // Map of pending connect requests, used to prevent repeated attempts while 197 // Map of pending connect requests, used to prevent repeated attempts while
176 // waiting for Shill and to trigger callbacks on eventual success or failure. 198 // waiting for Shill and to trigger callbacks on eventual success or failure.
177 std::map<std::string, ConnectRequest> pending_requests_; 199 std::map<std::string, ConnectRequest> pending_requests_;
178 scoped_ptr<ConnectRequest> queued_connect_; 200 scoped_ptr<ConnectRequest> queued_connect_;
179 201
180 // Track certificate loading state. 202 // Track certificate loading state.
181 bool logged_in_; 203 bool logged_in_;
182 bool certificates_loaded_; 204 bool certificates_loaded_;
183 205
184 DISALLOW_COPY_AND_ASSIGN(NetworkConnectionHandler); 206 DISALLOW_COPY_AND_ASSIGN(NetworkConnectionHandler);
185 }; 207 };
186 208
187 } // namespace chromeos 209 } // namespace chromeos
188 210
189 #endif // CHROMEOS_NETWORK_NETWORK_CONNECTION_HANDLER_H_ 211 #endif // CHROMEOS_NETWORK_NETWORK_CONNECTION_HANDLER_H_
OLDNEW
« no previous file with comments | « chromeos/network/network_configuration_handler.cc ('k') | chromeos/network/network_connection_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698