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

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: nits 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.IsOrigin()) {
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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 } 363 }
359 364
360 void TestChangeTracker::OnWindowInputEvent(Id window_id, 365 void TestChangeTracker::OnWindowInputEvent(Id window_id,
361 const ui::Event& event, 366 const ui::Event& event,
362 bool matches_pointer_watcher) { 367 bool matches_pointer_watcher) {
363 Change change; 368 Change change;
364 change.type = CHANGE_TYPE_INPUT_EVENT; 369 change.type = CHANGE_TYPE_INPUT_EVENT;
365 change.window_id = window_id; 370 change.window_id = window_id;
366 change.event_action = static_cast<int32_t>(event.type()); 371 change.event_action = static_cast<int32_t>(event.type());
367 change.matches_pointer_watcher = matches_pointer_watcher; 372 change.matches_pointer_watcher = matches_pointer_watcher;
373 if (event.IsLocatedEvent())
374 change.event_root_location = event.AsLocatedEvent()->root_location();
368 AddChange(change); 375 AddChange(change);
369 } 376 }
370 377
371 void TestChangeTracker::OnPointerEventObserved(const ui::Event& event, 378 void TestChangeTracker::OnPointerEventObserved(const ui::Event& event,
372 uint32_t window_id) { 379 uint32_t window_id) {
373 Change change; 380 Change change;
374 change.type = CHANGE_TYPE_POINTER_WATCHER_EVENT; 381 change.type = CHANGE_TYPE_POINTER_WATCHER_EVENT;
375 change.event_action = static_cast<int32_t>(event.type()); 382 change.event_action = static_cast<int32_t>(event.type());
376 change.window_id = window_id; 383 change.window_id = window_id;
377 AddChange(change); 384 AddChange(change);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 467
461 std::string TestWindow::ToString2() const { 468 std::string TestWindow::ToString2() const {
462 return base::StringPrintf( 469 return base::StringPrintf(
463 "window=%s parent=%s visible=%s", WindowIdToString(window_id).c_str(), 470 "window=%s parent=%s visible=%s", WindowIdToString(window_id).c_str(),
464 WindowIdToString(parent_id).c_str(), visible ? "true" : "false"); 471 WindowIdToString(parent_id).c_str(), visible ? "true" : "false");
465 } 472 }
466 473
467 } // namespace ws 474 } // namespace ws
468 475
469 } // namespace ui 476 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698