SimpleCache: add an histogram to record the age of entry on open
[chromium-blink-merge.git] / ash / rotator / screen_rotation.h
blob2f9616a648f3eb1805b5c64a184b1f90f7f87098
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
3 // found in the LICENSE file.
5 #ifndef ASH_SCREEN_ROTATION_H_
6 #define ASH_SCREEN_ROTATION_H_
8 #include "ash/ash_export.h"
9 #include "base/basictypes.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "ui/compositor/layer_animation_element.h"
12 #include "ui/gfx/point.h"
14 namespace ui {
15 class InterpolatedTransform;
16 class Layer;
19 namespace aura {
20 class RootWindow;
23 namespace ash {
25 // A screen rotation represents a single transition from one screen orientation
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
28 // in the middle of a transition.
29 class ASH_EXPORT ScreenRotation : public ui::LayerAnimationElement {
30 public:
31 // |degrees| are clockwise. |layer| is the target of the animation. Does not
32 // take ownership of |layer|.
33 ScreenRotation(int degrees, ui::Layer* layer);
34 virtual ~ScreenRotation();
36 private:
37 // Generates the intermediate transformation matrices used during the
38 // animation.
39 void InitTransform(ui::Layer* layer);
41 // Implementation of ui::LayerAnimationDelegate
42 virtual void OnStart(ui::LayerAnimationDelegate* delegate) OVERRIDE;
43 virtual bool OnProgress(double t,
44 ui::LayerAnimationDelegate* delegate) OVERRIDE;
45 virtual void OnGetTarget(TargetValue* target) const OVERRIDE;
46 virtual void OnAbort(ui::LayerAnimationDelegate* delegate) OVERRIDE;
48 static const ui::LayerAnimationElement::AnimatableProperties&
49 GetProperties();
51 scoped_ptr<ui::InterpolatedTransform> interpolated_transform_;
53 // The number of degrees to rotate.
54 int degrees_;
56 // The target origin.
57 gfx::Point new_origin_;
59 DISALLOW_COPY_AND_ASSIGN(ScreenRotation);
62 } // namespace ash
64 #endif // ASH_SCREEN_ROTATION_H_