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 <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 // animation completes/aborts. | 239 // animation completes/aborts. |
240 animation_sequence->AddObserver(layer_cleanup_observer.release()); | 240 animation_sequence->AddObserver(layer_cleanup_observer.release()); |
241 animator->StartAnimation(animation_sequence.release()); | 241 animator->StartAnimation(animation_sequence.release()); |
242 } | 242 } |
243 | 243 |
244 } // namespace | 244 } // namespace |
245 | 245 |
246 ScreenRotationAnimator::ScreenRotationAnimator(int64_t display_id) | 246 ScreenRotationAnimator::ScreenRotationAnimator(int64_t display_id) |
247 : display_id_(display_id) {} | 247 : display_id_(display_id) {} |
248 | 248 |
249 ScreenRotationAnimator::~ScreenRotationAnimator() { | 249 ScreenRotationAnimator::~ScreenRotationAnimator() {} |
250 } | |
251 | 250 |
252 bool ScreenRotationAnimator::CanAnimate() const { | 251 bool ScreenRotationAnimator::CanAnimate() const { |
253 return Shell::GetInstance() | 252 return Shell::GetInstance() |
254 ->display_manager() | 253 ->display_manager() |
255 ->GetDisplayForId(display_id_) | 254 ->GetDisplayForId(display_id_) |
256 .is_valid(); | 255 .is_valid(); |
257 } | 256 } |
258 | 257 |
259 void ScreenRotationAnimator::Rotate(display::Display::Rotation new_rotation, | 258 void ScreenRotationAnimator::Rotate(display::Display::Rotation new_rotation, |
260 display::Display::RotationSource source) { | 259 display::Display::RotationSource source) { |
261 const display::Display::Rotation current_rotation = | 260 const display::Display::Rotation current_rotation = |
262 GetCurrentRotation(display_id_); | 261 GetCurrentRotation(display_id_); |
263 | 262 |
264 if (current_rotation == new_rotation) | 263 if (current_rotation == new_rotation) |
265 return; | 264 return; |
266 | 265 |
267 RotateScreen(display_id_, new_rotation, source); | 266 RotateScreen(display_id_, new_rotation, source); |
268 } | 267 } |
269 | 268 |
270 } // namespace ash | 269 } // namespace ash |
OLD | NEW |