| Index: views/animation/screen_rotation_setter.h
|
| diff --git a/views/animation/screen_rotation_setter.h b/views/animation/screen_rotation_setter.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..070a830664394cbf2fb11a0b8a2368a5cecf3e6b
|
| --- /dev/null
|
| +++ b/views/animation/screen_rotation_setter.h
|
| @@ -0,0 +1,54 @@
|
| +// 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 VIEWS_ANIMATION_SCREEN_ROTATION_SETTER_H_
|
| +#define VIEWS_ANIMATION_SCREEN_ROTATION_SETTER_H_
|
| +#pragma once
|
| +
|
| +#include "base/memory/scoped_ptr.h"
|
| +#include "views/animation/screen_rotation.h"
|
| +#include "views/layer_property_setter.h"
|
| +
|
| +namespace ui {
|
| +class Transform;
|
| +}
|
| +
|
| +namespace views {
|
| +
|
| +class View;
|
| +
|
| +// A screen rotation setter is a LayerPropertySetter that initiates screen
|
| +// rotations in response to calls to |SetTransform|. Calls to |SetBounds| are
|
| +// applied to the layer immediately.
|
| +class ScreenRotationSetter : public LayerPropertySetter,
|
| + public ScreenRotationListener {
|
| + public:
|
| + ScreenRotationSetter(View* view);
|
| +
|
| + // implementation of LayerPropertySetter
|
| + virtual void Installed(ui::Layer* layer) OVERRIDE;
|
| + virtual void Uninstalled(ui::Layer* layer) OVERRIDE;
|
| + virtual void SetTransform(ui::Layer* layer,
|
| + const ui::Transform& transform) OVERRIDE;
|
| + virtual void SetBounds(ui::Layer* layer, const gfx::Rect& bounds) OVERRIDE;
|
| +
|
| + // implementation of ScreenRotationListener
|
| + virtual void OnScreenRotationCompleted(ScreenRotation* rotation) OVERRIDE;
|
| +
|
| + private:
|
| + // This is the currently animating rotation. We hang onto it so that if a
|
| + // call to |SetTransform| is made during the rotation, we can update the
|
| + // target orientation of this rotation.
|
| + scoped_ptr<ScreenRotation> rotation_;
|
| +
|
| + // The screen rotation setter is associated with a view so that the view's
|
| + // bounds may be set when the animation completes.
|
| + View* view_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(ScreenRotationSetter);
|
| +};
|
| +
|
| +} // namespace views
|
| +
|
| +#endif // VIEWS_ANIMATION_SCREEN_ROTATION_SETTER_H_
|
|
|