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

Side by Side Diff: chrome/browser/ui/tabs/tab_audio_indicator.h

Issue 23531053: ui/base/animation -> ui/gfx/animation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge 2 trunk Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_TABS_TAB_AUDIO_INDICATOR_H_ 5 #ifndef CHROME_BROWSER_UI_TABS_TAB_AUDIO_INDICATOR_H_
6 #define CHROME_BROWSER_UI_TABS_TAB_AUDIO_INDICATOR_H_ 6 #define CHROME_BROWSER_UI_TABS_TAB_AUDIO_INDICATOR_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/gtest_prod_util.h" 11 #include "base/gtest_prod_util.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "ui/base/animation/animation_delegate.h" 14 #include "ui/gfx/animation/animation_delegate.h"
15 #include "ui/gfx/image/image_skia.h" 15 #include "ui/gfx/image/image_skia.h"
16 16
17 namespace gfx { 17 namespace gfx {
18 class Canvas;
19 class Rect;
20 }
21 namespace ui {
22 class Animation; 18 class Animation;
23 class AnimationContainer; 19 class AnimationContainer;
20 class Canvas;
24 class LinearAnimation; 21 class LinearAnimation;
22 class Rect;
25 } 23 }
26 24
27 // This class is used to draw an animating tab audio indicator. 25 // This class is used to draw an animating tab audio indicator.
28 class TabAudioIndicator : public ui::AnimationDelegate { 26 class TabAudioIndicator : public gfx::AnimationDelegate {
29 public: 27 public:
30 class Delegate { 28 class Delegate {
31 public: 29 public:
32 virtual void ScheduleAudioIndicatorPaint() = 0; 30 virtual void ScheduleAudioIndicatorPaint() = 0;
33 31
34 protected: 32 protected:
35 virtual ~Delegate() {} 33 virtual ~Delegate() {}
36 }; 34 };
37 35
38 explicit TabAudioIndicator(Delegate* delegate); 36 explicit TabAudioIndicator(Delegate* delegate);
39 virtual ~TabAudioIndicator(); 37 virtual ~TabAudioIndicator();
40 38
41 void set_favicon(const gfx::ImageSkia& favicon) { favicon_ = favicon; } 39 void set_favicon(const gfx::ImageSkia& favicon) { favicon_ = favicon; }
42 40
43 void SetAnimationContainer(ui::AnimationContainer* animation_container); 41 void SetAnimationContainer(gfx::AnimationContainer* animation_container);
44 void SetIsPlayingAudio(bool is_playing_audio); 42 void SetIsPlayingAudio(bool is_playing_audio);
45 bool IsAnimating(); 43 bool IsAnimating();
46 44
47 void Paint(gfx::Canvas* canvas, const gfx::Rect& rect); 45 void Paint(gfx::Canvas* canvas, const gfx::Rect& rect);
48 46
49 private: 47 private:
50 enum State { 48 enum State {
51 STATE_NOT_ANIMATING, 49 STATE_NOT_ANIMATING,
52 STATE_ANIMATING, 50 STATE_ANIMATING,
53 STATE_ANIMATION_ENDING, 51 STATE_ANIMATION_ENDING,
54 }; 52 };
55 53
56 FRIEND_TEST_ALL_PREFIXES(TabAudioIndicatorTest, AnimationState); 54 FRIEND_TEST_ALL_PREFIXES(TabAudioIndicatorTest, AnimationState);
57 FRIEND_TEST_ALL_PREFIXES(TabAudioIndicatorTest, SchedulePaint); 55 FRIEND_TEST_ALL_PREFIXES(TabAudioIndicatorTest, SchedulePaint);
58 56
59 // AnimationDelegate: 57 // AnimationDelegate:
60 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; 58 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
61 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; 59 virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE;
62 60
63 // Gets the equalizer levels for all 3 columns. The values are tweened between 61 // Gets the equalizer levels for all 3 columns. The values are tweened between
64 // the current and target frame. 62 // the current and target frame.
65 std::vector<int> GetCurrentEqualizerLevels() const; 63 std::vector<int> GetCurrentEqualizerLevels() const;
66 64
67 Delegate* delegate_; 65 Delegate* delegate_;
68 scoped_ptr<ui::LinearAnimation> animation_; 66 scoped_ptr<gfx::LinearAnimation> animation_;
69 scoped_refptr<ui::AnimationContainer> animation_container_; 67 scoped_refptr<gfx::AnimationContainer> animation_container_;
70 gfx::ImageSkia favicon_; 68 gfx::ImageSkia favicon_;
71 69
72 // The equalizer frame that's currently being displayed. 70 // The equalizer frame that's currently being displayed.
73 size_t frame_index_; 71 size_t frame_index_;
74 72
75 // The equalizer levels that were last displayed. This is used to prevent 73 // The equalizer levels that were last displayed. This is used to prevent
76 // unnecessary drawing when animation progress doesn't result in equalizer 74 // unnecessary drawing when animation progress doesn't result in equalizer
77 // levels changing. 75 // levels changing.
78 std::vector<int> last_displayed_equalizer_levels_; 76 std::vector<int> last_displayed_equalizer_levels_;
79 77
80 State state_; 78 State state_;
81 79
82 DISALLOW_COPY_AND_ASSIGN(TabAudioIndicator); 80 DISALLOW_COPY_AND_ASSIGN(TabAudioIndicator);
83 }; 81 };
84 82
85 #endif // CHROME_BROWSER_UI_TABS_TAB_AUDIO_INDICATOR_H_ 83 #endif // CHROME_BROWSER_UI_TABS_TAB_AUDIO_INDICATOR_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel_bounds_animation.cc ('k') | chrome/browser/ui/tabs/tab_audio_indicator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698