Chromium Code Reviews| Index: chrome/browser/chromeos/input_method/ibus_controller_impl.cc |
| diff --git a/chrome/browser/chromeos/input_method/ibus_controller_impl.cc b/chrome/browser/chromeos/input_method/ibus_controller_impl.cc |
| index 10a354a9e7c5bb725a9d1c61288aaa4b0ce4fbb1..17873c6ca845b20b1778cf526c1ecbbfacbec225 100644 |
| --- a/chrome/browser/chromeos/input_method/ibus_controller_impl.cc |
| +++ b/chrome/browser/chromeos/input_method/ibus_controller_impl.cc |
| @@ -12,7 +12,9 @@ |
| #include <stack> |
| #include <utility> |
| +#include "base/environment.h" |
| #include "base/memory/scoped_ptr.h" |
| +#include "base/rand_util.h" |
| #include "base/stringprintf.h" |
| #include "base/string_split.h" |
| #include "chrome/browser/chromeos/input_method/input_method_config.h" |
| @@ -894,6 +896,8 @@ void IBusControllerImpl::UpdateProperty(IBusPanelService* panel, |
| bool IBusControllerImpl::MaybeLaunchIBusDaemon() { |
| static const char kIBusDaemonPath[] = "/usr/bin/ibus-daemon"; |
| + const std::string ibus_address = base::StringPrintf( |
|
Yusuke Sato
2012/04/24 04:58:37
nit: move this down to line 908.
Seigo Nonaka
2012/04/26 00:14:32
Done.
|
| + "unix:abstract=/tmp/ibus-%0lX", base::RandUint64()); |
| if (process_handle_ != base::kNullProcessHandle) { |
| DVLOG(1) << "MaybeLaunchIBusDaemon: ibus-daemon is already running."; |
| @@ -904,14 +908,27 @@ bool IBusControllerImpl::MaybeLaunchIBusDaemon() { |
| // TODO(zork): Send output to /var/log/ibus.log |
| const std::string ibus_daemon_command_line = |
| - base::StringPrintf("%s --panel=disable --cache=none --restart --replace", |
| - kIBusDaemonPath); |
| + base::StringPrintf("%s --panel=disable --cache=none --restart --replace" |
| + " --address=%s", |
| + kIBusDaemonPath, |
| + ibus_address.c_str()); |
| if (!LaunchProcess(ibus_daemon_command_line, |
| &process_handle_, |
| reinterpret_cast<GChildWatchFunc>(OnIBusDaemonExit))) { |
| DVLOG(1) << "Failed to launch " << ibus_daemon_command_line; |
| return false; |
| } |
| + |
| + // To avoid reading address file in UI thread, sets environment variable. The |
|
Yusuke Sato
2012/04/24 04:58:37
You can remove 922-927. See http://codereview.chro
Seigo Nonaka
2012/04/26 00:14:32
Done.
|
| + // libibus uses IBUS_ADDRESS environment variable at first if available. |
| + // https://github.com/ibus/ibus/blob/master/src/ibusshare.c#L188 |
| + // TODO(nona): Remove environment variable after fixing crosbug.com/26334. |
| + scoped_ptr<base::Environment> env(base::Environment::Create()); |
| + env->SetVar("IBUS_ADDRESS", ibus_address.c_str()); |
| + |
| + DBusThreadManager* dbus_thread_manager = DBusThreadManager::Get(); |
| + dbus_thread_manager->InitializeIBusBus(ibus_address); |
|
Yusuke Sato
2012/04/24 04:58:37
It seems that you code does not support dynamic ib
Seigo Nonaka
2012/04/26 00:14:32
I think latest patch support suggested case, howev
Yusuke Sato
2012/04/26 00:46:28
Ah ok, the dynamic shutdown feature is temporarily
Yusuke Sato
2012/04/26 00:48:48
s/crosbug 26443/crosbug 27051/
|
| + |
| return true; |
| } |