| OLD | NEW |
| 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" | |
| 16 #include "ash/shell.h" | 15 #include "ash/shell.h" |
| 17 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 18 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 19 #include "ui/aura/window.h" | 18 #include "ui/aura/window.h" |
| 20 #include "ui/compositor/layer.h" | 19 #include "ui/compositor/layer.h" |
| 21 #include "ui/compositor/layer_animation_observer.h" | 20 #include "ui/compositor/layer_animation_observer.h" |
| 22 #include "ui/compositor/layer_animation_sequence.h" | 21 #include "ui/compositor/layer_animation_sequence.h" |
| 23 #include "ui/compositor/layer_animator.h" | 22 #include "ui/compositor/layer_animator.h" |
| 24 #include "ui/compositor/layer_owner.h" | 23 #include "ui/compositor/layer_owner.h" |
| 25 #include "ui/compositor/layer_tree_owner.h" | 24 #include "ui/compositor/layer_tree_owner.h" |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 } // namespace | 273 } // namespace |
| 275 | 274 |
| 276 ScreenRotationAnimator::ScreenRotationAnimator(int64 display_id) | 275 ScreenRotationAnimator::ScreenRotationAnimator(int64 display_id) |
| 277 : display_id_(display_id) { | 276 : display_id_(display_id) { |
| 278 } | 277 } |
| 279 | 278 |
| 280 ScreenRotationAnimator::~ScreenRotationAnimator() { | 279 ScreenRotationAnimator::~ScreenRotationAnimator() { |
| 281 } | 280 } |
| 282 | 281 |
| 283 bool ScreenRotationAnimator::CanAnimate() const { | 282 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 | |
| 287 return Shell::GetInstance() | 283 return Shell::GetInstance() |
| 288 ->display_manager() | 284 ->display_manager() |
| 289 ->GetDisplayForId(display_id_) | 285 ->GetDisplayForId(display_id_) |
| 290 .is_valid() && | 286 .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; | |
| 297 } | 287 } |
| 298 | 288 |
| 299 void ScreenRotationAnimator::Rotate(gfx::Display::Rotation new_rotation, | 289 void ScreenRotationAnimator::Rotate(gfx::Display::Rotation new_rotation, |
| 300 gfx::Display::RotationSource source) { | 290 gfx::Display::RotationSource source) { |
| 301 const gfx::Display::Rotation current_rotation = | 291 const gfx::Display::Rotation current_rotation = |
| 302 GetCurrentRotation(display_id_); | 292 GetCurrentRotation(display_id_); |
| 303 | 293 |
| 304 if (current_rotation == new_rotation) | 294 if (current_rotation == new_rotation) |
| 305 return; | 295 return; |
| 306 | 296 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 329 RotateScreen(display_id_, new_rotation, source, | 319 RotateScreen(display_id_, new_rotation, source, |
| 330 base::TimeDelta::FromMilliseconds(kRotationDurationInMs), | 320 base::TimeDelta::FromMilliseconds(kRotationDurationInMs), |
| 331 rotation_degrees, 0 /* rotation_degree_offset */, | 321 rotation_degrees, 0 /* rotation_degree_offset */, |
| 332 gfx::Tween::FAST_OUT_LINEAR_IN, true /* should_scale */); | 322 gfx::Tween::FAST_OUT_LINEAR_IN, true /* should_scale */); |
| 333 } else { | 323 } else { |
| 334 NOTREACHED(); | 324 NOTREACHED(); |
| 335 } | 325 } |
| 336 } | 326 } |
| 337 | 327 |
| 338 } // namespace ash | 328 } // namespace ash |
| OLD | NEW |