| 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 "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "components/mus/common/util.h" | 9 #include "components/mus/common/util.h" |
| 10 #include "mojo/common/common_type_converters.h" | 10 #include "mojo/common/common_type_converters.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 change.property_key.c_str(), | 104 change.property_key.c_str(), |
| 105 change.property_value.c_str()); | 105 change.property_value.c_str()); |
| 106 | 106 |
| 107 case CHANGE_TYPE_DELEGATE_EMBED: | 107 case CHANGE_TYPE_DELEGATE_EMBED: |
| 108 return base::StringPrintf("DelegateEmbed url=%s", | 108 return base::StringPrintf("DelegateEmbed url=%s", |
| 109 change.embed_url.data()); | 109 change.embed_url.data()); |
| 110 | 110 |
| 111 case CHANGE_TYPE_FOCUSED: | 111 case CHANGE_TYPE_FOCUSED: |
| 112 return base::StringPrintf("Focused id=%s", | 112 return base::StringPrintf("Focused id=%s", |
| 113 WindowIdToString(change.window_id).c_str()); | 113 WindowIdToString(change.window_id).c_str()); |
| 114 |
| 115 case CHANGE_TYPE_CURSOR_CHANGED: |
| 116 return base::StringPrintf("CursorChanged id=%s cursor_id=%d", |
| 117 WindowIdToString(change.window_id).c_str(), |
| 118 change.cursor_id); |
| 114 } | 119 } |
| 115 return std::string(); | 120 return std::string(); |
| 116 } | 121 } |
| 117 | 122 |
| 118 } // namespace | 123 } // namespace |
| 119 | 124 |
| 120 std::vector<std::string> ChangesToDescription1( | 125 std::vector<std::string> ChangesToDescription1( |
| 121 const std::vector<Change>& changes) { | 126 const std::vector<Change>& changes) { |
| 122 std::vector<std::string> strings(changes.size()); | 127 std::vector<std::string> strings(changes.size()); |
| 123 for (size_t i = 0; i < changes.size(); ++i) | 128 for (size_t i = 0; i < changes.size(); ++i) |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 AddChange(change); | 325 AddChange(change); |
| 321 } | 326 } |
| 322 | 327 |
| 323 void TestChangeTracker::OnWindowFocused(Id window_id) { | 328 void TestChangeTracker::OnWindowFocused(Id window_id) { |
| 324 Change change; | 329 Change change; |
| 325 change.type = CHANGE_TYPE_FOCUSED; | 330 change.type = CHANGE_TYPE_FOCUSED; |
| 326 change.window_id = window_id; | 331 change.window_id = window_id; |
| 327 AddChange(change); | 332 AddChange(change); |
| 328 } | 333 } |
| 329 | 334 |
| 335 void TestChangeTracker::OnWindowPredefinedCursorChanged( |
| 336 Id window_id, |
| 337 mojom::Cursor cursor_id) { |
| 338 Change change; |
| 339 change.type = CHANGE_TYPE_CURSOR_CHANGED; |
| 340 change.window_id = window_id; |
| 341 change.cursor_id = cursor_id; |
| 342 AddChange(change); |
| 343 } |
| 344 |
| 330 void TestChangeTracker::DelegateEmbed(const String& url) { | 345 void TestChangeTracker::DelegateEmbed(const String& url) { |
| 331 Change change; | 346 Change change; |
| 332 change.type = CHANGE_TYPE_DELEGATE_EMBED; | 347 change.type = CHANGE_TYPE_DELEGATE_EMBED; |
| 333 change.embed_url = url; | 348 change.embed_url = url; |
| 334 AddChange(change); | 349 AddChange(change); |
| 335 } | 350 } |
| 336 | 351 |
| 337 void TestChangeTracker::AddChange(const Change& change) { | 352 void TestChangeTracker::AddChange(const Change& change) { |
| 338 changes_.push_back(change); | 353 changes_.push_back(change); |
| 339 if (delegate_) | 354 if (delegate_) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 353 std::string TestWindow::ToString2() const { | 368 std::string TestWindow::ToString2() const { |
| 354 return base::StringPrintf( | 369 return base::StringPrintf( |
| 355 "window=%s parent=%s visible=%s drawn=%s", | 370 "window=%s parent=%s visible=%s drawn=%s", |
| 356 WindowIdToString(window_id).c_str(), WindowIdToString(parent_id).c_str(), | 371 WindowIdToString(window_id).c_str(), WindowIdToString(parent_id).c_str(), |
| 357 visible ? "true" : "false", drawn ? "true" : "false"); | 372 visible ? "true" : "false", drawn ? "true" : "false"); |
| 358 } | 373 } |
| 359 | 374 |
| 360 } // namespace ws | 375 } // namespace ws |
| 361 | 376 |
| 362 } // namespace mus | 377 } // namespace mus |
| OLD | NEW |