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