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

Side by Side Diff: ash/test/ash_test_helper.cc

Issue 2784173002: Changes how window is updated when display changes in mash (Closed)
Patch Set: feedback Created 3 years, 8 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
« no previous file with comments | « ash/mus/window_manager.cc ('k') | ash/wm/window_state_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ash/test/ash_test_helper.h" 5 #include "ash/test/ash_test_helper.h"
6 6
7 #include "ash/accelerators/accelerator_controller_delegate_aura.h" 7 #include "ash/accelerators/accelerator_controller_delegate_aura.h"
8 #include "ash/aura/wm_shell_aura.h" 8 #include "ash/aura/wm_shell_aura.h"
9 #include "ash/common/test/test_session_state_delegate.h" 9 #include "ash/common/test/test_session_state_delegate.h"
10 #include "ash/common/test/test_system_tray_delegate.h" 10 #include "ash/common/test/test_system_tray_delegate.h"
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 ManagedDisplayInfo::CreateFromSpec(display_spec); 361 ManagedDisplayInfo::CreateFromSpec(display_spec);
362 gfx::Rect bounds = display_info.bounds_in_native(); 362 gfx::Rect bounds = display_info.bounds_in_native();
363 bounds.set_x(*next_x); 363 bounds.set_x(*next_x);
364 *next_x += bounds.size().width(); 364 *next_x += bounds.size().width();
365 display::Display updated_display = 365 display::Display updated_display =
366 root_window_controller->GetWindow()->GetDisplayNearestWindow(); 366 root_window_controller->GetWindow()->GetDisplayNearestWindow();
367 gfx::Insets work_area_insets = updated_display.GetWorkAreaInsets(); 367 gfx::Insets work_area_insets = updated_display.GetWorkAreaInsets();
368 updated_display.set_bounds(bounds); 368 updated_display.set_bounds(bounds);
369 updated_display.UpdateWorkAreaFromInsets(work_area_insets); 369 updated_display.UpdateWorkAreaFromInsets(work_area_insets);
370 updated_display.set_device_scale_factor(display_info.device_scale_factor()); 370 updated_display.set_device_scale_factor(display_info.device_scale_factor());
371 root_window_controller->GetWindow()->SetBounds(gfx::Rect(bounds.size())); 371 window_manager_app_->window_manager()->OnWmDisplayModified(updated_display);
372 ScreenMus* screen = window_manager_app_->window_manager()->screen_.get();
373 const bool is_primary =
374 screen->display_list().FindDisplayById(updated_display.id()) ==
375 screen->display_list().GetPrimaryDisplayIterator();
376 screen->display_list().UpdateDisplay(
377 updated_display, is_primary ? display::DisplayList::Type::PRIMARY
378 : display::DisplayList::Type::NOT_PRIMARY);
379 } 372 }
380 373
381 std::vector<RootWindowController*> AshTestHelper::GetRootsOrderedByDisplayId() { 374 std::vector<RootWindowController*> AshTestHelper::GetRootsOrderedByDisplayId() {
382 std::set<RootWindowController*> roots = 375 std::set<RootWindowController*> roots =
383 window_manager_app_->window_manager()->GetRootWindowControllers(); 376 window_manager_app_->window_manager()->GetRootWindowControllers();
384 std::vector<RootWindowController*> ordered_roots; 377 std::vector<RootWindowController*> ordered_roots;
385 ordered_roots.insert(ordered_roots.begin(), roots.begin(), roots.end()); 378 ordered_roots.insert(ordered_roots.begin(), roots.begin(), roots.end());
386 std::sort(ordered_roots.begin(), ordered_roots.end(), &CompareByDisplayId); 379 std::sort(ordered_roots.begin(), ordered_roots.end(), &CompareByDisplayId);
387 return ordered_roots; 380 return ordered_roots;
388 } 381 }
389 382
390 } // namespace test 383 } // namespace test
391 } // namespace ash 384 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/window_manager.cc ('k') | ash/wm/window_state_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698