Fix mouse warp with 2x displays
[chromium-blink-merge.git] / ash / wm / session_state_animator_impl.h
blob6c634bddaaae3fceb8559c37a3327edd30e60af0
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"
13 namespace ui {
14 class LayerAnimationObserver;
17 namespace ash {
19 // Displays onscreen animations for session state changes (lock/unlock, sign
20 // out, shut down).
21 class ASH_EXPORT SessionStateAnimatorImpl : public SessionStateAnimator {
22 public:
23 // Helper class used by tests to access internal state.
24 class ASH_EXPORT TestApi {
25 public:
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;
39 private:
40 SessionStateAnimatorImpl* animator_; // not owned
42 DISALLOW_COPY_AND_ASSIGN(TestApi);
45 SessionStateAnimatorImpl();
46 ~SessionStateAnimatorImpl() override;
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 void StartAnimation(int container_mask,
54 AnimationType type,
55 AnimationSpeed speed) override;
56 void StartAnimationWithCallback(int container_mask,
57 AnimationType type,
58 AnimationSpeed speed,
59 base::Closure callback) override;
60 AnimationSequence* BeginAnimationSequence(base::Closure callback) override;
61 bool IsBackgroundHidden() const override;
62 void ShowBackground() override;
63 void HideBackground() override;
65 private:
66 class AnimationSequence;
67 friend class AnimationSequence;
69 virtual void StartAnimationInSequence(int container_mask,
70 AnimationType type,
71 AnimationSpeed speed,
72 AnimationSequence* observer);
74 // Apply animation |type| to window |window| with |speed| and add |observer|
75 // if it is not NULL to the last animation sequence.
76 void RunAnimationForWindow(aura::Window* window,
77 SessionStateAnimator::AnimationType type,
78 SessionStateAnimator::AnimationSpeed speed,
79 ui::LayerAnimationObserver* observer);
81 DISALLOW_COPY_AND_ASSIGN(SessionStateAnimatorImpl);
84 } // namespace ash
86 #endif // ASH_WM_SESSION_STATE_ANIMATOR_IMPL_H_