| 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/ash_export.h" | 5 #include "ash/ash_export.h" |
| 6 #include "ash/common/pointer_down_watcher_delegate.h" | 6 #include "ash/common/pointer_watcher_delegate.h" |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/observer_list.h" | 8 #include "base/observer_list.h" |
| 9 #include "ui/events/event_handler.h" | 9 #include "ui/events/event_handler.h" |
| 10 | 10 |
| 11 namespace gfx { | 11 namespace gfx { |
| 12 class Point; | 12 class Point; |
| 13 } | 13 } |
| 14 | 14 |
| 15 namespace ui { | 15 namespace ui { |
| 16 class LocatedEvent; | 16 class LocatedEvent; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace views { | 19 namespace views { |
| 20 class Widget; | 20 class Widget; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace ash { | 23 namespace ash { |
| 24 | 24 |
| 25 // Support for PointerDownWatchers in non-mus ash, implemented with a pre-target | 25 // Support for PointerWatchers in non-mus ash, implemented with a pre-target |
| 26 // EventHandler on the Shell. | 26 // EventHandler on the Shell. |
| 27 class ASH_EXPORT PointerDownWatcherDelegateAura | 27 class ASH_EXPORT PointerWatcherDelegateAura : public PointerWatcherDelegate, |
| 28 : public PointerDownWatcherDelegate, | 28 public ui::EventHandler { |
| 29 public ui::EventHandler { | |
| 30 public: | 29 public: |
| 31 PointerDownWatcherDelegateAura(); | 30 PointerWatcherDelegateAura(); |
| 32 ~PointerDownWatcherDelegateAura() override; | 31 ~PointerWatcherDelegateAura() override; |
| 33 | 32 |
| 34 // PointerDownWatcherDelegate: | 33 // PointerWatcherDelegate: |
| 35 void AddPointerDownWatcher(views::PointerDownWatcher* watcher) override; | 34 void AddPointerWatcher(views::PointerWatcher* watcher) override; |
| 36 void RemovePointerDownWatcher(views::PointerDownWatcher* watcher) override; | 35 void RemovePointerWatcher(views::PointerWatcher* watcher) override; |
| 37 | 36 |
| 38 // ui::EventHandler: | 37 // ui::EventHandler: |
| 39 void OnMouseEvent(ui::MouseEvent* event) override; | 38 void OnMouseEvent(ui::MouseEvent* event) override; |
| 40 void OnTouchEvent(ui::TouchEvent* event) override; | 39 void OnTouchEvent(ui::TouchEvent* event) override; |
| 41 | 40 |
| 42 private: | 41 private: |
| 43 gfx::Point GetLocationInScreen(const ui::LocatedEvent& event) const; | 42 gfx::Point GetLocationInScreen(const ui::LocatedEvent& event) const; |
| 44 views::Widget* GetTargetWidget(const ui::LocatedEvent& event) const; | 43 views::Widget* GetTargetWidget(const ui::LocatedEvent& event) const; |
| 45 | 44 |
| 46 // Must be empty on destruction. | 45 // Must be empty on destruction. |
| 47 base::ObserverList<views::PointerDownWatcher, true> pointer_down_watchers_; | 46 base::ObserverList<views::PointerWatcher, true> pointer_watchers_; |
| 48 | 47 |
| 49 DISALLOW_COPY_AND_ASSIGN(PointerDownWatcherDelegateAura); | 48 DISALLOW_COPY_AND_ASSIGN(PointerWatcherDelegateAura); |
| 50 }; | 49 }; |
| 51 | 50 |
| 52 } // namespace ash | 51 } // namespace ash |
| OLD | NEW |