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

Side by Side Diff: ash/rotator/screen_rotation_animator.cc

Issue 1139793003: Disable Rotation Animations on Login Pages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/rotator/screen_rotation_animator.h" 5 #include "ash/rotator/screen_rotation_animator.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
11 #include "ash/display/display_controller.h" 11 #include "ash/display/display_controller.h"
12 #include "ash/display/display_info.h" 12 #include "ash/display/display_info.h"
13 #include "ash/display/display_manager.h" 13 #include "ash/display/display_manager.h"
14 #include "ash/rotator/screen_rotation_animation.h" 14 #include "ash/rotator/screen_rotation_animation.h"
15 #include "ash/session/session_state_delegate.h"
15 #include "ash/shell.h" 16 #include "ash/shell.h"
16 #include "base/command_line.h" 17 #include "base/command_line.h"
17 #include "base/time/time.h" 18 #include "base/time/time.h"
18 #include "ui/aura/window.h" 19 #include "ui/aura/window.h"
19 #include "ui/compositor/layer.h" 20 #include "ui/compositor/layer.h"
20 #include "ui/compositor/layer_animation_observer.h" 21 #include "ui/compositor/layer_animation_observer.h"
21 #include "ui/compositor/layer_animation_sequence.h" 22 #include "ui/compositor/layer_animation_sequence.h"
22 #include "ui/compositor/layer_animator.h" 23 #include "ui/compositor/layer_animator.h"
23 #include "ui/compositor/layer_owner.h" 24 #include "ui/compositor/layer_owner.h"
24 #include "ui/compositor/layer_tree_owner.h" 25 #include "ui/compositor/layer_tree_owner.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 } // namespace 274 } // namespace
274 275
275 ScreenRotationAnimator::ScreenRotationAnimator(int64 display_id) 276 ScreenRotationAnimator::ScreenRotationAnimator(int64 display_id)
276 : display_id_(display_id) { 277 : display_id_(display_id) {
277 } 278 }
278 279
279 ScreenRotationAnimator::~ScreenRotationAnimator() { 280 ScreenRotationAnimator::~ScreenRotationAnimator() {
280 } 281 }
281 282
282 bool ScreenRotationAnimator::CanAnimate() const { 283 bool ScreenRotationAnimator::CanAnimate() const {
284 // Animations are currently broken on the login screen.
285 // (chrome-os-partners:40118). Disabling the animations on this screen for
286 // M-43
283 return Shell::GetInstance() 287 return Shell::GetInstance()
284 ->display_manager() 288 ->display_manager()
285 ->GetDisplayForId(display_id_) 289 ->GetDisplayForId(display_id_)
286 .is_valid(); 290 .is_valid() &&
291 Shell::GetInstance()
292 ->session_state_delegate()
293 ->IsActiveUserSessionStarted() &&
294 !Shell::GetInstance()->session_state_delegate()->IsScreenLocked() &&
295 Shell::GetInstance()->session_state_delegate()->GetSessionState() ==
296 SessionStateDelegate::SESSION_STATE_ACTIVE;
287 } 297 }
288 298
289 void ScreenRotationAnimator::Rotate(gfx::Display::Rotation new_rotation, 299 void ScreenRotationAnimator::Rotate(gfx::Display::Rotation new_rotation,
290 gfx::Display::RotationSource source) { 300 gfx::Display::RotationSource source) {
291 const gfx::Display::Rotation current_rotation = 301 const gfx::Display::Rotation current_rotation =
292 GetCurrentRotation(display_id_); 302 GetCurrentRotation(display_id_);
293 303
294 if (current_rotation == new_rotation) 304 if (current_rotation == new_rotation)
295 return; 305 return;
296 306
(...skipping 22 matching lines...) Expand all
319 RotateScreen(display_id_, new_rotation, source, 329 RotateScreen(display_id_, new_rotation, source,
320 base::TimeDelta::FromMilliseconds(kRotationDurationInMs), 330 base::TimeDelta::FromMilliseconds(kRotationDurationInMs),
321 rotation_degrees, 0 /* rotation_degree_offset */, 331 rotation_degrees, 0 /* rotation_degree_offset */,
322 gfx::Tween::FAST_OUT_LINEAR_IN, true /* should_scale */); 332 gfx::Tween::FAST_OUT_LINEAR_IN, true /* should_scale */);
323 } else { 333 } else {
324 NOTREACHED(); 334 NOTREACHED();
325 } 335 }
326 } 336 }
327 337
328 } // namespace ash 338 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698