Chromium Code Reviews| OLD | NEW |
|---|---|
| 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-lowlevel.h> | |
|
Daniel Erat
2011/02/10 23:07:24
do you need this in the header, or can you forward
glotov
2011/02/11 16:36:52
Done.
| |
| 8 #include <dbus/dbus-glib.h> | 9 #include <dbus/dbus-glib.h> |
| 9 #include <glib-object.h> | 10 #include <glib-object.h> |
| 10 | 11 |
| 11 #include <algorithm> | 12 #include <algorithm> |
| 12 #include <string> | 13 #include <string> |
| 13 | 14 |
| 14 #include "base/logging.h" | 15 #include "base/logging.h" |
| 15 #include "chromeos/glib/object.h" | 16 #include "chromeos/glib/object.h" |
| 16 | 17 |
| 17 namespace chromeos { | 18 namespace chromeos { |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 409 | 410 |
| 410 BusConnection GetPrivateBusConnection(const char* address); | 411 BusConnection GetPrivateBusConnection(const char* address); |
| 411 | 412 |
| 412 // \brief Sends a signal named |signal_name| with no arguments to the | 413 // \brief Sends a signal named |signal_name| with no arguments to the |
| 413 // system bus per the given |path| and |interface_name|. | 414 // system bus per the given |path| and |interface_name|. |
| 414 | 415 |
| 415 void SendSignalWithNoArgumentsToSystemBus(const char* path, | 416 void SendSignalWithNoArgumentsToSystemBus(const char* path, |
| 416 const char* interface_name, | 417 const char* interface_name, |
| 417 const char* signal_name); | 418 const char* signal_name); |
| 418 | 419 |
| 420 // \brief Low-level signal monitor base class. | |
| 421 // | |
| 422 // Used when there is no definite named signal sender (that Proxy | |
| 423 // could be used for). | |
| 424 | |
| 425 class MonitorSignal { | |
|
Daniel Erat
2011/02/10 23:13:36
ah, just looked at the change where you're using i
glotov
2011/02/11 16:36:52
Done.
| |
| 426 public: | |
| 427 MonitorSignal() : interface_(NULL), signal_(NULL) {} | |
| 428 ~MonitorSignal(); | |
| 429 void StartMonitoring(const char* interface, const char* signal); | |
|
Daniel Erat
2011/02/10 23:07:24
it might be a bit cleaner to pass |interface| and
glotov
2011/02/11 16:36:52
Start monitoring in ctor is not good because deriv
| |
| 430 private: | |
| 431 // Callback invoked on the given signal arrival. | |
| 432 virtual void OnSignal(DBusMessage* message) = 0; | |
|
Daniel Erat
2011/02/10 23:07:24
nit: add a blank line between each method signatur
glotov
2011/02/11 16:36:52
Done.
| |
| 433 // Returns a string matching the D-Bus messages that we want to listen for. | |
| 434 std::string GetDBusMatchString() const; | |
| 435 // A D-Bus message filter to receive signals. | |
| 436 static DBusHandlerResult FilterDBusMessage(DBusConnection* dbus_conn, | |
| 437 DBusMessage* message, | |
| 438 void* data); | |
| 439 const char* interface_; | |
| 440 const char* signal_; | |
| 441 }; | |
| 442 | |
| 419 } // namespace dbus | 443 } // namespace dbus |
| 420 } // namespace chromeos | 444 } // namespace chromeos |
| 421 | 445 |
| 422 #endif // CHROMEOS_DBUS_H_ | 446 #endif // CHROMEOS_DBUS_H_ |
| OLD | NEW |