| 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 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 if (primary_tree_host_for_replace_) { | 622 if (primary_tree_host_for_replace_) { |
| 623 DCHECK(window_tree_hosts_.empty()); | 623 DCHECK(window_tree_hosts_.empty()); |
| 624 primary_display_id = display.id(); | 624 primary_display_id = display.id(); |
| 625 window_tree_hosts_[display.id()] = primary_tree_host_for_replace_; | 625 window_tree_hosts_[display.id()] = primary_tree_host_for_replace_; |
| 626 GetRootWindowSettings(GetWindow(primary_tree_host_for_replace_)) | 626 GetRootWindowSettings(GetWindow(primary_tree_host_for_replace_)) |
| 627 ->display_id = display.id(); | 627 ->display_id = display.id(); |
| 628 primary_tree_host_for_replace_ = nullptr; | 628 primary_tree_host_for_replace_ = nullptr; |
| 629 const display::ManagedDisplayInfo& display_info = | 629 const display::ManagedDisplayInfo& display_info = |
| 630 GetDisplayManager()->GetDisplayInfo(display.id()); | 630 GetDisplayManager()->GetDisplayInfo(display.id()); |
| 631 AshWindowTreeHost* ash_host = window_tree_hosts_[display.id()]; | 631 AshWindowTreeHost* ash_host = window_tree_hosts_[display.id()]; |
| 632 ash_host->AsWindowTreeHost()->SetBounds(display_info.bounds_in_native()); | 632 ash_host->AsWindowTreeHost()->SetBoundsInPixel( |
| 633 display_info.bounds_in_native()); |
| 633 SetDisplayPropertiesOnHost(ash_host, display); | 634 SetDisplayPropertiesOnHost(ash_host, display); |
| 634 } else { | 635 } else { |
| 635 if (primary_display_id == display::Display::kInvalidDisplayID) | 636 if (primary_display_id == display::Display::kInvalidDisplayID) |
| 636 primary_display_id = display.id(); | 637 primary_display_id = display.id(); |
| 637 DCHECK(!window_tree_hosts_.empty()); | 638 DCHECK(!window_tree_hosts_.empty()); |
| 638 AshWindowTreeHost* ash_host = | 639 AshWindowTreeHost* ash_host = |
| 639 AddWindowTreeHostForDisplay(display, AshWindowTreeHostInitParams()); | 640 AddWindowTreeHostForDisplay(display, AshWindowTreeHostInitParams()); |
| 640 RootWindowController::CreateForSecondaryDisplay(ash_host); | 641 RootWindowController::CreateForSecondaryDisplay(ash_host); |
| 641 } | 642 } |
| 642 } | 643 } |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 void WindowTreeHostManager::OnDisplayMetricsChanged( | 705 void WindowTreeHostManager::OnDisplayMetricsChanged( |
| 705 const display::Display& display, | 706 const display::Display& display, |
| 706 uint32_t metrics) { | 707 uint32_t metrics) { |
| 707 if (!(metrics & (DISPLAY_METRIC_BOUNDS | DISPLAY_METRIC_ROTATION | | 708 if (!(metrics & (DISPLAY_METRIC_BOUNDS | DISPLAY_METRIC_ROTATION | |
| 708 DISPLAY_METRIC_DEVICE_SCALE_FACTOR))) | 709 DISPLAY_METRIC_DEVICE_SCALE_FACTOR))) |
| 709 return; | 710 return; |
| 710 const display::ManagedDisplayInfo& display_info = | 711 const display::ManagedDisplayInfo& display_info = |
| 711 GetDisplayManager()->GetDisplayInfo(display.id()); | 712 GetDisplayManager()->GetDisplayInfo(display.id()); |
| 712 DCHECK(!display_info.bounds_in_native().IsEmpty()); | 713 DCHECK(!display_info.bounds_in_native().IsEmpty()); |
| 713 AshWindowTreeHost* ash_host = window_tree_hosts_[display.id()]; | 714 AshWindowTreeHost* ash_host = window_tree_hosts_[display.id()]; |
| 714 ash_host->AsWindowTreeHost()->SetBounds(display_info.bounds_in_native()); | 715 ash_host->AsWindowTreeHost()->SetBoundsInPixel( |
| 716 display_info.bounds_in_native()); |
| 715 SetDisplayPropertiesOnHost(ash_host, display); | 717 SetDisplayPropertiesOnHost(ash_host, display); |
| 716 } | 718 } |
| 717 | 719 |
| 718 void WindowTreeHostManager::OnHostResized(const aura::WindowTreeHost* host) { | 720 void WindowTreeHostManager::OnHostResized(const aura::WindowTreeHost* host) { |
| 719 display::Display display = | 721 display::Display display = |
| 720 display::Screen::GetScreen()->GetDisplayNearestWindow( | 722 display::Screen::GetScreen()->GetDisplayNearestWindow( |
| 721 const_cast<aura::Window*>(host->window())); | 723 const_cast<aura::Window*>(host->window())); |
| 722 | 724 |
| 723 display::DisplayManager* display_manager = GetDisplayManager(); | 725 display::DisplayManager* display_manager = GetDisplayManager(); |
| 724 if (display_manager->UpdateDisplayBounds(display.id(), host->GetBounds())) { | 726 if (display_manager->UpdateDisplayBounds(display.id(), |
| 727 host->GetBoundsInPixel())) { |
| 725 mirror_window_controller_->UpdateWindow(); | 728 mirror_window_controller_->UpdateWindow(); |
| 726 cursor_window_controller_->UpdateContainer(); | 729 cursor_window_controller_->UpdateContainer(); |
| 727 } | 730 } |
| 728 } | 731 } |
| 729 | 732 |
| 730 void WindowTreeHostManager::CreateOrUpdateMirroringDisplay( | 733 void WindowTreeHostManager::CreateOrUpdateMirroringDisplay( |
| 731 const display::DisplayInfoList& info_list) { | 734 const display::DisplayInfoList& info_list) { |
| 732 if (GetDisplayManager()->IsInMirrorMode() || | 735 if (GetDisplayManager()->IsInMirrorMode() || |
| 733 GetDisplayManager()->IsInUnifiedMode()) { | 736 GetDisplayManager()->IsInUnifiedMode()) { |
| 734 mirror_window_controller_->UpdateWindow(info_list); | 737 mirror_window_controller_->UpdateWindow(info_list); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 870 SetDisplayPropertiesOnHost(ash_host, display); | 873 SetDisplayPropertiesOnHost(ash_host, display); |
| 871 | 874 |
| 872 #if defined(OS_CHROMEOS) | 875 #if defined(OS_CHROMEOS) |
| 873 if (switches::ConstrainPointerToRoot()) | 876 if (switches::ConstrainPointerToRoot()) |
| 874 ash_host->ConfineCursorToRootWindow(); | 877 ash_host->ConfineCursorToRootWindow(); |
| 875 #endif | 878 #endif |
| 876 return ash_host; | 879 return ash_host; |
| 877 } | 880 } |
| 878 | 881 |
| 879 } // namespace ash | 882 } // namespace ash |
| OLD | NEW |