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 "content/public/browser/screen_orientation_provider.h" | 16 #include "content/public/browser/screen_orientation_provider.h" |
16 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
17 #include "ui/aura/window.h" | 18 #include "ui/aura/window.h" |
18 #include "ui/aura/window_observer.h" | 19 #include "ui/aura/window_observer.h" |
19 #include "ui/gfx/display.h" | 20 #include "ui/gfx/display.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 } | 107 } |
107 | 108 |
108 void ScreenOrientationController::SetDisplayRotation( | 109 void ScreenOrientationController::SetDisplayRotation( |
109 gfx::Display::Rotation rotation) { | 110 gfx::Display::Rotation rotation) { |
110 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 111 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
111 if (!display_manager->HasInternalDisplay()) | 112 if (!display_manager->HasInternalDisplay()) |
112 return; | 113 return; |
113 current_rotation_ = rotation; | 114 current_rotation_ = rotation; |
114 base::AutoReset<bool> auto_ignore_display_configuration_updates( | 115 base::AutoReset<bool> auto_ignore_display_configuration_updates( |
115 &ignore_display_configuration_updates_, true); | 116 &ignore_display_configuration_updates_, true); |
116 display_manager->SetDisplayRotation(gfx::Display::InternalDisplayId(), | 117 ash::ScreenRotationAnimator(gfx::Display::InternalDisplayId()) |
117 rotation); | 118 .Rotate(rotation); |
118 } | 119 } |
119 | 120 |
120 void ScreenOrientationController::OnWindowActivated(aura::Window* gained_active, | 121 void ScreenOrientationController::OnWindowActivated(aura::Window* gained_active, |
121 aura::Window* lost_active) { | 122 aura::Window* lost_active) { |
122 ApplyLockForActiveWindow(); | 123 ApplyLockForActiveWindow(); |
123 } | 124 } |
124 | 125 |
125 // Currently contents::WebContents will only be able to lock rotation while | 126 // Currently contents::WebContents will only be able to lock rotation while |
126 // fullscreen. In this state a user cannot click on the tab strip to change. If | 127 // fullscreen. In this state a user cannot click on the tab strip to change. If |
127 // this becomes supported for non-fullscreen tabs then the following interferes | 128 // this becomes supported for non-fullscreen tabs then the following interferes |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 | 385 |
385 void ScreenOrientationController::RemoveLockingWindow(aura::Window* window) { | 386 void ScreenOrientationController::RemoveLockingWindow(aura::Window* window) { |
386 locking_windows_.erase(window); | 387 locking_windows_.erase(window); |
387 if (locking_windows_.empty()) | 388 if (locking_windows_.empty()) |
388 Shell::GetInstance()->activation_client()->RemoveObserver(this); | 389 Shell::GetInstance()->activation_client()->RemoveObserver(this); |
389 window->RemoveObserver(this); | 390 window->RemoveObserver(this); |
390 ApplyLockForActiveWindow(); | 391 ApplyLockForActiveWindow(); |
391 } | 392 } |
392 | 393 |
393 } // namespace ash | 394 } // namespace ash |
OLD | NEW |