| 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_SHILL_PROPERTY_HANDLER_H_ | 5 #ifndef CHROMEOS_NETWORK_SHILL_PROPERTY_HANDLER_H_ |
| 6 #define CHROMEOS_NETWORK_SHILL_PROPERTY_HANDLER_H_ | 6 #define CHROMEOS_NETWORK_SHILL_PROPERTY_HANDLER_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 protected: | 83 protected: |
| 84 virtual ~Listener() {} | 84 virtual ~Listener() {} |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 explicit ShillPropertyHandler(Listener* listener); | 87 explicit ShillPropertyHandler(Listener* listener); |
| 88 virtual ~ShillPropertyHandler(); | 88 virtual ~ShillPropertyHandler(); |
| 89 | 89 |
| 90 // Sends an initial property request and sets up the observer. | 90 // Sends an initial property request and sets up the observer. |
| 91 void Init(); | 91 void Init(); |
| 92 | 92 |
| 93 // Returns true if |technology| is available / enabled / uninitialized. | 93 // Returns true if |technology| is available, enabled, etc. |
| 94 bool TechnologyAvailable(const std::string& technology) const; | 94 bool IsTechnologyAvailable(const std::string& technology) const; |
| 95 bool TechnologyEnabled(const std::string& technology) const; | 95 bool IsTechnologyEnabled(const std::string& technology) const; |
| 96 bool TechnologyUninitialized(const std::string& technology) const; | 96 bool IsTechnologyEnabling(const std::string& technology) const; |
| 97 bool IsTechnologyUninitialized(const std::string& technology) const; |
| 97 | 98 |
| 98 // Asynchronously sets the enabled state for |technology|. | 99 // Asynchronously sets the enabled state for |technology|. |
| 99 // Note: Modifes Manager state. Calls |error_callback| on failure. | 100 // Note: Modifes Manager state. Calls |error_callback| on failure. |
| 100 void SetTechnologyEnabled( | 101 void SetTechnologyEnabled( |
| 101 const std::string& technology, | 102 const std::string& technology, |
| 102 bool enabled, | 103 bool enabled, |
| 103 const network_handler::ErrorCallback& error_callback); | 104 const network_handler::ErrorCallback& error_callback); |
| 104 | 105 |
| 105 // Requests an immediate network scan. | 106 // Requests an immediate network scan. |
| 106 void RequestScan() const; | 107 void RequestScan() const; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 132 // Updates the Shill property observers to observe any entries for |type|. | 133 // Updates the Shill property observers to observe any entries for |type|. |
| 133 void UpdateObserved(ManagedState::ManagedType type, | 134 void UpdateObserved(ManagedState::ManagedType type, |
| 134 const base::ListValue& entries); | 135 const base::ListValue& entries); |
| 135 | 136 |
| 136 | 137 |
| 137 // Sets |*_technologies_| to contain only entries in |technologies|. | 138 // Sets |*_technologies_| to contain only entries in |technologies|. |
| 138 void UpdateAvailableTechnologies(const base::ListValue& technologies); | 139 void UpdateAvailableTechnologies(const base::ListValue& technologies); |
| 139 void UpdateEnabledTechnologies(const base::ListValue& technologies); | 140 void UpdateEnabledTechnologies(const base::ListValue& technologies); |
| 140 void UpdateUninitializedTechnologies(const base::ListValue& technologies); | 141 void UpdateUninitializedTechnologies(const base::ListValue& technologies); |
| 141 | 142 |
| 143 void EnableTechnologyFailed( |
| 144 const std::string& technology, |
| 145 const network_handler::ErrorCallback& error_callback, |
| 146 const std::string& error_name, |
| 147 const std::string& error_message); |
| 148 |
| 142 // Called when Shill returns the properties for a service or device. | 149 // Called when Shill returns the properties for a service or device. |
| 143 void GetPropertiesCallback(ManagedState::ManagedType type, | 150 void GetPropertiesCallback(ManagedState::ManagedType type, |
| 144 const std::string& path, | 151 const std::string& path, |
| 145 DBusMethodCallStatus call_status, | 152 DBusMethodCallStatus call_status, |
| 146 const base::DictionaryValue& properties); | 153 const base::DictionaryValue& properties); |
| 147 | 154 |
| 148 // Callback invoked when a watched property changes. Calls appropriate | 155 // Callback invoked when a watched property changes. Calls appropriate |
| 149 // handlers and signals observers. | 156 // handlers and signals observers. |
| 150 void PropertyChangedCallback(ManagedState::ManagedType type, | 157 void PropertyChangedCallback(ManagedState::ManagedType type, |
| 151 const std::string& path, | 158 const std::string& path, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 176 | 183 |
| 177 // List of network services with Shill property changed observers | 184 // List of network services with Shill property changed observers |
| 178 ShillPropertyObserverMap observed_networks_; | 185 ShillPropertyObserverMap observed_networks_; |
| 179 | 186 |
| 180 // List of network devices with Shill property changed observers | 187 // List of network devices with Shill property changed observers |
| 181 ShillPropertyObserverMap observed_devices_; | 188 ShillPropertyObserverMap observed_devices_; |
| 182 | 189 |
| 183 // Lists of available / enabled / uninitialized technologies | 190 // Lists of available / enabled / uninitialized technologies |
| 184 std::set<std::string> available_technologies_; | 191 std::set<std::string> available_technologies_; |
| 185 std::set<std::string> enabled_technologies_; | 192 std::set<std::string> enabled_technologies_; |
| 193 std::set<std::string> enabling_technologies_; |
| 186 std::set<std::string> uninitialized_technologies_; | 194 std::set<std::string> uninitialized_technologies_; |
| 187 | 195 |
| 188 DISALLOW_COPY_AND_ASSIGN(ShillPropertyHandler); | 196 DISALLOW_COPY_AND_ASSIGN(ShillPropertyHandler); |
| 189 }; | 197 }; |
| 190 | 198 |
| 191 } // namespace internal | 199 } // namespace internal |
| 192 } // namespace chromeos | 200 } // namespace chromeos |
| 193 | 201 |
| 194 #endif // CHROMEOS_NETWORK_SHILL_PROPERTY_HANDLER_H_ | 202 #endif // CHROMEOS_NETWORK_SHILL_PROPERTY_HANDLER_H_ |
| OLD | NEW |