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. 4 5 #ifndef ASH_WM_WINDOW_ANIMATIONS_H_ 6 #define ASH_WM_WINDOW_ANIMATIONS_H_ 7 8 #include <memory> 9 10 #include "ash/ash_export.h" 11 #include "ui/gfx/animation/tween.h" 12 #include "ui/wm/core/window_animations.h" 13 14 namespace aura { 15 class Window; 16 } 17 18 namespace ui { 19 class LayerTreeOwner; 20 } 21 22 // This is only for animations specific to Ash. For window animations shared 23 // with desktop Chrome, see ui/wm/core/window_animations.h. 24 namespace ash { 25 26 // Direction for ash-specific window animations used in workspaces and 27 // lock/unlock animations. 28 enum LayerScaleAnimationDirection { 29 LAYER_SCALE_ANIMATION_ABOVE, 30 LAYER_SCALE_ANIMATION_BELOW, 31 }; 32 33 // Applies scale related to the specified LayerScaleAnimationDirection. 34 ASH_EXPORT void SetTransformForScaleAnimation( 35 ui::Layer* layer, 36 LayerScaleAnimationDirection type); 37 38 // Implementation of cross fading. Window is the window being cross faded. It 39 // should be at the target bounds. |old_layer_owner| contains the previous layer 40 // from |window|. 41 ASH_EXPORT void CrossFadeAnimation( 42 aura::Window* window, 43 std::unique_ptr<ui::LayerTreeOwner> old_layer_owner); 44 45 // Implementation of cross fading which only animates the new layer. The old 46 // layer will be owned by an observer which will update the transform as the new 47 // layer's transform and bounds change. This is used by the 48 // WorkspaceWindowResizer which needs to animate a window which has its bounds 49 // updated throughout the course of the animation. 50 ASH_EXPORT void CrossFadeAnimationAnimateNewLayerOnly( 51 aura::Window* window, 52 const gfx::Rect& target_bounds, 53 base::TimeDelta duration, 54 gfx::Tween::Type tween_type, 55 const std::string& histogram_name); 56 57 ASH_EXPORT bool AnimateOnChildWindowVisibilityChanged(aura::Window* window, 58 bool visible); 59 60 // Creates vector of animation sequences that lasts for |duration| and changes 61 // brightness and grayscale to |target_value|. Caller takes ownership of 62 // returned LayerAnimationSequence objects. 63 ASH_EXPORT std::vector<ui::LayerAnimationSequence*> 64 CreateBrightnessGrayscaleAnimationSequence(float target_value, 65 base::TimeDelta duration); 66 67 // Returns the approximate bounds to which |window| will be animated when it 68 // is minimized. The bounds are approximate because the minimize animation 69 // involves rotation. 70 ASH_EXPORT gfx::Rect GetMinimizeAnimationTargetBoundsInScreen( 71 aura::Window* window); 72 73 } // namespace ash 74 75 #endif // ASH_WM_WINDOW_ANIMATIONS_H_ 76