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_EXPORTED_OBJECT_H_ | 5 #ifndef DBUS_EXPORTED_OBJECT_H_ |
6 #define DBUS_EXPORTED_OBJECT_H_ | 6 #define DBUS_EXPORTED_OBJECT_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <map> | 10 #include <map> |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 // Requests to send the signal from this object. The signal will be sent | 79 // Requests to send the signal from this object. The signal will be sent |
80 // asynchronously from the message loop in the D-Bus thread. | 80 // asynchronously from the message loop in the D-Bus thread. |
81 virtual void SendSignal(Signal* signal); | 81 virtual void SendSignal(Signal* signal); |
82 | 82 |
83 // Unregisters the object from the bus. The Bus object will take care of | 83 // Unregisters the object from the bus. The Bus object will take care of |
84 // unregistering so you don't have to do this manually. | 84 // unregistering so you don't have to do this manually. |
85 // | 85 // |
86 // BLOCKING CALL. | 86 // BLOCKING CALL. |
87 virtual void Unregister(); | 87 virtual void Unregister(); |
88 | 88 |
| 89 protected: |
| 90 // This is protected, so we can define sub classes. |
| 91 virtual ~ExportedObject(); |
| 92 |
89 private: | 93 private: |
90 friend class base::RefCountedThreadSafe<ExportedObject>; | 94 friend class base::RefCountedThreadSafe<ExportedObject>; |
91 virtual ~ExportedObject(); | |
92 | 95 |
93 // Helper function for ExportMethod(). | 96 // Helper function for ExportMethod(). |
94 void ExportMethodInternal(const std::string& interface_name, | 97 void ExportMethodInternal(const std::string& interface_name, |
95 const std::string& method_name, | 98 const std::string& method_name, |
96 MethodCallCallback method_call_callback, | 99 MethodCallCallback method_call_callback, |
97 OnExportedCallback exported_callback); | 100 OnExportedCallback exported_callback); |
98 | 101 |
99 // Called when the object is exported. | 102 // Called when the object is exported. |
100 void OnExported(OnExportedCallback on_exported_callback, | 103 void OnExported(OnExportedCallback on_exported_callback, |
101 const std::string& interface_name, | 104 const std::string& interface_name, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 144 |
142 // The method table where keys are absolute method names (i.e. interface | 145 // The method table where keys are absolute method names (i.e. interface |
143 // name + method name), and values are the corresponding callbacks. | 146 // name + method name), and values are the corresponding callbacks. |
144 typedef std::map<std::string, MethodCallCallback> MethodTable; | 147 typedef std::map<std::string, MethodCallCallback> MethodTable; |
145 MethodTable method_table_; | 148 MethodTable method_table_; |
146 }; | 149 }; |
147 | 150 |
148 } // namespace dbus | 151 } // namespace dbus |
149 | 152 |
150 #endif // DBUS_EXPORTED_OBJECT_H_ | 153 #endif // DBUS_EXPORTED_OBJECT_H_ |
OLD | NEW |