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

Side by Side Diff: services/ui/ws/event_targeter.h

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

Powered by Google App Engine
This is Rietveld 408576698