diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-07 15:47:05 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-07 15:47:05 +0000 |
commit | 7bd041f4dbbb55ee8f90f36310df994759b4796d (patch) | |
tree | d1a1e3eb6138de38154f572cb64d013f6b14fa69 /views/widget | |
parent | da26674143aa419676ddad552da5c8b5dbc72dc8 (diff) | |
download | chromium_src-7bd041f4dbbb55ee8f90f36310df994759b4796d.zip chromium_src-7bd041f4dbbb55ee8f90f36310df994759b4796d.tar.gz chromium_src-7bd041f4dbbb55ee8f90f36310df994759b4796d.tar.bz2 |
Preliminary InputMethod support for NativeWidgetAura
This should enable key events on aura. This needs more work to get real IME working.
Disable first run dialog on aura. This doesn't work and don't need now.
BUG=97261, 99439
TEST=type in omnibox on aura build
Review URL: http://codereview.chromium.org/8183011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104486 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/widget')
-rw-r--r-- | views/widget/native_widget_aura.cc | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/views/widget/native_widget_aura.cc b/views/widget/native_widget_aura.cc index ed5c2fa..b71992f 100644 --- a/views/widget/native_widget_aura.cc +++ b/views/widget/native_widget_aura.cc @@ -21,6 +21,12 @@ #include "ui/base/l10n/l10n_util_win.h" #endif +#if defined(HAVE_IBUS) +#include "views/ime/input_method_ibus.h" +#else +#include "views/ime/mock_input_method.h" +#endif + namespace views { //////////////////////////////////////////////////////////////////////////////// @@ -171,8 +177,13 @@ bool NativeWidgetAura::HasMouseCapture() const { } InputMethod* NativeWidgetAura::CreateInputMethod() { - NOTIMPLEMENTED(); - return NULL; +#if defined(HAVE_IBUS) + InputMethod* input_method = new InputMethodIBus(this); +#else + InputMethod* input_method = new MockInputMethod(this); +#endif + input_method->Init(GetWidget()); + return input_method; } void NativeWidgetAura::CenterWindow(const gfx::Size& size) { @@ -411,15 +422,32 @@ void NativeWidgetAura::OnBoundsChanged(const gfx::Rect& old_bounds, } void NativeWidgetAura::OnFocus() { + Widget* widget = GetWidget(); + if (widget->is_top_level()) { + InputMethod* input_method = widget->GetInputMethod(); + input_method->OnFocus(); + // See description of got_initial_focus_in_ for details on this. + widget->GetFocusManager()->RestoreFocusedView(); + } delegate_->OnNativeFocus(window_); } void NativeWidgetAura::OnBlur() { + Widget* widget = GetWidget(); + if (widget->is_top_level()) { + InputMethod* input_method = widget->GetInputMethod(); + input_method->OnBlur(); + widget->GetFocusManager()->StoreFocusedView(); + } delegate_->OnNativeBlur(NULL); } bool NativeWidgetAura::OnKeyEvent(aura::KeyEvent* event) { - return delegate_->OnKeyEvent(KeyEvent(event)); + InputMethod* input_method = GetWidget()->GetInputMethod(); + DCHECK(input_method); + // TODO(oshima): DispatchKeyEvent should return bool? + input_method->DispatchKeyEvent(KeyEvent(event)); + return true; } gfx::NativeCursor NativeWidgetAura::GetCursor(const gfx::Point& point) { |