Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(554)

Unified Diff: ui/views/widget/native_widget_aura.cc

Issue 8576005: IME (input method editor) support for Aura, part 3 of 3: Use ui::InputMethod in ash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move to ash/ime/ Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/test/views_test_base.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/native_widget_aura.cc
diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc
index 620a08c0154d9c78cb7d0fb5bc5a37c5984830c2..4bd87bb0158ef7ee20fab8cf9c3e539e04c64df3 100644
--- a/ui/views/widget/native_widget_aura.cc
+++ b/ui/views/widget/native_widget_aura.cc
@@ -20,6 +20,7 @@
#include "ui/gfx/compositor/layer.h"
#include "ui/gfx/font.h"
#include "ui/gfx/screen.h"
+#include "ui/views/ime/input_method_bridge.h"
#include "ui/views/widget/drop_helper.h"
#include "ui/views/widget/native_widget_delegate.h"
#include "ui/views/widget/tooltip_manager_aura.h"
@@ -31,12 +32,6 @@
#include "ui/base/l10n/l10n_util_win.h"
#endif
-#if defined(HAVE_IBUS)
-#include "ui/views/ime/input_method_ibus.h"
-#else
-#include "ui/views/ime/mock_input_method.h"
-#endif
-
namespace views {
namespace {
@@ -311,11 +306,10 @@ bool NativeWidgetAura::HasMouseCapture() const {
}
InputMethod* NativeWidgetAura::CreateInputMethod() {
-#if defined(HAVE_IBUS)
- InputMethod* input_method = new InputMethodIBus(this);
-#else
- InputMethod* input_method = new MockInputMethod(this);
-#endif
+ aura::RootWindow* root_window = aura::RootWindow::GetInstance();
+ ui::InputMethod* host = reinterpret_cast<ui::InputMethod*>(
+ root_window->GetProperty(aura::client::kRootWindowInputMethod));
+ InputMethod* input_method = new InputMethodBridge(this, host);
input_method->Init(GetWidget());
return input_method;
}
@@ -637,15 +631,17 @@ void NativeWidgetAura::OnBlur() {
}
bool NativeWidgetAura::OnKeyEvent(aura::KeyEvent* event) {
- // TODO(beng): Need an InputMethodAura to properly handle character events.
- // Right now, we just skip these.
- if (event->is_char())
+ if (event->is_char()) {
+ // If a ui::InputMethod object is attched to the root window, character
+ // events are handled inside the object and are not passed to this function.
+ // If such object is not attached, character events might be sent (e.g. on
+ // Windows). In this case, we just skip these.
return false;
+ }
DCHECK(window_->IsVisible());
InputMethod* input_method = GetWidget()->GetInputMethod();
DCHECK(input_method);
- // TODO(oshima): DispatchKeyEvent should return bool?
KeyEvent views_event(event);
input_method->DispatchKeyEvent(views_event);
return true;
« no previous file with comments | « ui/views/test/views_test_base.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698