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

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

Issue 2607063002: Remove mojo::Array. (Closed)
Patch Set: rebase Created 3 years, 11 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"
11 #include "mojo/common/common_type_converters.h"
12 #include "mojo/public/cpp/bindings/map.h" 11 #include "mojo/public/cpp/bindings/map.h"
13 #include "services/ui/common/util.h" 12 #include "services/ui/common/util.h"
14 13
15 using mojo::Array;
16
17 namespace ui { 14 namespace ui {
18 15
19 namespace ws { 16 namespace ws {
20 17
21 std::string WindowIdToString(Id id) { 18 std::string WindowIdToString(Id id) {
22 return (id == 0) ? "null" 19 return (id == 0) ? "null"
23 : base::StringPrintf("%d,%d", HiWord(id), LoWord(id)); 20 : base::StringPrintf("%d,%d", HiWord(id), LoWord(id));
24 } 21 }
25 22
26 namespace { 23 namespace {
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 change.type = CHANGE_TYPE_CAPTURE_CHANGED; 291 change.type = CHANGE_TYPE_CAPTURE_CHANGED;
295 change.window_id = new_capture_window_id; 292 change.window_id = new_capture_window_id;
296 change.window_id2 = old_capture_window_id; 293 change.window_id2 = old_capture_window_id;
297 AddChange(change); 294 AddChange(change);
298 } 295 }
299 296
300 void TestChangeTracker::OnWindowHierarchyChanged( 297 void TestChangeTracker::OnWindowHierarchyChanged(
301 Id window_id, 298 Id window_id,
302 Id old_parent_id, 299 Id old_parent_id,
303 Id new_parent_id, 300 Id new_parent_id,
304 Array<mojom::WindowDataPtr> windows) { 301 std::vector<mojom::WindowDataPtr> windows) {
305 Change change; 302 Change change;
306 change.type = CHANGE_TYPE_NODE_HIERARCHY_CHANGED; 303 change.type = CHANGE_TYPE_NODE_HIERARCHY_CHANGED;
307 change.window_id = window_id; 304 change.window_id = window_id;
308 change.window_id2 = old_parent_id; 305 change.window_id2 = old_parent_id;
309 change.window_id3 = new_parent_id; 306 change.window_id3 = new_parent_id;
310 WindowDatasToTestWindows(windows, &change.windows); 307 WindowDatasToTestWindows(windows, &change.windows);
311 AddChange(change); 308 AddChange(change);
312 } 309 }
313 310
314 void TestChangeTracker::OnWindowReordered(Id window_id, 311 void TestChangeTracker::OnWindowReordered(Id window_id,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 364
368 void TestChangeTracker::OnPointerEventObserved(const ui::Event& event, 365 void TestChangeTracker::OnPointerEventObserved(const ui::Event& event,
369 uint32_t window_id) { 366 uint32_t window_id) {
370 Change change; 367 Change change;
371 change.type = CHANGE_TYPE_POINTER_WATCHER_EVENT; 368 change.type = CHANGE_TYPE_POINTER_WATCHER_EVENT;
372 change.event_action = static_cast<int32_t>(event.type()); 369 change.event_action = static_cast<int32_t>(event.type());
373 change.window_id = window_id; 370 change.window_id = window_id;
374 AddChange(change); 371 AddChange(change);
375 } 372 }
376 373
377 void TestChangeTracker::OnWindowSharedPropertyChanged(Id window_id, 374 void TestChangeTracker::OnWindowSharedPropertyChanged(
378 const std::string& name, 375 Id window_id,
379 Array<uint8_t> data) { 376 const std::string& name,
377 const base::Optional<std::vector<uint8_t>>& data) {
380 Change change; 378 Change change;
381 change.type = CHANGE_TYPE_PROPERTY_CHANGED; 379 change.type = CHANGE_TYPE_PROPERTY_CHANGED;
382 change.window_id = window_id; 380 change.window_id = window_id;
383 change.property_key = name; 381 change.property_key = name;
384 if (data.is_null()) 382 if (!data)
385 change.property_value = "NULL"; 383 change.property_value = "NULL";
386 else 384 else
387 change.property_value = data.To<std::string>(); 385 change.property_value.assign(data->begin(), data->end());
388 AddChange(change); 386 AddChange(change);
389 } 387 }
390 388
391 void TestChangeTracker::OnWindowFocused(Id window_id) { 389 void TestChangeTracker::OnWindowFocused(Id window_id) {
392 Change change; 390 Change change;
393 change.type = CHANGE_TYPE_FOCUSED; 391 change.type = CHANGE_TYPE_FOCUSED;
394 change.window_id = window_id; 392 change.window_id = window_id;
395 AddChange(change); 393 AddChange(change);
396 } 394 }
397 395
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 454
457 std::string TestWindow::ToString2() const { 455 std::string TestWindow::ToString2() const {
458 return base::StringPrintf( 456 return base::StringPrintf(
459 "window=%s parent=%s visible=%s", WindowIdToString(window_id).c_str(), 457 "window=%s parent=%s visible=%s", WindowIdToString(window_id).c_str(),
460 WindowIdToString(parent_id).c_str(), visible ? "true" : "false"); 458 WindowIdToString(parent_id).c_str(), visible ? "true" : "false");
461 } 459 }
462 460
463 } // namespace ws 461 } // namespace ws
464 462
465 } // namespace ui 463 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698