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