| 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 // An interface for read-only observation of pointer events (in particular, the | 22 // 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. | 23 // 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. | 24 // 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 | 25 // To reduce IPC traffic from the window server, move events are not provided |
| 26 // unless the app specifically requests them. | 26 // unless the app specifically requests them. |
| 27 // NOTE: On mus this allows observation of events outside of windows owned | 27 // 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 | 28 // by the current process, in which case the |target| will be null. On mus |
| 29 // event.target() is always null. | 29 // event.target() is always null. |
| 30 // NOTE: Mouse capture change events are sent through OnPointerEventObserved and |
| 31 // its |target| is always null. |
| 30 class VIEWS_EXPORT PointerWatcher { | 32 class VIEWS_EXPORT PointerWatcher { |
| 31 public: | 33 public: |
| 32 PointerWatcher() {} | 34 PointerWatcher() {} |
| 33 | 35 |
| 34 virtual void OnPointerEventObserved(const ui::PointerEvent& event, | 36 virtual void OnPointerEventObserved(const ui::PointerEvent& event, |
| 35 const gfx::Point& location_in_screen, | 37 const gfx::Point& location_in_screen, |
| 36 Widget* target) = 0; | 38 Widget* target) = 0; |
| 37 | 39 |
| 38 // PointerWatcher is informed of capture changes as it's common to create a | |
| 39 // MouseEvent of type ui::ET_MOUSE_CAPTURE_CHANGED on capture change. | |
| 40 virtual void OnMouseCaptureChanged() {} | |
| 41 | |
| 42 protected: | 40 protected: |
| 43 virtual ~PointerWatcher() {} | 41 virtual ~PointerWatcher() {} |
| 44 | 42 |
| 45 private: | 43 private: |
| 46 DISALLOW_COPY_AND_ASSIGN(PointerWatcher); | 44 DISALLOW_COPY_AND_ASSIGN(PointerWatcher); |
| 47 }; | 45 }; |
| 48 | 46 |
| 49 } // namespace views | 47 } // namespace views |
| 50 | 48 |
| 51 #endif // UI_VIEWS_POINTER_WATCHER_H_ | 49 #endif // UI_VIEWS_POINTER_WATCHER_H_ |
| OLD | NEW |