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 "ash/ash_export.h" 9 #include "ui/gfx/transform.h" 10 #include "ui/views/corewm/window_animations.h" 11 12 namespace aura { 13 class Window; 14 } 15 namespace ui { 16 class Layer; 17 } 18 19 // This is only for animations specific to Ash. For window animations shared 20 // with desktop Chrome, see ui/views/corewm/window_animations.h. 21 namespace ash { 22 23 // An extension of the window animations provided by CoreWm. These should be 24 // Ash-specific only. 25 enum WindowVisibilityAnimationType { 26 // Window scale/rotates down to its launcher icon. 27 WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE = 28 views::corewm::WINDOW_VISIBILITY_ANIMATION_MAX, 29 // Fade in/out using brightness and grayscale web filters. 30 WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE 31 }; 32 33 // Direction for ash-specific window animations used in workspaces and 34 // lock/unlock animations. 35 enum LayerScaleAnimationDirection { 36 LAYER_SCALE_ANIMATION_ABOVE, 37 LAYER_SCALE_ANIMATION_BELOW, 38 }; 39 40 // Amount of time for the cross fade animation. 41 extern const int kCrossFadeDurationMS; 42 43 // Animate a cross-fade of |window| from its current bounds to |new_bounds|. 44 ASH_EXPORT void CrossFadeToBounds(aura::Window* window, 45 const gfx::Rect& new_bounds); 46 47 // Returns the duration of the cross-fade animation based on the |old_bounds| 48 // and |new_bounds| of the |window|. 49 ASH_EXPORT base::TimeDelta GetCrossFadeDuration(aura::Window* window, 50 const gfx::Rect& old_bounds, 51 const gfx::Rect& new_bounds); 52 53 ASH_EXPORT bool AnimateOnChildWindowVisibilityChanged(aura::Window* window, 54 bool visible); 55 56 // Creates vector of animation sequences that lasts for |duration| and changes 57 // brightness and grayscale to |target_value|. Caller takes ownership of 58 // returned LayerAnimationSequence objects. 59 ASH_EXPORT std::vector<ui::LayerAnimationSequence*> 60 CreateBrightnessGrayscaleAnimationSequence(float target_value, 61 base::TimeDelta duration); 62 63 // Applies scale related to the specified AshWindowScaleType. 64 ASH_EXPORT void SetTransformForScaleAnimation( 65 ui::Layer* layer, 66 LayerScaleAnimationDirection type); 67 68 // Returns the approximate bounds to which |window| will be animated when it 69 // is minimized. The bounds are approximate because the minimize animation 70 // involves rotation. 71 ASH_EXPORT gfx::Rect GetMinimizeAnimationTargetBoundsInScreen( 72 aura::Window* window); 73 74 } // namespace ash 75 76 #endif // ASH_WM_WINDOW_ANIMATIONS_H_ 77