Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(680)

Side by Side Diff: ash/launcher/background_animator.h

Issue 12313118: Refactor: Shelf Widget (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: formatting and moved a couple unit tests Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #ifndef ASH_LAUNCHER_BACKGROUND_ANIMATOR_H_
6 #define ASH_LAUNCHER_BACKGROUND_ANIMATOR_H_
7
8 #include "ash/ash_export.h"
9 #include "base/basictypes.h"
10 #include "ui/base/animation/animation_delegate.h"
11 #include "ui/base/animation/slide_animation.h"
12
13 namespace ash {
14 namespace internal {
15
16 // Delegate is notified any time the background changes.
17 class ASH_EXPORT BackgroundAnimatorDelegate {
18 public:
19 virtual void UpdateBackground(int alpha) = 0;
20
21 protected:
22 virtual ~BackgroundAnimatorDelegate() {}
23 };
24
25 // BackgroundAnimator is used by the launcher and system tray to animate the
26 // background (alpha).
27 class ASH_EXPORT BackgroundAnimator : public ui::AnimationDelegate {
28 public:
29 // How the background can be changed.
30 enum ChangeType {
31 CHANGE_ANIMATE,
32 CHANGE_IMMEDIATE
33 };
34
35 BackgroundAnimator(BackgroundAnimatorDelegate* delegate,
36 int min_alpha,
37 int max_alpha);
38 virtual ~BackgroundAnimator();
39
40 // Sets whether a background is rendered. Initial value is false. If |type|
41 // is |CHANGE_IMMEDIATE| and an animation is not in progress this notifies
42 // the delegate immediately (synchronously from this method).
43 void SetPaintsBackground(bool value, ChangeType type);
44 bool paints_background() const { return paints_background_; }
45
46 // Current alpha.
47 int alpha() const { return alpha_; }
48
49 // ui::AnimationDelegate overrides:
50 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
51
52 private:
53 BackgroundAnimatorDelegate* delegate_;
54
55 const int min_alpha_;
56 const int max_alpha_;
57
58 ui::SlideAnimation animation_;
59
60 // Whether the background is painted.
61 bool paints_background_;
62
63 // Current alpha value of the background.
64 int alpha_;
65
66 DISALLOW_COPY_AND_ASSIGN(BackgroundAnimator);
67 };
68
69 } // namespace internal
70 } // namespace ash
71
72 #endif // ASH_LAUNCHER_BACKGROUND_ANIMATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698