| OLD | NEW |
| 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 "components/mus/ws/test_change_tracker.h" | 5 #include "components/mus/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 29 matching lines...) Expand all Loading... |
| 40 return "OnEmbed"; | 40 return "OnEmbed"; |
| 41 | 41 |
| 42 case CHANGE_TYPE_EMBEDDED_APP_DISCONNECTED: | 42 case CHANGE_TYPE_EMBEDDED_APP_DISCONNECTED: |
| 43 return base::StringPrintf("OnEmbeddedAppDisconnected window=%s", | 43 return base::StringPrintf("OnEmbeddedAppDisconnected window=%s", |
| 44 WindowIdToString(change.window_id).c_str()); | 44 WindowIdToString(change.window_id).c_str()); |
| 45 | 45 |
| 46 case CHANGE_TYPE_UNEMBED: | 46 case CHANGE_TYPE_UNEMBED: |
| 47 return base::StringPrintf("OnUnembed window=%s", | 47 return base::StringPrintf("OnUnembed window=%s", |
| 48 WindowIdToString(change.window_id).c_str()); | 48 WindowIdToString(change.window_id).c_str()); |
| 49 | 49 |
| 50 case CHANGE_TYPE_LOST_CAPTURE: |
| 51 return base::StringPrintf("OnLostCapture window=%s", |
| 52 WindowIdToString(change.window_id).c_str()); |
| 53 |
| 50 case CHANGE_TYPE_NODE_ADD_TRANSIENT_WINDOW: | 54 case CHANGE_TYPE_NODE_ADD_TRANSIENT_WINDOW: |
| 51 return base::StringPrintf("AddTransientWindow parent = %s child = %s", | 55 return base::StringPrintf("AddTransientWindow parent = %s child = %s", |
| 52 WindowIdToString(change.window_id).c_str(), | 56 WindowIdToString(change.window_id).c_str(), |
| 53 WindowIdToString(change.window_id2).c_str()); | 57 WindowIdToString(change.window_id2).c_str()); |
| 54 | 58 |
| 55 case CHANGE_TYPE_NODE_BOUNDS_CHANGED: | 59 case CHANGE_TYPE_NODE_BOUNDS_CHANGED: |
| 56 return base::StringPrintf( | 60 return base::StringPrintf( |
| 57 "BoundsChanged window=%s old_bounds=%s new_bounds=%s", | 61 "BoundsChanged window=%s old_bounds=%s new_bounds=%s", |
| 58 WindowIdToString(change.window_id).c_str(), | 62 WindowIdToString(change.window_id).c_str(), |
| 59 RectToString(change.bounds).c_str(), | 63 RectToString(change.bounds).c_str(), |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 | 255 |
| 252 void TestChangeTracker::OnTransientWindowRemoved(Id window_id, | 256 void TestChangeTracker::OnTransientWindowRemoved(Id window_id, |
| 253 Id transient_window_id) { | 257 Id transient_window_id) { |
| 254 Change change; | 258 Change change; |
| 255 change.type = CHANGE_TYPE_NODE_REMOVE_TRANSIENT_WINDOW_FROM_PARENT; | 259 change.type = CHANGE_TYPE_NODE_REMOVE_TRANSIENT_WINDOW_FROM_PARENT; |
| 256 change.window_id = window_id; | 260 change.window_id = window_id; |
| 257 change.window_id2 = transient_window_id; | 261 change.window_id2 = transient_window_id; |
| 258 AddChange(change); | 262 AddChange(change); |
| 259 } | 263 } |
| 260 | 264 |
| 265 void TestChangeTracker::OnLostCapture(Id window_id) { |
| 266 Change change; |
| 267 change.type = CHANGE_TYPE_LOST_CAPTURE; |
| 268 change.window_id = window_id; |
| 269 AddChange(change); |
| 270 } |
| 271 |
| 261 void TestChangeTracker::OnWindowViewportMetricsChanged( | 272 void TestChangeTracker::OnWindowViewportMetricsChanged( |
| 262 mojom::ViewportMetricsPtr old_metrics, | 273 mojom::ViewportMetricsPtr old_metrics, |
| 263 mojom::ViewportMetricsPtr new_metrics) { | 274 mojom::ViewportMetricsPtr new_metrics) { |
| 264 Change change; | 275 Change change; |
| 265 change.type = CHANGE_TYPE_NODE_VIEWPORT_METRICS_CHANGED; | 276 change.type = CHANGE_TYPE_NODE_VIEWPORT_METRICS_CHANGED; |
| 266 // NOT IMPLEMENTED | 277 // NOT IMPLEMENTED |
| 267 AddChange(change); | 278 AddChange(change); |
| 268 } | 279 } |
| 269 | 280 |
| 270 void TestChangeTracker::OnWindowHierarchyChanged( | 281 void TestChangeTracker::OnWindowHierarchyChanged( |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 std::string TestWindow::ToString2() const { | 402 std::string TestWindow::ToString2() const { |
| 392 return base::StringPrintf( | 403 return base::StringPrintf( |
| 393 "window=%s parent=%s visible=%s drawn=%s", | 404 "window=%s parent=%s visible=%s drawn=%s", |
| 394 WindowIdToString(window_id).c_str(), WindowIdToString(parent_id).c_str(), | 405 WindowIdToString(window_id).c_str(), WindowIdToString(parent_id).c_str(), |
| 395 visible ? "true" : "false", drawn ? "true" : "false"); | 406 visible ? "true" : "false", drawn ? "true" : "false"); |
| 396 } | 407 } |
| 397 | 408 |
| 398 } // namespace ws | 409 } // namespace ws |
| 399 | 410 |
| 400 } // namespace mus | 411 } // namespace mus |
| OLD | NEW |