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

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

Issue 2696873002: Change OnWindowInputEvent to use display_id to find the host and update event root_location in WS. (Closed)
Patch Set: TODO Created 3 years, 9 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/test_change_tracker.h" 5 #include "services/ui/ws/test_change_tracker.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 return base::StringPrintf("DrawnStateChanged window=%s drawn=%s", 99 return base::StringPrintf("DrawnStateChanged window=%s drawn=%s",
100 WindowIdToString(change.window_id).c_str(), 100 WindowIdToString(change.window_id).c_str(),
101 change.bool_value ? "true" : "false"); 101 change.bool_value ? "true" : "false");
102 102
103 case CHANGE_TYPE_INPUT_EVENT: { 103 case CHANGE_TYPE_INPUT_EVENT: {
104 std::string result = base::StringPrintf( 104 std::string result = base::StringPrintf(
105 "InputEvent window=%s event_action=%d", 105 "InputEvent window=%s event_action=%d",
106 WindowIdToString(change.window_id).c_str(), change.event_action); 106 WindowIdToString(change.window_id).c_str(), change.event_action);
107 if (change.matches_pointer_watcher) 107 if (change.matches_pointer_watcher)
108 result += " matches_pointer_watcher"; 108 result += " matches_pointer_watcher";
109 if (change.event_root_location != gfx::Point()) {
sadrul 2017/03/14 16:08:32 Use PointF::IsOrigin() instead
riajiang 2017/03/14 19:03:26 Done.
110 result +=
111 base::StringPrintf(" event_root_location=%s",
112 change.event_root_location.ToString().c_str());
113 }
109 return result; 114 return result;
110 } 115 }
111 116
112 case CHANGE_TYPE_POINTER_WATCHER_EVENT: 117 case CHANGE_TYPE_POINTER_WATCHER_EVENT:
113 return base::StringPrintf("PointerWatcherEvent event_action=%d window=%s", 118 return base::StringPrintf("PointerWatcherEvent event_action=%d window=%s",
114 change.event_action, 119 change.event_action,
115 WindowIdToString(change.window_id).c_str()); 120 WindowIdToString(change.window_id).c_str());
116 121
117 case CHANGE_TYPE_PROPERTY_CHANGED: 122 case CHANGE_TYPE_PROPERTY_CHANGED:
118 return base::StringPrintf("PropertyChanged window=%s key=%s value=%s", 123 return base::StringPrintf("PropertyChanged window=%s key=%s value=%s",
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 } 218 }
214 219
215 Change::Change() 220 Change::Change()
216 : type(CHANGE_TYPE_EMBED), 221 : type(CHANGE_TYPE_EMBED),
217 client_id(0), 222 client_id(0),
218 window_id(0), 223 window_id(0),
219 window_id2(0), 224 window_id2(0),
220 window_id3(0), 225 window_id3(0),
221 event_action(0), 226 event_action(0),
222 matches_pointer_watcher(false), 227 matches_pointer_watcher(false),
228 event_root_location(gfx::Point()),
sadrul 2017/03/14 16:08:32 Don't need this
riajiang 2017/03/14 19:03:26 Done.
223 direction(mojom::OrderDirection::ABOVE), 229 direction(mojom::OrderDirection::ABOVE),
224 bool_value(false), 230 bool_value(false),
225 float_value(0.f), 231 float_value(0.f),
226 cursor_id(0), 232 cursor_id(0),
227 change_id(0u) {} 233 change_id(0u) {}
228 234
229 Change::Change(const Change& other) = default; 235 Change::Change(const Change& other) = default;
230 236
231 Change::~Change() {} 237 Change::~Change() {}
232 238
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 } 364 }
359 365
360 void TestChangeTracker::OnWindowInputEvent(Id window_id, 366 void TestChangeTracker::OnWindowInputEvent(Id window_id,
361 const ui::Event& event, 367 const ui::Event& event,
362 bool matches_pointer_watcher) { 368 bool matches_pointer_watcher) {
363 Change change; 369 Change change;
364 change.type = CHANGE_TYPE_INPUT_EVENT; 370 change.type = CHANGE_TYPE_INPUT_EVENT;
365 change.window_id = window_id; 371 change.window_id = window_id;
366 change.event_action = static_cast<int32_t>(event.type()); 372 change.event_action = static_cast<int32_t>(event.type());
367 change.matches_pointer_watcher = matches_pointer_watcher; 373 change.matches_pointer_watcher = matches_pointer_watcher;
374 if (event.IsLocatedEvent())
375 change.event_root_location = event.AsLocatedEvent()->root_location();
368 AddChange(change); 376 AddChange(change);
369 } 377 }
370 378
371 void TestChangeTracker::OnPointerEventObserved(const ui::Event& event, 379 void TestChangeTracker::OnPointerEventObserved(const ui::Event& event,
372 uint32_t window_id) { 380 uint32_t window_id) {
373 Change change; 381 Change change;
374 change.type = CHANGE_TYPE_POINTER_WATCHER_EVENT; 382 change.type = CHANGE_TYPE_POINTER_WATCHER_EVENT;
375 change.event_action = static_cast<int32_t>(event.type()); 383 change.event_action = static_cast<int32_t>(event.type());
376 change.window_id = window_id; 384 change.window_id = window_id;
377 AddChange(change); 385 AddChange(change);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 468
461 std::string TestWindow::ToString2() const { 469 std::string TestWindow::ToString2() const {
462 return base::StringPrintf( 470 return base::StringPrintf(
463 "window=%s parent=%s visible=%s", WindowIdToString(window_id).c_str(), 471 "window=%s parent=%s visible=%s", WindowIdToString(window_id).c_str(),
464 WindowIdToString(parent_id).c_str(), visible ? "true" : "false"); 472 WindowIdToString(parent_id).c_str(), visible ? "true" : "false");
465 } 473 }
466 474
467 } // namespace ws 475 } // namespace ws
468 476
469 } // namespace ui 477 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698