| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium 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 DBUS_BUS_H_ | 5 #ifndef DBUS_BUS_H_ |
| 6 #define DBUS_BUS_H_ | 6 #define DBUS_BUS_H_ |
| 7 | 7 |
| 8 #include <dbus/dbus.h> | 8 #include <dbus/dbus.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 SHARED, | 161 SHARED, |
| 162 }; | 162 }; |
| 163 | 163 |
| 164 // Specifies whether the GetServiceOwnerAndBlock call should report or | 164 // Specifies whether the GetServiceOwnerAndBlock call should report or |
| 165 // suppress errors. | 165 // suppress errors. |
| 166 enum GetServiceOwnerOption { | 166 enum GetServiceOwnerOption { |
| 167 REPORT_ERRORS, | 167 REPORT_ERRORS, |
| 168 SUPPRESS_ERRORS, | 168 SUPPRESS_ERRORS, |
| 169 }; | 169 }; |
| 170 | 170 |
| 171 // Specifies service ownership options. |
| 172 // |
| 173 // REQUIRE_PRIMARY indicates that you require primary ownership of the |
| 174 // service name. |
| 175 // |
| 176 // ALLOW_REPLACEMENT indicates that you'll allow another connection to |
| 177 // steal ownership of this service name from you. |
| 178 // |
| 179 // REQUIRE_PRIMARY_ALLOW_REPLACEMENT does the obvious. |
| 180 enum ServiceOwnershipOptions { |
| 181 REQUIRE_PRIMARY = (DBUS_NAME_FLAG_DO_NOT_QUEUE | |
| 182 DBUS_NAME_FLAG_REPLACE_EXISTING), |
| 183 REQUIRE_PRIMARY_ALLOW_REPLACEMENT = (REQUIRE_PRIMARY | |
| 184 DBUS_NAME_FLAG_ALLOW_REPLACEMENT), |
| 185 }; |
| 186 |
| 171 // Options used to create a Bus object. | 187 // Options used to create a Bus object. |
| 172 struct CHROME_DBUS_EXPORT Options { | 188 struct CHROME_DBUS_EXPORT Options { |
| 173 Options(); | 189 Options(); |
| 174 ~Options(); | 190 ~Options(); |
| 175 | 191 |
| 176 BusType bus_type; // SESSION by default. | 192 BusType bus_type; // SESSION by default. |
| 177 ConnectionType connection_type; // PRIVATE by default. | 193 ConnectionType connection_type; // PRIVATE by default. |
| 178 // If dbus_task_runner is set, the bus object will use that | 194 // If dbus_task_runner is set, the bus object will use that |
| 179 // task runner to process asynchronous operations. | 195 // task runner to process asynchronous operations. |
| 180 // | 196 // |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 virtual void ClosePrivateConnection(); | 407 virtual void ClosePrivateConnection(); |
| 392 | 408 |
| 393 // Requests the ownership of the service name given by |service_name|. | 409 // Requests the ownership of the service name given by |service_name|. |
| 394 // See also RequestOwnershipAndBlock(). | 410 // See also RequestOwnershipAndBlock(). |
| 395 // | 411 // |
| 396 // |on_ownership_callback| is called when the service name is obtained | 412 // |on_ownership_callback| is called when the service name is obtained |
| 397 // or failed to be obtained, in the origin thread. | 413 // or failed to be obtained, in the origin thread. |
| 398 // | 414 // |
| 399 // Must be called in the origin thread. | 415 // Must be called in the origin thread. |
| 400 virtual void RequestOwnership(const std::string& service_name, | 416 virtual void RequestOwnership(const std::string& service_name, |
| 417 ServiceOwnershipOptions options, |
| 401 OnOwnershipCallback on_ownership_callback); | 418 OnOwnershipCallback on_ownership_callback); |
| 402 | 419 |
| 403 // Requests the ownership of the given service name. | 420 // Requests the ownership of the given service name. |
| 404 // Returns true on success, or the the service name is already obtained. | 421 // Returns true on success, or the the service name is already obtained. |
| 405 // | 422 // |
| 406 // BLOCKING CALL. | 423 // BLOCKING CALL. |
| 407 virtual bool RequestOwnershipAndBlock(const std::string& service_name); | 424 virtual bool RequestOwnershipAndBlock(const std::string& service_name, |
| 425 ServiceOwnershipOptions options); |
| 408 | 426 |
| 409 // Releases the ownership of the given service name. | 427 // Releases the ownership of the given service name. |
| 410 // Returns true on success. | 428 // Returns true on success. |
| 411 // | 429 // |
| 412 // BLOCKING CALL. | 430 // BLOCKING CALL. |
| 413 virtual bool ReleaseOwnership(const std::string& service_name); | 431 virtual bool ReleaseOwnership(const std::string& service_name); |
| 414 | 432 |
| 415 // Sets up async operations. | 433 // Sets up async operations. |
| 416 // Returns true on success, or it's already set up. | 434 // Returns true on success, or it's already set up. |
| 417 // This function needs to be called before starting async operations. | 435 // This function needs to be called before starting async operations. |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 | 619 |
| 602 // Helper function used for UnregisterExportedObject(). | 620 // Helper function used for UnregisterExportedObject(). |
| 603 void UnregisterExportedObjectInternal( | 621 void UnregisterExportedObjectInternal( |
| 604 scoped_refptr<dbus::ExportedObject> exported_object); | 622 scoped_refptr<dbus::ExportedObject> exported_object); |
| 605 | 623 |
| 606 // Helper function used for ShutdownOnDBusThreadAndBlock(). | 624 // Helper function used for ShutdownOnDBusThreadAndBlock(). |
| 607 void ShutdownOnDBusThreadAndBlockInternal(); | 625 void ShutdownOnDBusThreadAndBlockInternal(); |
| 608 | 626 |
| 609 // Helper function used for RequestOwnership(). | 627 // Helper function used for RequestOwnership(). |
| 610 void RequestOwnershipInternal(const std::string& service_name, | 628 void RequestOwnershipInternal(const std::string& service_name, |
| 629 ServiceOwnershipOptions options, |
| 611 OnOwnershipCallback on_ownership_callback); | 630 OnOwnershipCallback on_ownership_callback); |
| 612 | 631 |
| 613 // Helper function used for GetServiceOwner(). | 632 // Helper function used for GetServiceOwner(). |
| 614 void GetServiceOwnerInternal(const std::string& service_name, | 633 void GetServiceOwnerInternal(const std::string& service_name, |
| 615 const GetServiceOwnerCallback& callback); | 634 const GetServiceOwnerCallback& callback); |
| 616 | 635 |
| 617 // Helper function used for ListenForServiceOwnerChange(). | 636 // Helper function used for ListenForServiceOwnerChange(). |
| 618 void ListenForServiceOwnerChangeInternal( | 637 void ListenForServiceOwnerChangeInternal( |
| 619 const std::string& service_name, | 638 const std::string& service_name, |
| 620 const GetServiceOwnerCallback& callback); | 639 const GetServiceOwnerCallback& callback); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 | 764 |
| 746 std::string address_; | 765 std::string address_; |
| 747 base::Closure on_disconnected_closure_; | 766 base::Closure on_disconnected_closure_; |
| 748 | 767 |
| 749 DISALLOW_COPY_AND_ASSIGN(Bus); | 768 DISALLOW_COPY_AND_ASSIGN(Bus); |
| 750 }; | 769 }; |
| 751 | 770 |
| 752 } // namespace dbus | 771 } // namespace dbus |
| 753 | 772 |
| 754 #endif // DBUS_BUS_H_ | 773 #endif // DBUS_BUS_H_ |
| OLD | NEW |