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..39ad3ea1c2e63f87a4808c291455f18a8e6b632c 100644 |
--- a/chromeos/dbus/dbus_thread_manager.cc |
+++ b/chromeos/dbus/dbus_thread_manager.cc |
@@ -131,11 +131,38 @@ class DBusThreadManagerImpl : public DBusThreadManager { |
} |
// DBusThreadManager override. |
+ virtual void MaybeResetIBusBus(const std::string &ibus_address) OVERRIDE { |
+ if (ibus_address_ == ibus_address) { |
+ // If current address is same as specified, do nothing. |
+ return; |
+ } |
+ |
+ if (ibus_bus_) { |
+ // If old connection is alive, shutdown it at first. |
+ ibus_bus_->ShutdownOnDBusThreadAndBlock(); |
+ } |
+ 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); |
+ ibus_address_ = ibus_address; |
+ VLOG(1) << "Connected to ibus-daemon.(address:" << ibus_address << ")"; |
+ } |
+ |
+ // DBusThreadManager override. |
virtual dbus::Bus* GetSystemBus() OVERRIDE { |
return system_bus_.get(); |
} |
// DBusThreadManager override. |
+ virtual dbus::Bus* GetIBusBus() OVERRIDE { |
+ return ibus_bus_.get(); |
+ } |
+ |
+ // DBusThreadManager override. |
virtual BluetoothAdapterClient* GetBluetoothAdapterClient() OVERRIDE { |
return bluetooth_adapter_client_.get(); |
} |
@@ -247,6 +274,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_; |
@@ -269,6 +297,8 @@ class DBusThreadManagerImpl : public DBusThreadManager { |
scoped_ptr<SessionManagerClient> session_manager_client_; |
scoped_ptr<SpeechSynthesizerClient> speech_synthesizer_client_; |
scoped_ptr<UpdateEngineClient> update_engine_client_; |
+ |
+ std::string ibus_address_; |
}; |
// static |