OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <dbus/dbus.h> | 9 #include <dbus/dbus.h> |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 class Response; | 23 class Response; |
24 class Signal; | 24 class Signal; |
25 | 25 |
26 // ObjectProxy is used to communicate with remote objects, mainly for | 26 // ObjectProxy is used to communicate with remote objects, mainly for |
27 // calling methods of these objects. | 27 // calling methods of these objects. |
28 // | 28 // |
29 // ObjectProxy is a ref counted object, to ensure that |this| of the | 29 // ObjectProxy is a ref counted object, to ensure that |this| of the |
30 // object is is alive when callbacks referencing |this| are called. | 30 // object is is alive when callbacks referencing |this| are called. |
31 class ObjectProxy : public base::RefCountedThreadSafe<ObjectProxy> { | 31 class ObjectProxy : public base::RefCountedThreadSafe<ObjectProxy> { |
32 public: | 32 public: |
33 // Client code should use Bus::GetObjectProxy() instead of this | 33 // Client code should use Bus::GetObjectProxy() or |
34 // constructor. | 34 // Bus::GetObjectProxyWithOptions() instead of this constructor. |
35 ObjectProxy(Bus* bus, | 35 ObjectProxy(Bus* bus, |
36 const std::string& service_name, | 36 const std::string& service_name, |
37 const std::string& object_path); | 37 const std::string& object_path, |
| 38 int options); |
| 39 |
| 40 // Options to be OR-ed together when calling Bus::GetObjectProxyWithOptions(). |
| 41 // Set the IGNORE_SERVICE_UNKNOWN_ERRORS option to silence logging of |
| 42 // org.freedesktop.DBus.Error.ServiceUnknown errors. |
| 43 enum Options { |
| 44 DEFAULT_OPTIONS = 0, |
| 45 IGNORE_SERVICE_UNKNOWN_ERRORS = 1 << 0 |
| 46 }; |
38 | 47 |
39 // Special timeout constants. | 48 // Special timeout constants. |
40 // | 49 // |
41 // The constants correspond to DBUS_TIMEOUT_USE_DEFAULT and | 50 // The constants correspond to DBUS_TIMEOUT_USE_DEFAULT and |
42 // DBUS_TIMEOUT_INFINITE. Here we use literal numbers instead of these | 51 // DBUS_TIMEOUT_INFINITE. Here we use literal numbers instead of these |
43 // macros as these aren't defined with D-Bus earlier than 1.4.12. | 52 // macros as these aren't defined with D-Bus earlier than 1.4.12. |
44 enum { | 53 enum { |
45 TIMEOUT_USE_DEFAULT = -1, | 54 TIMEOUT_USE_DEFAULT = -1, |
46 TIMEOUT_INFINITE = 0x7fffffff, | 55 TIMEOUT_INFINITE = 0x7fffffff, |
47 }; | 56 }; |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 // True if the message filter was added. | 196 // True if the message filter was added. |
188 bool filter_added_; | 197 bool filter_added_; |
189 | 198 |
190 // The method table where keys are absolute signal names (i.e. interface | 199 // The method table where keys are absolute signal names (i.e. interface |
191 // name + signal name), and values are the corresponding callbacks. | 200 // name + signal name), and values are the corresponding callbacks. |
192 typedef std::map<std::string, SignalCallback> MethodTable; | 201 typedef std::map<std::string, SignalCallback> MethodTable; |
193 MethodTable method_table_; | 202 MethodTable method_table_; |
194 | 203 |
195 std::set<std::string> match_rules_; | 204 std::set<std::string> match_rules_; |
196 | 205 |
| 206 const bool log_unknown_service_errors_; |
| 207 |
197 DISALLOW_COPY_AND_ASSIGN(ObjectProxy); | 208 DISALLOW_COPY_AND_ASSIGN(ObjectProxy); |
198 }; | 209 }; |
199 | 210 |
200 } // namespace dbus | 211 } // namespace dbus |
201 | 212 |
202 #endif // DBUS_OBJECT_PROXY_H_ | 213 #endif // DBUS_OBJECT_PROXY_H_ |
OLD | NEW |