| 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 void RequestUpdateForNetwork(const std::string& service_path); | 193 void RequestUpdateForNetwork(const std::string& service_path); |
| 194 | 194 |
| 195 // Request an update for all existing NetworkState entries, e.g. after | 195 // Request an update for all existing NetworkState entries, e.g. after |
| 196 // loading an ONC configuration file that may have updated one or more | 196 // loading an ONC configuration file that may have updated one or more |
| 197 // existing networks. | 197 // existing networks. |
| 198 void RequestUpdateForAllNetworks(); | 198 void RequestUpdateForAllNetworks(); |
| 199 | 199 |
| 200 // Set the list of devices on which portal check is enabled. | 200 // Set the list of devices on which portal check is enabled. |
| 201 void SetCheckPortalList(const std::string& check_portal_list); | 201 void SetCheckPortalList(const std::string& check_portal_list); |
| 202 | 202 |
| 203 const std::string& check_portal_list() const { return check_portal_list_; } | 203 const std::string& GetCheckPortalListForTest() const { |
| 204 return check_portal_list_; |
| 205 } |
| 204 | 206 |
| 205 // Generates a DictionaryValue of all NetworkState properties. Currently | 207 // Generates a DictionaryValue of all NetworkState properties. Currently |
| 206 // provided for debugging purposes only. | 208 // provided for debugging purposes only. |
| 207 void GetNetworkStatePropertiesForTest( | 209 void GetNetworkStatePropertiesForTest( |
| 208 base::DictionaryValue* dictionary) const; | 210 base::DictionaryValue* dictionary) const; |
| 209 | 211 |
| 210 // Construct and initialize an instance for testing. | 212 // Construct and initialize an instance for testing. |
| 211 static NetworkStateHandler* InitializeForTest(); | 213 static NetworkStateHandler* InitializeForTest(); |
| 212 | 214 |
| 213 // Default set of comma separated interfaces on which to enable | 215 // Default set of comma separated interfaces on which to enable |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 virtual void UpdateDeviceProperty( | 248 virtual void UpdateDeviceProperty( |
| 247 const std::string& device_path, | 249 const std::string& device_path, |
| 248 const std::string& key, | 250 const std::string& key, |
| 249 const base::Value& value) OVERRIDE; | 251 const base::Value& value) OVERRIDE; |
| 250 | 252 |
| 251 // Called by ShillPropertyHandler when the portal check list manager property | 253 // Called by ShillPropertyHandler when the portal check list manager property |
| 252 // changes. | 254 // changes. |
| 253 virtual void CheckPortalListChanged( | 255 virtual void CheckPortalListChanged( |
| 254 const std::string& check_portal_list) OVERRIDE; | 256 const std::string& check_portal_list) OVERRIDE; |
| 255 | 257 |
| 256 // Sends NetworkManagerChanged() to observers and logs an event. | 258 // Called by ShillPropertyHandler when a technology list changes. |
| 257 virtual void NotifyManagerPropertyChanged() OVERRIDE; | 259 virtual void TechnologyListChanged() OVERRIDE; |
| 258 | 260 |
| 259 // Called by |shill_property_handler_| when the service or device list has | 261 // Called by |shill_property_handler_| when the service or device list has |
| 260 // changed and all entries have been updated. This updates the list and | 262 // changed and all entries have been updated. This updates the list and |
| 261 // notifies observers. If |type| == TYPE_NETWORK this also calls | 263 // notifies observers. If |type| == TYPE_NETWORK this also calls |
| 262 // CheckDefaultNetworkChanged(). | 264 // CheckDefaultNetworkChanged(). |
| 263 virtual void ManagedStateListChanged( | 265 virtual void ManagedStateListChanged( |
| 264 ManagedState::ManagedType type) OVERRIDE; | 266 ManagedState::ManagedType type) OVERRIDE; |
| 265 | 267 |
| 266 // Called after construction. Called explicitly by tests after adding | 268 // Called after construction. Called explicitly by tests after adding |
| 267 // test observers. | 269 // test observers. |
| 268 void InitShillPropertyHandler(); | 270 void InitShillPropertyHandler(); |
| 269 | 271 |
| 270 private: | 272 private: |
| 271 typedef std::list<base::Closure> ScanCallbackList; | 273 typedef std::list<base::Closure> ScanCallbackList; |
| 272 typedef std::map<std::string, ScanCallbackList> ScanCompleteCallbackMap; | 274 typedef std::map<std::string, ScanCallbackList> ScanCompleteCallbackMap; |
| 273 friend class NetworkStateHandlerTest; | 275 friend class NetworkStateHandlerTest; |
| 274 FRIEND_TEST_ALL_PREFIXES(NetworkStateHandlerTest, NetworkStateHandlerStub); | 276 FRIEND_TEST_ALL_PREFIXES(NetworkStateHandlerTest, NetworkStateHandlerStub); |
| 275 | 277 |
| 276 // NetworkState specific method for UpdateManagedStateProperties which | 278 // NetworkState specific method for UpdateManagedStateProperties which |
| 277 // notifies observers. | 279 // notifies observers. |
| 278 void UpdateNetworkStateProperties(NetworkState* network, | 280 void UpdateNetworkStateProperties(NetworkState* network, |
| 279 const base::DictionaryValue& properties); | 281 const base::DictionaryValue& properties); |
| 280 | 282 |
| 283 // Sends DeviceListChanged() to observers and logs an event. |
| 284 void NotifyDeviceListChanged(); |
| 285 |
| 281 // Non-const getters for managed entries. These are const so that they can | 286 // Non-const getters for managed entries. These are const so that they can |
| 282 // be called by Get[Network|Device]State, even though they return non-const | 287 // be called by Get[Network|Device]State, even though they return non-const |
| 283 // pointers. | 288 // pointers. |
| 284 DeviceState* GetModifiableDeviceState(const std::string& device_path) const; | 289 DeviceState* GetModifiableDeviceState(const std::string& device_path) const; |
| 285 NetworkState* GetModifiableNetworkState( | 290 NetworkState* GetModifiableNetworkState( |
| 286 const std::string& service_path) const; | 291 const std::string& service_path) const; |
| 287 ManagedState* GetModifiableManagedState(const ManagedStateList* managed_list, | 292 ManagedState* GetModifiableManagedState(const ManagedStateList* managed_list, |
| 288 const std::string& path) const; | 293 const std::string& path) const; |
| 289 | 294 |
| 290 // Gets the list specified by |type|. | 295 // Gets the list specified by |type|. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 | 339 |
| 335 // Callbacks to run when a scan for the technology type completes. | 340 // Callbacks to run when a scan for the technology type completes. |
| 336 ScanCompleteCallbackMap scan_complete_callbacks_; | 341 ScanCompleteCallbackMap scan_complete_callbacks_; |
| 337 | 342 |
| 338 DISALLOW_COPY_AND_ASSIGN(NetworkStateHandler); | 343 DISALLOW_COPY_AND_ASSIGN(NetworkStateHandler); |
| 339 }; | 344 }; |
| 340 | 345 |
| 341 } // namespace chromeos | 346 } // namespace chromeos |
| 342 | 347 |
| 343 #endif // CHROMEOS_NETWORK_NETWORK_STATE_HANDLER_H_ | 348 #endif // CHROMEOS_NETWORK_NETWORK_STATE_HANDLER_H_ |
| OLD | NEW |