Disable TabDragController tests that fail with a real compositor.
[chromium-blink-merge.git] / ash / shelf / background_animator.h
blob805f7d5e5d2795b1b48767c17577a994d43d4281
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_SHELF_BACKGROUND_ANIMATOR_H_
6 #define ASH_SHELF_BACKGROUND_ANIMATOR_H_
8 #include "ash/ash_export.h"
9 #include "base/basictypes.h"
10 #include "ui/gfx/animation/animation_delegate.h"
11 #include "ui/gfx/animation/slide_animation.h"
13 namespace ash {
15 // How the background can be changed.
16 enum BackgroundAnimatorChangeType {
17 BACKGROUND_CHANGE_ANIMATE,
18 BACKGROUND_CHANGE_IMMEDIATE
21 namespace internal {
23 // Delegate is notified any time the background changes.
24 class ASH_EXPORT BackgroundAnimatorDelegate {
25 public:
26 virtual void UpdateBackground(int alpha) = 0;
28 protected:
29 virtual ~BackgroundAnimatorDelegate() {}
32 // BackgroundAnimator is used by the shelf to animate the background (alpha).
33 class ASH_EXPORT BackgroundAnimator : public gfx::AnimationDelegate {
34 public:
35 BackgroundAnimator(BackgroundAnimatorDelegate* delegate,
36 int min_alpha,
37 int max_alpha);
38 virtual ~BackgroundAnimator();
40 // Sets the transition time in ms.
41 void SetDuration(int time_in_ms);
43 // Sets whether a background is rendered. Initial value is false. If |type|
44 // is |CHANGE_IMMEDIATE| and an animation is not in progress this notifies
45 // the delegate immediately (synchronously from this method).
46 void SetPaintsBackground(bool value, BackgroundAnimatorChangeType type);
47 bool paints_background() const { return paints_background_; }
49 // Current alpha.
50 int alpha() const { return alpha_; }
52 // gfx::AnimationDelegate overrides:
53 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
55 private:
56 BackgroundAnimatorDelegate* delegate_;
58 const int min_alpha_;
59 const int max_alpha_;
61 gfx::SlideAnimation animation_;
63 // Whether the background is painted.
64 bool paints_background_;
66 // Current alpha value of the background.
67 int alpha_;
69 DISALLOW_COPY_AND_ASSIGN(BackgroundAnimator);
72 } // namespace internal
73 } // namespace ash
75 #endif // ASH_SHELF_BACKGROUND_ANIMATOR_H_