| 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 <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 // | 66 // |
| 67 // BLOCKING CALL. | 67 // BLOCKING CALL. |
| 68 virtual Response* CallMethodAndBlock(MethodCall* method_call, | 68 virtual Response* CallMethodAndBlock(MethodCall* method_call, |
| 69 int timeout_ms); | 69 int timeout_ms); |
| 70 | 70 |
| 71 // Requests to call the method of the remote object. | 71 // Requests to call the method of the remote object. |
| 72 // | 72 // |
| 73 // |callback| will be called in the origin thread, once the method call | 73 // |callback| will be called in the origin thread, once the method call |
| 74 // is complete. As it's called in the origin thread, |callback| can | 74 // is complete. As it's called in the origin thread, |callback| can |
| 75 // safely reference objects in the origin thread (i.e. UI thread in most | 75 // safely reference objects in the origin thread (i.e. UI thread in most |
| 76 // cases). | 76 // cases). If the caller is not interested in the response from the |
| 77 // method (i.e. calling a method that does not return a value), |
| 78 // EmptyResponseCallback() can be passed to the |callback| parameter. |
| 77 // | 79 // |
| 78 // If the method call is successful, a pointer to Response object will | 80 // If the method call is successful, a pointer to Response object will |
| 79 // be passed to the callback. If unsuccessful, NULL will be passed to | 81 // be passed to the callback. If unsuccessful, NULL will be passed to |
| 80 // the callback. | 82 // the callback. |
| 81 // | 83 // |
| 82 // Must be called in the origin thread. | 84 // Must be called in the origin thread. |
| 83 virtual void CallMethod(MethodCall* method_call, | 85 virtual void CallMethod(MethodCall* method_call, |
| 84 int timeout_ms, | 86 int timeout_ms, |
| 85 ResponseCallback callback); | 87 ResponseCallback callback); |
| 86 | 88 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 99 const std::string& signal_name, | 101 const std::string& signal_name, |
| 100 SignalCallback signal_callback, | 102 SignalCallback signal_callback, |
| 101 OnConnectedCallback on_connected_callback); | 103 OnConnectedCallback on_connected_callback); |
| 102 | 104 |
| 103 // Detaches from the remote object. The Bus object will take care of | 105 // Detaches from the remote object. The Bus object will take care of |
| 104 // detaching so you don't have to do this manually. | 106 // detaching so you don't have to do this manually. |
| 105 // | 107 // |
| 106 // BLOCKING CALL. | 108 // BLOCKING CALL. |
| 107 virtual void Detach(); | 109 virtual void Detach(); |
| 108 | 110 |
| 111 // Returns an empty callback that does nothing. Can be used for |
| 112 // CallMethod(). |
| 113 static ResponseCallback EmptyResponseCallback(); |
| 114 |
| 109 protected: | 115 protected: |
| 110 // This is protected, so we can define sub classes. | 116 // This is protected, so we can define sub classes. |
| 111 virtual ~ObjectProxy(); | 117 virtual ~ObjectProxy(); |
| 112 | 118 |
| 113 private: | 119 private: |
| 114 friend class base::RefCountedThreadSafe<ObjectProxy>; | 120 friend class base::RefCountedThreadSafe<ObjectProxy>; |
| 115 | 121 |
| 116 // Struct of data we'll be passing from StartAsyncMethodCall() to | 122 // Struct of data we'll be passing from StartAsyncMethodCall() to |
| 117 // OnPendingCallIsCompleteThunk(). | 123 // OnPendingCallIsCompleteThunk(). |
| 118 struct OnPendingCallIsCompleteData { | 124 struct OnPendingCallIsCompleteData { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 MethodTable method_table_; | 194 MethodTable method_table_; |
| 189 | 195 |
| 190 std::vector<std::string> match_rules_; | 196 std::vector<std::string> match_rules_; |
| 191 | 197 |
| 192 DISALLOW_COPY_AND_ASSIGN(ObjectProxy); | 198 DISALLOW_COPY_AND_ASSIGN(ObjectProxy); |
| 193 }; | 199 }; |
| 194 | 200 |
| 195 } // namespace dbus | 201 } // namespace dbus |
| 196 | 202 |
| 197 #endif // DBUS_OBJECT_PROXY_H_ | 203 #endif // DBUS_OBJECT_PROXY_H_ |
| OLD | NEW |