| 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 const std::string& service_path, | 198 const std::string& service_path, |
| 199 const std::string& key, | 199 const std::string& key, |
| 200 const base::Value& value) OVERRIDE; | 200 const base::Value& value) OVERRIDE; |
| 201 | 201 |
| 202 // Called by ShillPropertyHandler when a watched device property changes. | 202 // Called by ShillPropertyHandler when a watched device property changes. |
| 203 virtual void UpdateDeviceProperty( | 203 virtual void UpdateDeviceProperty( |
| 204 const std::string& device_path, | 204 const std::string& device_path, |
| 205 const std::string& key, | 205 const std::string& key, |
| 206 const base::Value& value) OVERRIDE; | 206 const base::Value& value) OVERRIDE; |
| 207 | 207 |
| 208 // Sends NetworkManagerChanged() to observers. | 208 // Sends NetworkManagerChanged() to observers and logs an event. |
| 209 virtual void ManagerPropertyChanged() OVERRIDE; | 209 virtual void NotifyManagerPropertyChanged() OVERRIDE; |
| 210 | 210 |
| 211 // Called by |shill_property_handler_| when the service or device list has | 211 // Called by |shill_property_handler_| when the service or device list has |
| 212 // changed and all entries have been updated. This updates the list and | 212 // changed and all entries have been updated. This updates the list and |
| 213 // notifies observers. If |type| == TYPE_NETWORK this also calls | 213 // notifies observers. If |type| == TYPE_NETWORK this also calls |
| 214 // CheckDefaultNetworkChanged(). | 214 // CheckDefaultNetworkChanged(). |
| 215 virtual void ManagedStateListChanged( | 215 virtual void ManagedStateListChanged( |
| 216 ManagedState::ManagedType type) OVERRIDE; | 216 ManagedState::ManagedType type) OVERRIDE; |
| 217 | 217 |
| 218 // Called in Initialize(). Called explicitly by tests after adding | 218 // Called in Initialize(). Called explicitly by tests after adding |
| 219 // test observers. | 219 // test observers. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 249 | 249 |
| 250 // Notifies observers and updates connecting_network_. | 250 // Notifies observers and updates connecting_network_. |
| 251 void NetworkPropertiesUpdated(const NetworkState* network); | 251 void NetworkPropertiesUpdated(const NetworkState* network); |
| 252 | 252 |
| 253 // Called whenever Device.Scanning state transitions to false. | 253 // Called whenever Device.Scanning state transitions to false. |
| 254 void ScanCompleted(const std::string& type); | 254 void ScanCompleted(const std::string& type); |
| 255 | 255 |
| 256 // Returns the technology type for |type|. | 256 // Returns the technology type for |type|. |
| 257 std::string GetTechnologyForType(const std::string& type) const; | 257 std::string GetTechnologyForType(const std::string& type) const; |
| 258 | 258 |
| 259 // Returns a log friendly name for the managed state associated with |path|. |
| 260 std::string GetNameFromPath(const std::string& path) const; |
| 261 |
| 259 // Shill property handler instance, owned by this class. | 262 // Shill property handler instance, owned by this class. |
| 260 scoped_ptr<internal::ShillPropertyHandler> shill_property_handler_; | 263 scoped_ptr<internal::ShillPropertyHandler> shill_property_handler_; |
| 261 | 264 |
| 262 // Observer list | 265 // Observer list |
| 263 ObserverList<NetworkStateHandlerObserver> observers_; | 266 ObserverList<NetworkStateHandlerObserver> observers_; |
| 264 | 267 |
| 265 // Lists of managed states | 268 // Lists of managed states |
| 266 ManagedStateList network_list_; | 269 ManagedStateList network_list_; |
| 267 ManagedStateList device_list_; | 270 ManagedStateList device_list_; |
| 268 | 271 |
| 269 // Keeps track of the default network for notifying observers when it changes. | 272 // Keeps track of the default network for notifying observers when it changes. |
| 270 std::string default_network_path_; | 273 std::string default_network_path_; |
| 271 | 274 |
| 272 // Convenience member to track the user initiated connecting network. Set | 275 // Convenience member to track the user initiated connecting network. Set |
| 273 // externally when a connection is requested and cleared here when the state | 276 // externally when a connection is requested and cleared here when the state |
| 274 // changes to something other than Connecting (after observers are notified). | 277 // changes to something other than Connecting (after observers are notified). |
| 275 // TODO(stevenjb): Move this to NetworkConfigurationHandler. | 278 // TODO(stevenjb): Move this to NetworkConfigurationHandler. |
| 276 std::string connecting_network_; | 279 std::string connecting_network_; |
| 277 | 280 |
| 278 // Callbacks to run when a scan for the technology type completes. | 281 // Callbacks to run when a scan for the technology type completes. |
| 279 ScanCompleteCallbackMap scan_complete_callbacks_; | 282 ScanCompleteCallbackMap scan_complete_callbacks_; |
| 280 | 283 |
| 281 DISALLOW_COPY_AND_ASSIGN(NetworkStateHandler); | 284 DISALLOW_COPY_AND_ASSIGN(NetworkStateHandler); |
| 282 }; | 285 }; |
| 283 | 286 |
| 284 } // namespace chromeos | 287 } // namespace chromeos |
| 285 | 288 |
| 286 #endif // CHROMEOS_NETWORK_NETWORK_STATE_HANDLER_H_ | 289 #endif // CHROMEOS_NETWORK_NETWORK_STATE_HANDLER_H_ |
| OLD | NEW |