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

Unified Diff: components/mus/ws/window_tree.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_tree.cc
diff --git a/components/mus/ws/window_tree.cc b/components/mus/ws/window_tree.cc
index 863a3a13e61a2095581b0f08fac3b089e39daa76..8ebe876acc0203f2a75fe8a8145fab4ee9c49787 100644
--- a/components/mus/ws/window_tree.cc
+++ b/components/mus/ws/window_tree.cc
@@ -13,6 +13,7 @@
#include "components/mus/ws/default_access_policy.h"
#include "components/mus/ws/display.h"
#include "components/mus/ws/display_manager.h"
+#include "components/mus/ws/event_tester.h"
#include "components/mus/ws/focus_controller.h"
#include "components/mus/ws/operation.h"
#include "components/mus/ws/platform_display.h"
@@ -956,6 +957,11 @@ void WindowTree::DispatchInputEventImpl(ServerWindow* target,
mojom::Event::From(event));
}
+void WindowTree::SendToEventObserver(const ui::Event& event) {
+ if (event_observer_tester_ && event_observer_tester_->MatchesEvent(event))
+ client()->OnEventObserved(mojom::Event::From(event));
sky 2016/04/21 17:23:04 If the event was targetted at this client, then I
James Cook 2016/04/22 18:22:55 Done.
+}
+
void WindowTree::NewWindow(
uint32_t change_id,
Id transport_window_id,
@@ -1109,6 +1115,14 @@ void WindowTree::ReleaseCapture(uint32_t change_id, Id window_id) {
client()->OnChangeCompleted(change_id, success);
}
+void WindowTree::SetEventObserver(mojom::EventMatcherPtr matcher) {
+ event_observer_tester_.reset(new EventTester(*matcher));
+}
+
+void WindowTree::ClearEventObserver() {
+ event_observer_tester_.reset();
+}
+
void WindowTree::SetWindowBounds(uint32_t change_id,
Id window_id,
mojo::RectPtr bounds) {

Powered by Google App Engine
This is Rietveld 408576698