Chromium Code Reviews| Index: dbus/bus.h |
| diff --git a/dbus/bus.h b/dbus/bus.h |
| index 220ed78af86ca844853fa35ddbe59afea34209ed..0b24cfbb2106915de7d16cbf2e2a8a426c7780c7 100644 |
| --- a/dbus/bus.h |
| +++ b/dbus/bus.h |
| @@ -168,6 +168,22 @@ class CHROME_DBUS_EXPORT Bus : public base::RefCountedThreadSafe<Bus> { |
| SUPPRESS_ERRORS, |
| }; |
| + // Specifies service ownership options. |
| + // |
| + // REQUIRE_PRIMARY indicates that you require primary ownership of the |
| + // service name. |
| + // |
| + // ALLOW_REPLACEMENT indicates that you'll allow another connection to |
| + // steal ownership of this service name from you. |
| + // |
| + // REQUIRE_PRIMARY_ALLOW_REPLACEMENT does the obvious. |
| + enum ServiceOwnershipOptions { |
| + REQUIRE_PRIMARY = (DBUS_NAME_FLAG_DO_NOT_QUEUE | |
| + DBUS_NAME_FLAG_REPLACE_EXISTING), |
| + ALLOW_REPLACEMENT = DBUS_NAME_FLAG_ALLOW_REPLACEMENT, |
|
satorux1
2013/07/26 00:50:12
Don't we need DBUS_NAME_FLAG_DO_NOT_QUEUE for this
Chris Masone
2013/07/26 01:00:24
I thought about doing that, but wasn't sure if it
satorux1
2013/07/26 01:14:45
That's a good point. I think ALLOW_REPLACEMENT alo
Chris Masone
2013/07/26 17:37:24
Done.
|
| + REQUIRE_PRIMARY_ALLOW_REPLACEMENT = REQUIRE_PRIMARY | ALLOW_REPLACEMENT, |
| + }; |
| + |
| // Options used to create a Bus object. |
| struct CHROME_DBUS_EXPORT Options { |
| Options(); |
| @@ -398,13 +414,15 @@ class CHROME_DBUS_EXPORT Bus : public base::RefCountedThreadSafe<Bus> { |
| // |
| // Must be called in the origin thread. |
| virtual void RequestOwnership(const std::string& service_name, |
| + ServiceOwnershipOptions options, |
| OnOwnershipCallback on_ownership_callback); |
| // Requests the ownership of the given service name. |
| // Returns true on success, or the the service name is already obtained. |
| // |
| // BLOCKING CALL. |
| - virtual bool RequestOwnershipAndBlock(const std::string& service_name); |
| + virtual bool RequestOwnershipAndBlock(const std::string& service_name, |
| + ServiceOwnershipOptions options); |
| // Releases the ownership of the given service name. |
| // Returns true on success. |
| @@ -608,6 +626,7 @@ class CHROME_DBUS_EXPORT Bus : public base::RefCountedThreadSafe<Bus> { |
| // Helper function used for RequestOwnership(). |
| void RequestOwnershipInternal(const std::string& service_name, |
| + ServiceOwnershipOptions options, |
| OnOwnershipCallback on_ownership_callback); |
| // Helper function used for GetServiceOwner(). |