| 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/pointer_watcher_delegate_aura.h" | 5 #include "ash/pointer_watcher_delegate_aura.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/events/event.h" | 10 #include "ui/events/event.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 } | 37 } |
| 38 } | 38 } |
| 39 | 39 |
| 40 void PointerWatcherDelegateAura::RemovePointerWatcher( | 40 void PointerWatcherDelegateAura::RemovePointerWatcher( |
| 41 views::PointerWatcher* watcher) { | 41 views::PointerWatcher* watcher) { |
| 42 non_move_watchers_.RemoveObserver(watcher); | 42 non_move_watchers_.RemoveObserver(watcher); |
| 43 move_watchers_.RemoveObserver(watcher); | 43 move_watchers_.RemoveObserver(watcher); |
| 44 } | 44 } |
| 45 | 45 |
| 46 void PointerWatcherDelegateAura::OnMouseEvent(ui::MouseEvent* event) { | 46 void PointerWatcherDelegateAura::OnMouseEvent(ui::MouseEvent* event) { |
| 47 if (event->type() == ui::ET_MOUSE_CAPTURE_CHANGED) { | |
| 48 FOR_EACH_OBSERVER(views::PointerWatcher, non_move_watchers_, | |
| 49 OnMouseCaptureChanged()); | |
| 50 FOR_EACH_OBSERVER(views::PointerWatcher, move_watchers_, | |
| 51 OnMouseCaptureChanged()); | |
| 52 return; | |
| 53 } | |
| 54 | |
| 55 // For compatibility with the mus version, don't send drags. | 47 // For compatibility with the mus version, don't send drags. |
| 56 if (event->type() != ui::ET_MOUSE_PRESSED && | 48 if (event->type() != ui::ET_MOUSE_PRESSED && |
| 57 event->type() != ui::ET_MOUSE_RELEASED && | 49 event->type() != ui::ET_MOUSE_RELEASED && |
| 58 event->type() != ui::ET_MOUSE_MOVED) | 50 event->type() != ui::ET_MOUSE_MOVED && |
| 51 event->type() != ui::ET_MOUSEWHEEL && |
| 52 event->type() != ui::ET_MOUSE_CAPTURE_CHANGED) |
| 59 return; | 53 return; |
| 60 | 54 |
| 61 DCHECK(ui::PointerEvent::CanConvertFrom(*event)); | 55 DCHECK(ui::PointerEvent::CanConvertFrom(*event)); |
| 62 NotifyWatchers(ui::PointerEvent(*event), *event); | 56 NotifyWatchers(ui::PointerEvent(*event), *event); |
| 63 } | 57 } |
| 64 | 58 |
| 65 void PointerWatcherDelegateAura::OnTouchEvent(ui::TouchEvent* event) { | 59 void PointerWatcherDelegateAura::OnTouchEvent(ui::TouchEvent* event) { |
| 66 // For compatibility with the mus version, don't send drags. | 60 // For compatibility with the mus version, don't send drags. |
| 67 if (event->type() != ui::ET_TOUCH_PRESSED && | 61 if (event->type() != ui::ET_TOUCH_PRESSED && |
| 68 event->type() != ui::ET_TOUCH_RELEASED) | 62 event->type() != ui::ET_TOUCH_RELEASED) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 96 views::PointerWatcher, move_watchers_, | 90 views::PointerWatcher, move_watchers_, |
| 97 OnPointerEventObserved(event, screen_location, target_widget)); | 91 OnPointerEventObserved(event, screen_location, target_widget)); |
| 98 if (event.type() != ui::ET_POINTER_MOVED) { | 92 if (event.type() != ui::ET_POINTER_MOVED) { |
| 99 FOR_EACH_OBSERVER( | 93 FOR_EACH_OBSERVER( |
| 100 views::PointerWatcher, non_move_watchers_, | 94 views::PointerWatcher, non_move_watchers_, |
| 101 OnPointerEventObserved(event, screen_location, target_widget)); | 95 OnPointerEventObserved(event, screen_location, target_widget)); |
| 102 } | 96 } |
| 103 } | 97 } |
| 104 | 98 |
| 105 } // namespace ash | 99 } // namespace ash |
| OLD | NEW |