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