OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 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. |
| 4 |
| 5 #ifndef VIEWS_ANIMATION_SCREEN_ROTATION_SETTER_H_ |
| 6 #define VIEWS_ANIMATION_SCREEN_ROTATION_SETTER_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "views/animation/screen_rotation.h" |
| 11 #include "views/layer_property_setter.h" |
| 12 |
| 13 namespace ui { |
| 14 class Transform; |
| 15 } |
| 16 |
| 17 namespace views { |
| 18 |
| 19 class View; |
| 20 |
| 21 // A screen rotation setter is a LayerPropertySetter that initiates screen |
| 22 // rotations in response to calls to |SetTransform|. Calls to |SetBounds| are |
| 23 // applied to the layer immediately. |
| 24 class ScreenRotationSetter : public LayerPropertySetter, |
| 25 public ScreenRotationListener { |
| 26 public: |
| 27 ScreenRotationSetter(View* view); |
| 28 |
| 29 // implementation of LayerPropertySetter |
| 30 virtual void Installed(ui::Layer* layer) OVERRIDE; |
| 31 virtual void Uninstalled(ui::Layer* layer) OVERRIDE; |
| 32 virtual void SetTransform(ui::Layer* layer, |
| 33 const ui::Transform& transform) OVERRIDE; |
| 34 virtual void SetBounds(ui::Layer* layer, const gfx::Rect& bounds) OVERRIDE; |
| 35 |
| 36 // implementation of ScreenRotationListener |
| 37 virtual void OnScreenRotationCompleted(ScreenRotation* rotation) OVERRIDE; |
| 38 |
| 39 private: |
| 40 // This is the currently animating rotation. We hang onto it so that if a |
| 41 // call to |SetTransform| is made during the rotation, we can update the |
| 42 // target orientation of this rotation. |
| 43 scoped_ptr<ScreenRotation> rotation_; |
| 44 |
| 45 // The screen rotation setter is associated with a view so that the view's |
| 46 // bounds may be set when the animation completes. |
| 47 View* view_; |
| 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(ScreenRotationSetter); |
| 50 }; |
| 51 |
| 52 } // namespace views |
| 53 |
| 54 #endif // VIEWS_ANIMATION_SCREEN_ROTATION_SETTER_H_ |
OLD | NEW |