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"
16 // Delegate is notified any time the background changes.
17 class ASH_EXPORT BackgroundAnimatorDelegate {
19 virtual void UpdateBackground(int alpha) = 0;
22 virtual ~BackgroundAnimatorDelegate() {}
25 // BackgroundAnimator is used by the shelf to animate the background (alpha).
26 class ASH_EXPORT BackgroundAnimator : public gfx::AnimationDelegate {
28 // How the background can be changed.
34 BackgroundAnimator(BackgroundAnimatorDelegate* delegate,
37 virtual ~BackgroundAnimator();
39 // Sets the transition time in ms.
40 void SetDuration(int time_in_ms);
42 // Sets whether a background is rendered. Initial value is false. If |type|
43 // is |CHANGE_IMMEDIATE| and an animation is not in progress this notifies
44 // the delegate immediately (synchronously from this method).
45 void SetPaintsBackground(bool value, ChangeType type);
46 bool paints_background() const { return paints_background_; }
49 int alpha() const { return alpha_; }
51 // gfx::AnimationDelegate overrides:
52 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
55 BackgroundAnimatorDelegate* delegate_;
60 gfx::SlideAnimation animation_;
62 // Whether the background is painted.
63 bool paints_background_;
65 // Current alpha value of the background.
68 DISALLOW_COPY_AND_ASSIGN(BackgroundAnimator);
71 } // namespace internal
74 #endif // ASH_SHELF_BACKGROUND_ANIMATOR_H_