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

Unified Diff: services/ui/ws/event_dispatcher.h

Issue 2905333002: Separate out event-targeting logic in EventDispatcher to EventTargeter. (Closed)
Patch Set: Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: services/ui/ws/event_dispatcher.h
diff --git a/services/ui/ws/event_dispatcher.h b/services/ui/ws/event_dispatcher.h
index 8b084d7994f697a555d078ac1023b4dc5336f825..3f31617f11fd5b9a74101f9495e6d9911f2c45e3 100644
--- a/services/ui/ws/event_dispatcher.h
+++ b/services/ui/ws/event_dispatcher.h
@@ -16,6 +16,7 @@
#include "services/ui/public/interfaces/cursor/cursor.mojom.h"
#include "services/ui/public/interfaces/window_manager.mojom.h"
#include "services/ui/ws/drag_cursor_updater.h"
+#include "services/ui/ws/event_targeter.h"
#include "services/ui/ws/modal_window_controller.h"
#include "services/ui/ws/server_window_observer.h"
#include "ui/gfx/geometry/rect_f.h"
@@ -29,7 +30,6 @@ class PointerEvent;
namespace ws {
class Accelerator;
-struct DeepestWindow;
class DragController;
class DragSource;
class DragTargetConnection;
@@ -147,27 +147,6 @@ class EventDispatcher : public ServerWindowObserver, public DragCursorUpdater {
private:
friend class test::EventDispatcherTestApi;
- // Keeps track of state associated with an active pointer.
- struct PointerTarget {
- PointerTarget()
- : window(nullptr),
- is_mouse_event(false),
- in_nonclient_area(false),
- is_pointer_down(false) {}
-
- // The target window, which may be null. null is used in two situations:
- // when there is no valid window target, or there was a target but the
- // window is destroyed before a corresponding release/cancel.
- ServerWindow* window;
-
- bool is_mouse_event;
-
- // Did the pointer event start in the non-client area.
- bool in_nonclient_area;
-
- bool is_pointer_down;
- };
-
void SetMouseCursorSourceWindow(ServerWindow* window);
void ProcessKeyEvent(const ui::KeyEvent& event,
@@ -201,11 +180,6 @@ class EventDispatcher : public ServerWindowObserver, public DragCursorUpdater {
void UpdateTargetForPointer(int32_t pointer_id,
const ui::LocatedEvent& event);
- // Returns a PointerTarget for the supplied event. If there is no valid
- // event target for the specified location |window| in the returned value is
- // null.
- PointerTarget PointerTargetForEvent(const ui::LocatedEvent& event);
-
// Returns true if any pointers are in the pressed/down state.
bool AreAnyPointersDown() const;
@@ -234,8 +208,6 @@ class EventDispatcher : public ServerWindowObserver, public DragCursorUpdater {
Accelerator* FindAccelerator(const ui::KeyEvent& event,
const ui::mojom::AcceleratorPhase phase);
- DeepestWindow FindDeepestVisibleWindowForEvents(const gfx::Point& location);
-
// Clears the implicit captures in |pointer_targets_|, with the exception of
// |window|. |window| may be null. |client_id| is the target client of
// |window|.
@@ -261,6 +233,8 @@ class EventDispatcher : public ServerWindowObserver, public DragCursorUpdater {
ModalWindowController modal_window_controller_;
+ std::unique_ptr<EventTargeter> event_targeter_;
+
bool mouse_button_down_;
ServerWindow* mouse_cursor_source_window_;
bool mouse_cursor_in_non_client_area_;

Powered by Google App Engine
This is Rietveld 408576698