| 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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 // Called by ShillPropertyHandler when a technology list changes. | 274 // Called by ShillPropertyHandler when a technology list changes. |
| 275 virtual void TechnologyListChanged() OVERRIDE; | 275 virtual void TechnologyListChanged() OVERRIDE; |
| 276 | 276 |
| 277 // Called by |shill_property_handler_| when the service or device list has | 277 // Called by |shill_property_handler_| when the service or device list has |
| 278 // changed and all entries have been updated. This updates the list and | 278 // changed and all entries have been updated. This updates the list and |
| 279 // notifies observers. If |type| == TYPE_NETWORK this also calls | 279 // notifies observers. If |type| == TYPE_NETWORK this also calls |
| 280 // CheckDefaultNetworkChanged(). | 280 // CheckDefaultNetworkChanged(). |
| 281 virtual void ManagedStateListChanged( | 281 virtual void ManagedStateListChanged( |
| 282 ManagedState::ManagedType type) OVERRIDE; | 282 ManagedState::ManagedType type) OVERRIDE; |
| 283 | 283 |
| 284 // Called when the default network service changes. Sets default_network_path_ |
| 285 // and notifies listeners. |
| 286 virtual void DefaultNetworkServiceChanged( |
| 287 const std::string& service_path) OVERRIDE; |
| 288 |
| 284 // Called after construction. Called explicitly by tests after adding | 289 // Called after construction. Called explicitly by tests after adding |
| 285 // test observers. | 290 // test observers. |
| 286 void InitShillPropertyHandler(); | 291 void InitShillPropertyHandler(); |
| 287 | 292 |
| 288 private: | 293 private: |
| 289 typedef std::list<base::Closure> ScanCallbackList; | 294 typedef std::list<base::Closure> ScanCallbackList; |
| 290 typedef std::map<std::string, ScanCallbackList> ScanCompleteCallbackMap; | 295 typedef std::map<std::string, ScanCallbackList> ScanCompleteCallbackMap; |
| 291 friend class NetworkStateHandlerTest; | 296 friend class NetworkStateHandlerTest; |
| 292 FRIEND_TEST_ALL_PREFIXES(NetworkStateHandlerTest, NetworkStateHandlerStub); | 297 FRIEND_TEST_ALL_PREFIXES(NetworkStateHandlerTest, NetworkStateHandlerStub); |
| 293 | 298 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 307 const std::string& service_path) const; | 312 const std::string& service_path) const; |
| 308 ManagedState* GetModifiableManagedState(const ManagedStateList* managed_list, | 313 ManagedState* GetModifiableManagedState(const ManagedStateList* managed_list, |
| 309 const std::string& path) const; | 314 const std::string& path) const; |
| 310 | 315 |
| 311 // Gets the list specified by |type|. | 316 // Gets the list specified by |type|. |
| 312 ManagedStateList* GetManagedList(ManagedState::ManagedType type); | 317 ManagedStateList* GetManagedList(ManagedState::ManagedType type); |
| 313 | 318 |
| 314 // Helper function to notify observers. Calls CheckDefaultNetworkChanged(). | 319 // Helper function to notify observers. Calls CheckDefaultNetworkChanged(). |
| 315 void OnNetworkConnectionStateChanged(NetworkState* network); | 320 void OnNetworkConnectionStateChanged(NetworkState* network); |
| 316 | 321 |
| 317 // If the default network changed returns true and sets | 322 // Notifies observers when the default network or its properties change. |
| 318 // |default_network_path_|. | 323 void NotifyDefaultNetworkChanged(const NetworkState* default_network); |
| 319 bool CheckDefaultNetworkChanged(); | |
| 320 | |
| 321 // Logs an event and notifies observers. | |
| 322 void OnDefaultNetworkChanged(); | |
| 323 | 324 |
| 324 // Notifies observers about changes to |network|. | 325 // Notifies observers about changes to |network|. |
| 325 void NetworkPropertiesUpdated(const NetworkState* network); | 326 void NotifyNetworkPropertiesUpdated(const NetworkState* network); |
| 326 | 327 |
| 327 // Called whenever Device.Scanning state transitions to false. | 328 // Called whenever Device.Scanning state transitions to false. |
| 328 void ScanCompleted(const std::string& type); | 329 void ScanCompleted(const std::string& type); |
| 329 | 330 |
| 330 // Returns the technology type for |type|. | 331 // Returns the technology type for |type|. |
| 331 std::string GetTechnologyForType(const NetworkTypePattern& type) const; | 332 std::string GetTechnologyForType(const NetworkTypePattern& type) const; |
| 332 | 333 |
| 333 // Shill property handler instance, owned by this class. | 334 // Shill property handler instance, owned by this class. |
| 334 scoped_ptr<internal::ShillPropertyHandler> shill_property_handler_; | 335 scoped_ptr<internal::ShillPropertyHandler> shill_property_handler_; |
| 335 | 336 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 355 | 356 |
| 356 // Callbacks to run when a scan for the technology type completes. | 357 // Callbacks to run when a scan for the technology type completes. |
| 357 ScanCompleteCallbackMap scan_complete_callbacks_; | 358 ScanCompleteCallbackMap scan_complete_callbacks_; |
| 358 | 359 |
| 359 DISALLOW_COPY_AND_ASSIGN(NetworkStateHandler); | 360 DISALLOW_COPY_AND_ASSIGN(NetworkStateHandler); |
| 360 }; | 361 }; |
| 361 | 362 |
| 362 } // namespace chromeos | 363 } // namespace chromeos |
| 363 | 364 |
| 364 #endif // CHROMEOS_NETWORK_NETWORK_STATE_HANDLER_H_ | 365 #endif // CHROMEOS_NETWORK_NETWORK_STATE_HANDLER_H_ |
| OLD | NEW |