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/shell.h" | 11 #include "ash/shell.h" |
11 #include "ash/wm/maximize_mode/maximize_mode_controller.h" | 12 #include "ash/wm/maximize_mode/maximize_mode_controller.h" |
12 #include "base/auto_reset.h" | 13 #include "base/auto_reset.h" |
13 #include "base/command_line.h" | 14 #include "base/command_line.h" |
14 #include "chromeos/accelerometer/accelerometer_reader.h" | 15 #include "chromeos/accelerometer/accelerometer_reader.h" |
15 #include "chromeos/accelerometer/accelerometer_types.h" | 16 #include "chromeos/accelerometer/accelerometer_types.h" |
16 #include "content/public/browser/screen_orientation_provider.h" | 17 #include "content/public/browser/screen_orientation_provider.h" |
17 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
18 #include "ui/aura/window.h" | 19 #include "ui/aura/window.h" |
19 #include "ui/aura/window_observer.h" | 20 #include "ui/aura/window_observer.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 } | 112 } |
112 | 113 |
113 void ScreenOrientationController::SetDisplayRotation( | 114 void ScreenOrientationController::SetDisplayRotation( |
114 gfx::Display::Rotation rotation) { | 115 gfx::Display::Rotation rotation) { |
115 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 116 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
116 if (!display_manager->HasInternalDisplay()) | 117 if (!display_manager->HasInternalDisplay()) |
117 return; | 118 return; |
118 current_rotation_ = rotation; | 119 current_rotation_ = rotation; |
119 base::AutoReset<bool> auto_ignore_display_configuration_updates( | 120 base::AutoReset<bool> auto_ignore_display_configuration_updates( |
120 &ignore_display_configuration_updates_, true); | 121 &ignore_display_configuration_updates_, true); |
121 display_manager->SetDisplayRotation(gfx::Display::InternalDisplayId(), | 122 ash::ScreenRotationAnimator(gfx::Display::InternalDisplayId()) |
122 rotation); | 123 .Rotate(rotation); |
123 } | 124 } |
124 | 125 |
125 void ScreenOrientationController::OnWindowActivated(aura::Window* gained_active, | 126 void ScreenOrientationController::OnWindowActivated(aura::Window* gained_active, |
126 aura::Window* lost_active) { | 127 aura::Window* lost_active) { |
127 ApplyLockForActiveWindow(); | 128 ApplyLockForActiveWindow(); |
128 } | 129 } |
129 | 130 |
130 // Currently contents::WebContents will only be able to lock rotation while | 131 // Currently contents::WebContents will only be able to lock rotation while |
131 // fullscreen. In this state a user cannot click on the tab strip to change. If | 132 // fullscreen. In this state a user cannot click on the tab strip to change. If |
132 // this becomes supported for non-fullscreen tabs then the following interferes | 133 // this becomes supported for non-fullscreen tabs then the following interferes |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 } | 414 } |
414 | 415 |
415 bool ScreenOrientationController::CanRotateInLockedState() { | 416 bool ScreenOrientationController::CanRotateInLockedState() { |
416 return rotation_locked_orientation_ == | 417 return rotation_locked_orientation_ == |
417 blink::WebScreenOrientationLockLandscape || | 418 blink::WebScreenOrientationLockLandscape || |
418 rotation_locked_orientation_ == | 419 rotation_locked_orientation_ == |
419 blink::WebScreenOrientationLockPortrait; | 420 blink::WebScreenOrientationLockPortrait; |
420 } | 421 } |
421 | 422 |
422 } // namespace ash | 423 } // namespace ash |
OLD | NEW |