Index: ash/display/display_controller.cc |
diff --git a/ash/display/display_controller.cc b/ash/display/display_controller.cc |
index 2aa2fc692c0133d44c7ae02998692b4175d7aaaa..5ccb002af8fd3500417860f7fe440e92bb3734ea 100644 |
--- a/ash/display/display_controller.cc |
+++ b/ash/display/display_controller.cc |
@@ -631,7 +631,9 @@ bool DisplayController::UpdateWorkAreaOfDisplayNearestWindow( |
} |
void DisplayController::OnDisplayAdded(const gfx::Display& display) { |
- if (GetDisplayManager()->IsInUnifiedMode()) { |
+#if defined(OS_CHROMEOS) |
+ if (GetDisplayManager()->default_multi_display_mode() == |
+ DisplayManager::UNIFIED) { |
if (primary_display_id == gfx::Display::kInvalidDisplayID) |
primary_display_id = display.id(); |
AshWindowTreeHost* ash_host = |
@@ -642,13 +644,22 @@ void DisplayController::OnDisplayAdded(const gfx::Display& display) { |
AshWindowTreeHost* to_delete = primary_tree_host_for_replace_; |
primary_tree_host_for_replace_ = nullptr; |
DeleteHost(to_delete); |
+#ifndef NDEBUG |
+ auto iter = std::find_if( |
+ window_tree_hosts_.begin(), window_tree_hosts_.end(), |
+ [to_delete](const std::pair<int64, AshWindowTreeHost*>& pair) { |
+ return pair.second == to_delete; |
+ }); |
+ DCHECK(iter == window_tree_hosts_.end()); |
+#endif |
// the host has already been removed from the window_tree_host_. |
} |
- } |
- // TODO(oshima): It should be possible to consolidate logic for |
- // unified and non unified, but I'm keeping them separated to minimize |
- // the risk in M44. I'll consolidate this in M45. |
- else if (primary_tree_host_for_replace_) { |
+ } else |
+#endif |
+ // TODO(oshima): It should be possible to consolidate logic for |
+ // unified and non unified, but I'm keeping them separated to minimize |
+ // the risk in M44. I'll consolidate this in M45. |
+ if (primary_tree_host_for_replace_) { |
DCHECK(window_tree_hosts_.empty()); |
primary_display_id = display.id(); |
window_tree_hosts_[display.id()] = primary_tree_host_for_replace_; |