Chromium Code Reviews| Index: dbus/bus.h |
| =================================================================== |
| --- dbus/bus.h (revision 197157) |
| +++ dbus/bus.h (working copy) |
| @@ -211,6 +211,12 @@ |
| // - the requested service name. |
| // - whether ownership has been obtained or not. |
| typedef base::Callback<void (const std::string&, bool)> OnOwnershipCallback; |
| + |
| + // Called when GetServiceOwner() completes. |
| + // |service_owner| is the return value from GetServiceOwnerAndBlock(). |
| + typedef base::Callback<void (const std::string& service_owner)> |
| + GetServiceOwnerCallback; |
| + |
| // TODO(satorux): Remove the service name parameter as the caller of |
| // RequestOwnership() knows the service name. |
| @@ -530,6 +536,19 @@ |
| // AssertOnOriginThread(). |
| virtual void AssertOnDBusThread(); |
| + // Gets the owner for |service_name| via org.freedesktop.DBus.GetNameOwner. |
| + // Returns the owner name, if any, or an empty string on failure. |
| + // Set |suppress_errors| to true to avoid printing error messages. |
| + // |
| + // BLOCKING CALL. |
| + virtual std::string GetServiceOwnerAndBlock(const std::string& service_name, |
|
satorux1
2013/04/30 04:50:00
Seems to me that we we don't need to expose the bl
Lei Zhang
2013/04/30 20:49:23
Used in object_proxy.cc.
|
| + bool suppress_errors); |
|
satorux1
2013/04/30 04:50:00
so far, this is always true, right? please remove
Lei Zhang
2013/04/30 20:49:23
It's false in object_proxy.cc.
satorux1
2013/05/01 01:19:27
I see. Then could you make it an enum as boolean i
Lei Zhang
2013/05/01 01:40:50
Done.
|
| + |
| + // A non-blocking version of GetServiceOwnerAndBlock(). |
| + // Must be called in the origin thread. |
| + virtual void GetServiceOwner(const std::string& service_name, |
| + const GetServiceOwnerCallback& callback); |
| + |
| // Returns true if the bus is connected to D-Bus. |
| bool is_connected() { return connection_ != NULL; } |
| @@ -555,6 +574,10 @@ |
| void RequestOwnershipInternal(const std::string& service_name, |
| OnOwnershipCallback on_ownership_callback); |
| + // Helper function used for GetServiceOwner(). |
| + void GetServiceOwnerInternal(const std::string& service_name, |
| + const GetServiceOwnerCallback& callback); |
| + |
| // Processes the all incoming data to the connection, if any. |
| // |
| // BLOCKING CALL. |