Chromium Code Reviews| 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_|. | |
|
satorux1
2012/10/26 05:26:00
Please add
//
// BLOCKING CALL.
Haruki Sato
2012/10/26 05:53:13
Done. Thanks.
| |
| 250 bool UpdateNameOwner(); | |
|
satorux1
2012/10/26 05:26:00
UpdateNameOwnerAndBlock()
Haruki Sato
2012/10/26 05:53:13
Done.
| |
| 251 | |
| 252 // Handles NameOwnerChanged signal from D-Bus's special message bus. | |
| 253 DBusHandlerResult HandleNameOwnerChanged(dbus::Signal* signal); | |
| 254 | |
| 239 scoped_refptr<Bus> bus_; | 255 scoped_refptr<Bus> bus_; |
| 240 std::string service_name_; | 256 std::string service_name_; |
| 241 ObjectPath object_path_; | 257 ObjectPath object_path_; |
| 242 | 258 |
| 243 // True if the message filter was added. | 259 // True if the message filter was added. |
| 244 bool filter_added_; | 260 bool filter_added_; |
| 245 | 261 |
| 246 // The method table where keys are absolute signal names (i.e. interface | 262 // The method table where keys are absolute signal names (i.e. interface |
| 247 // name + signal name), and values are the corresponding callbacks. | 263 // name + signal name), and values are the corresponding callbacks. |
| 248 typedef std::map<std::string, SignalCallback> MethodTable; | 264 typedef std::map<std::string, SignalCallback> MethodTable; |
| 249 MethodTable method_table_; | 265 MethodTable method_table_; |
| 250 | 266 |
| 251 std::set<std::string> match_rules_; | 267 std::set<std::string> match_rules_; |
| 252 | 268 |
| 253 const bool ignore_service_unknown_errors_; | 269 const bool ignore_service_unknown_errors_; |
| 254 | 270 |
| 271 // Known name owner of the well-known bus name represnted by |service_name_|. | |
| 272 std::string service_name_owner_; | |
| 273 | |
| 255 DISALLOW_COPY_AND_ASSIGN(ObjectProxy); | 274 DISALLOW_COPY_AND_ASSIGN(ObjectProxy); |
| 256 }; | 275 }; |
| 257 | 276 |
| 258 } // namespace dbus | 277 } // namespace dbus |
| 259 | 278 |
| 260 #endif // DBUS_OBJECT_PROXY_H_ | 279 #endif // DBUS_OBJECT_PROXY_H_ |
| OLD | NEW |