| 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" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 : host_(host), | 80 : host_(host), |
| 81 touch_ids_down_(0), | 81 touch_ids_down_(0), |
| 82 mouse_pressed_handler_(NULL), | 82 mouse_pressed_handler_(NULL), |
| 83 mouse_moved_handler_(NULL), | 83 mouse_moved_handler_(NULL), |
| 84 event_dispatch_target_(NULL), | 84 event_dispatch_target_(NULL), |
| 85 old_dispatch_target_(NULL), | 85 old_dispatch_target_(NULL), |
| 86 synthesize_mouse_move_(false), | 86 synthesize_mouse_move_(false), |
| 87 move_hold_count_(0), | 87 move_hold_count_(0), |
| 88 dispatching_held_event_(nullptr), | 88 dispatching_held_event_(nullptr), |
| 89 observer_manager_(this), | 89 observer_manager_(this), |
| 90 transform_events_(true), | |
| 91 repost_event_factory_(this), | 90 repost_event_factory_(this), |
| 92 held_event_factory_(this) { | 91 held_event_factory_(this) { |
| 93 ui::GestureRecognizer::Get()->AddGestureEventHelper(this); | 92 ui::GestureRecognizer::Get()->AddGestureEventHelper(this); |
| 94 Env::GetInstance()->AddObserver(this); | 93 Env::GetInstance()->AddObserver(this); |
| 95 } | 94 } |
| 96 | 95 |
| 97 WindowEventDispatcher::~WindowEventDispatcher() { | 96 WindowEventDispatcher::~WindowEventDispatcher() { |
| 98 TRACE_EVENT0("shutdown", "WindowEventDispatcher::Destructor"); | 97 TRACE_EVENT0("shutdown", "WindowEventDispatcher::Destructor"); |
| 99 Env::GetInstance()->RemoveObserver(this); | 98 Env::GetInstance()->RemoveObserver(this); |
| 100 ui::GestureRecognizer::Get()->RemoveGestureEventHelper(this); | 99 ui::GestureRecognizer::Get()->RemoveGestureEventHelper(this); |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 //////////////////////////////////////////////////////////////////////////////// | 431 //////////////////////////////////////////////////////////////////////////////// |
| 433 // WindowEventDispatcher, ui::EventProcessor implementation: | 432 // WindowEventDispatcher, ui::EventProcessor implementation: |
| 434 ui::EventTarget* WindowEventDispatcher::GetRootTarget() { | 433 ui::EventTarget* WindowEventDispatcher::GetRootTarget() { |
| 435 return window(); | 434 return window(); |
| 436 } | 435 } |
| 437 | 436 |
| 438 void WindowEventDispatcher::OnEventProcessingStarted(ui::Event* event) { | 437 void WindowEventDispatcher::OnEventProcessingStarted(ui::Event* event) { |
| 439 // The held events are already in |window()|'s coordinate system. So it is | 438 // The held events are already in |window()|'s coordinate system. So it is |
| 440 // not necessary to apply the transform to convert from the host's | 439 // not necessary to apply the transform to convert from the host's |
| 441 // coordinate system to |window()|'s coordinate system. | 440 // coordinate system to |window()|'s coordinate system. |
| 442 if (event->IsLocatedEvent() && !is_dispatched_held_event(*event) && | 441 if (event->IsLocatedEvent() && !is_dispatched_held_event(*event)) |
| 443 transform_events_) { | |
| 444 TransformEventForDeviceScaleFactor(static_cast<ui::LocatedEvent*>(event)); | 442 TransformEventForDeviceScaleFactor(static_cast<ui::LocatedEvent*>(event)); |
| 445 } | |
| 446 } | 443 } |
| 447 | 444 |
| 448 //////////////////////////////////////////////////////////////////////////////// | 445 //////////////////////////////////////////////////////////////////////////////// |
| 449 // WindowEventDispatcher, ui::EventDispatcherDelegate implementation: | 446 // WindowEventDispatcher, ui::EventDispatcherDelegate implementation: |
| 450 | 447 |
| 451 bool WindowEventDispatcher::CanDispatchToTarget(ui::EventTarget* target) { | 448 bool WindowEventDispatcher::CanDispatchToTarget(ui::EventTarget* target) { |
| 452 return event_dispatch_target_ == target; | 449 return event_dispatch_target_ == target; |
| 453 } | 450 } |
| 454 | 451 |
| 455 ui::EventDispatchDetails WindowEventDispatcher::PreDispatchEvent( | 452 ui::EventDispatchDetails WindowEventDispatcher::PreDispatchEvent( |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 909 } | 906 } |
| 910 | 907 |
| 911 // This flag is set depending on the gestures recognized in the call above, | 908 // This flag is set depending on the gestures recognized in the call above, |
| 912 // and needs to propagate with the forwarded event. | 909 // and needs to propagate with the forwarded event. |
| 913 event->set_may_cause_scrolling(orig_event.may_cause_scrolling()); | 910 event->set_may_cause_scrolling(orig_event.may_cause_scrolling()); |
| 914 | 911 |
| 915 return PreDispatchLocatedEvent(target, event); | 912 return PreDispatchLocatedEvent(target, event); |
| 916 } | 913 } |
| 917 | 914 |
| 918 } // namespace aura | 915 } // namespace aura |
| OLD | NEW |