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 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "base/values.h" | 15 #include "base/values.h" |
16 #include "chromeos/cert_loader.h" | 16 #include "chromeos/cert_loader.h" |
17 #include "chromeos/chromeos_export.h" | 17 #include "chromeos/chromeos_export.h" |
18 #include "chromeos/dbus/dbus_method_call_status.h" | 18 #include "chromeos/dbus/dbus_method_call_status.h" |
19 #include "chromeos/login/login_state.h" | 19 #include "chromeos/login/login_state.h" |
20 #include "chromeos/network/network_handler.h" | 20 #include "chromeos/network/network_handler.h" |
21 #include "chromeos/network/network_handler_callbacks.h" | 21 #include "chromeos/network/network_handler_callbacks.h" |
22 #include "chromeos/network/network_policy_observer.h" | 22 #include "chromeos/network/network_policy_observer.h" |
23 #include "chromeos/network/network_state_handler_observer.h" | 23 #include "chromeos/network/network_state_handler_observer.h" |
24 | 24 |
25 namespace chromeos { | 25 namespace chromeos { |
26 | 26 |
| 27 class CertificatePattern; |
27 class NetworkState; | 28 class NetworkState; |
28 class NetworkUIData; | |
29 | 29 |
30 // The NetworkConnectionHandler class is used to manage network connection | 30 // The NetworkConnectionHandler class is used to manage network connection |
31 // requests. This is the only class that should make Shill Connect calls. | 31 // requests. This is the only class that should make Shill Connect calls. |
32 // It handles the following steps: | 32 // It handles the following steps: |
33 // 1. Determine whether or not sufficient information (e.g. passphrase) is | 33 // 1. Determine whether or not sufficient information (e.g. passphrase) is |
34 // known to be available to connect to the network. | 34 // known to be available to connect to the network. |
35 // 2. Request additional information (e.g. user data which contains certificate | 35 // 2. Request additional information (e.g. user data which contains certificate |
36 // information) and determine whether sufficient information is available. | 36 // information) and determine whether sufficient information is available. |
37 // 3. Possibly configure the network certificate info (tpm slot and pkcs11 id). | 37 // 3. Possibly configure the network certificate info (tpm slot and pkcs11 id). |
38 // 4. Send the connect request. | 38 // 4. Send the connect request. |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 187 |
188 // Handles success or failure from Shill.Service.Connect. | 188 // Handles success or failure from Shill.Service.Connect. |
189 void HandleShillConnectSuccess(const std::string& service_path); | 189 void HandleShillConnectSuccess(const std::string& service_path); |
190 void HandleShillConnectFailure(const std::string& service_path, | 190 void HandleShillConnectFailure(const std::string& service_path, |
191 const std::string& error_name, | 191 const std::string& error_name, |
192 const std::string& error_message); | 192 const std::string& error_message); |
193 | 193 |
194 void CheckPendingRequest(const std::string service_path); | 194 void CheckPendingRequest(const std::string service_path); |
195 void CheckAllPendingRequests(); | 195 void CheckAllPendingRequests(); |
196 | 196 |
197 // Returns the PKCS#11 ID of a cert matching the certificate pattern in | 197 // Returns the PKCS#11 ID of a cert matching the certificate pattern. Returns |
198 // |ui_data|. Returns empty string otherwise. | 198 // empty string otherwise. |
199 std::string CertificateIsConfigured(NetworkUIData* ui_data); | 199 std::string CertificateIsConfigured(const CertificatePattern& pattern); |
200 void ErrorCallbackForPendingRequest(const std::string& service_path, | 200 void ErrorCallbackForPendingRequest(const std::string& service_path, |
201 const std::string& error_name); | 201 const std::string& error_name); |
202 | 202 |
203 // Calls Shill.Manager.Disconnect asynchronously. | 203 // Calls Shill.Manager.Disconnect asynchronously. |
204 void CallShillDisconnect( | 204 void CallShillDisconnect( |
205 const std::string& service_path, | 205 const std::string& service_path, |
206 const base::Closure& success_callback, | 206 const base::Closure& success_callback, |
207 const network_handler::ErrorCallback& error_callback); | 207 const network_handler::ErrorCallback& error_callback); |
208 | 208 |
209 // Handle success from Shill.Service.Disconnect. | 209 // Handle success from Shill.Service.Disconnect. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 // Whether the handler already requested a 'ConnectToBestNetwork' after login, | 250 // Whether the handler already requested a 'ConnectToBestNetwork' after login, |
251 // see ConnectToBestNetworkAfterLogin(). | 251 // see ConnectToBestNetworkAfterLogin(). |
252 bool requested_connect_to_best_network_; | 252 bool requested_connect_to_best_network_; |
253 | 253 |
254 DISALLOW_COPY_AND_ASSIGN(NetworkConnectionHandler); | 254 DISALLOW_COPY_AND_ASSIGN(NetworkConnectionHandler); |
255 }; | 255 }; |
256 | 256 |
257 } // namespace chromeos | 257 } // namespace chromeos |
258 | 258 |
259 #endif // CHROMEOS_NETWORK_NETWORK_CONNECTION_HANDLER_H_ | 259 #endif // CHROMEOS_NETWORK_NETWORK_CONNECTION_HANDLER_H_ |
OLD | NEW |