| OLD | NEW |
| 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" |
| 28 #include "ui/compositor/dip_util.h" | 29 #include "ui/compositor/dip_util.h" |
| 29 #include "ui/events/event.h" | 30 #include "ui/events/event.h" |
| 30 #include "ui/events/event_utils.h" | 31 #include "ui/events/event_utils.h" |
| 31 #include "ui/events/gestures/gesture_recognizer.h" | 32 #include "ui/events/gestures/gesture_recognizer.h" |
| 32 #include "ui/events/gestures/gesture_types.h" | 33 #include "ui/events/gestures/gesture_types.h" |
| 33 | 34 |
| 34 typedef ui::EventDispatchDetails DispatchDetails; | 35 typedef ui::EventDispatchDetails DispatchDetails; |
| 35 | 36 |
| 36 namespace aura { | 37 namespace aura { |
| 37 | 38 |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 } | 513 } |
| 513 } | 514 } |
| 514 | 515 |
| 515 DispatchDetails details; | 516 DispatchDetails details; |
| 516 if (event->IsMouseEvent()) { | 517 if (event->IsMouseEvent()) { |
| 517 details = PreDispatchMouseEvent(target_window, event->AsMouseEvent()); | 518 details = PreDispatchMouseEvent(target_window, event->AsMouseEvent()); |
| 518 } else if (event->IsScrollEvent()) { | 519 } else if (event->IsScrollEvent()) { |
| 519 details = PreDispatchLocatedEvent(target_window, event->AsScrollEvent()); | 520 details = PreDispatchLocatedEvent(target_window, event->AsScrollEvent()); |
| 520 } else if (event->IsTouchEvent()) { | 521 } else if (event->IsTouchEvent()) { |
| 521 details = PreDispatchTouchEvent(target_window, event->AsTouchEvent()); | 522 details = PreDispatchTouchEvent(target_window, event->AsTouchEvent()); |
| 523 } else if (event->IsKeyEvent()) { |
| 524 details = PreDispatchKeyEvent(event->AsKeyEvent()); |
| 522 } | 525 } |
| 523 if (details.dispatcher_destroyed || details.target_destroyed) | 526 if (details.dispatcher_destroyed || details.target_destroyed) |
| 524 return details; | 527 return details; |
| 525 | 528 |
| 526 old_dispatch_target_ = event_dispatch_target_; | 529 old_dispatch_target_ = event_dispatch_target_; |
| 527 event_dispatch_target_ = target_window; | 530 event_dispatch_target_ = target_window; |
| 528 return DispatchDetails(); | 531 return DispatchDetails(); |
| 529 } | 532 } |
| 530 | 533 |
| 531 ui::EventDispatchDetails WindowEventDispatcher::PostDispatchEvent( | 534 ui::EventDispatchDetails WindowEventDispatcher::PostDispatchEvent( |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 return DispatchDetails(); | 925 return DispatchDetails(); |
| 923 } | 926 } |
| 924 | 927 |
| 925 // This flag is set depending on the gestures recognized in the call above, | 928 // This flag is set depending on the gestures recognized in the call above, |
| 926 // and needs to propagate with the forwarded event. | 929 // and needs to propagate with the forwarded event. |
| 927 event->set_may_cause_scrolling(orig_event.may_cause_scrolling()); | 930 event->set_may_cause_scrolling(orig_event.may_cause_scrolling()); |
| 928 | 931 |
| 929 return PreDispatchLocatedEvent(target, event); | 932 return PreDispatchLocatedEvent(target, event); |
| 930 } | 933 } |
| 931 | 934 |
| 935 ui::EventDispatchDetails WindowEventDispatcher::PreDispatchKeyEvent( |
| 936 ui::KeyEvent* event) { |
| 937 if (skip_ime_ || !host_->has_input_method() || |
| 938 (event->flags() & ui::EF_IS_SYNTHESIZED)) |
| 939 return ui::EventDispatchDetails(); |
| 940 host_->GetInputMethod()->DispatchKeyEvent(event); |
| 941 event->StopPropagation(); |
| 942 return ui::EventDispatchDetails(); |
| 943 } |
| 944 |
| 932 } // namespace aura | 945 } // namespace aura |
| OLD | NEW |