| 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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 const base::StringPiece& method_name, | 229 const base::StringPiece& method_name, |
| 230 const base::StringPiece& error_name, | 230 const base::StringPiece& error_name, |
| 231 const base::StringPiece& error_message) const; | 231 const base::StringPiece& error_message) const; |
| 232 | 232 |
| 233 // Used as ErrorCallback by CallMethod(). | 233 // Used as ErrorCallback by CallMethod(). |
| 234 void OnCallMethodError(const std::string& interface_name, | 234 void OnCallMethodError(const std::string& interface_name, |
| 235 const std::string& method_name, | 235 const std::string& method_name, |
| 236 ResponseCallback response_callback, | 236 ResponseCallback response_callback, |
| 237 ErrorResponse* error_response); | 237 ErrorResponse* error_response); |
| 238 | 238 |
| 239 // Adds the match rule to the bus and associate the callback with the signal. |
| 240 bool AddMatchRuleWithCallback(const std::string& match_rule, |
| 241 const std::string& absolute_signal_name, |
| 242 SignalCallback signal_callback); |
| 243 |
| 244 // Adds the match rule to the bus so that HandleMessage can see the signal. |
| 245 bool AddMatchRuleWithoutCallback(const std::string& match_rule, |
| 246 const std::string& absolute_signal_name); |
| 247 |
| 248 // Calls D-Bus's GetNameOwner method synchronously to update |
| 249 // |service_name_owner_| with the current owner of |service_name_|. |
| 250 // |
| 251 // BLOCKING CALL. |
| 252 void UpdateNameOwnerAndBlock(); |
| 253 |
| 254 // Handles NameOwnerChanged signal from D-Bus's special message bus. |
| 255 DBusHandlerResult HandleNameOwnerChanged(dbus::Signal* signal); |
| 256 |
| 239 scoped_refptr<Bus> bus_; | 257 scoped_refptr<Bus> bus_; |
| 240 std::string service_name_; | 258 std::string service_name_; |
| 241 ObjectPath object_path_; | 259 ObjectPath object_path_; |
| 242 | 260 |
| 243 // True if the message filter was added. | 261 // True if the message filter was added. |
| 244 bool filter_added_; | 262 bool filter_added_; |
| 245 | 263 |
| 246 // The method table where keys are absolute signal names (i.e. interface | 264 // The method table where keys are absolute signal names (i.e. interface |
| 247 // name + signal name), and values are the corresponding callbacks. | 265 // name + signal name), and values are the corresponding callbacks. |
| 248 typedef std::map<std::string, SignalCallback> MethodTable; | 266 typedef std::map<std::string, SignalCallback> MethodTable; |
| 249 MethodTable method_table_; | 267 MethodTable method_table_; |
| 250 | 268 |
| 251 std::set<std::string> match_rules_; | 269 std::set<std::string> match_rules_; |
| 252 | 270 |
| 253 const bool ignore_service_unknown_errors_; | 271 const bool ignore_service_unknown_errors_; |
| 254 | 272 |
| 273 // Known name owner of the well-known bus name represnted by |service_name_|. |
| 274 std::string service_name_owner_; |
| 275 |
| 255 DISALLOW_COPY_AND_ASSIGN(ObjectProxy); | 276 DISALLOW_COPY_AND_ASSIGN(ObjectProxy); |
| 256 }; | 277 }; |
| 257 | 278 |
| 258 } // namespace dbus | 279 } // namespace dbus |
| 259 | 280 |
| 260 #endif // DBUS_OBJECT_PROXY_H_ | 281 #endif // DBUS_OBJECT_PROXY_H_ |
| OLD | NEW |