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

Side by Side Diff: ash/wm/common/background_animator.h

Issue 2030593002: Renames ash/wm/common into ash/common/wm (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « ash/wm/common/ash_wm_common.gyp ('k') | ash/wm/common/background_animator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_WM_COMMON_BACKGROUND_ANIMATOR_H_
6 #define ASH_WM_COMMON_BACKGROUND_ANIMATOR_H_
7
8 #include "ash/ash_export.h"
9 #include "base/macros.h"
10 #include "ui/gfx/animation/animation_delegate.h"
11 #include "ui/gfx/animation/slide_animation.h"
12
13 namespace ash {
14
15 // How the background can be changed.
16 enum BackgroundAnimatorChangeType {
17 BACKGROUND_CHANGE_ANIMATE,
18 BACKGROUND_CHANGE_IMMEDIATE
19 };
20
21 // Delegate is notified any time the background changes.
22 class ASH_EXPORT BackgroundAnimatorDelegate {
23 public:
24 virtual void UpdateBackground(int alpha) = 0;
25
26 protected:
27 virtual ~BackgroundAnimatorDelegate() {}
28 };
29
30 // BackgroundAnimator is used by the shelf to animate the background (alpha).
31 class ASH_EXPORT BackgroundAnimator : public gfx::AnimationDelegate {
32 public:
33 BackgroundAnimator(BackgroundAnimatorDelegate* delegate,
34 int min_alpha,
35 int max_alpha);
36 ~BackgroundAnimator() override;
37
38 // Sets the transition time in ms.
39 void SetDuration(int time_in_ms);
40
41 // Sets whether a background is rendered. Initial value is false. If |type|
42 // is |CHANGE_IMMEDIATE| and an animation is not in progress this notifies
43 // the delegate immediately (synchronously from this method).
44 void SetPaintsBackground(bool value, BackgroundAnimatorChangeType type);
45 bool paints_background() const { return paints_background_; }
46
47 // Current alpha.
48 int alpha() const { return alpha_; }
49
50 // gfx::AnimationDelegate overrides:
51 void AnimationProgressed(const gfx::Animation* animation) override;
52
53 private:
54 BackgroundAnimatorDelegate* delegate_;
55
56 const int min_alpha_;
57 const int max_alpha_;
58
59 gfx::SlideAnimation animation_;
60
61 // Whether the background is painted.
62 bool paints_background_;
63
64 // Current alpha value of the background.
65 int alpha_;
66
67 DISALLOW_COPY_AND_ASSIGN(BackgroundAnimator);
68 };
69
70 } // namespace ash
71
72 #endif // ASH_WM_COMMON_BACKGROUND_ANIMATOR_H_
OLDNEW
« no previous file with comments | « ash/wm/common/ash_wm_common.gyp ('k') | ash/wm/common/background_animator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698