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

Unified Diff: services/ui/ws/window_tree.cc

Issue 2092343002: Touch HUD app for mustash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change window manager connection unittest to original Created 4 years, 5 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
« no previous file with comments | « services/ui/ws/window_tree.h ('k') | ui/views/controls/touch/touch_hud_drawer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/ws/window_tree.cc
diff --git a/services/ui/ws/window_tree.cc b/services/ui/ws/window_tree.cc
index a32eec9bcd3393b4b683a8d93e3ce6d0960e448a..46c7fdea37204a4e283a97e3ab963de19248d6f1 100644
--- a/services/ui/ws/window_tree.cc
+++ b/services/ui/ws/window_tree.cc
@@ -981,8 +981,9 @@ void WindowTree::DispatchInputEventImpl(ServerWindow* target,
}
void WindowTree::SendToEventObserver(const ui::Event& event) {
- if (event_observer_matcher_ && event_observer_matcher_->MatchesEvent(event))
+ if (event_observer_matcher_ && event_observer_matcher_->MatchesEvent(event)) {
client()->OnEventObserved(ui::Event::Clone(event), event_observer_id_);
+ }
}
void WindowTree::NewWindow(
@@ -1157,20 +1158,34 @@ 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->pointer_kind_matcher) {
DVLOG(1) << "SetEventObserver must specify an event type.";
return;
}
+
const ui::mojom::EventType event_type_whitelist[] = {
ui::mojom::EventType::POINTER_CANCEL, ui::mojom::EventType::POINTER_DOWN,
ui::mojom::EventType::POINTER_MOVE, ui::mojom::EventType::POINTER_UP,
ui::mojom::EventType::MOUSE_EXIT, ui::mojom::EventType::WHEEL,
};
+ const ui::mojom::PointerKind pointer_kind_whitelist[] = {
+ ui::mojom::PointerKind::MOUSE, ui::mojom::PointerKind::TOUCH,
+ };
+
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->pointer_kind_matcher) {
+ for (ui::mojom::PointerKind pointer : pointer_kind_whitelist) {
+ if (matcher->pointer_kind_matcher->pointer_kind == pointer) {
+ allowed = true;
+ break;
+ }
}
}
if (!allowed) {
@@ -1408,6 +1423,13 @@ void WindowTree::GetCursorLocationMemory(
GetCursorLocationMemory());
}
+void WindowTree::SetAcceptEvents(Id transport_window_id, bool accept_events) {
+ ServerWindow* window =
+ GetWindowByClientId(ClientWindowId(transport_window_id));
+ if (window)
+ window->SetAcceptEvents(accept_events);
+}
+
void WindowTree::AddAccelerator(uint32_t id,
mojom::EventMatcherPtr event_matcher,
const AddAcceleratorCallback& callback) {
« no previous file with comments | « services/ui/ws/window_tree.h ('k') | ui/views/controls/touch/touch_hud_drawer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698