Index: chromeos/dbus/dbus_thread_manager.cc |
diff --git a/chromeos/dbus/dbus_thread_manager.cc b/chromeos/dbus/dbus_thread_manager.cc |
index 421c2cb0febeee93f0ed10a7d1df680c93204659..c2be8e0d326580eece417bc4178ebac0ac3de932 100644 |
--- a/chromeos/dbus/dbus_thread_manager.cc |
+++ b/chromeos/dbus/dbus_thread_manager.cc |
@@ -5,6 +5,7 @@ |
#include "chromeos/dbus/dbus_thread_manager.h" |
#include "base/chromeos/chromeos_version.h" |
+#include "base/environment.h" |
#include "base/threading/thread.h" |
#include "chromeos/dbus/bluetooth_adapter_client.h" |
#include "chromeos/dbus/bluetooth_device_client.h" |
@@ -53,6 +54,22 @@ class DBusThreadManagerImpl : public DBusThreadManager { |
dbus_thread_->message_loop_proxy(); |
system_bus_ = new dbus::Bus(system_bus_options); |
+ // Create the connection to the ibus bus. |
satorux1
2012/04/23 23:09:21
Is this the right place to connect to the ibus bus
Seigo Nonaka
2012/04/24 00:37:58
Ah yes!
Done.
On 2012/04/23 23:09:21, satorux1 w
|
+ std::string ibus_address; |
+ scoped_ptr<base::Environment> env(base::Environment::Create()); |
+ if (env->GetVar("IBUS_ADDRESS", &ibus_address)) { |
+ dbus::Bus::Options ibus_bus_options; |
+ ibus_bus_options.bus_type = dbus::Bus::CUSTOM_ADDRESS; |
+ ibus_bus_options.address = ibus_address; |
+ ibus_bus_options.connection_type = dbus::Bus::PRIVATE; |
+ ibus_bus_options.dbus_thread_message_loop_proxy = |
+ dbus_thread_->message_loop_proxy(); |
+ ibus_bus_ = new dbus::Bus(ibus_bus_options); |
+ VLOG(1) << "Connected to ibus-daemon.(address:" << ibus_address << ")"; |
+ } else { |
+ LOG(ERROR) << "Can not connect to ibus-daemon."; |
+ } |
+ |
// Determine whether we use stub or real client implementations. |
const DBusClientImplementationType client_type = |
base::chromeos::IsRunningOnChromeOS() ? |
@@ -136,6 +153,11 @@ class DBusThreadManagerImpl : public DBusThreadManager { |
} |
// DBusThreadManager override. |
+ virtual dbus::Bus* GetIBusBus() OVERRIDE { |
+ return ibus_bus_.get(); |
+ } |
+ |
+ // DBusThreadManager override. |
virtual BluetoothAdapterClient* GetBluetoothAdapterClient() OVERRIDE { |
return bluetooth_adapter_client_.get(); |
} |
@@ -247,6 +269,7 @@ class DBusThreadManagerImpl : public DBusThreadManager { |
scoped_ptr<base::Thread> dbus_thread_; |
scoped_refptr<dbus::Bus> system_bus_; |
+ scoped_refptr<dbus::Bus> ibus_bus_; |
scoped_ptr<BluetoothAdapterClient> bluetooth_adapter_client_; |
scoped_ptr<BluetoothDeviceClient> bluetooth_device_client_; |
scoped_ptr<BluetoothInputClient> bluetooth_input_client_; |