OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_SCREEN_ROTATION_H_ | 5 #ifndef ASH_WINDOW_ROTATION_H_ |
6 #define ASH_SCREEN_ROTATION_H_ | 6 #define ASH_WINDOW_ROTATION_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "ui/compositor/layer_animation_element.h" | 11 #include "ui/compositor/layer_animation_element.h" |
12 #include "ui/gfx/geometry/point.h" | 12 #include "ui/gfx/geometry/point.h" |
13 | 13 |
14 namespace ui { | 14 namespace ui { |
15 class InterpolatedTransform; | 15 class InterpolatedTransform; |
16 class Layer; | 16 class Layer; |
17 } | 17 } |
18 | 18 |
19 namespace aura { | 19 namespace aura { |
20 class RootWindow; | 20 class RootWindow; |
21 } | 21 } |
22 | 22 |
23 namespace ash { | 23 namespace ash { |
24 | 24 |
25 // A screen rotation represents a single transition from one screen orientation | 25 // A window rotation represents a single transition from one window orientation |
26 // to another. The intended usage is that a new instance of the class is | 26 // to another. The intended usage is that a new instance of the class is |
27 // created for every transition. It is possible to update the target orientation | 27 // created for every transition. It is possible to update the target orientation |
28 // in the middle of a transition. | 28 // in the middle of a transition. |
29 class ASH_EXPORT ScreenRotation : public ui::LayerAnimationElement { | 29 class ASH_EXPORT WindowRotation : public ui::LayerAnimationElement { |
30 public: | 30 public: |
31 // |degrees| are clockwise. |layer| is the target of the animation. Does not | 31 // |degrees| are clockwise. |layer| is the target of the animation. Does not |
32 // take ownership of |layer|. | 32 // take ownership of |layer|. |
33 ScreenRotation(int degrees, ui::Layer* layer); | 33 WindowRotation(int degrees, ui::Layer* layer); |
34 ~ScreenRotation() override; | 34 ~WindowRotation() override; |
35 | 35 |
36 private: | 36 private: |
37 // Generates the intermediate transformation matrices used during the | 37 // Generates the intermediate transformation matrices used during the |
38 // animation. | 38 // animation. |
39 void InitTransform(ui::Layer* layer); | 39 void InitTransform(ui::Layer* layer); |
40 | 40 |
41 // Implementation of ui::LayerAnimationDelegate | 41 // Implementation of ui::LayerAnimationDelegate |
42 void OnStart(ui::LayerAnimationDelegate* delegate) override; | 42 void OnStart(ui::LayerAnimationDelegate* delegate) override; |
43 bool OnProgress(double t, ui::LayerAnimationDelegate* delegate) override; | 43 bool OnProgress(double t, ui::LayerAnimationDelegate* delegate) override; |
44 void OnGetTarget(TargetValue* target) const override; | 44 void OnGetTarget(TargetValue* target) const override; |
45 void OnAbort(ui::LayerAnimationDelegate* delegate) override; | 45 void OnAbort(ui::LayerAnimationDelegate* delegate) override; |
46 | 46 |
47 scoped_ptr<ui::InterpolatedTransform> interpolated_transform_; | 47 scoped_ptr<ui::InterpolatedTransform> interpolated_transform_; |
48 | 48 |
49 // The number of degrees to rotate. | 49 // The number of degrees to rotate. |
50 int degrees_; | 50 int degrees_; |
51 | 51 |
52 // The target origin. | 52 // The target origin. |
53 gfx::Point new_origin_; | 53 gfx::Point new_origin_; |
54 | 54 |
55 DISALLOW_COPY_AND_ASSIGN(ScreenRotation); | 55 DISALLOW_COPY_AND_ASSIGN(WindowRotation); |
56 }; | 56 }; |
57 | 57 |
58 } // namespace ash | 58 } // namespace ash |
59 | 59 |
60 #endif // ASH_SCREEN_ROTATION_H_ | 60 #endif // ASH_WINDOW_ROTATION_H_ |
OLD | NEW |