| Index: chromeos_input_method.cc
|
| diff --git a/chromeos_input_method.cc b/chromeos_input_method.cc
|
| index 5bc2c1120593743d5c7c155a86021ae4a5f9d479..3eee4bc8b7afc0d736e00d962505f8e1344a3011 100644
|
| --- a/chromeos_input_method.cc
|
| +++ b/chromeos_input_method.cc
|
| @@ -30,6 +30,7 @@
|
| namespace {
|
|
|
| // TODO(yusukes): Remove all code for ibus-1.3 once we finish migrating to 1.4.
|
| +// http://crosbug.com/10838
|
| #if !IBUS_CHECK_VERSION(1, 3, 99)
|
| #define ibus_engine_desc_get_name(d) ((d)->name)
|
| #define ibus_engine_desc_get_longname(d) ((d)->longname)
|
| @@ -460,6 +461,29 @@ class InputMethodStatusConnection {
|
| #endif
|
| }
|
|
|
| + // Called by cros API ChromeOSStopInputMethodProcess().
|
| + bool StopInputMethodProcess() {
|
| +#if IBUS_CHECK_VERSION(1, 3, 99)
|
| + if (!IBusConnectionIsAlive()) {
|
| + LOG(ERROR) << "StopInputMethodProcess: IBus connection is not alive";
|
| + return false;
|
| + }
|
| + ibus_bus_exit(ibus_, FALSE /* do not restart */);
|
| + if (ibus_config_) {
|
| + // Release |ibus_config_| to make sure next IBusConnectionIsAlive() call
|
| + // will return false.
|
| + g_object_unref(ibus_config_);
|
| + ibus_config_ = NULL;
|
| + }
|
| + return true;
|
| +#else
|
| + // For ibus-1.3, we don't implement the API and just return false since
|
| + // libcros's ibus-1.3 support will be removed soon. Chrome will use the
|
| + // kill system call to terminate the daemon.
|
| + return false;
|
| +#endif
|
| + }
|
| +
|
| // InputMethodType is used for GetInputMethods().
|
| enum InputMethodType {
|
| kActiveInputMethods, // Get active input methods.
|
| @@ -1631,6 +1655,12 @@ void ChromeOSDisconnectInputMethodStatus(
|
| }
|
|
|
| extern "C"
|
| +bool ChromeOSStopInputMethodProcess(InputMethodStatusConnection* connection) {
|
| + g_return_val_if_fail(connection, false);
|
| + return connection->StopInputMethodProcess();
|
| +}
|
| +
|
| +extern "C"
|
| InputMethodDescriptors* ChromeOSGetActiveInputMethods(
|
| InputMethodStatusConnection* connection) {
|
| g_return_val_if_fail(connection, NULL);
|
|
|