Chromium Code Reviews| 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 #ifndef UI_VIEWS_POINTER_WATCHER_H_ | 5 #ifndef UI_VIEWS_POINTER_WATCHER_H_ |
| 6 #define UI_VIEWS_POINTER_WATCHER_H_ | 6 #define UI_VIEWS_POINTER_WATCHER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "ui/views/views_export.h" | 9 #include "ui/views/views_export.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 PointerEvent; | 16 class PointerEvent; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace views { | 19 namespace views { |
| 20 class Widget; | 20 class Widget; |
| 21 | 21 |
| 22 // When pointer watchers are added they need to specify which events they want | |
|
sky
2016/08/31 23:27:39
How about:
When a PointerWatcher is added the typ
sammiequon
2016/09/01 00:49:24
Done.
| |
| 23 // to receive. BASIC means they receive only presses, releases, capture and | |
| 24 // wheel events, MOVES means they receive move events in addition, and DRAGS | |
| 25 // means | |
| 26 // they receive move and drag events in addition. | |
| 27 enum class PointerWatcherEventTypes { BASIC, MOVES, DRAGS }; | |
| 28 | |
| 22 // An interface for read-only observation of pointer events (in particular, the | 29 // An interface for read-only observation of pointer events (in particular, the |
| 23 // events cannot be marked as handled). Only certain event types are supported. | 30 // events cannot be marked as handled). Only certain event types are supported. |
| 24 // The |target| is the top-level widget that will receive the event, if any. | 31 // The |target| is the top-level widget that will receive the event, if any. |
| 25 // To reduce IPC traffic from the window server, move events are not provided | 32 // To reduce IPC traffic from the window server, move events are not provided |
| 26 // unless the app specifically requests them. | 33 // unless the app specifically requests them. |
| 27 // NOTE: On mus this allows observation of events outside of windows owned | 34 // NOTE: On mus this allows observation of events outside of windows owned |
| 28 // by the current process, in which case the |target| will be null. On mus | 35 // by the current process, in which case the |target| will be null. On mus |
| 29 // event.target() is always null. | 36 // event.target() is always null. |
| 30 // NOTE: Mouse capture change events are sent through OnPointerEventObserved and | 37 // NOTE: Mouse capture change events are sent through OnPointerEventObserved and |
| 31 // its |target| is always null. | 38 // its |target| is always null. |
| 32 class VIEWS_EXPORT PointerWatcher { | 39 class VIEWS_EXPORT PointerWatcher { |
| 33 public: | 40 public: |
| 34 PointerWatcher() {} | 41 PointerWatcher() {} |
| 35 | 42 |
| 36 virtual void OnPointerEventObserved(const ui::PointerEvent& event, | 43 virtual void OnPointerEventObserved(const ui::PointerEvent& event, |
| 37 const gfx::Point& location_in_screen, | 44 const gfx::Point& location_in_screen, |
| 38 Widget* target) = 0; | 45 Widget* target) = 0; |
| 39 | 46 |
| 40 protected: | 47 protected: |
| 41 virtual ~PointerWatcher() {} | 48 virtual ~PointerWatcher() {} |
| 42 | 49 |
| 43 private: | 50 private: |
| 44 DISALLOW_COPY_AND_ASSIGN(PointerWatcher); | 51 DISALLOW_COPY_AND_ASSIGN(PointerWatcher); |
| 45 }; | 52 }; |
| 46 | 53 |
| 47 } // namespace views | 54 } // namespace views |
| 48 | 55 |
| 49 #endif // UI_VIEWS_POINTER_WATCHER_H_ | 56 #endif // UI_VIEWS_POINTER_WATCHER_H_ |
| OLD | NEW |