| Index: views/ime/input_method_ibus.cc
|
| diff --git a/views/ime/input_method_ibus.cc b/views/ime/input_method_ibus.cc
|
| index a20e05a2ffe2839e40ffb4bbc291be62faf72b78..c8d72511e0a845e35313991479e2121ca6d6b815 100644
|
| --- a/views/ime/input_method_ibus.cc
|
| +++ b/views/ime/input_method_ibus.cc
|
| @@ -14,6 +14,7 @@
|
| #include <X11/Xutil.h>
|
| #endif
|
|
|
| +#include "base/command_line.h"
|
| #include "base/basictypes.h"
|
| #include "base/i18n/char_iterator.h"
|
| #include "base/logging.h"
|
| @@ -31,6 +32,9 @@
|
|
|
| namespace {
|
|
|
| +// A global flag to switch the InputMethod implementation to InputMethodIBus
|
| +bool inputmethod_ibus_enabled = false;
|
| +
|
| // Converts ibus key state flags to Views event flags.
|
| int ViewsFlagsFromIBusState(guint32 state) {
|
| return (state & IBUS_LOCK_MASK ? ui::EF_CAPS_LOCK_DOWN : 0) |
|
| @@ -126,6 +130,9 @@ void ExtractCompositionTextFromIBusPreedit(IBusText* text,
|
| }
|
| }
|
|
|
| +// A switch to enable InputMethodIBus
|
| +const char kEnableInputMethodIBusSwitch[] = "enable-inputmethod-ibus";
|
| +
|
| } // namespace
|
|
|
| namespace views {
|
| @@ -409,6 +416,22 @@ bool InputMethodIBus::IsActive() {
|
| return context_ != NULL;
|
| }
|
|
|
| +// static
|
| +bool InputMethodIBus::IsInputMethodIBusEnabled() {
|
| +#if defined(TOUCH_UI)
|
| + return true;
|
| +#else
|
| + return inputmethod_ibus_enabled ||
|
| + CommandLine::ForCurrentProcess()->HasSwitch(
|
| + kEnableInputMethodIBusSwitch);
|
| +#endif
|
| +}
|
| +
|
| +// static
|
| +void InputMethodIBus::SetEnableInputMethodIBus(bool enabled) {
|
| + inputmethod_ibus_enabled = enabled;
|
| +}
|
| +
|
| void InputMethodIBus::FocusedViewWillChange() {
|
| ConfirmCompositionText();
|
| }
|
|
|