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

Side by Side Diff: ui/aura/window_event_dispatcher.cc

Issue 2909603002: Revert of Remove InputMethodEventHandler. (Closed)
Patch Set: Created 3 years, 7 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 | « ui/aura/window_event_dispatcher.h ('k') | ui/aura/window_tree_host.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 "ui/aura/window_event_dispatcher.h" 5 #include "ui/aura/window_event_dispatcher.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/threading/thread_task_runner_handle.h" 11 #include "base/threading/thread_task_runner_handle.h"
12 #include "base/trace_event/trace_event.h" 12 #include "base/trace_event/trace_event.h"
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 #include "ui/aura/client/capture_client.h" 14 #include "ui/aura/client/capture_client.h"
15 #include "ui/aura/client/cursor_client.h" 15 #include "ui/aura/client/cursor_client.h"
16 #include "ui/aura/client/event_client.h" 16 #include "ui/aura/client/event_client.h"
17 #include "ui/aura/client/focus_client.h" 17 #include "ui/aura/client/focus_client.h"
18 #include "ui/aura/client/screen_position_client.h" 18 #include "ui/aura/client/screen_position_client.h"
19 #include "ui/aura/env.h" 19 #include "ui/aura/env.h"
20 #include "ui/aura/env_input_state_controller.h" 20 #include "ui/aura/env_input_state_controller.h"
21 #include "ui/aura/mus/mus_mouse_location_updater.h" 21 #include "ui/aura/mus/mus_mouse_location_updater.h"
22 #include "ui/aura/window.h" 22 #include "ui/aura/window.h"
23 #include "ui/aura/window_delegate.h" 23 #include "ui/aura/window_delegate.h"
24 #include "ui/aura/window_targeter.h" 24 #include "ui/aura/window_targeter.h"
25 #include "ui/aura/window_tracker.h" 25 #include "ui/aura/window_tracker.h"
26 #include "ui/aura/window_tree_host.h" 26 #include "ui/aura/window_tree_host.h"
27 #include "ui/base/hit_test.h" 27 #include "ui/base/hit_test.h"
28 #include "ui/base/ime/input_method.h"
29 #include "ui/compositor/dip_util.h" 28 #include "ui/compositor/dip_util.h"
30 #include "ui/events/event.h" 29 #include "ui/events/event.h"
31 #include "ui/events/event_utils.h" 30 #include "ui/events/event_utils.h"
32 #include "ui/events/gestures/gesture_recognizer.h" 31 #include "ui/events/gestures/gesture_recognizer.h"
33 #include "ui/events/gestures/gesture_types.h" 32 #include "ui/events/gestures/gesture_types.h"
34 33
35 typedef ui::EventDispatchDetails DispatchDetails; 34 typedef ui::EventDispatchDetails DispatchDetails;
36 35
37 namespace aura { 36 namespace aura {
38 37
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 : host_(host), 85 : host_(host),
87 mouse_pressed_handler_(NULL), 86 mouse_pressed_handler_(NULL),
88 mouse_moved_handler_(NULL), 87 mouse_moved_handler_(NULL),
89 event_dispatch_target_(NULL), 88 event_dispatch_target_(NULL),
90 old_dispatch_target_(NULL), 89 old_dispatch_target_(NULL),
91 synthesize_mouse_move_(false), 90 synthesize_mouse_move_(false),
92 move_hold_count_(0), 91 move_hold_count_(0),
93 dispatching_held_event_(nullptr), 92 dispatching_held_event_(nullptr),
94 observer_manager_(this), 93 observer_manager_(this),
95 event_targeter_(new WindowTargeter), 94 event_targeter_(new WindowTargeter),
96 skip_ime_(false),
97 repost_event_factory_(this), 95 repost_event_factory_(this),
98 held_event_factory_(this) { 96 held_event_factory_(this) {
99 ui::GestureRecognizer::Get()->AddGestureEventHelper(this); 97 ui::GestureRecognizer::Get()->AddGestureEventHelper(this);
100 Env::GetInstance()->AddObserver(this); 98 Env::GetInstance()->AddObserver(this);
101 if (Env::GetInstance()->mode() == Env::Mode::MUS) 99 if (Env::GetInstance()->mode() == Env::Mode::MUS)
102 mus_mouse_location_updater_ = base::MakeUnique<MusMouseLocationUpdater>(); 100 mus_mouse_location_updater_ = base::MakeUnique<MusMouseLocationUpdater>();
103 } 101 }
104 102
105 WindowEventDispatcher::~WindowEventDispatcher() { 103 WindowEventDispatcher::~WindowEventDispatcher() {
106 TRACE_EVENT0("shutdown", "WindowEventDispatcher::Destructor"); 104 TRACE_EVENT0("shutdown", "WindowEventDispatcher::Destructor");
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 } 512 }
515 } 513 }
516 514
517 DispatchDetails details; 515 DispatchDetails details;
518 if (event->IsMouseEvent()) { 516 if (event->IsMouseEvent()) {
519 details = PreDispatchMouseEvent(target_window, event->AsMouseEvent()); 517 details = PreDispatchMouseEvent(target_window, event->AsMouseEvent());
520 } else if (event->IsScrollEvent()) { 518 } else if (event->IsScrollEvent()) {
521 details = PreDispatchLocatedEvent(target_window, event->AsScrollEvent()); 519 details = PreDispatchLocatedEvent(target_window, event->AsScrollEvent());
522 } else if (event->IsTouchEvent()) { 520 } else if (event->IsTouchEvent()) {
523 details = PreDispatchTouchEvent(target_window, event->AsTouchEvent()); 521 details = PreDispatchTouchEvent(target_window, event->AsTouchEvent());
524 } else if (event->IsKeyEvent()) {
525 details = PreDispatchKeyEvent(event->AsKeyEvent());
526 } 522 }
527 if (details.dispatcher_destroyed || details.target_destroyed) 523 if (details.dispatcher_destroyed || details.target_destroyed)
528 return details; 524 return details;
529 525
530 old_dispatch_target_ = event_dispatch_target_; 526 old_dispatch_target_ = event_dispatch_target_;
531 event_dispatch_target_ = target_window; 527 event_dispatch_target_ = target_window;
532 return DispatchDetails(); 528 return DispatchDetails();
533 } 529 }
534 530
535 ui::EventDispatchDetails WindowEventDispatcher::PostDispatchEvent( 531 ui::EventDispatchDetails WindowEventDispatcher::PostDispatchEvent(
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 return DispatchDetails(); 922 return DispatchDetails();
927 } 923 }
928 924
929 // This flag is set depending on the gestures recognized in the call above, 925 // This flag is set depending on the gestures recognized in the call above,
930 // and needs to propagate with the forwarded event. 926 // and needs to propagate with the forwarded event.
931 event->set_may_cause_scrolling(orig_event.may_cause_scrolling()); 927 event->set_may_cause_scrolling(orig_event.may_cause_scrolling());
932 928
933 return PreDispatchLocatedEvent(target, event); 929 return PreDispatchLocatedEvent(target, event);
934 } 930 }
935 931
936 ui::EventDispatchDetails WindowEventDispatcher::PreDispatchKeyEvent(
937 ui::KeyEvent* event) {
938 if (skip_ime_ || !host_->has_input_method() ||
939 (event->flags() & ui::EF_IS_SYNTHESIZED))
940 return ui::EventDispatchDetails();
941 host_->GetInputMethod()->DispatchKeyEvent(event);
942 event->StopPropagation();
943 return ui::EventDispatchDetails();
944 }
945
946 } // namespace aura 932 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/window_event_dispatcher.h ('k') | ui/aura/window_tree_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698