Chromium Code Reviews| 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 |
|
oshima
2016/04/08 07:09:40
include?
| |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <utility> | 10 #include <utility> |
| 11 | 11 |
| 12 #include "ash/ash_switches.h" | 12 #include "ash/ash_switches.h" |
| 13 #include "ash/display/cursor_window_controller.h" | 13 #include "ash/display/cursor_window_controller.h" |
| 14 #include "ash/display/display_layout_store.h" | 14 #include "ash/display/display_layout_store.h" |
| 15 #include "ash/display/display_manager.h" | 15 #include "ash/display/display_manager.h" |
| 16 #include "ash/display/mirror_window_controller.h" | 16 #include "ash/display/mirror_window_controller.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 126 // Scale all motion on High-DPI displays. | 126 // Scale all motion on High-DPI displays. |
| 127 float scale = display.device_scale_factor(); | 127 float scale = display.device_scale_factor(); |
| 128 | 128 |
| 129 if (!display.IsInternal()) | 129 if (!display.IsInternal()) |
| 130 scale *= kCursorMultiplierForExternalDisplays; | 130 scale *= kCursorMultiplierForExternalDisplays; |
| 131 | 131 |
| 132 ui::CursorController::GetInstance()->SetCursorConfigForWindow( | 132 ui::CursorController::GetInstance()->SetCursorConfigForWindow( |
| 133 host->GetAcceleratedWidget(), info.GetActiveRotation(), scale); | 133 host->GetAcceleratedWidget(), info.GetActiveRotation(), scale); |
| 134 #endif | 134 #endif |
| 135 #endif | 135 #endif |
| 136 scoped_ptr<RootWindowTransformer> transformer( | 136 std::unique_ptr<RootWindowTransformer> transformer( |
| 137 CreateRootWindowTransformerForDisplay(host->window(), display)); | 137 CreateRootWindowTransformerForDisplay(host->window(), display)); |
| 138 ash_host->SetRootWindowTransformer(std::move(transformer)); | 138 ash_host->SetRootWindowTransformer(std::move(transformer)); |
| 139 | 139 |
| 140 DisplayMode mode = | 140 DisplayMode mode = |
| 141 GetDisplayManager()->GetActiveModeForDisplayId(display.id()); | 141 GetDisplayManager()->GetActiveModeForDisplayId(display.id()); |
| 142 if (mode.refresh_rate > 0.0f) { | 142 if (mode.refresh_rate > 0.0f) { |
| 143 host->compositor()->SetAuthoritativeVSyncInterval( | 143 host->compositor()->SetAuthoritativeVSyncInterval( |
| 144 base::TimeDelta::FromMicroseconds(base::Time::kMicrosecondsPerSecond / | 144 base::TimeDelta::FromMicroseconds(base::Time::kMicrosecondsPerSecond / |
| 145 mode.refresh_rate)); | 145 mode.refresh_rate)); |
| 146 } | 146 } |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 439 window_tree_hosts_[old_primary_display.id()] = non_primary_host; | 439 window_tree_hosts_[old_primary_display.id()] = non_primary_host; |
| 440 GetRootWindowSettings(GetWindow(non_primary_host))->display_id = | 440 GetRootWindowSettings(GetWindow(non_primary_host))->display_id = |
| 441 old_primary_display.id(); | 441 old_primary_display.id(); |
| 442 | 442 |
| 443 const display::DisplayLayout& layout = | 443 const display::DisplayLayout& layout = |
| 444 GetDisplayManager()->GetCurrentDisplayLayout(); | 444 GetDisplayManager()->GetCurrentDisplayLayout(); |
| 445 // The requested primary id can be same as one in the stored layout | 445 // The requested primary id can be same as one in the stored layout |
| 446 // when the primary id is set after new displays are connected. | 446 // when the primary id is set after new displays are connected. |
| 447 // Only update the layout if it is requested to swap primary display. | 447 // Only update the layout if it is requested to swap primary display. |
| 448 if (layout.primary_id != new_primary_display.id()) { | 448 if (layout.primary_id != new_primary_display.id()) { |
| 449 scoped_ptr<display::DisplayLayout> swapped_layout(layout.Copy()); | 449 std::unique_ptr<display::DisplayLayout> swapped_layout(layout.Copy()); |
| 450 swapped_layout->placement_list[0].Swap(); | 450 swapped_layout->placement_list[0].Swap(); |
| 451 swapped_layout->primary_id = new_primary_display.id(); | 451 swapped_layout->primary_id = new_primary_display.id(); |
| 452 display::DisplayIdList list = display_manager->GetCurrentDisplayIdList(); | 452 display::DisplayIdList list = display_manager->GetCurrentDisplayIdList(); |
| 453 GetDisplayManager()->layout_store()->RegisterLayoutForDisplayIdList( | 453 GetDisplayManager()->layout_store()->RegisterLayoutForDisplayIdList( |
| 454 list, std::move(swapped_layout)); | 454 list, std::move(swapped_layout)); |
| 455 } | 455 } |
| 456 | 456 |
| 457 primary_display_id = new_primary_display.id(); | 457 primary_display_id = new_primary_display.id(); |
| 458 | 458 |
| 459 UpdateWorkAreaOfDisplayNearestWindow(GetWindow(primary_host), | 459 UpdateWorkAreaOfDisplayNearestWindow(GetWindow(primary_host), |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 841 SetDisplayPropertiesOnHost(ash_host, display); | 841 SetDisplayPropertiesOnHost(ash_host, display); |
| 842 | 842 |
| 843 #if defined(OS_CHROMEOS) | 843 #if defined(OS_CHROMEOS) |
| 844 if (switches::ConstrainPointerToRoot()) | 844 if (switches::ConstrainPointerToRoot()) |
| 845 ash_host->ConfineCursorToRootWindow(); | 845 ash_host->ConfineCursorToRootWindow(); |
| 846 #endif | 846 #endif |
| 847 return ash_host; | 847 return ash_host; |
| 848 } | 848 } |
| 849 | 849 |
| 850 } // namespace ash | 850 } // namespace ash |
| OLD | NEW |