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

Unified Diff: mojo/views/native_widget_view_manager.cc

Issue 329803002: Fix text input. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 6 months 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/views/native_widget_view_manager.cc
diff --git a/mojo/views/native_widget_view_manager.cc b/mojo/views/native_widget_view_manager.cc
index 05e33d6e7f661e56bd9741b7a388b01b2d40e9ba..2b342d8797086d25f61cadf39193526b31bac4b4 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,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698