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

Side by Side Diff: mojo/views/native_widget_view_manager.cc

Issue 476283006: mojo: Fix double character inserts on Windows by removing a Linux hack. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move input method to its own file. Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « mojo/views/input_method_mojo_linux.cc ('k') | ui/base/ime/input_method_auralinux.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mojo/views/native_widget_view_manager.h" 5 #include "mojo/views/native_widget_view_manager.h"
6 6
7 #include "mojo/aura/window_tree_host_mojo.h" 7 #include "mojo/aura/window_tree_host_mojo.h"
8 #include "mojo/services/public/cpp/input_events/input_events_type_converters.h" 8 #include "mojo/services/public/cpp/input_events/input_events_type_converters.h"
9 #include "ui/aura/client/aura_constants.h" 9 #include "ui/aura/client/aura_constants.h"
10 #include "ui/aura/client/default_capture_client.h" 10 #include "ui/aura/client/default_capture_client.h"
11 #include "ui/aura/window.h" 11 #include "ui/aura/window.h"
12 #include "ui/aura/window_event_dispatcher.h" 12 #include "ui/aura/window_event_dispatcher.h"
13 #include "ui/base/ime/input_method.h" 13 #include "ui/base/ime/input_method.h"
14 #include "ui/base/ime/input_method_base.h"
14 #include "ui/base/ime/input_method_delegate.h" 15 #include "ui/base/ime/input_method_delegate.h"
15 #include "ui/base/ime/input_method_factory.h" 16 #include "ui/base/ime/input_method_factory.h"
16 #include "ui/base/ime/text_input_client.h" 17 #include "ui/base/ime/text_input_client.h"
17 #include "ui/wm/core/base_focus_rules.h" 18 #include "ui/wm/core/base_focus_rules.h"
18 #include "ui/wm/core/capture_controller.h" 19 #include "ui/wm/core/capture_controller.h"
19 #include "ui/wm/core/focus_controller.h" 20 #include "ui/wm/core/focus_controller.h"
20 21
22 #if defined(OS_LINUX)
23 #include "mojo/views/input_method_mojo_linux.h"
24 #endif
25
21 namespace mojo { 26 namespace mojo {
22 namespace { 27 namespace {
23 28
24 // TODO: figure out what this should be. 29 // TODO: figure out what this should be.
25 class FocusRulesImpl : public wm::BaseFocusRules { 30 class FocusRulesImpl : public wm::BaseFocusRules {
26 public: 31 public:
27 FocusRulesImpl() {} 32 FocusRulesImpl() {}
28 virtual ~FocusRulesImpl() {} 33 virtual ~FocusRulesImpl() {}
29 34
30 virtual bool SupportsChildActivation(aura::Window* window) const OVERRIDE { 35 virtual bool SupportsChildActivation(aura::Window* window) const OVERRIDE {
31 return true; 36 return true;
32 } 37 }
33 38
34 private: 39 private:
35 DISALLOW_COPY_AND_ASSIGN(FocusRulesImpl); 40 DISALLOW_COPY_AND_ASSIGN(FocusRulesImpl);
36 }; 41 };
37 42
38 class MinimalInputEventFilter : public ui::internal::InputMethodDelegate, 43 class MinimalInputEventFilter : public ui::internal::InputMethodDelegate,
39 public ui::EventHandler { 44 public ui::EventHandler {
40 public: 45 public:
41 explicit MinimalInputEventFilter(aura::Window* root) 46 explicit MinimalInputEventFilter(aura::Window* root)
42 : root_(root) { 47 : root_(root) {
43 ui::InitializeInputMethodForTesting(); 48 ui::InitializeInputMethodForTesting();
49 #if defined(OS_LINUX)
50 input_method_.reset(new InputMethodMojoLinux(this));
51 #else
44 input_method_ = ui::CreateInputMethod(this, gfx::kNullAcceleratedWidget); 52 input_method_ = ui::CreateInputMethod(this, gfx::kNullAcceleratedWidget);
53 #endif
45 input_method_->Init(true); 54 input_method_->Init(true);
46 root_->AddPreTargetHandler(this); 55 root_->AddPreTargetHandler(this);
47 root_->SetProperty(aura::client::kRootWindowInputMethodKey, 56 root_->SetProperty(aura::client::kRootWindowInputMethodKey,
48 input_method_.get()); 57 input_method_.get());
49 } 58 }
50 59
51 virtual ~MinimalInputEventFilter() { 60 virtual ~MinimalInputEventFilter() {
52 root_->RemovePreTargetHandler(this); 61 root_->RemovePreTargetHandler(this);
53 root_->SetProperty(aura::client::kRootWindowInputMethodKey, 62 root_->SetProperty(aura::client::kRootWindowInputMethodKey,
54 static_cast<ui::InputMethod*>(NULL)); 63 static_cast<ui::InputMethod*>(NULL));
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 } 152 }
144 153
145 void NativeWidgetViewManager::OnViewInputEvent(View* view, 154 void NativeWidgetViewManager::OnViewInputEvent(View* view,
146 const EventPtr& event) { 155 const EventPtr& event) {
147 scoped_ptr<ui::Event> ui_event(event.To<scoped_ptr<ui::Event> >()); 156 scoped_ptr<ui::Event> ui_event(event.To<scoped_ptr<ui::Event> >());
148 if (ui_event) 157 if (ui_event)
149 window_tree_host_->SendEventToProcessor(ui_event.get()); 158 window_tree_host_->SendEventToProcessor(ui_event.get());
150 } 159 }
151 160
152 } // namespace mojo 161 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/views/input_method_mojo_linux.cc ('k') | ui/base/ime/input_method_auralinux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698