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

Unified Diff: components/mus/ws/window_tree.h

Issue 1909733002: mus: Add EventObserver to allow passively listening to UI events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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: components/mus/ws/window_tree.h
diff --git a/components/mus/ws/window_tree.h b/components/mus/ws/window_tree.h
index 48324f7382d0776a6bf98a88d6f8fabe214f387d..43639d257231008775cd636ab94bfe3ca22a45b0 100644
--- a/components/mus/ws/window_tree.h
+++ b/components/mus/ws/window_tree.h
@@ -39,6 +39,7 @@ namespace ws {
class AccessPolicy;
class DisplayManager;
class Display;
+class EventMatcher;
class ServerWindow;
class TargetedEvent;
class WindowManagerState;
@@ -211,6 +212,9 @@ class WindowTree : public mojom::WindowTree,
const ServerWindow* transient_window,
bool originated_change);
+ // Sends this event to the client if it matches an active event observer.
+ void SendToEventObserver(const ui::Event& event);
+
private:
friend class test::WindowTreeTestApi;
@@ -339,6 +343,8 @@ class WindowTree : public mojom::WindowTree,
override;
void SetCapture(uint32_t change_id, Id window_id) override;
void ReleaseCapture(uint32_t change_id, Id window_id) override;
+ void SetEventObserver(mojom::EventMatcherPtr matcher,
+ uint32_t observer_id) override;
void SetWindowBounds(uint32_t change_id,
Id window_id,
mojo::RectPtr bounds) override;
@@ -407,7 +413,7 @@ class WindowTree : public mojom::WindowTree,
WindowServer* window_server_;
- const UserId user_id_;
+ UserId user_id_;
// Id of this tree as assigned by WindowServer.
const ConnectionSpecificId id_;
@@ -434,6 +440,13 @@ class WindowTree : public mojom::WindowTree,
uint32_t event_ack_id_;
+ // Set when the client is using SetEventObserver() to observe events,
+ // otherwise null.
+ std::unique_ptr<EventMatcher> event_observer_matcher_;
+
+ // The ID supplied by the client for the current event observer.
+ uint32_t event_observer_id_ = 0;
+
// WindowManager the current event came from.
WindowManagerState* event_source_wms_ = nullptr;

Powered by Google App Engine
This is Rietveld 408576698