summaryrefslogtreecommitdiffstats
path: root/mojo
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-12 16:16:32 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-12 16:16:32 +0000
commitf1fb414402ac6077d6d424f1eddfca69bb7fc00a (patch)
tree920a8d1f8eb44fc9e62f7fef148a45218d2e7bde /mojo
parent1b830e9cb3214f10573a31e436027c35f2a3c8f9 (diff)
downloadchromium_src-f1fb414402ac6077d6d424f1eddfca69bb7fc00a.zip
chromium_src-f1fb414402ac6077d6d424f1eddfca69bb7fc00a.tar.gz
chromium_src-f1fb414402ac6077d6d424f1eddfca69bb7fc00a.tar.bz2
Fix text input.
The mock input method wasn't filtering WM_CHARs. R=sky@chromium.org http://crbug.com/365012 Review URL: https://codereview.chromium.org/329803002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@276700 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo')
-rw-r--r--mojo/views/native_widget_view_manager.cc46
1 files changed, 5 insertions, 41 deletions
diff --git a/mojo/views/native_widget_view_manager.cc b/mojo/views/native_widget_view_manager.cc
index 05e33d6..2b342d8 100644
--- a/mojo/views/native_widget_view_manager.cc
+++ b/mojo/views/native_widget_view_manager.cc
@@ -10,9 +10,9 @@
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h"
#include "ui/aura/window_event_dispatcher.h"
+#include "ui/base/ime/input_method.h"
#include "ui/base/ime/input_method_delegate.h"
#include "ui/base/ime/input_method_factory.h"
-#include "ui/base/ime/mock_input_method.h"
#include "ui/base/ime/text_input_client.h"
#include "ui/wm/core/base_focus_rules.h"
#include "ui/wm/core/focus_controller.h"
@@ -34,50 +34,14 @@ class FocusRulesImpl : public wm::BaseFocusRules {
DISALLOW_COPY_AND_ASSIGN(FocusRulesImpl);
};
-class InputMethodImpl : public ui::MockInputMethod {
- public:
- explicit InputMethodImpl(ui::internal::InputMethodDelegate* delegate)
- : MockInputMethod(delegate),
- delegate_(delegate) {
- }
- virtual ~InputMethodImpl() {
- }
-
- // MockInputMethod:
- virtual bool DispatchKeyEvent(const ui::KeyEvent& event) OVERRIDE {
- // If no text input client, do nothing.
- if (!GetTextInputClient())
- return DispatchKeyEventPostIME(event);
-
- const bool handled = DispatchKeyEventPostIME(event);
- if (event.type() == ui::ET_KEY_PRESSED && GetTextInputClient()) {
- const uint16 ch = event.GetCharacter();
- if (ch) {
- GetTextInputClient()->InsertChar(ch, event.flags());
- return true;
- }
- }
- return handled;
- }
-
- private:
- bool DispatchKeyEventPostIME(const ui::KeyEvent& event) const {
- return delegate_ && delegate_->DispatchKeyEventPostIME(event);
- }
-
- ui::internal::InputMethodDelegate* delegate_;
-
- DISALLOW_COPY_AND_ASSIGN(InputMethodImpl);
-};
-
class MinimalInputEventFilter : public ui::internal::InputMethodDelegate,
public ui::EventHandler {
public:
explicit MinimalInputEventFilter(aura::Window* root)
- : root_(root) {
- ui::SetUpInputMethodFactoryForTesting();
- input_method_.reset(new InputMethodImpl(this));
- ui::InitializeInputMethod();
+ : root_(root),
+ input_method_(
+ ui::CreateInputMethod(this, gfx::kNullAcceleratedWidget).Pass()) {
+ ui::InitializeInputMethodForTesting();
input_method_->Init(true);
root_->AddPreTargetHandler(this);
root_->SetProperty(aura::client::kRootWindowInputMethodKey,