| 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 (GetDisplayManager()->default_multi_display_mode() == |
| 636 DisplayManager::UNIFIED) { |
| 635 if (primary_display_id == gfx::Display::kInvalidDisplayID) | 637 if (primary_display_id == gfx::Display::kInvalidDisplayID) |
| 636 primary_display_id = display.id(); | 638 primary_display_id = display.id(); |
| 637 AshWindowTreeHost* ash_host = | 639 AshWindowTreeHost* ash_host = |
| 638 AddWindowTreeHostForDisplay(display, AshWindowTreeHostInitParams()); | 640 AddWindowTreeHostForDisplay(display, AshWindowTreeHostInitParams()); |
| 639 RootWindowController::CreateForSecondaryDisplay(ash_host); | 641 RootWindowController::CreateForSecondaryDisplay(ash_host); |
| 640 | 642 |
| 641 if (primary_tree_host_for_replace_) { | 643 if (primary_tree_host_for_replace_) { |
| 642 AshWindowTreeHost* to_delete = primary_tree_host_for_replace_; | 644 AshWindowTreeHost* to_delete = primary_tree_host_for_replace_; |
| 643 primary_tree_host_for_replace_ = nullptr; | 645 primary_tree_host_for_replace_ = nullptr; |
| 644 DeleteHost(to_delete); | 646 DeleteHost(to_delete); |
| 647 #ifndef NDEBUG |
| 648 auto iter = std::find_if( |
| 649 window_tree_hosts_.begin(), window_tree_hosts_.end(), |
| 650 [to_delete](const std::pair<int64, AshWindowTreeHost*>& pair) { |
| 651 return pair.second == to_delete; |
| 652 }); |
| 653 DCHECK(iter == window_tree_hosts_.end()); |
| 654 #endif |
| 645 // the host has already been removed from the window_tree_host_. | 655 // the host has already been removed from the window_tree_host_. |
| 646 } | 656 } |
| 647 } | 657 } else |
| 648 // TODO(oshima): It should be possible to consolidate logic for | 658 #endif |
| 649 // unified and non unified, but I'm keeping them separated to minimize | 659 // TODO(oshima): It should be possible to consolidate logic for |
| 650 // the risk in M44. I'll consolidate this in M45. | 660 // unified and non unified, but I'm keeping them separated to minimize |
| 651 else if (primary_tree_host_for_replace_) { | 661 // the risk in M44. I'll consolidate this in M45. |
| 662 if (primary_tree_host_for_replace_) { |
| 652 DCHECK(window_tree_hosts_.empty()); | 663 DCHECK(window_tree_hosts_.empty()); |
| 653 primary_display_id = display.id(); | 664 primary_display_id = display.id(); |
| 654 window_tree_hosts_[display.id()] = primary_tree_host_for_replace_; | 665 window_tree_hosts_[display.id()] = primary_tree_host_for_replace_; |
| 655 GetRootWindowSettings(GetWindow(primary_tree_host_for_replace_)) | 666 GetRootWindowSettings(GetWindow(primary_tree_host_for_replace_)) |
| 656 ->display_id = display.id(); | 667 ->display_id = display.id(); |
| 657 primary_tree_host_for_replace_ = nullptr; | 668 primary_tree_host_for_replace_ = nullptr; |
| 658 const DisplayInfo& display_info = | 669 const DisplayInfo& display_info = |
| 659 GetDisplayManager()->GetDisplayInfo(display.id()); | 670 GetDisplayManager()->GetDisplayInfo(display.id()); |
| 660 AshWindowTreeHost* ash_host = window_tree_hosts_[display.id()]; | 671 AshWindowTreeHost* ash_host = window_tree_hosts_[display.id()]; |
| 661 ash_host->AsWindowTreeHost()->SetBounds(display_info.bounds_in_native()); | 672 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() | 875 Shell::GetInstance()->display_configurator_animation() |
| 865 ->StartFadeInAnimation(); | 876 ->StartFadeInAnimation(); |
| 866 #endif | 877 #endif |
| 867 } | 878 } |
| 868 | 879 |
| 869 void DisplayController::SetMirrorModeAfterAnimation(bool mirror) { | 880 void DisplayController::SetMirrorModeAfterAnimation(bool mirror) { |
| 870 GetDisplayManager()->SetMirrorMode(mirror); | 881 GetDisplayManager()->SetMirrorMode(mirror); |
| 871 } | 882 } |
| 872 | 883 |
| 873 } // namespace ash | 884 } // namespace ash |
| OLD | NEW |