Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / ui / wm / core / window_animations.h
blob422167e35d753f80d6b5b3000c3025e32d82c278
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.
5 #ifndef UI_WM_CORE_WINDOW_ANIMATIONS_H_
6 #define UI_WM_CORE_WINDOW_ANIMATIONS_H_
8 #include <vector>
10 #include "ui/compositor/scoped_layer_animation_settings.h"
11 #include "ui/wm/wm_export.h"
13 namespace aura {
14 class Window;
16 namespace base {
17 class TimeDelta;
19 namespace gfx {
20 class Rect;
22 namespace ui {
23 class ImplicitAnimationObserver;
24 class Layer;
25 class LayerAnimationSequence;
28 namespace wm {
30 // A variety of canned animations for window transitions.
31 enum WindowVisibilityAnimationType {
32 WINDOW_VISIBILITY_ANIMATION_TYPE_DEFAULT = 0, // Default. Lets the system
33 // decide based on window
34 // type.
35 WINDOW_VISIBILITY_ANIMATION_TYPE_DROP, // Window shrinks in.
36 WINDOW_VISIBILITY_ANIMATION_TYPE_VERTICAL, // Vertical Glenimation.
37 WINDOW_VISIBILITY_ANIMATION_TYPE_FADE, // Fades in/out.
38 WINDOW_VISIBILITY_ANIMATION_TYPE_ROTATE, // Window rotates in.
40 // Downstream library animations start above this point.
41 WINDOW_VISIBILITY_ANIMATION_MAX
44 // Canned animations that take effect once but don't have a symmetric pair as
45 // visibility animations do.
46 enum WindowAnimationType {
47 WINDOW_ANIMATION_TYPE_BOUNCE = 0, // Window scales up and down.
50 // Type of visibility change transition that a window should animate.
51 // Default behavior is to animate both show and hide.
52 enum WindowVisibilityAnimationTransition {
53 ANIMATE_SHOW = 0x1,
54 ANIMATE_HIDE = 0x2,
55 ANIMATE_BOTH = ANIMATE_SHOW | ANIMATE_HIDE,
56 ANIMATE_NONE = 0x4,
59 // These two methods use int for type rather than WindowVisibilityAnimationType
60 // since downstream libraries can extend the set of animations.
61 WM_EXPORT void SetWindowVisibilityAnimationType(aura::Window* window, int type);
62 WM_EXPORT int GetWindowVisibilityAnimationType(aura::Window* window);
64 WM_EXPORT void SetWindowVisibilityAnimationTransition(
65 aura::Window* window,
66 WindowVisibilityAnimationTransition transition);
68 WM_EXPORT bool HasWindowVisibilityAnimationTransition(
69 aura::Window* window,
70 WindowVisibilityAnimationTransition transition);
72 WM_EXPORT void SetWindowVisibilityAnimationDuration(
73 aura::Window* window,
74 const base::TimeDelta& duration);
76 WM_EXPORT base::TimeDelta GetWindowVisibilityAnimationDuration(
77 const aura::Window& window);
79 WM_EXPORT void SetWindowVisibilityAnimationVerticalPosition(
80 aura::Window* window,
81 float position);
83 class ImplicitHidingWindowAnimationObserver;
84 // A wrapper of ui::ScopedLayerAnimationSettings for implicit hiding animations.
85 // Use this to ensure that the hiding animation is visible even after
86 // the window is deleted or deactivated, instead of using
87 // ui::ScopedLayerAnimationSettings directly.
88 class WM_EXPORT ScopedHidingAnimationSettings {
89 public:
90 explicit ScopedHidingAnimationSettings(aura::Window* window);
91 ~ScopedHidingAnimationSettings();
93 // Returns the wrapped ScopedLayeAnimationSettings instance.
94 ui::ScopedLayerAnimationSettings* layer_animation_settings() {
95 return &layer_animation_settings_;
98 private:
99 ui::ScopedLayerAnimationSettings layer_animation_settings_;
100 ImplicitHidingWindowAnimationObserver* observer_;
102 DISALLOW_COPY_AND_ASSIGN(ScopedHidingAnimationSettings);
105 // Returns false if the |window| didn't animate.
106 WM_EXPORT bool AnimateOnChildWindowVisibilityChanged(aura::Window* window,
107 bool visible);
108 WM_EXPORT bool AnimateWindow(aura::Window* window, WindowAnimationType type);
110 // Returns true if window animations are disabled for |window|. Window
111 // animations are enabled by default. If |window| is NULL, this just checks
112 // if the global flag disabling window animations is present.
113 WM_EXPORT bool WindowAnimationsDisabled(aura::Window* window);
115 } // namespace wm
117 #endif // UI_WM_CORE_WINDOW_ANIMATIONS_H_