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

Unified Diff: ash/display/display_manager.cc

Issue 1150913002: Save and restore unified mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
Index: ash/display/display_manager.cc
diff --git a/ash/display/display_manager.cc b/ash/display/display_manager.cc
index 92c0f59f5966f78a81f058e788c52ed392615ba0..0746d163bbead7936f81f5075b2a8538fe98dc81 100644
--- a/ash/display/display_manager.cc
+++ b/ash/display/display_manager.cc
@@ -140,9 +140,6 @@ DisplayManager::DisplayManager()
if (base::SysInfo::IsRunningOnChromeOS())
DisplayInfo::SetUse125DSFForUIScaling(true);
- if (switches::UnifiedDesktopEnabled())
- default_multi_display_mode_ = UNIFIED;
-
change_display_upon_host_resize_ = !base::SysInfo::IsRunningOnChromeOS();
#endif
gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_ALTERNATE, screen_.get());
@@ -641,6 +638,8 @@ void DisplayManager::OnNativeDisplaysChanged(
if (gfx::Display::HasInternalDisplay() && !internal_display_connected &&
display_info_.find(gfx::Display::InternalDisplayId()) ==
display_info_.end()) {
+ // Create a dummy internal display if the chrome restarted
+ // in docked mode.
DisplayInfo internal_display_info(
gfx::Display::InternalDisplayId(),
l10n_util::GetStringUTF8(IDS_ASH_INTERNAL_DISPLAY_NAME),
@@ -648,6 +647,22 @@ void DisplayManager::OnNativeDisplaysChanged(
internal_display_info.SetBounds(gfx::Rect(0, 0, 800, 600));
display_info_[gfx::Display::InternalDisplayId()] = internal_display_info;
}
+
+ if (new_display_info_list.size() > 1) {
+ std::sort(new_display_info_list.begin(), new_display_info_list.end(),
+ DisplayInfoSortFunctor());
+ DisplayIdPair pair = std::make_pair(new_display_info_list[0].id(),
+ new_display_info_list[1].id());
+ DisplayLayout layout = layout_store_->GetRegisteredDisplayLayout(pair);
+ default_multi_display_mode_ = layout.default_unified ? UNIFIED : EXTENDED;
Jun Mukai 2015/05/21 09:38:12 (layout.default_unified && ash::switches::UnifiedD
oshima 2015/05/21 12:24:12 good point. Done. Also updated tests because tests
+#if defined(OS_CHROMEOS)
+ // Mirror mode is set by DisplayConfigurator on the device.
+ // Emulate it when running on linux desktop.
+ if (!base::SysInfo::IsRunningOnChromeOS() && layout.mirrored)
+ SetMultiDisplayMode(MIRRORING);
+#endif
+ }
+
UpdateDisplays(new_display_info_list);
}

Powered by Google App Engine
This is Rietveld 408576698