| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ash/aura/pointer_watcher_adapter.h" | 5 #include "ash/aura/pointer_watcher_adapter.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ui/aura/client/screen_position_client.h" | 8 #include "ui/aura/client/screen_position_client.h" |
| 9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
| 10 #include "ui/display/screen.h" | 10 #include "ui/display/screen.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 const ui::LocatedEvent& event) const { | 88 const ui::LocatedEvent& event) const { |
| 89 aura::Window* window = static_cast<aura::Window*>(event.target()); | 89 aura::Window* window = static_cast<aura::Window*>(event.target()); |
| 90 return views::Widget::GetTopLevelWidgetForNativeView(window); | 90 return views::Widget::GetTopLevelWidgetForNativeView(window); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void PointerWatcherAdapter::NotifyWatchers( | 93 void PointerWatcherAdapter::NotifyWatchers( |
| 94 const ui::PointerEvent& event, | 94 const ui::PointerEvent& event, |
| 95 const ui::LocatedEvent& original_event) { | 95 const ui::LocatedEvent& original_event) { |
| 96 const gfx::Point screen_location(GetLocationInScreen(original_event)); | 96 const gfx::Point screen_location(GetLocationInScreen(original_event)); |
| 97 views::Widget* target_widget = GetTargetWidget(original_event); | 97 views::Widget* target_widget = GetTargetWidget(original_event); |
| 98 FOR_EACH_OBSERVER( | 98 for (auto& observer : drag_watchers_) |
| 99 views::PointerWatcher, drag_watchers_, | 99 observer.OnPointerEventObserved(event, screen_location, target_widget); |
| 100 OnPointerEventObserved(event, screen_location, target_widget)); | |
| 101 if (original_event.type() != ui::ET_TOUCH_MOVED && | 100 if (original_event.type() != ui::ET_TOUCH_MOVED && |
| 102 original_event.type() != ui::ET_MOUSE_DRAGGED) { | 101 original_event.type() != ui::ET_MOUSE_DRAGGED) { |
| 103 FOR_EACH_OBSERVER( | 102 for (auto& observer : move_watchers_) |
| 104 views::PointerWatcher, move_watchers_, | 103 observer.OnPointerEventObserved(event, screen_location, target_widget); |
| 105 OnPointerEventObserved(event, screen_location, target_widget)); | |
| 106 } | 104 } |
| 107 if (event.type() != ui::ET_POINTER_MOVED) { | 105 if (event.type() != ui::ET_POINTER_MOVED) { |
| 108 FOR_EACH_OBSERVER( | 106 for (auto& observer : non_move_watchers_) |
| 109 views::PointerWatcher, non_move_watchers_, | 107 observer.OnPointerEventObserved(event, screen_location, target_widget); |
| 110 OnPointerEventObserved(event, screen_location, target_widget)); | |
| 111 } | 108 } |
| 112 } | 109 } |
| 113 | 110 |
| 114 } // namespace ash | 111 } // namespace ash |
| OLD | NEW |