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

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

Issue 2092343002: Touch HUD app for mustash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 f1dc0c89db7b249f99514aadae43252bfc10b238..82b123a5ecf692d136bcd108c08471ea61ec4bf3 100644
--- a/components/mus/ws/window_tree.cc
+++ b/components/mus/ws/window_tree.cc
@@ -1156,7 +1156,7 @@ void WindowTree::SetEventObserver(mojom::EventMatcherPtr matcher,
// Do not allow key events to be observed, as a compromised app could register
// itself as an event observer and spy on keystrokes to another app.
- if (!matcher->type_matcher) {
+ if (!matcher->type_matcher && !matcher->types_matcher) {
DVLOG(1) << "SetEventObserver must specify an event type.";
return;
}
@@ -1166,11 +1166,24 @@ void WindowTree::SetEventObserver(mojom::EventMatcherPtr matcher,
ui::mojom::EventType::MOUSE_EXIT, ui::mojom::EventType::WHEEL,
};
bool allowed = false;
- for (ui::mojom::EventType event_type : event_type_whitelist) {
- if (matcher->type_matcher->type == event_type) {
- allowed = true;
- break;
+ if (matcher->type_matcher) {
+ for (ui::mojom::EventType event_type : event_type_whitelist) {
+ if (matcher->type_matcher->type == event_type) {
+ allowed = true;
+ break;
+ }
}
+ } else if (matcher->types_matcher) {
+ bool exist = true;
+ for (ui::mojom::EventType event_type : matcher->types_matcher->types) {
+ if (std::find(std::begin(event_type_whitelist),
+ std::end(event_type_whitelist), event_type) ==
+ std::end(event_type_whitelist)) {
+ exist = false;
+ break;
+ }
+ }
+ if (exist) allowed = true;
}
if (!allowed) {
DVLOG(1) << "SetEventObserver event type not allowed";

Powered by Google App Engine
This is Rietveld 408576698