window_animations.h 2.6 KB

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