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

Unified Diff: chromeos/dbus/dbus.h

Issue 6485006: MonitorSignal low-level wrapper introduced (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/common.git@master
Patch Set: typo Created 9 years, 10 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
« no previous file with comments | « no previous file | chromeos/dbus/dbus.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/dbus/dbus.h
diff --git a/chromeos/dbus/dbus.h b/chromeos/dbus/dbus.h
index 025802160d4f4155ef60a9ea3522171b7fbd7a7b..f786b2b9592c6420c002cc985516852bfba5d6b7 100644
--- a/chromeos/dbus/dbus.h
+++ b/chromeos/dbus/dbus.h
@@ -14,6 +14,9 @@
#include "base/logging.h"
#include "chromeos/glib/object.h"
+struct DBusMessage;
+struct DBusConnection;
+
namespace chromeos {
// \precondition No functions in the dbus namespace can be called before
@@ -416,6 +419,32 @@ void SendSignalWithNoArgumentsToSystemBus(const char* path,
const char* interface_name,
const char* signal_name);
+// \brief Low-level signal monitor base class.
+//
+// Used when there is no definite named signal sender (that Proxy
+// could be used for).
+
+class SignalWatcher {
+ public:
+ SignalWatcher() {}
+ ~SignalWatcher();
+ void StartMonitoring(const std::string& interface, const std::string& signal);
+ private:
+
+ // Callback invoked on the given signal arrival.
+ virtual void OnSignal(DBusMessage* message) = 0;
+
+ // Returns a string matching the D-Bus messages that we want to listen for.
+ std::string GetDBusMatchString() const;
+
+ // A D-Bus message filter to receive signals.
+ static DBusHandlerResult FilterDBusMessage(DBusConnection* dbus_conn,
+ DBusMessage* message,
+ void* data);
+ std::string interface_;
+ std::string signal_;
+};
+
} // namespace dbus
} // namespace chromeos
« no previous file with comments | « no previous file | chromeos/dbus/dbus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698