| 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 #ifndef ASH_ROTATOR_SCREEN_ROTATION_ANIMATOR_H_ | 5 #ifndef ASH_ROTATOR_SCREEN_ROTATION_ANIMATOR_H_ |
| 6 #define ASH_ROTATOR_SCREEN_ROTATION_ANIMATOR_H_ | 6 #define ASH_ROTATOR_SCREEN_ROTATION_ANIMATOR_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 void RemoveScreenRotationAnimatorObserver( | 49 void RemoveScreenRotationAnimatorObserver( |
| 50 ScreenRotationAnimatorObserver* observer); | 50 ScreenRotationAnimatorObserver* observer); |
| 51 | 51 |
| 52 void OnLayerAnimationEnded(); | 52 void OnLayerAnimationEnded(); |
| 53 | 53 |
| 54 void OnLayerAnimationAborted(); | 54 void OnLayerAnimationAborted(); |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 friend class ash::test::ScreenRotationAnimatorTestApi; | 57 friend class ash::test::ScreenRotationAnimatorTestApi; |
| 58 struct ScreenRotationRequest; | 58 struct ScreenRotationRequest; |
| 59 class ScreenRotationAnimationMetricsReporter; |
| 59 | 60 |
| 60 // Set the screen orientation to |new_rotation| and animate the change. The | 61 // Set the screen orientation to |new_rotation| and animate the change. The |
| 61 // animation will rotate the initial orientation's layer towards the new | 62 // animation will rotate the initial orientation's layer towards the new |
| 62 // orientation through |rotation_degrees| while fading out, and the new | 63 // orientation through |rotation_degrees| while fading out, and the new |
| 63 // orientation's layer will be rotated in to the |new_orientation| through | 64 // orientation's layer will be rotated in to the |new_orientation| through |
| 64 // |rotation_degrees| arc. | 65 // |rotation_degrees| arc. |
| 65 void AnimateRotation(std::unique_ptr<ScreenRotationRequest> rotation_request); | 66 void AnimateRotation(std::unique_ptr<ScreenRotationRequest> rotation_request); |
| 66 | 67 |
| 67 // When screen rotation animation is ended or aborted, if the request queue is | 68 // When screen rotation animation is ended or aborted, if the request queue is |
| 68 // not empty, it will call |Rotate()| with the pending rotation request. | 69 // not empty, it will call |Rotate()| with the pending rotation request. |
| 69 // Otherwise it will notify |screen_rotation_animator_observer_|. | 70 // Otherwise it will notify |screen_rotation_animator_observer_|. |
| 70 void ProcessAnimationQueue(); | 71 void ProcessAnimationQueue(); |
| 71 | 72 |
| 72 void set_disable_animation_timers_for_test(bool disable_timers); | 73 void set_disable_animation_timers_for_test(bool disable_timers); |
| 73 | 74 |
| 74 void StopAnimating(); | 75 void StopAnimating(); |
| 75 | 76 |
| 76 // The id of the display to rotate. | 77 // The id of the display to rotate. |
| 77 int64_t display_id_; | 78 int64_t display_id_; |
| 78 bool is_rotating_; | 79 bool is_rotating_; |
| 79 // Only set in unittest to disable animation timers. | 80 // Only set in unittest to disable animation timers. |
| 80 bool disable_animation_timers_for_test_; | 81 bool disable_animation_timers_for_test_; |
| 81 base::ObserverList<ScreenRotationAnimatorObserver> | 82 base::ObserverList<ScreenRotationAnimatorObserver> |
| 82 screen_rotation_animator_observers_; | 83 screen_rotation_animator_observers_; |
| 83 std::unique_ptr<ui::LayerTreeOwner> old_layer_tree_owner_; | 84 std::unique_ptr<ui::LayerTreeOwner> old_layer_tree_owner_; |
| 84 std::unique_ptr<ScreenRotationRequest> last_pending_request_; | 85 std::unique_ptr<ScreenRotationRequest> last_pending_request_; |
| 86 std::unique_ptr<ScreenRotationAnimationMetricsReporter> metrics_reporter_; |
| 85 base::WeakPtrFactory<ScreenRotationAnimator> weak_factory_; | 87 base::WeakPtrFactory<ScreenRotationAnimator> weak_factory_; |
| 86 | 88 |
| 87 DISALLOW_COPY_AND_ASSIGN(ScreenRotationAnimator); | 89 DISALLOW_COPY_AND_ASSIGN(ScreenRotationAnimator); |
| 88 }; | 90 }; |
| 89 | 91 |
| 90 } // namespace ash | 92 } // namespace ash |
| 91 | 93 |
| 92 #endif // ASH_ROTATOR_SCREEN_ROTATION_ANIMATOR_H_ | 94 #endif // ASH_ROTATOR_SCREEN_ROTATION_ANIMATOR_H_ |
| OLD | NEW |