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

Unified Diff: components/mus/ws/window_manager_state.cc

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: . 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_manager_state.cc
diff --git a/components/mus/ws/window_manager_state.cc b/components/mus/ws/window_manager_state.cc
index c81bb8cb86b78b4d1ccfc2e6e0649a9e30cc96f3..a864cdea4013c5fe009578513acf89c10966e693 100644
--- a/components/mus/ws/window_manager_state.cc
+++ b/components/mus/ws/window_manager_state.cc
@@ -226,6 +226,15 @@ void WindowManagerState::ProcessEvent(const ui::Event& event) {
QueueEvent(event, nullptr);
return;
}
+
+ // Only send events to any event observers after the previous event was acked,
+ // to maintain ordering with events sent via normal dispatch.
+ // TODO(jamescook): If the event dispatcher finds a target window, and that
+ // window's window tree has an event observer that matches the event, just
+ // send the event once via normal dispatch and let the client library trigger
+ // its event observer mechanism. http://crbug.com/605580
+ window_server()->SendToEventObservers(event);
sky 2016/04/21 17:23:03 This comment doesn't match with the code. This fun
James Cook 2016/04/22 18:22:54 This code is gone.
+
event_dispatcher_.ProcessEvent(event);
}
@@ -274,6 +283,11 @@ void WindowManagerState::ProcessNextEventFromQueue() {
event_dispatcher_.ProcessEvent(*queued_event->event);
return;
}
+
+ // If the event has a target it was already sent to observers before its
+ // initial processing.
+ window_server()->SendToEventObservers(*queued_event->event);
+
if (queued_event->processed_target->IsValid()) {
DispatchInputEventToWindowImpl(
queued_event->processed_target->window(),

Powered by Google App Engine
This is Rietveld 408576698