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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 // Asynchronously sets the enabled state for |technology|. | 100 // Asynchronously sets the enabled state for |technology|. |
101 // Note: Modifes Manager state. Calls |error_callback| on failure. | 101 // Note: Modifes Manager state. Calls |error_callback| on failure. |
102 void SetTechnologyEnabled( | 102 void SetTechnologyEnabled( |
103 const std::string& technology, | 103 const std::string& technology, |
104 bool enabled, | 104 bool enabled, |
105 const network_handler::ErrorCallback& error_callback); | 105 const network_handler::ErrorCallback& error_callback); |
106 | 106 |
107 // Requests an immediate network scan. | 107 // Requests an immediate network scan. |
108 void RequestScan() const; | 108 void RequestScan() const; |
109 | 109 |
| 110 // Calls Manager.ConnectToBestServices(). |
| 111 void ConnectToBestServices() const; |
| 112 |
110 // Requests all properties for the service or device (called for new items). | 113 // Requests all properties for the service or device (called for new items). |
111 void RequestProperties(ManagedState::ManagedType type, | 114 void RequestProperties(ManagedState::ManagedType type, |
112 const std::string& path); | 115 const std::string& path); |
113 | 116 |
114 // Returns true if |service_path| is being observed. | 117 // Returns true if |service_path| is being observed. |
115 bool IsObservingNetwork(const std::string& service_path) { | 118 bool IsObservingNetwork(const std::string& service_path) { |
116 return observed_networks_.count(service_path) != 0; | 119 return observed_networks_.count(service_path) != 0; |
117 } | 120 } |
118 | 121 |
| 122 // Returns a WeakPtr for passing to callbacks. |
| 123 base::WeakPtr<ShillPropertyHandler> AsWeakPtr() { |
| 124 return weak_ptr_factory_.GetWeakPtr(); |
| 125 } |
| 126 |
119 // ShillPropertyChangedObserver overrides | 127 // ShillPropertyChangedObserver overrides |
120 virtual void OnPropertyChanged(const std::string& key, | 128 virtual void OnPropertyChanged(const std::string& key, |
121 const base::Value& value) OVERRIDE; | 129 const base::Value& value) OVERRIDE; |
122 | 130 |
123 private: | 131 private: |
124 // Callback for dbus method fetching properties. | 132 // Callback for dbus method fetching properties. |
125 void ManagerPropertiesCallback(DBusMethodCallStatus call_status, | 133 void ManagerPropertiesCallback(DBusMethodCallStatus call_status, |
126 const base::DictionaryValue& properties); | 134 const base::DictionaryValue& properties); |
127 // Called form OnPropertyChanged() and ManagerPropertiesCallback(). | 135 // Called form OnPropertyChanged() and ManagerPropertiesCallback(). |
128 // Returns true if observers should be notified. | 136 // Returns true if observers should be notified. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 // For Shill client callbacks | 195 // For Shill client callbacks |
188 base::WeakPtrFactory<ShillPropertyHandler> weak_ptr_factory_; | 196 base::WeakPtrFactory<ShillPropertyHandler> weak_ptr_factory_; |
189 | 197 |
190 DISALLOW_COPY_AND_ASSIGN(ShillPropertyHandler); | 198 DISALLOW_COPY_AND_ASSIGN(ShillPropertyHandler); |
191 }; | 199 }; |
192 | 200 |
193 } // namespace internal | 201 } // namespace internal |
194 } // namespace chromeos | 202 } // namespace chromeos |
195 | 203 |
196 #endif // CHROMEOS_NETWORK_SHILL_PROPERTY_HANDLER_H_ | 204 #endif // CHROMEOS_NETWORK_SHILL_PROPERTY_HANDLER_H_ |
OLD | NEW |