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

Side by Side Diff: services/ui/ws/window_tree.cc

Issue 2125663002: mus: Add watcher for all touch events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "services/ui/ws/window_tree.h" 5 #include "services/ui/ws/window_tree.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 uint32_t observer_id) { 1150 uint32_t observer_id) {
1151 if (matcher.is_null() || observer_id == 0) { 1151 if (matcher.is_null() || observer_id == 0) {
1152 // Clear any existing event observer. 1152 // Clear any existing event observer.
1153 event_observer_matcher_.reset(); 1153 event_observer_matcher_.reset();
1154 event_observer_id_ = 0; 1154 event_observer_id_ = 0;
1155 return; 1155 return;
1156 } 1156 }
1157 1157
1158 // Do not allow key events to be observed, as a compromised app could register 1158 // Do not allow key events to be observed, as a compromised app could register
1159 // itself as an event observer and spy on keystrokes to another app. 1159 // itself as an event observer and spy on keystrokes to another app.
1160 if (!matcher->type_matcher) { 1160 if (!matcher->type_matcher && !matcher->pointer_kind_matcher) {
1161 DVLOG(1) << "SetEventObserver must specify an event type."; 1161 DVLOG(1) << "SetEventObserver must specify an event type.";
1162 return; 1162 return;
1163 } 1163 }
1164
1164 const ui::mojom::EventType event_type_whitelist[] = { 1165 const ui::mojom::EventType event_type_whitelist[] = {
1165 ui::mojom::EventType::POINTER_CANCEL, ui::mojom::EventType::POINTER_DOWN, 1166 ui::mojom::EventType::POINTER_CANCEL, ui::mojom::EventType::POINTER_DOWN,
1166 ui::mojom::EventType::POINTER_MOVE, ui::mojom::EventType::POINTER_UP, 1167 ui::mojom::EventType::POINTER_MOVE, ui::mojom::EventType::POINTER_UP,
1167 ui::mojom::EventType::MOUSE_EXIT, ui::mojom::EventType::WHEEL, 1168 ui::mojom::EventType::MOUSE_EXIT, ui::mojom::EventType::WHEEL,
1168 }; 1169 };
1170 const ui::mojom::PointerKind pointer_kind_whitelist[] = {
1171 ui::mojom::PointerKind::MOUSE, ui::mojom::PointerKind::TOUCH,
1172 };
1173
1169 bool allowed = false; 1174 bool allowed = false;
1170 for (ui::mojom::EventType event_type : event_type_whitelist) { 1175 if (matcher->type_matcher) {
1171 if (matcher->type_matcher->type == event_type) { 1176 for (ui::mojom::EventType event_type : event_type_whitelist) {
1172 allowed = true; 1177 if (matcher->type_matcher->type == event_type) {
1173 break; 1178 allowed = true;
1179 break;
1180 }
1181 }
1182 } else if (matcher->pointer_kind_matcher) {
sky 2016/07/06 20:22:02 Shouldn't this conditional be a standalone if? Tha
riajiang 2016/07/08 02:51:40 Yes, changed it to a standalone if.
1183 for (ui::mojom::PointerKind pointer : pointer_kind_whitelist) {
1184 if (matcher->pointer_kind_matcher->pointer_kind == pointer) {
1185 allowed = true;
1186 break;
1187 }
1174 } 1188 }
1175 } 1189 }
1176 if (!allowed) { 1190 if (!allowed) {
1177 DVLOG(1) << "SetEventObserver event type not allowed"; 1191 DVLOG(1) << "SetEventObserver event type not allowed";
1178 return; 1192 return;
1179 } 1193 }
1180 1194
1181 event_observer_matcher_.reset(new EventMatcher(*matcher)); 1195 event_observer_matcher_.reset(new EventMatcher(*matcher));
1182 event_observer_id_ = observer_id; 1196 event_observer_id_ = observer_id;
1183 } 1197 }
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
1530 } 1544 }
1531 1545
1532 bool WindowTree::IsWindowRootOfAnotherTreeForAccessPolicy( 1546 bool WindowTree::IsWindowRootOfAnotherTreeForAccessPolicy(
1533 const ServerWindow* window) const { 1547 const ServerWindow* window) const {
1534 WindowTree* tree = window_server_->GetTreeWithRoot(window); 1548 WindowTree* tree = window_server_->GetTreeWithRoot(window);
1535 return tree && tree != this; 1549 return tree && tree != this;
1536 } 1550 }
1537 1551
1538 } // namespace ws 1552 } // namespace ws
1539 } // namespace ui 1553 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/views/mus/window_manager_connection.h » ('j') | ui/views/mus/window_manager_connection.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698