Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: ash/pointer_watcher_delegate_aura.h

Issue 2235363003: Wires up WmShellMus::Add/RemovePointerWatcher (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pointer_watcher_capture
Patch Set: cleanup Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_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 class PointerEvent;
17 } 18 }
18 19
19 namespace views { 20 namespace views {
20 class Widget; 21 class Widget;
21 } 22 }
22 23
23 namespace ash { 24 namespace ash {
24 25
25 // Support for PointerWatchers in non-mus ash, implemented with a pre-target 26 // Support for PointerWatchers in non-mus ash, implemented with a pre-target
26 // EventHandler on the Shell. 27 // EventHandler on the Shell.
27 class ASH_EXPORT PointerWatcherDelegateAura : public PointerWatcherDelegate, 28 class ASH_EXPORT PointerWatcherDelegateAura : public PointerWatcherDelegate,
28 public ui::EventHandler { 29 public ui::EventHandler {
29 public: 30 public:
30 PointerWatcherDelegateAura(); 31 PointerWatcherDelegateAura();
31 ~PointerWatcherDelegateAura() override; 32 ~PointerWatcherDelegateAura() override;
32 33
33 // PointerWatcherDelegate: 34 // PointerWatcherDelegate:
34 void AddPointerWatcher(views::PointerWatcher* watcher) override; 35 void AddPointerWatcher(views::PointerWatcher* watcher,
36 bool wants_moves) override;
35 void RemovePointerWatcher(views::PointerWatcher* watcher) override; 37 void RemovePointerWatcher(views::PointerWatcher* watcher) override;
36 38
37 // ui::EventHandler: 39 // ui::EventHandler:
38 void OnMouseEvent(ui::MouseEvent* event) override; 40 void OnMouseEvent(ui::MouseEvent* event) override;
39 void OnTouchEvent(ui::TouchEvent* event) override; 41 void OnTouchEvent(ui::TouchEvent* event) override;
40 42
41 private: 43 private:
42 gfx::Point GetLocationInScreen(const ui::LocatedEvent& event) const; 44 gfx::Point GetLocationInScreen(const ui::LocatedEvent& event) const;
43 views::Widget* GetTargetWidget(const ui::LocatedEvent& event) const; 45 views::Widget* GetTargetWidget(const ui::LocatedEvent& event) const;
44 46
45 // Must be empty on destruction. 47 // Calls OnPointerEventObserved() on the appropriate set of watchers as
48 // determined by the type of event. |original_event| is the original
49 // event supplied to OnMouseEvent()/OnTouchEvent(), |pointer_event| is
50 // |original_event| converted to a PointerEvent.
51 void NotifyWatchers(const ui::PointerEvent& pointer_event,
52 const ui::LocatedEvent& original_event);
53
54 // The true parameter to ObserverList indicates the list Must be empty on
James Cook 2016/08/12 16:08:53 nit: Must -> must and rewrap lines Thanks for the
sky 2016/08/12 17:59:37 Done.
55 // destruction.
56 // Two sets of observers are maintained, one for observers not needing
57 // moves |pointer_watchers_| and |move_pointer_watchers_| for those observers
58 // wanting moves too.
46 base::ObserverList<views::PointerWatcher, true> pointer_watchers_; 59 base::ObserverList<views::PointerWatcher, true> pointer_watchers_;
James Cook 2016/08/12 16:08:53 optional: Maybe non_move_pointer_watchers_? If th
sky 2016/08/12 17:59:37 I like non_move_watchers_ and move_watchers_. Done
60 base::ObserverList<views::PointerWatcher, true> move_pointer_watchers_;
James Cook 2016/08/12 16:08:53 Or maybe this one should be called |pointer_watche
47 61
48 DISALLOW_COPY_AND_ASSIGN(PointerWatcherDelegateAura); 62 DISALLOW_COPY_AND_ASSIGN(PointerWatcherDelegateAura);
49 }; 63 };
50 64
51 } // namespace ash 65 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698