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_DBUS_SHILL_CLIENT_HELPER_H_ | 5 #ifndef CHROMEOS_DBUS_SHILL_CLIENT_HELPER_H_ |
6 #define CHROMEOS_DBUS_SHILL_CLIENT_HELPER_H_ | 6 #define CHROMEOS_DBUS_SHILL_CLIENT_HELPER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 typedef base::Callback<void(const base::ListValue& result)> ListValueCallback; | 59 typedef base::Callback<void(const base::ListValue& result)> ListValueCallback; |
60 | 60 |
61 // A callback to handle errors for method call. | 61 // A callback to handle errors for method call. |
62 typedef base::Callback<void(const std::string& error_name, | 62 typedef base::Callback<void(const std::string& error_name, |
63 const std::string& error_message)> ErrorCallback; | 63 const std::string& error_message)> ErrorCallback; |
64 | 64 |
65 ShillClientHelper(dbus::Bus* bus, dbus::ObjectProxy* proxy); | 65 ShillClientHelper(dbus::Bus* bus, dbus::ObjectProxy* proxy); |
66 | 66 |
67 virtual ~ShillClientHelper(); | 67 virtual ~ShillClientHelper(); |
68 | 68 |
| 69 // Returns true if there is a PropertyChangedObserver registered. |
| 70 bool IsObserved() const; |
| 71 |
| 72 // Returns true if the are method calls waiting for a response. If this |
| 73 // function is called from within the return callback return true only if |
| 74 // there are *other* calls waiting for a response. |
| 75 bool IsWaitingResponse() const; |
| 76 |
69 // Adds an |observer| of the PropertyChanged signal. | 77 // Adds an |observer| of the PropertyChanged signal. |
70 void AddPropertyChangedObserver(ShillPropertyChangedObserver* observer); | 78 void AddPropertyChangedObserver(ShillPropertyChangedObserver* observer); |
71 | 79 |
72 // Removes an |observer| of the PropertyChanged signal. | 80 // Removes an |observer| of the PropertyChanged signal. |
73 void RemovePropertyChangedObserver(ShillPropertyChangedObserver* observer); | 81 void RemovePropertyChangedObserver(ShillPropertyChangedObserver* observer); |
74 | 82 |
75 // Starts monitoring PropertyChanged signal. | 83 // Starts monitoring PropertyChanged signal. |
76 void MonitorPropertyChanged(const std::string& interface_name); | 84 void MonitorPropertyChanged(const std::string& interface_name); |
77 | 85 |
78 // Calls a method without results. | 86 // Calls a method without results. |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 // Handles errors for method calls. | 181 // Handles errors for method calls. |
174 void OnError(const ErrorCallback& error_callback, | 182 void OnError(const ErrorCallback& error_callback, |
175 dbus::ErrorResponse* response); | 183 dbus::ErrorResponse* response); |
176 | 184 |
177 // TODO(hashimoto): Remove this when we no longer need to make blocking calls. | 185 // TODO(hashimoto): Remove this when we no longer need to make blocking calls. |
178 BlockingMethodCaller blocking_method_caller_; | 186 BlockingMethodCaller blocking_method_caller_; |
179 dbus::ObjectProxy* proxy_; | 187 dbus::ObjectProxy* proxy_; |
180 PropertyChangedHandler property_changed_handler_; | 188 PropertyChangedHandler property_changed_handler_; |
181 ObserverList<ShillPropertyChangedObserver, true /* check_empty */> | 189 ObserverList<ShillPropertyChangedObserver, true /* check_empty */> |
182 observer_list_; | 190 observer_list_; |
| 191 int in_progress_calls_; |
183 | 192 |
184 // Note: This should remain the last member so it'll be destroyed and | 193 // Note: This should remain the last member so it'll be destroyed and |
185 // invalidate its weak pointers before any other members are destroyed. | 194 // invalidate its weak pointers before any other members are destroyed. |
186 base::WeakPtrFactory<ShillClientHelper> weak_ptr_factory_; | 195 base::WeakPtrFactory<ShillClientHelper> weak_ptr_factory_; |
187 | 196 |
188 DISALLOW_COPY_AND_ASSIGN(ShillClientHelper); | 197 DISALLOW_COPY_AND_ASSIGN(ShillClientHelper); |
189 }; | 198 }; |
190 | 199 |
191 } // namespace chromeos | 200 } // namespace chromeos |
192 | 201 |
193 #endif // CHROMEOS_DBUS_SHILL_CLIENT_HELPER_H_ | 202 #endif // CHROMEOS_DBUS_SHILL_CLIENT_HELPER_H_ |
OLD | NEW |