diff options
author | nona@chromium.org <nona@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-19 03:20:03 +0000 |
---|---|---|
committer | nona@chromium.org <nona@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-19 03:20:03 +0000 |
commit | 7e1942af8a3fd104735e9c3b7b8800772b8c13b6 (patch) | |
tree | 30363ea070da75f795988eeb5eb277c782ff7266 /dbus/bus.cc | |
parent | 9a5e6aeed9bf7bf92dc2d5a8fb7e92f26a9b9116 (diff) | |
download | chromium_src-7e1942af8a3fd104735e9c3b7b8800772b8c13b6.zip chromium_src-7e1942af8a3fd104735e9c3b7b8800772b8c13b6.tar.gz chromium_src-7e1942af8a3fd104735e9c3b7b8800772b8c13b6.tar.bz2 |
Extends dbus module to accept user specified addresses.
To connect ibus-daemon, needs to extend dbus module to accept user specified addresses.
The ibus provides text inputting features and it is already used in Chrome OS.
The ibus uses dbus protocol but using the ibus-daemon instead of the dbus-daemon.
BUG=chromium-os:26334
TEST=ran dbus_unittests
Review URL: http://codereview.chromium.org/10021044
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132933 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'dbus/bus.cc')
-rw-r--r-- | dbus/bus.cc | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/dbus/bus.cc b/dbus/bus.cc index 91ba252..6e9209b 100644 --- a/dbus/bus.cc +++ b/dbus/bus.cc @@ -186,7 +186,8 @@ Bus::Bus(const Options& options) async_operations_set_up_(false), shutdown_completed_(false), num_pending_watches_(0), - num_pending_timeouts_(0) { + num_pending_timeouts_(0), + address_(options.address) { // This is safe to call multiple times. dbus_threads_init_default(); // The origin message loop is unnecessary if the client uses synchronous @@ -288,11 +289,19 @@ bool Bus::Connect() { return true; ScopedDBusError error; - const DBusBusType dbus_bus_type = static_cast<DBusBusType>(bus_type_); - if (connection_type_ == PRIVATE) { - connection_ = dbus_bus_get_private(dbus_bus_type, error.get()); + if (bus_type_ == CUSTOM_ADDRESS) { + if (connection_type_ == PRIVATE) { + connection_ = dbus_connection_open_private(address_.c_str(), error.get()); + } else { + connection_ = dbus_connection_open(address_.c_str(), error.get()); + } } else { - connection_ = dbus_bus_get(dbus_bus_type, error.get()); + const DBusBusType dbus_bus_type = static_cast<DBusBusType>(bus_type_); + if (connection_type_ == PRIVATE) { + connection_ = dbus_bus_get_private(dbus_bus_type, error.get()); + } else { + connection_ = dbus_bus_get(dbus_bus_type, error.get()); + } } if (!connection_) { LOG(ERROR) << "Failed to connect to the bus: " |