| 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 DBUS_OBJECT_PROXY_H_ | 5 #ifndef DBUS_OBJECT_PROXY_H_ |
| 6 #define DBUS_OBJECT_PROXY_H_ | 6 #define DBUS_OBJECT_PROXY_H_ |
| 7 | 7 |
| 8 #include <dbus/dbus.h> | 8 #include <dbus/dbus.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 // | 135 // |
| 136 // |on_connected_callback| is called when the object proxy is connected | 136 // |on_connected_callback| is called when the object proxy is connected |
| 137 // to the signal, or failed to be connected, in the origin thread. | 137 // to the signal, or failed to be connected, in the origin thread. |
| 138 // | 138 // |
| 139 // Must be called in the origin thread. | 139 // Must be called in the origin thread. |
| 140 virtual void ConnectToSignal(const std::string& interface_name, | 140 virtual void ConnectToSignal(const std::string& interface_name, |
| 141 const std::string& signal_name, | 141 const std::string& signal_name, |
| 142 SignalCallback signal_callback, | 142 SignalCallback signal_callback, |
| 143 OnConnectedCallback on_connected_callback); | 143 OnConnectedCallback on_connected_callback); |
| 144 | 144 |
| 145 // Sets a callback for "NameOwnerChanged" signal. The callback is called on |
| 146 // the origin thread when D-Bus system sends "NameOwnerChanged" for the name |
| 147 // represented by |service_name_|. |
| 148 virtual void SetNameOwnerChangedCallback(SignalCallback callback); |
| 149 |
| 145 // Detaches from the remote object. The Bus object will take care of | 150 // Detaches from the remote object. The Bus object will take care of |
| 146 // detaching so you don't have to do this manually. | 151 // detaching so you don't have to do this manually. |
| 147 // | 152 // |
| 148 // BLOCKING CALL. | 153 // BLOCKING CALL. |
| 149 virtual void Detach(); | 154 virtual void Detach(); |
| 150 | 155 |
| 151 // Returns an empty callback that does nothing. Can be used for | 156 // Returns an empty callback that does nothing. Can be used for |
| 152 // CallMethod(). | 157 // CallMethod(). |
| 153 static ResponseCallback EmptyResponseCallback(); | 158 static ResponseCallback EmptyResponseCallback(); |
| 154 | 159 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 bool AddMatchRuleWithoutCallback(const std::string& match_rule, | 252 bool AddMatchRuleWithoutCallback(const std::string& match_rule, |
| 248 const std::string& absolute_signal_name); | 253 const std::string& absolute_signal_name); |
| 249 | 254 |
| 250 // Calls D-Bus's GetNameOwner method synchronously to update | 255 // Calls D-Bus's GetNameOwner method synchronously to update |
| 251 // |service_name_owner_| with the current owner of |service_name_|. | 256 // |service_name_owner_| with the current owner of |service_name_|. |
| 252 // | 257 // |
| 253 // BLOCKING CALL. | 258 // BLOCKING CALL. |
| 254 void UpdateNameOwnerAndBlock(); | 259 void UpdateNameOwnerAndBlock(); |
| 255 | 260 |
| 256 // Handles NameOwnerChanged signal from D-Bus's special message bus. | 261 // Handles NameOwnerChanged signal from D-Bus's special message bus. |
| 257 DBusHandlerResult HandleNameOwnerChanged(dbus::Signal* signal); | 262 DBusHandlerResult HandleNameOwnerChanged(scoped_ptr<dbus::Signal> signal); |
| 258 | 263 |
| 259 scoped_refptr<Bus> bus_; | 264 scoped_refptr<Bus> bus_; |
| 260 std::string service_name_; | 265 std::string service_name_; |
| 261 ObjectPath object_path_; | 266 ObjectPath object_path_; |
| 262 | 267 |
| 263 // True if the message filter was added. | 268 // True if the message filter was added. |
| 264 bool filter_added_; | 269 bool filter_added_; |
| 265 | 270 |
| 266 // The method table where keys are absolute signal names (i.e. interface | 271 // The method table where keys are absolute signal names (i.e. interface |
| 267 // name + signal name), and values are the corresponding callbacks. | 272 // name + signal name), and values are the corresponding callbacks. |
| 268 typedef std::map<std::string, SignalCallback> MethodTable; | 273 typedef std::map<std::string, SignalCallback> MethodTable; |
| 269 MethodTable method_table_; | 274 MethodTable method_table_; |
| 270 | 275 |
| 276 // The callback called when NameOwnerChanged signal is received. |
| 277 SignalCallback name_owner_changed_callback_; |
| 278 |
| 271 std::set<std::string> match_rules_; | 279 std::set<std::string> match_rules_; |
| 272 | 280 |
| 273 const bool ignore_service_unknown_errors_; | 281 const bool ignore_service_unknown_errors_; |
| 274 | 282 |
| 275 // Known name owner of the well-known bus name represnted by |service_name_|. | 283 // Known name owner of the well-known bus name represnted by |service_name_|. |
| 276 std::string service_name_owner_; | 284 std::string service_name_owner_; |
| 277 | 285 |
| 278 DISALLOW_COPY_AND_ASSIGN(ObjectProxy); | 286 DISALLOW_COPY_AND_ASSIGN(ObjectProxy); |
| 279 }; | 287 }; |
| 280 | 288 |
| 281 } // namespace dbus | 289 } // namespace dbus |
| 282 | 290 |
| 283 #endif // DBUS_OBJECT_PROXY_H_ | 291 #endif // DBUS_OBJECT_PROXY_H_ |
| OLD | NEW |