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 ASH_WM_SESSION_STATE_ANIMATOR_IMPL_H_
6 #define ASH_WM_SESSION_STATE_ANIMATOR_IMPL_H_
8 #include "ash/ash_export.h"
9 #include "ash/wm/session_state_animator.h"
10 #include "base/basictypes.h"
11 #include "ui/aura/window.h"
14 class LayerAnimationObserver;
19 // Displays onscreen animations for session state changes (lock/unlock, sign
21 class ASH_EXPORT SessionStateAnimatorImpl : public SessionStateAnimator {
23 // Helper class used by tests to access internal state.
24 class ASH_EXPORT TestApi {
26 explicit TestApi(SessionStateAnimatorImpl* animator)
27 : animator_(animator) {}
29 // Returns true if containers of a given |container_mask|
30 // were last animated with |type| (probably; the analysis is fairly ad-hoc).
31 // |container_mask| is a bitfield of a Container.
32 bool ContainersAreAnimated(int container_mask,
33 SessionStateAnimator::AnimationType type) const;
35 // Returns true if root window was last animated with |type| (probably;
36 // the analysis is fairly ad-hoc).
37 bool RootWindowIsAnimated(SessionStateAnimator::AnimationType type) const;
40 SessionStateAnimatorImpl* animator_; // not owned
42 DISALLOW_COPY_AND_ASSIGN(TestApi);
45 SessionStateAnimatorImpl();
46 virtual ~SessionStateAnimatorImpl();
48 // Fills |containers| with the containers included in |container_mask|.
49 static void GetContainers(int container_mask,
50 aura::Window::Windows* containers);
52 // ash::SessionStateAnimator:
53 virtual void StartAnimation(int container_mask,
55 AnimationSpeed speed) OVERRIDE;
56 virtual void StartAnimationWithCallback(
60 base::Closure callback) OVERRIDE;
61 virtual AnimationSequence* BeginAnimationSequence(
62 base::Closure callback) OVERRIDE;
63 virtual bool IsBackgroundHidden() const OVERRIDE;
64 virtual void ShowBackground() OVERRIDE;
65 virtual void HideBackground() OVERRIDE;
68 class AnimationSequence;
69 friend class AnimationSequence;
71 virtual void StartAnimationInSequence(int container_mask,
74 AnimationSequence* observer);
76 // Apply animation |type| to window |window| with |speed| and add |observer|
77 // if it is not NULL to the last animation sequence.
78 void RunAnimationForWindow(aura::Window* window,
79 SessionStateAnimator::AnimationType type,
80 SessionStateAnimator::AnimationSpeed speed,
81 ui::LayerAnimationObserver* observer);
83 DISALLOW_COPY_AND_ASSIGN(SessionStateAnimatorImpl);
88 #endif // ASH_WM_SESSION_STATE_ANIMATOR_IMPL_H_