Chromium Code Reviews| 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" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
| 14 #include "ui/display/display.h" | 14 #include "ui/display/display.h" |
| 15 | 15 |
| 16 namespace cc { | |
| 17 class CopyOutputResult; | |
| 18 } // namespace cc | |
| 19 | |
| 16 namespace ui { | 20 namespace ui { |
| 17 class AnimationMetricsReporter; | 21 class AnimationMetricsReporter; |
| 18 class Layer; | 22 class Layer; |
| 19 class LayerTreeOwner; | 23 class LayerTreeOwner; |
| 20 } // namespace ui | 24 } // namespace ui |
| 21 | 25 |
| 22 namespace ash { | 26 namespace ash { |
| 23 namespace test { | 27 namespace test { |
| 24 class ScreenRotationAnimatorTestApi; | 28 class ScreenRotationAnimatorTestApi; |
| 25 } // namespace test | 29 } // namespace test |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 52 | 56 |
| 53 // When screen rotation animation is ended or aborted, calls |Rotate()| with | 57 // When screen rotation animation is ended or aborted, calls |Rotate()| with |
| 54 // the pending rotation request if the request queue is not empty. Otherwise | 58 // the pending rotation request if the request queue is not empty. Otherwise |
| 55 // notifies |screen_rotation_animator_observer_|. | 59 // notifies |screen_rotation_animator_observer_|. |
| 56 void ProcessAnimationQueue(); | 60 void ProcessAnimationQueue(); |
| 57 | 61 |
| 58 private: | 62 private: |
| 59 friend class ash::test::ScreenRotationAnimatorTestApi; | 63 friend class ash::test::ScreenRotationAnimatorTestApi; |
| 60 struct ScreenRotationRequest; | 64 struct ScreenRotationRequest; |
| 61 | 65 |
| 62 // Set the screen orientation to |new_rotation| and animate the change. The | 66 void StartRotationAnimation( |
| 67 std::unique_ptr<ScreenRotationRequest> rotation_request); | |
| 68 | |
| 69 void RequestCopyRootLayerAndAnimateRotation( | |
|
bruthig
2017/03/30 18:28:24
Some docs on these functions would be helpful. Es
wutao
2017/03/30 21:25:41
Done.
| |
| 70 std::unique_ptr<ScreenRotationRequest> rotation_request); | |
| 71 | |
| 72 void OnRootLayerCopiedBeforeRotation( | |
| 73 std::unique_ptr<ScreenRotationRequest> rotation_request, | |
| 74 std::unique_ptr<cc::CopyOutputResult> result); | |
| 75 | |
| 76 // Recreates all |root_window| layers. | |
| 77 void CreateOldLayerTree(); | |
| 78 | |
| 79 // Requests a copy of |root_window| root layer output. | |
| 80 void CopyOldLayerTree(std::unique_ptr<cc::CopyOutputResult> result); | |
| 81 | |
| 82 // Sets the screen orientation to |new_rotation| and animate the change. The | |
| 63 // animation will rotate the initial orientation's layer towards the new | 83 // animation will rotate the initial orientation's layer towards the new |
| 64 // orientation through |rotation_degrees| while fading out, and the new | 84 // orientation through |rotation_degrees| while fading out, and the new |
| 65 // orientation's layer will be rotated in to the |new_orientation| through | 85 // orientation's layer will be rotated in to the |new_orientation| through |
| 66 // |rotation_degrees| arc. | 86 // |rotation_degrees| arc. |
| 67 void AnimateRotation(std::unique_ptr<ScreenRotationRequest> rotation_request); | 87 void AnimateRotation(std::unique_ptr<ScreenRotationRequest> rotation_request); |
|
bruthig
2017/03/30 18:28:24
It is a very subtle detail that AnimateRotation()
wutao
2017/03/30 21:25:41
I prefer document it here first. In the further ed
| |
| 68 | 88 |
| 69 void set_disable_animation_timers_for_test(bool disable_timers); | 89 void set_disable_animation_timers_for_test(bool disable_timers); |
| 70 | 90 |
| 71 void StopAnimating(); | 91 void StopAnimating(); |
| 72 | 92 |
| 73 // The id of the display to rotate. | 93 // The id of the display to rotate. |
| 74 int64_t display_id_; | 94 int64_t display_id_; |
| 75 bool is_rotating_; | 95 bool is_rotating_; |
| 76 std::unique_ptr<ui::AnimationMetricsReporter> metrics_reporter_; | 96 std::unique_ptr<ui::AnimationMetricsReporter> metrics_reporter_; |
| 77 // Only set in unittest to disable animation timers. | 97 // Only set in unittest to disable animation timers. |
| 78 bool disable_animation_timers_for_test_; | 98 bool disable_animation_timers_for_test_; |
| 79 base::ObserverList<ScreenRotationAnimatorObserver> | 99 base::ObserverList<ScreenRotationAnimatorObserver> |
| 80 screen_rotation_animator_observers_; | 100 screen_rotation_animator_observers_; |
| 81 std::unique_ptr<ui::LayerTreeOwner> old_layer_tree_owner_; | 101 std::unique_ptr<ui::LayerTreeOwner> old_layer_tree_owner_; |
| 82 std::unique_ptr<ScreenRotationRequest> last_pending_request_; | 102 std::unique_ptr<ScreenRotationRequest> last_pending_request_; |
| 83 base::WeakPtrFactory<ScreenRotationAnimator> weak_factory_; | 103 base::WeakPtrFactory<ScreenRotationAnimator> weak_factory_; |
| 84 | 104 |
| 85 DISALLOW_COPY_AND_ASSIGN(ScreenRotationAnimator); | 105 DISALLOW_COPY_AND_ASSIGN(ScreenRotationAnimator); |
| 86 }; | 106 }; |
| 87 | 107 |
| 88 } // namespace ash | 108 } // namespace ash |
| 89 | 109 |
| 90 #endif // ASH_ROTATOR_SCREEN_ROTATION_ANIMATOR_H_ | 110 #endif // ASH_ROTATOR_SCREEN_ROTATION_ANIMATOR_H_ |
| OLD | NEW |