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