Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Side by Side Diff: dbus/exported_object.h

Issue 9668018: dbus: remove service name from ExportedObject (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: pay more attention when fixing mock Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « dbus/bus_unittest.cc ('k') | dbus/exported_object.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_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 <dbus/dbus.h> 9 #include <dbus/dbus.h>
10 10
(...skipping 17 matching lines...) Expand all
28 28
29 // ExportedObject is used to export objects and methods to other D-Bus 29 // ExportedObject is used to export objects and methods to other D-Bus
30 // clients. 30 // clients.
31 // 31 //
32 // ExportedObject is a ref counted object, to ensure that |this| of the 32 // ExportedObject is a ref counted object, to ensure that |this| of the
33 // object is alive when callbacks referencing |this| are called. 33 // object is alive when callbacks referencing |this| are called.
34 class ExportedObject : public base::RefCountedThreadSafe<ExportedObject> { 34 class ExportedObject : public base::RefCountedThreadSafe<ExportedObject> {
35 public: 35 public:
36 // Client code should use Bus::GetExportedObject() instead of this 36 // Client code should use Bus::GetExportedObject() instead of this
37 // constructor. 37 // constructor.
38 ExportedObject(Bus* bus, 38 ExportedObject(Bus* bus, const ObjectPath& object_path);
39 const std::string& service_name,
40 const ObjectPath& object_path);
41 39
42 // Called to send a response from an exported method. Response* is the 40 // Called to send a response from an exported method. Response* is the
43 // response message. Callers should pass a NULL Response* in the event 41 // response message. Callers should pass a NULL Response* in the event
44 // of an error that prevents the sending of a response. 42 // of an error that prevents the sending of a response.
45 typedef base::Callback<void (Response*)> ResponseSender; 43 typedef base::Callback<void (Response*)> ResponseSender;
46 44
47 // Called when an exported method is called. MethodCall* is the request 45 // Called when an exported method is called. MethodCall* is the request
48 // message. ResponseSender is the callback that should be used to send a 46 // message. ResponseSender is the callback that should be used to send a
49 // response. 47 // response.
50 typedef base::Callback<void (MethodCall*, ResponseSender)> MethodCallCallback; 48 typedef base::Callback<void (MethodCall*, ResponseSender)> MethodCallCallback;
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 // Redirects the function call to HandleMessage(). 148 // Redirects the function call to HandleMessage().
151 static DBusHandlerResult HandleMessageThunk(DBusConnection* connection, 149 static DBusHandlerResult HandleMessageThunk(DBusConnection* connection,
152 DBusMessage* raw_message, 150 DBusMessage* raw_message,
153 void* user_data); 151 void* user_data);
154 152
155 // Redirects the function call to OnUnregistered(). 153 // Redirects the function call to OnUnregistered().
156 static void OnUnregisteredThunk(DBusConnection* connection, 154 static void OnUnregisteredThunk(DBusConnection* connection,
157 void* user_data); 155 void* user_data);
158 156
159 scoped_refptr<Bus> bus_; 157 scoped_refptr<Bus> bus_;
160 std::string service_name_;
161 ObjectPath object_path_; 158 ObjectPath object_path_;
162 bool object_is_registered_; 159 bool object_is_registered_;
163 160
164 // The method table where keys are absolute method names (i.e. interface 161 // The method table where keys are absolute method names (i.e. interface
165 // name + method name), and values are the corresponding callbacks. 162 // name + method name), and values are the corresponding callbacks.
166 typedef std::map<std::string, MethodCallCallback> MethodTable; 163 typedef std::map<std::string, MethodCallCallback> MethodTable;
167 MethodTable method_table_; 164 MethodTable method_table_;
168 }; 165 };
169 166
170 } // namespace dbus 167 } // namespace dbus
171 168
172 #endif // DBUS_EXPORTED_OBJECT_H_ 169 #endif // DBUS_EXPORTED_OBJECT_H_
OLDNEW
« no previous file with comments | « dbus/bus_unittest.cc ('k') | dbus/exported_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698