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

Unified Diff: ash/display/display_controller.cc

Issue 11801019: Merge 174008 (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1364/src/
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/display/display_controller.h ('k') | ash/display/display_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/display/display_controller.cc
===================================================================
--- ash/display/display_controller.cc (revision 175368)
+++ ash/display/display_controller.cc (working copy)
@@ -161,7 +161,8 @@
}
DisplayController::DisplayController()
- : desired_primary_display_id_(gfx::Display::kInvalidDisplayID) {
+ : desired_primary_display_id_(gfx::Display::kInvalidDisplayID),
+ primary_root_window_for_replace_(NULL) {
// Reset primary display to make sure that tests don't use
// stale display info from previous tests.
primary_display_id = gfx::Display::kInvalidDisplayID;
@@ -465,14 +466,23 @@
}
void DisplayController::OnDisplayAdded(const gfx::Display& display) {
- DCHECK(!root_windows_.empty());
NotifyDisplayConfigurationChanging();
- aura::RootWindow* root = AddRootWindowForDisplay(display);
- UpdateDisplayBoundsForLayout();
- if (desired_primary_display_id_ == display.id())
- SetPrimaryDisplay(display);
-
- Shell::GetInstance()->InitRootWindowForSecondaryDisplay(root);
+ if (primary_root_window_for_replace_) {
+ DCHECK(root_windows_.empty());
+ primary_display_id = display.id();
+ root_windows_[display.id()] = primary_root_window_for_replace_;
+ primary_root_window_for_replace_->SetProperty(
+ internal::kDisplayIdKey, display.id());
+ primary_root_window_for_replace_ = NULL;
+ UpdateDisplayBoundsForLayout();
+ } else {
+ DCHECK(!root_windows_.empty());
+ aura::RootWindow* root = AddRootWindowForDisplay(display);
+ UpdateDisplayBoundsForLayout();
+ if (desired_primary_display_id_ == display.id())
+ SetPrimaryDisplay(display);
+ Shell::GetInstance()->InitRootWindowForSecondaryDisplay(root);
+ }
}
void DisplayController::OnDisplayRemoved(const gfx::Display& display) {
@@ -487,6 +497,13 @@
// When the primary root window's display is removed, move the primary
// root to the other display.
if (primary_display_id == display.id()) {
+ // Temporarily store the primary root window in
+ // |primary_root_window_for_replace_| when replacing the display.
+ if (root_windows_.size() == 0) {
+ primary_display_id = gfx::Display::kInvalidDisplayID;
+ primary_root_window_for_replace_ = root_to_delete;
+ return;
+ }
DCHECK_EQ(1U, root_windows_.size());
primary_display_id = GetSecondaryDisplay()->id();
aura::RootWindow* primary_root = root_to_delete;
« no previous file with comments | « ash/display/display_controller.h ('k') | ash/display/display_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698