| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // * kMatchTypeDefault returns the default (active) network | 54 // * kMatchTypeDefault returns the default (active) network |
| 55 // * kMatchTypeNonVirtual returns the primary non virtual network | 55 // * kMatchTypeNonVirtual returns the primary non virtual network |
| 56 // * kMatchTypeWireless returns the primary wireless network | 56 // * kMatchTypeWireless returns the primary wireless network |
| 57 // * kMatchTypeMobile returns the primary cellular or wimax network | 57 // * kMatchTypeMobile returns the primary cellular or wimax network |
| 58 | 58 |
| 59 class CHROMEOS_EXPORT NetworkStateHandler | 59 class CHROMEOS_EXPORT NetworkStateHandler |
| 60 : public internal::ShillPropertyHandler::Listener { | 60 : public internal::ShillPropertyHandler::Listener { |
| 61 public: | 61 public: |
| 62 typedef std::vector<ManagedState*> ManagedStateList; | 62 typedef std::vector<ManagedState*> ManagedStateList; |
| 63 typedef std::vector<const NetworkState*> NetworkStateList; | 63 typedef std::vector<const NetworkState*> NetworkStateList; |
| 64 typedef std::vector<const DeviceState*> DeviceStateList; |
| 64 | 65 |
| 65 enum TechnologyState { | 66 enum TechnologyState { |
| 66 TECHNOLOGY_UNAVAILABLE, | 67 TECHNOLOGY_UNAVAILABLE, |
| 67 TECHNOLOGY_AVAILABLE, | 68 TECHNOLOGY_AVAILABLE, |
| 68 TECHNOLOGY_UNINITIALIZED, | 69 TECHNOLOGY_UNINITIALIZED, |
| 69 TECHNOLOGY_ENABLING, | 70 TECHNOLOGY_ENABLING, |
| 70 TECHNOLOGY_ENABLED | 71 TECHNOLOGY_ENABLED |
| 71 }; | 72 }; |
| 72 | 73 |
| 73 virtual ~NetworkStateHandler(); | 74 virtual ~NetworkStateHandler(); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 std::string HardwareAddressForType(const std::string& type) const; | 134 std::string HardwareAddressForType(const std::string& type) const; |
| 134 // Same as above but in aa:bb format. | 135 // Same as above but in aa:bb format. |
| 135 std::string FormattedHardwareAddressForType(const std::string& type) const; | 136 std::string FormattedHardwareAddressForType(const std::string& type) const; |
| 136 | 137 |
| 137 // Sets |list| to contain the list of networks. The returned list contains | 138 // Sets |list| to contain the list of networks. The returned list contains |
| 138 // a copy of NetworkState pointers which should not be stored or used beyond | 139 // a copy of NetworkState pointers which should not be stored or used beyond |
| 139 // the scope of the calling function (i.e. they may later become invalid, but | 140 // the scope of the calling function (i.e. they may later become invalid, but |
| 140 // only on the UI thread). | 141 // only on the UI thread). |
| 141 void GetNetworkList(NetworkStateList* list) const; | 142 void GetNetworkList(NetworkStateList* list) const; |
| 142 | 143 |
| 144 // Sets |list| to contain the list of devices. The returned list contains |
| 145 // a copy of DeviceState pointers which should not be stored or used beyond |
| 146 // the scope of the calling function (i.e. they may later become invalid, but |
| 147 // only on the UI thread). |
| 148 void GetDeviceList(DeviceStateList* list) const; |
| 149 |
| 143 // Requests a network scan. This may trigger updates to the network | 150 // Requests a network scan. This may trigger updates to the network |
| 144 // list, which will trigger the appropriate observer calls. | 151 // list, which will trigger the appropriate observer calls. |
| 145 void RequestScan() const; | 152 void RequestScan() const; |
| 146 | 153 |
| 147 // Request a scan if not scanning and run |callback| when the Scanning state | 154 // Request a scan if not scanning and run |callback| when the Scanning state |
| 148 // for any Device matching |type| completes. | 155 // for any Device matching |type| completes. |
| 149 void WaitForScan(const std::string& type, const base::Closure& callback); | 156 void WaitForScan(const std::string& type, const base::Closure& callback); |
| 150 | 157 |
| 151 // Request a network scan then signal Shill to connect to the best available | 158 // Request a network scan then signal Shill to connect to the best available |
| 152 // networks when completed. | 159 // networks when completed. |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 | 312 |
| 306 // Callbacks to run when a scan for the technology type completes. | 313 // Callbacks to run when a scan for the technology type completes. |
| 307 ScanCompleteCallbackMap scan_complete_callbacks_; | 314 ScanCompleteCallbackMap scan_complete_callbacks_; |
| 308 | 315 |
| 309 DISALLOW_COPY_AND_ASSIGN(NetworkStateHandler); | 316 DISALLOW_COPY_AND_ASSIGN(NetworkStateHandler); |
| 310 }; | 317 }; |
| 311 | 318 |
| 312 } // namespace chromeos | 319 } // namespace chromeos |
| 313 | 320 |
| 314 #endif // CHROMEOS_NETWORK_NETWORK_STATE_HANDLER_H_ | 321 #endif // CHROMEOS_NETWORK_NETWORK_STATE_HANDLER_H_ |
| OLD | NEW |