| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 SERVICES_UI_WS_EVENT_TARGETER_H_ | 5 #ifndef SERVICES_UI_WS_EVENT_TARGETER_H_ |
| 6 #define SERVICES_UI_WS_EVENT_TARGETER_H_ | 6 #define SERVICES_UI_WS_EVENT_TARGETER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 | 11 |
| 12 namespace gfx { | 12 namespace gfx { |
| 13 class Point; | 13 class Point; |
| 14 } | 14 } |
| 15 | 15 |
| 16 namespace ui { | 16 namespace ui { |
| 17 class LocatedEvent; | 17 class LocatedEvent; |
| 18 | 18 |
| 19 namespace ws { | 19 namespace ws { |
| 20 struct DeepestWindow; | 20 struct DeepestWindow; |
| 21 class EventDispatcherDelegate; | 21 class EventTargeterDelegate; |
| 22 class ModalWindowController; | 22 class ModalWindowController; |
| 23 class ServerWindow; | 23 class ServerWindow; |
| 24 | 24 |
| 25 // Keeps track of state associated with an active pointer. | 25 // Keeps track of state associated with an active pointer. |
| 26 struct PointerTarget { | 26 struct PointerTarget { |
| 27 PointerTarget() | 27 PointerTarget() |
| 28 : window(nullptr), | 28 : window(nullptr), |
| 29 is_mouse_event(false), | 29 is_mouse_event(false), |
| 30 in_nonclient_area(false), | 30 in_nonclient_area(false), |
| 31 is_pointer_down(false) {} | 31 is_pointer_down(false) {} |
| 32 | 32 |
| 33 // The target window, which may be null. null is used in two situations: | 33 // The target window, which may be null. null is used in two situations: |
| 34 // when there is no valid window target, or there was a target but the | 34 // when there is no valid window target, or there was a target but the |
| 35 // window is destroyed before a corresponding release/cancel. | 35 // window is destroyed before a corresponding release/cancel. |
| 36 ServerWindow* window; | 36 ServerWindow* window; |
| 37 | 37 |
| 38 bool is_mouse_event; | 38 bool is_mouse_event; |
| 39 | 39 |
| 40 // Did the pointer event start in the non-client area. | 40 // Did the pointer event start in the non-client area. |
| 41 bool in_nonclient_area; | 41 bool in_nonclient_area; |
| 42 | 42 |
| 43 bool is_pointer_down; | 43 bool is_pointer_down; |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 // Finds the PointerTarget for an event or the DeepestWindow for a location. | 46 // Finds the PointerTarget for an event or the DeepestWindow for a location. |
| 47 class EventTargeter { | 47 class EventTargeter { |
| 48 public: | 48 public: |
| 49 EventTargeter(EventDispatcherDelegate* event_dispatcher_delegate, | 49 EventTargeter(EventTargeterDelegate* event_targeter_delegate, |
| 50 ModalWindowController* modal_window_controller); | 50 ModalWindowController* modal_window_controller); |
| 51 ~EventTargeter(); | 51 ~EventTargeter(); |
| 52 | 52 |
| 53 // Returns a PointerTarget for the supplied |event|. If there is no valid | 53 // Returns a PointerTarget for the supplied |event|. If there is no valid |
| 54 // event target for the specified location |window| in the returned value is | 54 // event target for the specified location |window| in the returned value is |
| 55 // null. | 55 // null. |
| 56 PointerTarget PointerTargetForEvent(const ui::LocatedEvent& event, | 56 PointerTarget PointerTargetForEvent(const ui::LocatedEvent& event, |
| 57 int64_t* display_id); | 57 int64_t* display_id); |
| 58 | 58 |
| 59 // Returns a DeepestWindow for the supplied |location|. If there is no valid | 59 // Returns a DeepestWindow for the supplied |location|. If there is no valid |
| 60 // root window, |window| in the returned value is null. | 60 // root window, |window| in the returned value is null. |
| 61 DeepestWindow FindDeepestVisibleWindowForEvents(gfx::Point* location, | 61 DeepestWindow FindDeepestVisibleWindowForEvents(gfx::Point* location, |
| 62 int64_t* display_id); | 62 int64_t* display_id); |
| 63 | 63 |
| 64 private: | 64 private: |
| 65 EventDispatcherDelegate* event_dispatcher_delegate_; | 65 EventTargeterDelegate* event_targeter_delegate_; |
| 66 ModalWindowController* modal_window_controller_; | 66 ModalWindowController* modal_window_controller_; |
| 67 | 67 |
| 68 DISALLOW_COPY_AND_ASSIGN(EventTargeter); | 68 DISALLOW_COPY_AND_ASSIGN(EventTargeter); |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 } // namespace ws | 71 } // namespace ws |
| 72 } // namespace ui | 72 } // namespace ui |
| 73 | 73 |
| 74 #endif // SERVICES_UI_WS_EVENT_TARGETER_H_ | 74 #endif // SERVICES_UI_WS_EVENT_TARGETER_H_ |
| OLD | NEW |