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" |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 | 260 |
261 } // namespace | 261 } // namespace |
262 | 262 |
263 ScreenRotationAnimator::ScreenRotationAnimator(int64 display_id) | 263 ScreenRotationAnimator::ScreenRotationAnimator(int64 display_id) |
264 : display_id_(display_id) { | 264 : display_id_(display_id) { |
265 } | 265 } |
266 | 266 |
267 ScreenRotationAnimator::~ScreenRotationAnimator() { | 267 ScreenRotationAnimator::~ScreenRotationAnimator() { |
268 } | 268 } |
269 | 269 |
| 270 bool ScreenRotationAnimator::CanAnimate() const { |
| 271 return Shell::GetInstance() |
| 272 ->display_manager() |
| 273 ->GetDisplayForId(display_id_) |
| 274 .is_valid(); |
| 275 } |
| 276 |
270 void ScreenRotationAnimator::Rotate(gfx::Display::Rotation new_rotation) { | 277 void ScreenRotationAnimator::Rotate(gfx::Display::Rotation new_rotation) { |
271 const gfx::Display::Rotation current_rotation = | 278 const gfx::Display::Rotation current_rotation = |
272 GetCurrentRotation(display_id_); | 279 GetCurrentRotation(display_id_); |
273 | 280 |
274 if (current_rotation == new_rotation) | 281 if (current_rotation == new_rotation) |
275 return; | 282 return; |
276 | 283 |
277 const std::string switch_value = | 284 const std::string switch_value = |
278 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 285 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
279 switches::kAshEnableScreenRotationAnimation); | 286 switches::kAshEnableScreenRotationAnimation); |
(...skipping 19 matching lines...) Expand all Loading... |
299 RotateScreen(display_id_, new_rotation, | 306 RotateScreen(display_id_, new_rotation, |
300 base::TimeDelta::FromMilliseconds(kRotationDurationInMs), | 307 base::TimeDelta::FromMilliseconds(kRotationDurationInMs), |
301 rotation_degrees, 0 /* rotation_degree_offset */, | 308 rotation_degrees, 0 /* rotation_degree_offset */, |
302 gfx::Tween::FAST_OUT_LINEAR_IN, true /* should_scale */); | 309 gfx::Tween::FAST_OUT_LINEAR_IN, true /* should_scale */); |
303 } else { | 310 } else { |
304 NOTREACHED(); | 311 NOTREACHED(); |
305 } | 312 } |
306 } | 313 } |
307 | 314 |
308 } // namespace ash | 315 } // namespace ash |
OLD | NEW |