Roll src/third_party/skia f2539d5:070e010
[chromium-blink-merge.git] / ash / rotator / screen_rotation_animator.h
blob6aff4327e7c8b574d59834b9b6a1ea4225dbf51e
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
3 // found in the LICENSE file.
5 #ifndef ASH_ROTATOR_SCREEN_ROTATION_ANIMATOR_H_
6 #define ASH_ROTATOR_SCREEN_ROTATION_ANIMATOR_H_
8 #include "ash/ash_export.h"
9 #include "base/basictypes.h"
10 #include "ui/gfx/display.h"
12 namespace ash {
14 // Utility to perform a screen rotation with an animation.
15 class ASH_EXPORT ScreenRotationAnimator {
16 public:
17 explicit ScreenRotationAnimator(int64 display_id);
18 ~ScreenRotationAnimator();
20 // Returns true if the screen rotation animation can be completed
21 // successfully. For example an animation is not possible if |display_id_|
22 // specifies a gfx::Display that is not currently active. See
23 // www.crbug.com/479503.
24 bool CanAnimate() const;
26 // Rotates the gfx::Display specified by |display_id_| to the |new_rotation|
27 // orientation, for the given |source|. The rotation will also become active.
28 // Clients should only call |Rotate(gfx::Display::Rotation)| if |CanAnimate()|
29 // returns true.
30 void Rotate(gfx::Display::Rotation new_rotation,
31 gfx::Display::RotationSource source);
33 private:
34 // The id of the display to rotate.
35 int64 display_id_;
37 DISALLOW_COPY_AND_ASSIGN(ScreenRotationAnimator);
40 } // namespace ash
42 #endif // ASH_ROTATOR_SCREEN_ROTATION_ANIMATOR_H_