Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/content/display/screen_orientation_controller_chromeos.h" | 5 #include "ash/content/display/screen_orientation_controller_chromeos.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/display/display_info.h" | 8 #include "ash/display/display_info.h" |
| 9 #include "ash/display/display_manager.h" | 9 #include "ash/display/display_manager.h" |
| 10 #include "ash/rotator/screen_rotation_animator.h" | 10 #include "ash/rotator/screen_rotation_animator.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 109 &ignore_display_configuration_updates_, true); | 109 &ignore_display_configuration_updates_, true); |
| 110 display_manager->RegisterDisplayRotationProperties(rotation_locked_, | 110 display_manager->RegisterDisplayRotationProperties(rotation_locked_, |
| 111 current_rotation_); | 111 current_rotation_); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void ScreenOrientationController::SetDisplayRotation( | 114 void ScreenOrientationController::SetDisplayRotation( |
| 115 gfx::Display::Rotation rotation) { | 115 gfx::Display::Rotation rotation) { |
| 116 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 116 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
| 117 if (!display_manager->HasInternalDisplay()) | 117 if (!display_manager->HasInternalDisplay()) |
| 118 return; | 118 return; |
| 119 | |
| 119 current_rotation_ = rotation; | 120 current_rotation_ = rotation; |
| 120 base::AutoReset<bool> auto_ignore_display_configuration_updates( | 121 base::AutoReset<bool> auto_ignore_display_configuration_updates( |
| 121 &ignore_display_configuration_updates_, true); | 122 &ignore_display_configuration_updates_, true); |
| 122 ash::ScreenRotationAnimator(gfx::Display::InternalDisplayId()) | 123 |
| 123 .Rotate(rotation); | 124 ash::ScreenRotationAnimator screen_rotation_animator( |
| 125 gfx::Display::InternalDisplayId()); | |
| 126 if (screen_rotation_animator.CanAnimate()) { | |
| 127 screen_rotation_animator.Rotate(rotation); | |
| 128 } else { | |
| 129 // TODO(bruthig): Fix the DisplayManager so that display rotations set on | |
| 130 // inactive displays are persisted. See www.crbug.com/480703. | |
| 131 Shell::GetInstance()->display_manager()->SetDisplayRotation( | |
|
jonross
2015/04/24 14:18:08
Use the display manager from 116
bruthig
2015/04/24 16:17:12
display manager no longer exists.
jonross
2015/04/24 17:08:30
Acknowledged.
| |
| 132 gfx::Display::InternalDisplayId(), rotation); | |
| 133 } | |
| 124 } | 134 } |
| 125 | 135 |
| 126 void ScreenOrientationController::OnWindowActivated(aura::Window* gained_active, | 136 void ScreenOrientationController::OnWindowActivated(aura::Window* gained_active, |
| 127 aura::Window* lost_active) { | 137 aura::Window* lost_active) { |
| 128 ApplyLockForActiveWindow(); | 138 ApplyLockForActiveWindow(); |
| 129 } | 139 } |
| 130 | 140 |
| 131 // Currently contents::WebContents will only be able to lock rotation while | 141 // Currently contents::WebContents will only be able to lock rotation while |
| 132 // fullscreen. In this state a user cannot click on the tab strip to change. If | 142 // fullscreen. In this state a user cannot click on the tab strip to change. If |
| 133 // this becomes supported for non-fullscreen tabs then the following interferes | 143 // this becomes supported for non-fullscreen tabs then the following interferes |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 416 } | 426 } |
| 417 | 427 |
| 418 bool ScreenOrientationController::CanRotateInLockedState() { | 428 bool ScreenOrientationController::CanRotateInLockedState() { |
| 419 return rotation_locked_orientation_ == | 429 return rotation_locked_orientation_ == |
| 420 blink::WebScreenOrientationLockLandscape || | 430 blink::WebScreenOrientationLockLandscape || |
| 421 rotation_locked_orientation_ == | 431 rotation_locked_orientation_ == |
| 422 blink::WebScreenOrientationLockPortrait; | 432 blink::WebScreenOrientationLockPortrait; |
| 423 } | 433 } |
| 424 | 434 |
| 425 } // namespace ash | 435 } // namespace ash |
| OLD | NEW |