Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(367)

Side by Side Diff: ash/content/display/screen_orientation_controller_chromeos.cc

Issue 1108473002: Fixed the ScreenOrientationController so that it doesn't crash by animating (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed rebase errors. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 } 110 }
111 111
112 void ScreenOrientationController::SetDisplayRotation( 112 void ScreenOrientationController::SetDisplayRotation(
113 gfx::Display::Rotation rotation, 113 gfx::Display::Rotation rotation,
114 gfx::Display::RotationSource source) { 114 gfx::Display::RotationSource source) {
115 if (!gfx::Display::HasInternalDisplay()) 115 if (!gfx::Display::HasInternalDisplay())
116 return; 116 return;
117 current_rotation_ = rotation; 117 current_rotation_ = rotation;
118 base::AutoReset<bool> auto_ignore_display_configuration_updates( 118 base::AutoReset<bool> auto_ignore_display_configuration_updates(
119 &ignore_display_configuration_updates_, true); 119 &ignore_display_configuration_updates_, true);
120 ash::ScreenRotationAnimator(gfx::Display::InternalDisplayId()) 120
121 .Rotate(rotation, source); 121 ash::ScreenRotationAnimator screen_rotation_animator(
122 gfx::Display::InternalDisplayId());
123 if (screen_rotation_animator.CanAnimate()) {
124 screen_rotation_animator.Rotate(rotation, source);
125 } else {
126 // TODO(bruthig): Fix the DisplayManager so that display rotations set on
127 // inactive displays are persisted. See www.crbug.com/480703.
128 Shell::GetInstance()->display_manager()->SetDisplayRotation(
129 gfx::Display::InternalDisplayId(), rotation, source);
130 }
122 } 131 }
123 132
124 void ScreenOrientationController::OnWindowActivated(aura::Window* gained_active, 133 void ScreenOrientationController::OnWindowActivated(aura::Window* gained_active,
125 aura::Window* lost_active) { 134 aura::Window* lost_active) {
126 ApplyLockForActiveWindow(); 135 ApplyLockForActiveWindow();
127 } 136 }
128 137
129 // Currently contents::WebContents will only be able to lock rotation while 138 // Currently contents::WebContents will only be able to lock rotation while
130 // fullscreen. In this state a user cannot click on the tab strip to change. If 139 // fullscreen. In this state a user cannot click on the tab strip to change. If
131 // this becomes supported for non-fullscreen tabs then the following interferes 140 // this becomes supported for non-fullscreen tabs then the following interferes
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 } 432 }
424 433
425 bool ScreenOrientationController::CanRotateInLockedState() { 434 bool ScreenOrientationController::CanRotateInLockedState() {
426 return rotation_locked_orientation_ == 435 return rotation_locked_orientation_ ==
427 blink::WebScreenOrientationLockLandscape || 436 blink::WebScreenOrientationLockLandscape ||
428 rotation_locked_orientation_ == 437 rotation_locked_orientation_ ==
429 blink::WebScreenOrientationLockPortrait; 438 blink::WebScreenOrientationLockPortrait;
430 } 439 }
431 440
432 } // namespace ash 441 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698