| 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 "ui/gfx/display.h" | 12 #include "ui/display/display.h" |
| 13 | 13 |
| 14 namespace ash { | 14 namespace ash { |
| 15 | 15 |
| 16 // Utility to perform a screen rotation with an animation. | 16 // Utility to perform a screen rotation with an animation. |
| 17 class ASH_EXPORT ScreenRotationAnimator { | 17 class ASH_EXPORT ScreenRotationAnimator { |
| 18 public: | 18 public: |
| 19 explicit ScreenRotationAnimator(int64_t display_id); | 19 explicit ScreenRotationAnimator(int64_t display_id); |
| 20 ~ScreenRotationAnimator(); | 20 ~ScreenRotationAnimator(); |
| 21 | 21 |
| 22 // Returns true if the screen rotation animation can be completed | 22 // Returns true if the screen rotation animation can be completed |
| 23 // successfully. For example an animation is not possible if |display_id_| | 23 // successfully. For example an animation is not possible if |display_id_| |
| 24 // specifies a gfx::Display that is not currently active. See | 24 // specifies a display::Display that is not currently active. See |
| 25 // www.crbug.com/479503. | 25 // www.crbug.com/479503. |
| 26 bool CanAnimate() const; | 26 bool CanAnimate() const; |
| 27 | 27 |
| 28 // Rotates the gfx::Display specified by |display_id_| to the |new_rotation| | 28 // Rotates the display::Display specified by |display_id_| to the |
| 29 // |new_rotation| |
| 29 // orientation, for the given |source|. The rotation will also become active. | 30 // orientation, for the given |source|. The rotation will also become active. |
| 30 // Clients should only call |Rotate()| if |CanAnimate()| returns true. | 31 // Clients should only call |Rotate()| if |CanAnimate()| returns true. |
| 31 void Rotate(gfx::Display::Rotation new_rotation, | 32 void Rotate(display::Display::Rotation new_rotation, |
| 32 gfx::Display::RotationSource source); | 33 display::Display::RotationSource source); |
| 33 | 34 |
| 34 private: | 35 private: |
| 35 // The id of the display to rotate. | 36 // The id of the display to rotate. |
| 36 int64_t display_id_; | 37 int64_t display_id_; |
| 37 | 38 |
| 38 DISALLOW_COPY_AND_ASSIGN(ScreenRotationAnimator); | 39 DISALLOW_COPY_AND_ASSIGN(ScreenRotationAnimator); |
| 39 }; | 40 }; |
| 40 | 41 |
| 41 } // namespace ash | 42 } // namespace ash |
| 42 | 43 |
| 43 #endif // ASH_ROTATOR_SCREEN_ROTATION_ANIMATOR_H_ | 44 #endif // ASH_ROTATOR_SCREEN_ROTATION_ANIMATOR_H_ |
| OLD | NEW |