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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 | 292 |
293 void WindowEventDispatcher::OnCursorMovedToRootLocation( | 293 void WindowEventDispatcher::OnCursorMovedToRootLocation( |
294 const gfx::Point& root_location) { | 294 const gfx::Point& root_location) { |
295 SetLastMouseLocation(window(), root_location); | 295 SetLastMouseLocation(window(), root_location); |
296 synthesize_mouse_move_ = false; | 296 synthesize_mouse_move_ = false; |
297 } | 297 } |
298 | 298 |
299 //////////////////////////////////////////////////////////////////////////////// | 299 //////////////////////////////////////////////////////////////////////////////// |
300 // WindowEventDispatcher, private: | 300 // WindowEventDispatcher, private: |
301 | 301 |
| 302 Window* WindowEventDispatcher::window() { |
| 303 return host_->window(); |
| 304 } |
| 305 |
| 306 const Window* WindowEventDispatcher::window() const { |
| 307 return host_->window(); |
| 308 } |
| 309 |
302 void WindowEventDispatcher::TransformEventForDeviceScaleFactor( | 310 void WindowEventDispatcher::TransformEventForDeviceScaleFactor( |
303 ui::LocatedEvent* event) { | 311 ui::LocatedEvent* event) { |
304 event->UpdateForRootTransform(host()->GetInverseRootTransform()); | 312 event->UpdateForRootTransform(host_->GetInverseRootTransform()); |
305 } | 313 } |
306 | 314 |
307 ui::EventDispatchDetails WindowEventDispatcher::DispatchMouseEnterOrExit( | 315 ui::EventDispatchDetails WindowEventDispatcher::DispatchMouseEnterOrExit( |
308 const ui::MouseEvent& event, | 316 const ui::MouseEvent& event, |
309 ui::EventType type) { | 317 ui::EventType type) { |
310 if (event.type() != ui::ET_MOUSE_CAPTURE_CHANGED && | 318 if (event.type() != ui::ET_MOUSE_CAPTURE_CHANGED && |
311 !(event.flags() & ui::EF_IS_SYNTHESIZED)) { | 319 !(event.flags() & ui::EF_IS_SYNTHESIZED)) { |
312 SetLastMouseLocation(window(), event.root_location()); | 320 SetLastMouseLocation(window(), event.root_location()); |
313 } | 321 } |
314 | 322 |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 | 638 |
631 ui::EventDispatchDetails WindowEventDispatcher::SynthesizeMouseMoveEvent() { | 639 ui::EventDispatchDetails WindowEventDispatcher::SynthesizeMouseMoveEvent() { |
632 DispatchDetails details; | 640 DispatchDetails details; |
633 if (!synthesize_mouse_move_) | 641 if (!synthesize_mouse_move_) |
634 return details; | 642 return details; |
635 synthesize_mouse_move_ = false; | 643 synthesize_mouse_move_ = false; |
636 gfx::Point root_mouse_location = GetLastMouseLocationInRoot(); | 644 gfx::Point root_mouse_location = GetLastMouseLocationInRoot(); |
637 if (!window()->bounds().Contains(root_mouse_location)) | 645 if (!window()->bounds().Contains(root_mouse_location)) |
638 return details; | 646 return details; |
639 gfx::Point host_mouse_location = root_mouse_location; | 647 gfx::Point host_mouse_location = root_mouse_location; |
640 host()->ConvertPointToHost(&host_mouse_location); | 648 host_->ConvertPointToHost(&host_mouse_location); |
641 ui::MouseEvent event(ui::ET_MOUSE_MOVED, | 649 ui::MouseEvent event(ui::ET_MOUSE_MOVED, |
642 host_mouse_location, | 650 host_mouse_location, |
643 host_mouse_location, | 651 host_mouse_location, |
644 ui::EF_IS_SYNTHESIZED, | 652 ui::EF_IS_SYNTHESIZED, |
645 0); | 653 0); |
646 return OnEventFromSource(&event); | 654 return OnEventFromSource(&event); |
647 } | 655 } |
648 | 656 |
649 void WindowEventDispatcher::PreDispatchLocatedEvent(Window* target, | 657 void WindowEventDispatcher::PreDispatchLocatedEvent(Window* target, |
650 ui::LocatedEvent* event) { | 658 ui::LocatedEvent* event) { |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 break; | 797 break; |
790 | 798 |
791 default: | 799 default: |
792 NOTREACHED(); | 800 NOTREACHED(); |
793 break; | 801 break; |
794 } | 802 } |
795 PreDispatchLocatedEvent(target, event); | 803 PreDispatchLocatedEvent(target, event); |
796 } | 804 } |
797 | 805 |
798 } // namespace aura | 806 } // namespace aura |
OLD | NEW |