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 30 matching lines...) Expand all Loading... | |
41 // available State information, and NetworkConfigurationHandler for any | 41 // available State information, and NetworkConfigurationHandler for any |
42 // configuration calls. | 42 // configuration calls. |
43 | 43 |
44 class CHROMEOS_EXPORT NetworkConnectionHandler | 44 class CHROMEOS_EXPORT NetworkConnectionHandler |
45 : public LoginState::Observer, | 45 : public LoginState::Observer, |
46 public CertLoader::Observer, | 46 public CertLoader::Observer, |
47 public NetworkStateHandlerObserver, | 47 public NetworkStateHandlerObserver, |
48 public base::SupportsWeakPtr<NetworkConnectionHandler> { | 48 public base::SupportsWeakPtr<NetworkConnectionHandler> { |
49 public: | 49 public: |
50 // Constants for |error_name| from |error_callback| for Connect. | 50 // Constants for |error_name| from |error_callback| for Connect. |
51 | |
52 // No network matching |service_path| is found (hidden networks must be | |
53 // configured before connecting). | |
51 static const char kErrorNotFound[]; | 54 static const char kErrorNotFound[]; |
55 | |
56 // Already connected to the network. | |
52 static const char kErrorConnected[]; | 57 static const char kErrorConnected[]; |
58 | |
59 // Already connecting to the network. | |
53 static const char kErrorConnecting[]; | 60 static const char kErrorConnecting[]; |
61 | |
62 // The passphrase is missing or invalid. | |
54 static const char kErrorPassphraseRequired[]; | 63 static const char kErrorPassphraseRequired[]; |
64 | |
55 static const char kErrorActivationRequired[]; | 65 static const char kErrorActivationRequired[]; |
66 | |
67 // The network requires a cert and none exists. | |
56 static const char kErrorCertificateRequired[]; | 68 static const char kErrorCertificateRequired[]; |
69 | |
70 // The network had an authentication error, indicating that additional or | |
71 // different authentication information is required. | |
57 static const char kErrorAuthenticationRequired[]; | 72 static const char kErrorAuthenticationRequired[]; |
73 | |
74 // Additional configuration is required. | |
58 static const char kErrorConfigurationRequired[]; | 75 static const char kErrorConfigurationRequired[]; |
76 | |
77 // Configuration failed during the configure stage of the connect flow. | |
78 static const char kErrorConfigureFailed[]; | |
79 | |
80 // For Disconnect or Activate, an unexpected DBus or Shill error occurred. | |
59 static const char kErrorShillError[]; | 81 static const char kErrorShillError[]; |
60 static const char kErrorConnectFailed[]; | 82 |
61 static const char kErrorConfigureFailed[]; | 83 // A new network connect request canceled this one. |
62 static const char kErrorActivateFailed[]; | |
63 static const char kErrorMissingProvider[]; | |
64 static const char kErrorConnectCanceled[]; | 84 static const char kErrorConnectCanceled[]; |
65 static const char kErrorUnknown[]; | |
66 | 85 |
67 // Constants for |error_name| from |error_callback| for Disconnect. | 86 // Constants for |error_name| from |error_callback| for Disconnect. |
68 static const char kErrorNotConnected[]; | 87 static const char kErrorNotConnected[]; |
69 | 88 |
70 virtual ~NetworkConnectionHandler(); | 89 virtual ~NetworkConnectionHandler(); |
71 | 90 |
72 // ConnectToNetwork() will start an asynchronous connection attempt. | 91 // ConnectToNetwork() will start an asynchronous connection attempt. |
73 // On success, |success_callback| will be called. | 92 // On success, |success_callback| will be called. |
74 // On failure, |error_callback| will be called with |error_name| one of: | 93 // On failure, |error_callback| will be called with |error_name| one of the |
75 // kErrorNotFound if no network matching |service_path| is found | 94 // constants defined above, or flimflam::kErrorConnectFailed or |
76 // (hidden networks must be configured before connecting). | 95 // flimflam::kErrorBadPassphrase if the Shill network property (from a |
pneubeck (no reviews)
2013/08/26 08:14:11
'network property' ? maybe error property
stevenjb
2013/08/27 15:52:08
Done.
| |
77 // kErrorConnected if already connected to the network. | 96 // previous connect attempt) was set to one of those. |
78 // kErrorConnecting if already connecting to the network. | |
79 // kErrorCertificateRequired if the network requires a cert and none exists. | |
80 // kErrorPassphraseRequired if passphrase only is missing or incorrect. | |
81 // kErrorAuthenticationRequired if other authentication is required. | |
82 // kErrorConfigurationRequired if additional configuration is required. | |
83 // kErrorShillError if a DBus or Shill error occurred. | |
84 // |error_message| will contain an additional error string for debugging. | 97 // |error_message| will contain an additional error string for debugging. |
85 // If |check_error_state| is true, the current state of the network is | 98 // If |check_error_state| is true, the current state of the network is |
86 // checked for errors, otherwise current state is ignored (e.g. for recently | 99 // checked for errors, otherwise current state is ignored (e.g. for recently |
87 // configured networks or repeat attempts). | 100 // configured networks or repeat attempts). |
88 void ConnectToNetwork(const std::string& service_path, | 101 void ConnectToNetwork(const std::string& service_path, |
89 const base::Closure& success_callback, | 102 const base::Closure& success_callback, |
90 const network_handler::ErrorCallback& error_callback, | 103 const network_handler::ErrorCallback& error_callback, |
91 bool check_error_state); | 104 bool check_error_state); |
92 | 105 |
93 // DisconnectNetwork() will send a Disconnect request to Shill. | 106 // DisconnectNetwork() will send a Disconnect request to Shill. |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
211 // Track certificate loading state. | 224 // Track certificate loading state. |
212 bool logged_in_; | 225 bool logged_in_; |
213 bool certificates_loaded_; | 226 bool certificates_loaded_; |
214 | 227 |
215 DISALLOW_COPY_AND_ASSIGN(NetworkConnectionHandler); | 228 DISALLOW_COPY_AND_ASSIGN(NetworkConnectionHandler); |
216 }; | 229 }; |
217 | 230 |
218 } // namespace chromeos | 231 } // namespace chromeos |
219 | 232 |
220 #endif // CHROMEOS_NETWORK_NETWORK_CONNECTION_HANDLER_H_ | 233 #endif // CHROMEOS_NETWORK_NETWORK_CONNECTION_HANDLER_H_ |
OLD | NEW |