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

Unified Diff: dbus/object_proxy.h

Issue 11199007: Add sender verification of D-Bus signals. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: address comments. Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: dbus/object_proxy.h
diff --git a/dbus/object_proxy.h b/dbus/object_proxy.h
index 9642262be56e909cf099211108e6bae54cc3f09c..f2b247e62cf151f410480f860d524954ac046440 100644
--- a/dbus/object_proxy.h
+++ b/dbus/object_proxy.h
@@ -214,6 +214,10 @@ class ObjectProxy : public base::RefCountedThreadSafe<ObjectProxy> {
DBusHandlerResult HandleMessage(DBusConnection* connection,
DBusMessage* raw_message);
+ // Verifies the sender, checks if we know about the signal, and invokes the
+ // callback if any.
satorux1 2012/10/25 08:56:23 callback if any -> callback associated with the si
Haruki Sato 2012/10/26 05:03:24 Removed method.
+ DBusHandlerResult VerifySenderAndDispatch(scoped_ptr<dbus::Signal> signal);
+
// Runs the method. Helper function for HandleMessage().
void RunMethod(base::TimeTicks start_time,
SignalCallback signal_callback,
@@ -236,6 +240,36 @@ class ObjectProxy : public base::RefCountedThreadSafe<ObjectProxy> {
ResponseCallback response_callback,
ErrorResponse* error_response);
+ // Adds the match rule to the bus and associate the callback with the signal.
+ bool AddMatchRuleWithCallback(const std::string& match_rule,
+ const std::string& absolute_signal_name,
+ SignalCallback signal_callback);
+
+ // Adds the match rule to the bus so that HandleMessage can see the signal.
+ bool AddMatchRuleWithoutCallback(const std::string& match_rule,
+ const std::string& absolute_signal_name);
+
+ // Calls D-Bus's GetNameOwner method asynchronously to update the owner of
+ // |service_name_|. |pending_signal| will be processed after receiving the
+ // response for GetNameOwner. If |pending_signal| is NULL, it just update
+ // the owner information.
+ DBusHandlerResult UpdateNameOwnerAsync(scoped_ptr<Signal> pending_signal);
+
+ // Handles NameOwnerChanged signal from D-Bus's special message bus.
+ DBusHandlerResult HandleNameOwnerChanged(dbus::Signal* signal);
+
+ // Helper Processes the response of GetNameOwner method call.
+ void OnGetNameOwner(Signal* signal, Response* callback);
+
+ // Helper function for OnGetNameOwner.
+ void OnGetNameOwnerOnDbusThread(Signal* signal, Response* callback);
+
+ // Processes the error response of GetNameOwner method call.
+ void OnGetNameOwnerError(Signal* signal, ErrorResponse* callback);
+
+ // Helper function for OnGetNameOwnerError.
+ void OnGetNameOwnerErrorOnDbusThread(Signal* signal, ErrorResponse* callback);
+
scoped_refptr<Bus> bus_;
std::string service_name_;
ObjectPath object_path_;
@@ -252,6 +286,9 @@ class ObjectProxy : public base::RefCountedThreadSafe<ObjectProxy> {
const bool ignore_service_unknown_errors_;
+ // Known name owner of the well-known bus name represnted by |service_name_|.
+ std::string service_name_owner_;
+
DISALLOW_COPY_AND_ASSIGN(ObjectProxy);
};

Powered by Google App Engine
This is Rietveld 408576698