diff options
author | vollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-07 19:26:30 +0000 |
---|---|---|
committer | vollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-07 19:26:30 +0000 |
commit | 2ddfe43ba403bd2272154b2307e631d7394b55c3 (patch) | |
tree | b736178f711282c82a5b28f5ff47990dd90b79fe /ui/gfx/compositor/screen_rotation.h | |
parent | 554890fecb9712a3e7a99c5c82ca5b3d4f06f0d5 (diff) | |
download | chromium_src-2ddfe43ba403bd2272154b2307e631d7394b55c3.zip chromium_src-2ddfe43ba403bd2272154b2307e631d7394b55c3.tar.gz chromium_src-2ddfe43ba403bd2272154b2307e631d7394b55c3.tar.bz2 |
Reenable triggering of screen rotations by sensors.
Depends on http://codereview.chromium.org/8395046
BUG=None
TEST=Visiting about:rotate?right, about:rotate?left, etc. should cause the appropriate screen rotations.
Review URL: http://codereview.chromium.org/8402002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108889 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/compositor/screen_rotation.h')
-rw-r--r-- | ui/gfx/compositor/screen_rotation.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/ui/gfx/compositor/screen_rotation.h b/ui/gfx/compositor/screen_rotation.h new file mode 100644 index 0000000..1d95a5d --- /dev/null +++ b/ui/gfx/compositor/screen_rotation.h @@ -0,0 +1,56 @@ +// Copyright (c) 2011 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 UI_GFX_COMPOSITOR_SCREEN_ROTATION_H_ +#define UI_GFX_COMPOSITOR_SCREEN_ROTATION_H_ +#pragma once + +#include "base/basictypes.h" +#include "base/memory/scoped_ptr.h" +#include "ui/base/animation/animation_delegate.h" +#include "ui/gfx/compositor/compositor_export.h" +#include "ui/gfx/compositor/layer_animation_element.h" +#include "ui/gfx/point.h" + +namespace ui { +class InterpolatedTransform; +class LayerAnimationDelegate; + +// 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 COMPOSITOR_EXPORT ScreenRotation : public 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 LayerAnimationDelegate + virtual void OnStart(LayerAnimationDelegate* delegate) OVERRIDE; + virtual void OnProgress(double t, + LayerAnimationDelegate* delegate) OVERRIDE; + virtual void OnGetTarget(TargetValue* target) const OVERRIDE; + virtual void OnAbort() OVERRIDE; + + static const LayerAnimationElement::AnimatableProperties& GetProperties(); + + // Generates the intermediate transformation matrices used during the + // animation. + scoped_ptr<InterpolatedTransform> interpolated_transform_; + + // The number of degrees to rotate. + int degrees_; + + // The target origin + gfx::Point new_origin_; + + DISALLOW_COPY_AND_ASSIGN(ScreenRotation); +}; + +} // namespace ui + +#endif // UI_GFX_COMPOSITOR_SCREEN_ROTATION_H_ |