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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chromeos/dbus/dbus.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) 2009 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium OS 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 CHROMEOS_DBUS_H_ 5 #ifndef CHROMEOS_DBUS_H_
6 #define CHROMEOS_DBUS_H_ 6 #define CHROMEOS_DBUS_H_
7 7
8 #include <dbus/dbus-glib.h> 8 #include <dbus/dbus-glib.h>
9 #include <glib-object.h> 9 #include <glib-object.h>
10 10
11 #include <algorithm> 11 #include <algorithm>
12 #include <string> 12 #include <string>
13 13
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "chromeos/glib/object.h" 15 #include "chromeos/glib/object.h"
16 16
17 struct DBusMessage;
18 struct DBusConnection;
19
17 namespace chromeos { 20 namespace chromeos {
18 21
19 // \precondition No functions in the dbus namespace can be called before 22 // \precondition No functions in the dbus namespace can be called before
20 // ::g_type_init(); 23 // ::g_type_init();
21 24
22 namespace dbus { 25 namespace dbus {
23 26
24 // \brief BusConnection manages the ref-count for a ::DBusGConnection*. 27 // \brief BusConnection manages the ref-count for a ::DBusGConnection*.
25 // 28 //
26 // A BusConnection has reference semantics bound to a particular communication 29 // A BusConnection has reference semantics bound to a particular communication
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 412
410 BusConnection GetPrivateBusConnection(const char* address); 413 BusConnection GetPrivateBusConnection(const char* address);
411 414
412 // \brief Sends a signal named |signal_name| with no arguments to the 415 // \brief Sends a signal named |signal_name| with no arguments to the
413 // system bus per the given |path| and |interface_name|. 416 // system bus per the given |path| and |interface_name|.
414 417
415 void SendSignalWithNoArgumentsToSystemBus(const char* path, 418 void SendSignalWithNoArgumentsToSystemBus(const char* path,
416 const char* interface_name, 419 const char* interface_name,
417 const char* signal_name); 420 const char* signal_name);
418 421
422 // \brief Low-level signal monitor base class.
423 //
424 // Used when there is no definite named signal sender (that Proxy
425 // could be used for).
426
427 class SignalWatcher {
428 public:
429 SignalWatcher() {}
430 ~SignalWatcher();
431 void StartMonitoring(const std::string& interface, const std::string& signal);
432 private:
433
434 // Callback invoked on the given signal arrival.
435 virtual void OnSignal(DBusMessage* message) = 0;
436
437 // Returns a string matching the D-Bus messages that we want to listen for.
438 std::string GetDBusMatchString() const;
439
440 // A D-Bus message filter to receive signals.
441 static DBusHandlerResult FilterDBusMessage(DBusConnection* dbus_conn,
442 DBusMessage* message,
443 void* data);
444 std::string interface_;
445 std::string signal_;
446 };
447
419 } // namespace dbus 448 } // namespace dbus
420 } // namespace chromeos 449 } // namespace chromeos
421 450
422 #endif // CHROMEOS_DBUS_H_ 451 #endif // CHROMEOS_DBUS_H_
OLDNEW
« 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