Chromium Code Reviews| Index: ash/rotator/screen_rotation_animator.h |
| diff --git a/ash/rotator/screen_rotation_animator.h b/ash/rotator/screen_rotation_animator.h |
| index b541106e88030c68a5217cc03451e46268688eae..1332c0f3a10152571a38a28d82ae98898d008cbe 100644 |
| --- a/ash/rotator/screen_rotation_animator.h |
| +++ b/ash/rotator/screen_rotation_animator.h |
| @@ -8,11 +8,16 @@ |
| #include <stdint.h> |
| #include "ash/ash_export.h" |
| +#include "base/callback_forward.h" |
| #include "base/macros.h" |
| #include "base/memory/weak_ptr.h" |
| #include "base/observer_list.h" |
| #include "ui/display/display.h" |
| +namespace cc { |
| +class CopyOutputResult; |
| +} // namespace cc |
| + |
| namespace ui { |
| class AnimationMetricsReporter; |
| class Layer; |
| @@ -30,7 +35,7 @@ class ScreenRotationAnimatorObserver; |
| class ASH_EXPORT ScreenRotationAnimator { |
| public: |
| explicit ScreenRotationAnimator(int64_t display_id); |
| - ~ScreenRotationAnimator(); |
| + virtual ~ScreenRotationAnimator(); |
| // Rotates the display::Display specified by |display_id_| to the |
| // |new_rotation| orientation, for the given |source|. The rotation will also |
| @@ -55,11 +60,45 @@ class ASH_EXPORT ScreenRotationAnimator { |
| // notifies |screen_rotation_animator_observer_|. |
| void ProcessAnimationQueue(); |
| + protected: |
| + struct ScreenRotationRequest { |
| + ScreenRotationRequest(display::Display::Rotation to_rotation, |
| + display::Display::RotationSource from_source) |
| + : new_rotation(to_rotation), source(from_source) {} |
| + display::Display::Rotation new_rotation; |
| + display::Display::RotationSource source; |
| + }; |
| + |
| + // This function can be overridden in unit test to test removing external |
| + // display. |
| + virtual base::Callback<void(std::unique_ptr<cc::CopyOutputResult> result)> |
|
oshima
2017/04/05 01:55:42
using CopyCallback = OnceCallback<....>
wutao
2017/04/05 07:41:57
Changed to: using CopyCallback = base::Callback<>.
|
| + CreateAfterCopyCallback( |
| + std::unique_ptr<ScreenRotationRequest> rotation_request); |
| + |
| + // The callback in |RequestCopyRootLayerAndAnimateRotation()|. |
| + void OnRootLayerCopiedBeforeRotation( |
| + std::unique_ptr<ScreenRotationRequest> rotation_request, |
| + std::unique_ptr<cc::CopyOutputResult> result); |
| + |
| private: |
| friend class ash::test::ScreenRotationAnimatorTestApi; |
| - struct ScreenRotationRequest; |
| - // Set the screen orientation to |new_rotation| and animate the change. The |
| + void StartRotationAnimation( |
| + std::unique_ptr<ScreenRotationRequest> rotation_request); |
| + |
| + // This is an asynchronous call to request copy output of root layer. |
| + void RequestCopyRootLayerAndAnimateRotation( |
| + std::unique_ptr<ScreenRotationRequest> rotation_request); |
| + |
| + // Recreates all |root_window| layers. |
| + void CreateOldLayerTree(); |
| + |
| + // Requests a copy of |root_window| root layer output. |
| + void CopyOldLayerTree(std::unique_ptr<cc::CopyOutputResult> result); |
| + |
| + // Note: Only call this function when the |old_layer_tree_owner_| is set up |
| + // properly. |
| + // Sets the screen orientation to |new_rotation| and animate the change. The |
| // animation will rotate the initial orientation's layer towards the new |
| // orientation through |rotation_degrees| while fading out, and the new |
| // orientation's layer will be rotated in to the |new_orientation| through |