Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_UI_TABS_TAB_AUDIO_INDICATOR_H_ | |
| 6 #define CHROME_BROWSER_UI_TABS_TAB_AUDIO_INDICATOR_H_ | |
| 7 | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
|
cpu_(ooo_6.6-7.5)
2013/03/11 02:40:27
what does require basictypes.h in this header?
sail
2013/03/11 23:16:13
Done.
Removed.
| |
| 11 #include "base/compiler_specific.h" | |
| 12 #include "base/gtest_prod_util.h" | |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "ui/base/animation/animation_delegate.h" | |
| 15 | |
| 16 namespace gfx { | |
| 17 class Canvas; | |
| 18 class Rect; | |
| 19 } | |
| 20 namespace ui { | |
| 21 class Animation; | |
| 22 class LinearAnimation; | |
| 23 } | |
| 24 | |
| 25 // This class is used to draw an animating tab audio indicator. | |
| 26 class TabAudioIndicator : public ui::AnimationDelegate { | |
| 27 public: | |
| 28 class Delegate { | |
| 29 public: | |
| 30 virtual void ScheduleAudioIndicatorPaint() = 0; | |
| 31 }; | |
| 32 | |
| 33 explicit TabAudioIndicator(Delegate* delegate); | |
| 34 virtual ~TabAudioIndicator(); | |
| 35 | |
| 36 void SetIsPlayingAudio(bool is_playing_audio); | |
| 37 bool IsAnimating(); | |
| 38 | |
| 39 void Paint(gfx::Canvas* canvas, const gfx::Rect& rect); | |
| 40 | |
| 41 private: | |
| 42 FRIEND_TEST_ALL_PREFIXES(TabAudioIndicatorTest, AnimationState); | |
| 43 FRIEND_TEST_ALL_PREFIXES(TabAudioIndicatorTest, SchedulePaint); | |
| 44 | |
| 45 // AnimationDelegate: | |
| 46 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | |
| 47 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; | |
| 48 | |
| 49 // Gets the equalizer levels for all 3 columns. The values are tweened between | |
| 50 // the current and target frame. | |
| 51 std::vector<int> GetCurrentEqualizerLevels() const; | |
| 52 | |
| 53 Delegate* delegate_; | |
| 54 scoped_ptr<ui::LinearAnimation> animation_; | |
| 55 | |
| 56 // The equalizer frame that's currently being displayed. | |
| 57 int frame_index_; | |
|
cpu_(ooo_6.6-7.5)
2013/03/11 02:40:27
size_t
sail
2013/03/11 23:16:13
Done.
| |
| 58 | |
| 59 // The equalizer levels that were last displayed. This is used to prevent | |
| 60 // unnecessary drawing when animation progress doesn't result in equalizer | |
| 61 // levels changing. | |
| 62 std::vector<int> last_displayed_equalizer_levels_; | |
| 63 | |
| 64 enum State { | |
| 65 STATE_ANIMATING, | |
| 66 STATE_ANIMATION_ENDING, | |
| 67 STATE_NOT_ANIMATING, | |
|
cpu_(ooo_6.6-7.5)
2013/03/11 02:40:27
it is nice if STATE_NOT_ANIMATING is first since i
sail
2013/03/11 23:16:13
Done.
| |
| 68 }; | |
| 69 State state_; | |
| 70 | |
| 71 DISALLOW_COPY_AND_ASSIGN(TabAudioIndicator); | |
| 72 }; | |
| 73 | |
| 74 #endif // CHROME_BROWSER_UI_TABS_TAB_AUDIO_INDICATOR_H_ | |
| OLD | NEW |