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