| 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/window_tree_host_manager.h" | 5 #include "ash/display/window_tree_host_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 if (primary_tree_host_for_replace_) { | 648 if (primary_tree_host_for_replace_) { |
| 649 DCHECK(window_tree_hosts_.empty()); | 649 DCHECK(window_tree_hosts_.empty()); |
| 650 primary_display_id = display.id(); | 650 primary_display_id = display.id(); |
| 651 window_tree_hosts_[display.id()] = primary_tree_host_for_replace_; | 651 window_tree_hosts_[display.id()] = primary_tree_host_for_replace_; |
| 652 GetRootWindowSettings(GetWindow(primary_tree_host_for_replace_)) | 652 GetRootWindowSettings(GetWindow(primary_tree_host_for_replace_)) |
| 653 ->display_id = display.id(); | 653 ->display_id = display.id(); |
| 654 primary_tree_host_for_replace_ = nullptr; | 654 primary_tree_host_for_replace_ = nullptr; |
| 655 const display::ManagedDisplayInfo& display_info = | 655 const display::ManagedDisplayInfo& display_info = |
| 656 GetDisplayManager()->GetDisplayInfo(display.id()); | 656 GetDisplayManager()->GetDisplayInfo(display.id()); |
| 657 AshWindowTreeHost* ash_host = window_tree_hosts_[display.id()]; | 657 AshWindowTreeHost* ash_host = window_tree_hosts_[display.id()]; |
| 658 ash_host->AsWindowTreeHost()->SetBounds(display_info.bounds_in_native()); | 658 ash_host->AsWindowTreeHost()->SetBoundsInPixels( |
| 659 display_info.bounds_in_native()); |
| 659 SetDisplayPropertiesOnHost(ash_host, display); | 660 SetDisplayPropertiesOnHost(ash_host, display); |
| 660 } else { | 661 } else { |
| 661 if (primary_display_id == display::kInvalidDisplayId) | 662 if (primary_display_id == display::kInvalidDisplayId) |
| 662 primary_display_id = display.id(); | 663 primary_display_id = display.id(); |
| 663 DCHECK(!window_tree_hosts_.empty()); | 664 DCHECK(!window_tree_hosts_.empty()); |
| 664 AshWindowTreeHost* ash_host = | 665 AshWindowTreeHost* ash_host = |
| 665 AddWindowTreeHostForDisplay(display, AshWindowTreeHostInitParams()); | 666 AddWindowTreeHostForDisplay(display, AshWindowTreeHostInitParams()); |
| 666 RootWindowController::CreateForSecondaryDisplay(ash_host); | 667 RootWindowController::CreateForSecondaryDisplay(ash_host); |
| 667 } | 668 } |
| 668 } | 669 } |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 730 void WindowTreeHostManager::OnDisplayMetricsChanged( | 731 void WindowTreeHostManager::OnDisplayMetricsChanged( |
| 731 const display::Display& display, | 732 const display::Display& display, |
| 732 uint32_t metrics) { | 733 uint32_t metrics) { |
| 733 if (!(metrics & (DISPLAY_METRIC_BOUNDS | DISPLAY_METRIC_ROTATION | | 734 if (!(metrics & (DISPLAY_METRIC_BOUNDS | DISPLAY_METRIC_ROTATION | |
| 734 DISPLAY_METRIC_DEVICE_SCALE_FACTOR))) | 735 DISPLAY_METRIC_DEVICE_SCALE_FACTOR))) |
| 735 return; | 736 return; |
| 736 const display::ManagedDisplayInfo& display_info = | 737 const display::ManagedDisplayInfo& display_info = |
| 737 GetDisplayManager()->GetDisplayInfo(display.id()); | 738 GetDisplayManager()->GetDisplayInfo(display.id()); |
| 738 DCHECK(!display_info.bounds_in_native().IsEmpty()); | 739 DCHECK(!display_info.bounds_in_native().IsEmpty()); |
| 739 AshWindowTreeHost* ash_host = window_tree_hosts_[display.id()]; | 740 AshWindowTreeHost* ash_host = window_tree_hosts_[display.id()]; |
| 740 ash_host->AsWindowTreeHost()->SetBounds(display_info.bounds_in_native()); | 741 ash_host->AsWindowTreeHost()->SetBoundsInPixels( |
| 742 display_info.bounds_in_native()); |
| 741 SetDisplayPropertiesOnHost(ash_host, display); | 743 SetDisplayPropertiesOnHost(ash_host, display); |
| 742 } | 744 } |
| 743 | 745 |
| 744 void WindowTreeHostManager::OnHostResized(const aura::WindowTreeHost* host) { | 746 void WindowTreeHostManager::OnHostResized(const aura::WindowTreeHost* host) { |
| 745 display::Display display = | 747 display::Display display = |
| 746 display::Screen::GetScreen()->GetDisplayNearestWindow( | 748 display::Screen::GetScreen()->GetDisplayNearestWindow( |
| 747 const_cast<aura::Window*>(host->window())); | 749 const_cast<aura::Window*>(host->window())); |
| 748 | 750 |
| 749 display::DisplayManager* display_manager = GetDisplayManager(); | 751 display::DisplayManager* display_manager = GetDisplayManager(); |
| 750 if (display_manager->UpdateDisplayBounds(display.id(), host->GetBounds())) { | 752 if (display_manager->UpdateDisplayBounds(display.id(), |
| 753 host->GetBoundsInPixels())) { |
| 751 mirror_window_controller_->UpdateWindow(); | 754 mirror_window_controller_->UpdateWindow(); |
| 752 cursor_window_controller_->UpdateContainer(); | 755 cursor_window_controller_->UpdateContainer(); |
| 753 } | 756 } |
| 754 } | 757 } |
| 755 | 758 |
| 756 void WindowTreeHostManager::CreateOrUpdateMirroringDisplay( | 759 void WindowTreeHostManager::CreateOrUpdateMirroringDisplay( |
| 757 const display::DisplayInfoList& info_list) { | 760 const display::DisplayInfoList& info_list) { |
| 758 if (GetDisplayManager()->IsInMirrorMode() || | 761 if (GetDisplayManager()->IsInMirrorMode() || |
| 759 GetDisplayManager()->IsInUnifiedMode()) { | 762 GetDisplayManager()->IsInUnifiedMode()) { |
| 760 mirror_window_controller_->UpdateWindow(info_list); | 763 mirror_window_controller_->UpdateWindow(info_list); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 SetDisplayPropertiesOnHost(ash_host, display); | 898 SetDisplayPropertiesOnHost(ash_host, display); |
| 896 | 899 |
| 897 #if defined(OS_CHROMEOS) | 900 #if defined(OS_CHROMEOS) |
| 898 if (switches::ConstrainPointerToRoot()) | 901 if (switches::ConstrainPointerToRoot()) |
| 899 ash_host->ConfineCursorToRootWindow(); | 902 ash_host->ConfineCursorToRootWindow(); |
| 900 #endif | 903 #endif |
| 901 return ash_host; | 904 return ash_host; |
| 902 } | 905 } |
| 903 | 906 |
| 904 } // namespace ash | 907 } // namespace ash |
| OLD | NEW |