summaryrefslogtreecommitdiffstats
path: root/ash/rotator/screen_rotation.h
diff options
context:
space:
mode:
authoryoshiki@chromium.org <yoshiki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-29 04:54:14 +0000
committeryoshiki@chromium.org <yoshiki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-29 04:54:14 +0000
commit9d4db2fd5bde9ea789077e8e7dee55b6403a949f (patch)
treec66c065af44d0321b68021e4984afd5e0b3a5a74 /ash/rotator/screen_rotation.h
parent745cf4a60e364e8e7993857f1198f767d96c603f (diff)
downloadchromium_src-9d4db2fd5bde9ea789077e8e7dee55b6403a949f.zip
chromium_src-9d4db2fd5bde9ea789077e8e7dee55b6403a949f.tar.gz
chromium_src-9d4db2fd5bde9ea789077e8e7dee55b6403a949f.tar.bz2
Move screen rotation code to ash
BUG=none TEST=none Review URL: https://chromiumcodereview.appspot.com/10698007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144875 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/rotator/screen_rotation.h')
-rw-r--r--ash/rotator/screen_rotation.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/ash/rotator/screen_rotation.h b/ash/rotator/screen_rotation.h
new file mode 100644
index 0000000..7f3c20b
--- /dev/null
+++ b/ash/rotator/screen_rotation.h
@@ -0,0 +1,65 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ASH_SCREEN_ROTATION_H_
+#define ASH_SCREEN_ROTATION_H_
+#pragma once
+
+#include "ash/ash_export.h"
+#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
+#include "ui/base/animation/animation_delegate.h"
+#include "ui/compositor/compositor_export.h"
+#include "ui/compositor/layer_animation_element.h"
+#include "ui/gfx/point.h"
+
+namespace ui {
+class InterpolatedTransform;
+class LayerAnimationDelegate;
+}
+
+namespace aura {
+class RootWindow;
+}
+
+namespace ash {
+
+// A screen rotation represents a single transition from one screen orientation
+// to another. The intended usage is that a new instance of the class is
+// created for every transition. It is possible to update the target orientation
+// in the middle of a transition.
+class ASH_EXPORT ScreenRotation : public ui::LayerAnimationElement {
+ public:
+ // The screen rotation does not own the view or the listener, and these
+ // objects are required to outlive the Screen rotation object.
+ ScreenRotation(int degrees);
+ virtual ~ScreenRotation();
+
+ private:
+ // Implementation of ui::LayerAnimationDelegate
+ virtual void OnStart(ui::LayerAnimationDelegate* delegate) OVERRIDE;
+ virtual bool OnProgress(double t,
+ ui::LayerAnimationDelegate* delegate) OVERRIDE;
+ virtual void OnGetTarget(TargetValue* target) const OVERRIDE;
+ virtual void OnAbort() OVERRIDE;
+
+ static const ui::LayerAnimationElement::AnimatableProperties&
+ GetProperties();
+
+ // Generates the intermediate transformation matrices used during the
+ // animation.
+ scoped_ptr<ui::InterpolatedTransform> interpolated_transform_;
+
+ // The number of degrees to rotate.
+ int degrees_;
+
+ // The target origin
+ gfx::Point new_origin_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScreenRotation);
+};
+
+} // namespace ash
+
+#endif // ASH_SCREEN_ROTATION_H_