Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 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" |
Torne (Richard Coles) | a140131 | 2014-03-18 10:20:56 +0000 | [diff] [blame] | 9 | #include "base/memory/scoped_ptr.h" |
| 10 | #include "ui/gfx/animation/tween.h" |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 11 | #include "ui/gfx/transform.h" |
Torne (Richard Coles) | a140131 | 2014-03-18 10:20:56 +0000 | [diff] [blame] | 12 | #include "ui/wm/core/window_animations.h" |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 13 | |
| 14 | namespace aura { |
| 15 | class Window; |
| 16 | } |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 17 | namespace ui { |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 18 | class Layer; |
Torne (Richard Coles) | a140131 | 2014-03-18 10:20:56 +0000 | [diff] [blame] | 19 | class LayerTreeOwner; |
| 20 | } |
| 21 | namespace views { |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 22 | } |
| 23 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 24 | // This is only for animations specific to Ash. For window animations shared |
| 25 | // with desktop Chrome, see ui/views/corewm/window_animations.h. |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 26 | namespace ash { |
| 27 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 28 | // An extension of the window animations provided by CoreWm. These should be |
| 29 | // Ash-specific only. |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 30 | enum WindowVisibilityAnimationType { |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 31 | // Window scale/rotates down to its launcher icon. |
| 32 | WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE = |
Torne (Richard Coles) | a140131 | 2014-03-18 10:20:56 +0000 | [diff] [blame] | 33 | ::wm::WINDOW_VISIBILITY_ANIMATION_MAX, |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 34 | // Fade in/out using brightness and grayscale web filters. |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 35 | WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 36 | }; |
| 37 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 38 | // Direction for ash-specific window animations used in workspaces and |
| 39 | // lock/unlock animations. |
| 40 | enum LayerScaleAnimationDirection { |
| 41 | LAYER_SCALE_ANIMATION_ABOVE, |
| 42 | LAYER_SCALE_ANIMATION_BELOW, |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 43 | }; |
| 44 | |
Ben Murdoch | 2385ea3 | 2013-08-06 11:01:04 +0100 | [diff] [blame] | 45 | // Amount of time for the cross fade animation. |
| 46 | extern const int kCrossFadeDurationMS; |
| 47 | |
Torne (Richard Coles) | a140131 | 2014-03-18 10:20:56 +0000 | [diff] [blame] | 48 | // Implementation of cross fading. Window is the window being cross faded. It |
| 49 | // should be at the target bounds. |old_layer_owner| contains the previous layer |
| 50 | // from |window|. |tween_type| specifies the tween type of the cross fade |
| 51 | // animation. |
| 52 | ASH_EXPORT base::TimeDelta CrossFadeAnimation( |
| 53 | aura::Window* window, |
| 54 | scoped_ptr<ui::LayerTreeOwner> old_layer_owner, |
| 55 | gfx::Tween::Type tween_type); |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 56 | |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 57 | ASH_EXPORT bool AnimateOnChildWindowVisibilityChanged(aura::Window* window, |
| 58 | bool visible); |
| 59 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 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 | // Applies scale related to the specified AshWindowScaleType. |
| 68 | ASH_EXPORT void SetTransformForScaleAnimation( |
| 69 | ui::Layer* layer, |
| 70 | LayerScaleAnimationDirection type); |
| 71 | |
Ben Murdoch | ca12bfa | 2013-07-23 11:17:05 +0100 | [diff] [blame] | 72 | // Returns the approximate bounds to which |window| will be animated when it |
| 73 | // is minimized. The bounds are approximate because the minimize animation |
| 74 | // involves rotation. |
| 75 | ASH_EXPORT gfx::Rect GetMinimizeAnimationTargetBoundsInScreen( |
| 76 | aura::Window* window); |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 77 | |
Ben Murdoch | ca12bfa | 2013-07-23 11:17:05 +0100 | [diff] [blame] | 78 | } // namespace ash |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 79 | |
| 80 | #endif // ASH_WM_WINDOW_ANIMATIONS_H_ |