OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/display/display_controller.h" | 5 #include "ash/display/display_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
624 const aura::Window* window, | 624 const aura::Window* window, |
625 const gfx::Insets& insets) { | 625 const gfx::Insets& insets) { |
626 const aura::Window* root_window = window->GetRootWindow(); | 626 const aura::Window* root_window = window->GetRootWindow(); |
627 int64 id = GetRootWindowSettings(root_window)->display_id; | 627 int64 id = GetRootWindowSettings(root_window)->display_id; |
628 // if id is |kInvaildDisplayID|, it's being deleted. | 628 // if id is |kInvaildDisplayID|, it's being deleted. |
629 DCHECK(id != gfx::Display::kInvalidDisplayID); | 629 DCHECK(id != gfx::Display::kInvalidDisplayID); |
630 return GetDisplayManager()->UpdateWorkAreaOfDisplay(id, insets); | 630 return GetDisplayManager()->UpdateWorkAreaOfDisplay(id, insets); |
631 } | 631 } |
632 | 632 |
633 void DisplayController::OnDisplayAdded(const gfx::Display& display) { | 633 void DisplayController::OnDisplayAdded(const gfx::Display& display) { |
634 if (GetDisplayManager()->IsInUnifiedMode()) { | 634 #if defined(OS_CHROMEOS) |
635 if (switches::UnifiedDesktopEnabled()) { | |
Jun Mukai
2015/04/28 17:07:39
Does this mean it's always in the unified desktop
oshima
2015/04/28 17:10:18
That's a flag, so you can't change it on the fly a
oshima
2015/04/28 17:20:20
Actually, I should check the default multi display
| |
635 if (primary_display_id == gfx::Display::kInvalidDisplayID) | 636 if (primary_display_id == gfx::Display::kInvalidDisplayID) |
636 primary_display_id = display.id(); | 637 primary_display_id = display.id(); |
637 AshWindowTreeHost* ash_host = | 638 AshWindowTreeHost* ash_host = |
638 AddWindowTreeHostForDisplay(display, AshWindowTreeHostInitParams()); | 639 AddWindowTreeHostForDisplay(display, AshWindowTreeHostInitParams()); |
639 RootWindowController::CreateForSecondaryDisplay(ash_host); | 640 RootWindowController::CreateForSecondaryDisplay(ash_host); |
640 | 641 |
641 if (primary_tree_host_for_replace_) { | 642 if (primary_tree_host_for_replace_) { |
642 AshWindowTreeHost* to_delete = primary_tree_host_for_replace_; | 643 AshWindowTreeHost* to_delete = primary_tree_host_for_replace_; |
643 primary_tree_host_for_replace_ = nullptr; | 644 primary_tree_host_for_replace_ = nullptr; |
644 DeleteHost(to_delete); | 645 DeleteHost(to_delete); |
646 #ifndef NDEBUG | |
647 auto iter = std::find_if( | |
648 window_tree_hosts_.begin(), window_tree_hosts_.end(), | |
649 [to_delete](const std::pair<int64, AshWindowTreeHost*>& pair) { | |
650 return pair.second == to_delete; | |
651 }); | |
652 DCHECK(iter == window_tree_hosts_.end()); | |
653 #endif | |
645 // the host has already been removed from the window_tree_host_. | 654 // the host has already been removed from the window_tree_host_. |
646 } | 655 } |
647 } | 656 } else |
657 #endif | |
648 // TODO(oshima): It should be possible to consolidate logic for | 658 // TODO(oshima): It should be possible to consolidate logic for |
649 // unified and non unified, but I'm keeping them separated to minimize | 659 // unified and non unified, but I'm keeping them separated to minimize |
650 // the risk in M44. I'll consolidate this in M45. | 660 // the risk in M44. I'll consolidate this in M45. |
651 else if (primary_tree_host_for_replace_) { | 661 if (primary_tree_host_for_replace_) { |
652 DCHECK(window_tree_hosts_.empty()); | 662 DCHECK(window_tree_hosts_.empty()); |
653 primary_display_id = display.id(); | 663 primary_display_id = display.id(); |
654 window_tree_hosts_[display.id()] = primary_tree_host_for_replace_; | 664 window_tree_hosts_[display.id()] = primary_tree_host_for_replace_; |
655 GetRootWindowSettings(GetWindow(primary_tree_host_for_replace_)) | 665 GetRootWindowSettings(GetWindow(primary_tree_host_for_replace_)) |
656 ->display_id = display.id(); | 666 ->display_id = display.id(); |
657 primary_tree_host_for_replace_ = nullptr; | 667 primary_tree_host_for_replace_ = nullptr; |
658 const DisplayInfo& display_info = | 668 const DisplayInfo& display_info = |
659 GetDisplayManager()->GetDisplayInfo(display.id()); | 669 GetDisplayManager()->GetDisplayInfo(display.id()); |
660 AshWindowTreeHost* ash_host = window_tree_hosts_[display.id()]; | 670 AshWindowTreeHost* ash_host = window_tree_hosts_[display.id()]; |
661 ash_host->AsWindowTreeHost()->SetBounds(display_info.bounds_in_native()); | 671 ash_host->AsWindowTreeHost()->SetBounds(display_info.bounds_in_native()); |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
864 Shell::GetInstance()->display_configurator_animation() | 874 Shell::GetInstance()->display_configurator_animation() |
865 ->StartFadeInAnimation(); | 875 ->StartFadeInAnimation(); |
866 #endif | 876 #endif |
867 } | 877 } |
868 | 878 |
869 void DisplayController::SetMirrorModeAfterAnimation(bool mirror) { | 879 void DisplayController::SetMirrorModeAfterAnimation(bool mirror) { |
870 GetDisplayManager()->SetMirrorMode(mirror); | 880 GetDisplayManager()->SetMirrorMode(mirror); |
871 } | 881 } |
872 | 882 |
873 } // namespace ash | 883 } // namespace ash |
OLD | NEW |