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

Unified Diff: components/mus/ws/event_dispatcher.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: 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/event_dispatcher.cc
diff --git a/components/mus/ws/event_dispatcher.cc b/components/mus/ws/event_dispatcher.cc
index fd97ee1649207ee17f27d796229fbafd29219092..69d7fa155ecaf903264d89c6736a20eb9dd75b5a 100644
--- a/components/mus/ws/event_dispatcher.cc
+++ b/components/mus/ws/event_dispatcher.cc
@@ -196,7 +196,7 @@ void EventDispatcher::RemoveAccelerator(uint32_t id) {
}
void EventDispatcher::ProcessEvent(const ui::Event& event) {
- if (!root_)
+ if (!root_) // Tests may not have a root window.
return;
if (event.IsKeyEvent()) {
@@ -229,9 +229,11 @@ void EventDispatcher::ProcessKeyEvent(const ui::KeyEvent& event) {
if (focused_window) {
delegate_->DispatchInputEventToWindow(focused_window, false, event,
post_target);
- } else if (post_target) {
- delegate_->OnAccelerator(post_target->id(), event);
+ return;
}
+ delegate_->OnEventTargetNotFound(event);
+ if (post_target)
+ delegate_->OnAccelerator(post_target->id(), event);
}
void EventDispatcher::ProcessLocatedEvent(const ui::LocatedEvent& event) {
@@ -380,8 +382,10 @@ bool EventDispatcher::AreAnyPointersDown() const {
void EventDispatcher::DispatchToPointerTarget(const PointerTarget& target,
const ui::LocatedEvent& event) {
- if (!target.window)
+ if (!target.window) {
+ delegate_->OnEventTargetNotFound(event);
return;
+ }
gfx::Point location(event.location());
gfx::Transform transform(GetTransformToWindow(surface_id_, target.window));

Powered by Google App Engine
This is Rietveld 408576698