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_STATE_HANDLER_H_ | 5 #ifndef CHROMEOS_NETWORK_NETWORK_STATE_HANDLER_H_ |
6 #define CHROMEOS_NETWORK_NETWORK_STATE_HANDLER_H_ | 6 #define CHROMEOS_NETWORK_NETWORK_STATE_HANDLER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 16 matching lines...) Expand all Loading... |
27 } | 27 } |
28 | 28 |
29 namespace tracked_objects { | 29 namespace tracked_objects { |
30 class Location; | 30 class Location; |
31 } | 31 } |
32 | 32 |
33 namespace chromeos { | 33 namespace chromeos { |
34 | 34 |
35 class DeviceState; | 35 class DeviceState; |
36 class NetworkState; | 36 class NetworkState; |
| 37 class NetworkStateBase; |
37 class NetworkStateHandlerObserver; | 38 class NetworkStateHandlerObserver; |
38 class NetworkStateHandlerTest; | 39 class NetworkStateHandlerTest; |
39 class NetworkTypePattern; | 40 class NetworkTypePattern; |
40 | 41 |
41 // Class for tracking the list of visible networks and their properties. | 42 // Class for tracking the list of visible networks and their properties. |
42 // | 43 // |
43 // This class maps essential properties from the connection manager (Shill) for | 44 // This class maps essential properties from the connection manager (Shill) for |
44 // each visible network. It is not used to change the properties of services or | 45 // each visible network. It is not used to change the properties of services or |
45 // devices, only global (manager) properties. | 46 // devices, only global (manager) properties. |
46 // | 47 // |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 // only on the UI thread). | 162 // only on the UI thread). |
162 void GetDeviceList(DeviceStateList* list) const; | 163 void GetDeviceList(DeviceStateList* list) const; |
163 | 164 |
164 // Sets |list| to contain the list of favorite (aka "preferred") networks. | 165 // Sets |list| to contain the list of favorite (aka "preferred") networks. |
165 // See GetNetworkList() for usage, and notes for |favorite_list_|. | 166 // See GetNetworkList() for usage, and notes for |favorite_list_|. |
166 // Favorites that are visible have the same path() as the entries in | 167 // Favorites that are visible have the same path() as the entries in |
167 // GetNetworkList(), so GetNetworkState() can be used to determine if a | 168 // GetNetworkList(), so GetNetworkState() can be used to determine if a |
168 // favorite is visible and retrieve the complete properties (and vice-versa). | 169 // favorite is visible and retrieve the complete properties (and vice-versa). |
169 void GetFavoriteList(FavoriteStateList* list) const; | 170 void GetFavoriteList(FavoriteStateList* list) const; |
170 | 171 |
| 172 // Like GetFavoriteList() but only returns favorites with matching |type|. |
| 173 void GetFavoriteListByType(const NetworkTypePattern& type, |
| 174 FavoriteStateList* list) const; |
| 175 |
171 // Finds and returns a favorite state by |service_path| or NULL if not found. | 176 // Finds and returns a favorite state by |service_path| or NULL if not found. |
172 const FavoriteState* GetFavoriteState(const std::string& service_path) const; | 177 const FavoriteState* GetFavoriteState(const std::string& service_path) const; |
173 | 178 |
174 // Requests a network scan. This may trigger updates to the network | 179 // Requests a network scan. This may trigger updates to the network |
175 // list, which will trigger the appropriate observer calls. | 180 // list, which will trigger the appropriate observer calls. |
176 void RequestScan() const; | 181 void RequestScan() const; |
177 | 182 |
178 // Request a scan if not scanning and run |callback| when the Scanning state | 183 // Request a scan if not scanning and run |callback| when the Scanning state |
179 // for any Device of network type |type| completes. | 184 // for any Device of network type |type| completes. |
180 void WaitForScan(const std::string& type, const base::Closure& callback); | 185 void WaitForScan(const std::string& type, const base::Closure& callback); |
(...skipping 14 matching lines...) Expand all Loading... |
195 // Request an update for all existing NetworkState entries, e.g. after | 200 // Request an update for all existing NetworkState entries, e.g. after |
196 // loading an ONC configuration file that may have updated one or more | 201 // loading an ONC configuration file that may have updated one or more |
197 // existing networks. | 202 // existing networks. |
198 void RequestUpdateForAllNetworks(); | 203 void RequestUpdateForAllNetworks(); |
199 | 204 |
200 // Set the list of devices on which portal check is enabled. | 205 // Set the list of devices on which portal check is enabled. |
201 void SetCheckPortalList(const std::string& check_portal_list); | 206 void SetCheckPortalList(const std::string& check_portal_list); |
202 | 207 |
203 const std::string& check_portal_list() const { return check_portal_list_; } | 208 const std::string& check_portal_list() const { return check_portal_list_; } |
204 | 209 |
| 210 // Returns the FavoriteState of the EthernetEAP service, which contains the |
| 211 // EAP parameters used by |ethernet|. If the |ethernet| is not connected using |
| 212 // EAP, returns NULL. |
| 213 const FavoriteState* GetEAPForEthernet( |
| 214 const NetworkStateBase* ethernet) const; |
| 215 |
205 // Generates a DictionaryValue of all NetworkState properties. Currently | 216 // Generates a DictionaryValue of all NetworkState properties. Currently |
206 // provided for debugging purposes only. | 217 // provided for debugging purposes only. |
207 void GetNetworkStatePropertiesForTest( | 218 void GetNetworkStatePropertiesForTest( |
208 base::DictionaryValue* dictionary) const; | 219 base::DictionaryValue* dictionary) const; |
209 | 220 |
210 // Construct and initialize an instance for testing. | 221 // Construct and initialize an instance for testing. |
211 static NetworkStateHandler* InitializeForTest(); | 222 static NetworkStateHandler* InitializeForTest(); |
212 | 223 |
213 // Default set of comma separated interfaces on which to enable | 224 // Default set of comma separated interfaces on which to enable |
214 // portal checking. | 225 // portal checking. |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 // Helper function to notify observers. Calls CheckDefaultNetworkChanged(). | 304 // Helper function to notify observers. Calls CheckDefaultNetworkChanged(). |
294 void OnNetworkConnectionStateChanged(NetworkState* network); | 305 void OnNetworkConnectionStateChanged(NetworkState* network); |
295 | 306 |
296 // If the default network changed returns true and sets | 307 // If the default network changed returns true and sets |
297 // |default_network_path_|. | 308 // |default_network_path_|. |
298 bool CheckDefaultNetworkChanged(); | 309 bool CheckDefaultNetworkChanged(); |
299 | 310 |
300 // Logs an event and notifies observers. | 311 // Logs an event and notifies observers. |
301 void OnDefaultNetworkChanged(); | 312 void OnDefaultNetworkChanged(); |
302 | 313 |
303 // Notifies observers and updates connecting_network_. | 314 // Notifies observers about changes to |network|. |
304 void NetworkPropertiesUpdated(const NetworkState* network); | 315 void NetworkPropertiesUpdated(const NetworkState* network); |
305 | 316 |
306 // Called whenever Device.Scanning state transitions to false. | 317 // Called whenever Device.Scanning state transitions to false. |
307 void ScanCompleted(const std::string& type); | 318 void ScanCompleted(const std::string& type); |
308 | 319 |
309 // Returns the technology type for |type|. | 320 // Returns the technology type for |type|. |
310 std::string GetTechnologyForType(const NetworkTypePattern& type) const; | 321 std::string GetTechnologyForType(const NetworkTypePattern& type) const; |
311 | 322 |
312 // Shill property handler instance, owned by this class. | 323 // Shill property handler instance, owned by this class. |
313 scoped_ptr<internal::ShillPropertyHandler> shill_property_handler_; | 324 scoped_ptr<internal::ShillPropertyHandler> shill_property_handler_; |
(...skipping 20 matching lines...) Expand all Loading... |
334 | 345 |
335 // Callbacks to run when a scan for the technology type completes. | 346 // Callbacks to run when a scan for the technology type completes. |
336 ScanCompleteCallbackMap scan_complete_callbacks_; | 347 ScanCompleteCallbackMap scan_complete_callbacks_; |
337 | 348 |
338 DISALLOW_COPY_AND_ASSIGN(NetworkStateHandler); | 349 DISALLOW_COPY_AND_ASSIGN(NetworkStateHandler); |
339 }; | 350 }; |
340 | 351 |
341 } // namespace chromeos | 352 } // namespace chromeos |
342 | 353 |
343 #endif // CHROMEOS_NETWORK_NETWORK_STATE_HANDLER_H_ | 354 #endif // CHROMEOS_NETWORK_NETWORK_STATE_HANDLER_H_ |
OLD | NEW |