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 (switches::UnifiedDesktopEnabled()) { |
oshima
2015/04/28 07:29:41
I made this change when cleaning up the previous C
| |
635 if (primary_display_id == gfx::Display::kInvalidDisplayID) | 635 if (primary_display_id == gfx::Display::kInvalidDisplayID) |
636 primary_display_id = display.id(); | 636 primary_display_id = display.id(); |
637 AshWindowTreeHost* ash_host = | 637 AshWindowTreeHost* ash_host = |
638 AddWindowTreeHostForDisplay(display, AshWindowTreeHostInitParams()); | 638 AddWindowTreeHostForDisplay(display, AshWindowTreeHostInitParams()); |
639 RootWindowController::CreateForSecondaryDisplay(ash_host); | 639 RootWindowController::CreateForSecondaryDisplay(ash_host); |
640 | 640 |
641 if (primary_tree_host_for_replace_) { | 641 if (primary_tree_host_for_replace_) { |
642 AshWindowTreeHost* to_delete = primary_tree_host_for_replace_; | 642 AshWindowTreeHost* to_delete = primary_tree_host_for_replace_; |
643 primary_tree_host_for_replace_ = nullptr; | 643 primary_tree_host_for_replace_ = nullptr; |
644 DeleteHost(to_delete); | 644 DeleteHost(to_delete); |
645 #ifndef NDEBUG | |
646 auto iter = std::find_if( | |
647 window_tree_hosts_.begin(), window_tree_hosts_.end(), | |
648 [to_delete](const std::pair<int64, AshWindowTreeHost*>& pair) { | |
649 return pair.second == to_delete; | |
650 }); | |
651 DCHECK(iter == window_tree_hosts_.end()); | |
652 #endif | |
645 // the host has already been removed from the window_tree_host_. | 653 // the host has already been removed from the window_tree_host_. |
646 } | 654 } |
647 } | 655 } |
648 // TODO(oshima): It should be possible to consolidate logic for | 656 // TODO(oshima): It should be possible to consolidate logic for |
649 // unified and non unified, but I'm keeping them separated to minimize | 657 // unified and non unified, but I'm keeping them separated to minimize |
650 // the risk in M44. I'll consolidate this in M45. | 658 // the risk in M44. I'll consolidate this in M45. |
651 else if (primary_tree_host_for_replace_) { | 659 else if (primary_tree_host_for_replace_) { |
652 DCHECK(window_tree_hosts_.empty()); | 660 DCHECK(window_tree_hosts_.empty()); |
653 primary_display_id = display.id(); | 661 primary_display_id = display.id(); |
654 window_tree_hosts_[display.id()] = primary_tree_host_for_replace_; | 662 window_tree_hosts_[display.id()] = primary_tree_host_for_replace_; |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
864 Shell::GetInstance()->display_configurator_animation() | 872 Shell::GetInstance()->display_configurator_animation() |
865 ->StartFadeInAnimation(); | 873 ->StartFadeInAnimation(); |
866 #endif | 874 #endif |
867 } | 875 } |
868 | 876 |
869 void DisplayController::SetMirrorModeAfterAnimation(bool mirror) { | 877 void DisplayController::SetMirrorModeAfterAnimation(bool mirror) { |
870 GetDisplayManager()->SetMirrorMode(mirror); | 878 GetDisplayManager()->SetMirrorMode(mirror); |
871 } | 879 } |
872 | 880 |
873 } // namespace ash | 881 } // namespace ash |
OLD | NEW |