OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_CHROMEOS_SETTING_LEVEL_BUBBLE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_H_ |
6 #define CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "app/animation_delegate.h" | |
10 #include "app/slide_animation.h" | |
11 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
12 #include "base/timer.h" | 10 #include "base/timer.h" |
13 #include "chrome/browser/views/info_bubble.h" | 11 #include "chrome/browser/views/info_bubble.h" |
| 12 #include "ui/base/animation/animation_delegate.h" |
| 13 #include "ui/base/animation/slide_animation.h" |
14 | 14 |
15 class SkBitmap; | 15 class SkBitmap; |
16 | 16 |
17 namespace chromeos { | 17 namespace chromeos { |
18 | 18 |
19 class SettingLevelBubbleView; | 19 class SettingLevelBubbleView; |
20 | 20 |
21 // Singleton class controlling a bubble displaying a level-based setting like | 21 // Singleton class controlling a bubble displaying a level-based setting like |
22 // volume or brightness. | 22 // volume or brightness. |
23 class SettingLevelBubble : public InfoBubbleDelegate, | 23 class SettingLevelBubble : public InfoBubbleDelegate, |
24 public AnimationDelegate { | 24 public ui::AnimationDelegate { |
25 public: | 25 public: |
26 void ShowBubble(int percent); | 26 void ShowBubble(int percent); |
27 void HideBubble(); | 27 void HideBubble(); |
28 | 28 |
29 protected: | 29 protected: |
30 explicit SettingLevelBubble(SkBitmap* increase_icon, | 30 explicit SettingLevelBubble(SkBitmap* increase_icon, |
31 SkBitmap* decrease_icon, | 31 SkBitmap* decrease_icon, |
32 SkBitmap* zero_icon); | 32 SkBitmap* zero_icon); |
33 virtual ~SettingLevelBubble() {} | 33 virtual ~SettingLevelBubble() {} |
34 | 34 |
35 private: | 35 private: |
36 void OnTimeout(); | 36 void OnTimeout(); |
37 | 37 |
38 // Overridden from InfoBubbleDelegate. | 38 // Overridden from InfoBubbleDelegate. |
39 virtual void InfoBubbleClosing(InfoBubble* info_bubble, | 39 virtual void InfoBubbleClosing(InfoBubble* info_bubble, |
40 bool closed_by_escape); | 40 bool closed_by_escape); |
41 virtual bool CloseOnEscape() { return true; } | 41 virtual bool CloseOnEscape() { return true; } |
42 virtual bool FadeInOnShow() { return false; } | 42 virtual bool FadeInOnShow() { return false; } |
43 | 43 |
44 // Overridden from AnimationDelegate. | 44 // Overridden from ui::AnimationDelegate. |
45 virtual void AnimationEnded(const Animation* animation); | 45 virtual void AnimationEnded(const ui::Animation* animation); |
46 virtual void AnimationProgressed(const Animation* animation); | 46 virtual void AnimationProgressed(const ui::Animation* animation); |
47 | 47 |
48 // Previous and current percentages, or -1 if not yet shown. | 48 // Previous and current percentages, or -1 if not yet shown. |
49 int previous_percent_; | 49 int previous_percent_; |
50 int current_percent_; | 50 int current_percent_; |
51 | 51 |
52 // Icons displayed in the bubble when increasing or decreasing the level or | 52 // Icons displayed in the bubble when increasing or decreasing the level or |
53 // setting it to zero. Not owned by us. | 53 // setting it to zero. Not owned by us. |
54 SkBitmap* increase_icon_; | 54 SkBitmap* increase_icon_; |
55 SkBitmap* decrease_icon_; | 55 SkBitmap* decrease_icon_; |
56 SkBitmap* zero_icon_; | 56 SkBitmap* zero_icon_; |
57 | 57 |
58 // Currently shown bubble or NULL. | 58 // Currently shown bubble or NULL. |
59 InfoBubble* bubble_; | 59 InfoBubble* bubble_; |
60 | 60 |
61 // Its contents view, owned by InfoBubble. | 61 // Its contents view, owned by InfoBubble. |
62 SettingLevelBubbleView* view_; | 62 SettingLevelBubbleView* view_; |
63 | 63 |
64 SlideAnimation animation_; | 64 ui::SlideAnimation animation_; |
65 base::OneShotTimer<SettingLevelBubble> timeout_timer_; | 65 base::OneShotTimer<SettingLevelBubble> timeout_timer_; |
66 | 66 |
67 DISALLOW_COPY_AND_ASSIGN(SettingLevelBubble); | 67 DISALLOW_COPY_AND_ASSIGN(SettingLevelBubble); |
68 }; | 68 }; |
69 | 69 |
70 } // namespace chromeos | 70 } // namespace chromeos |
71 | 71 |
72 #endif // CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_H_ | 72 #endif // CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_H_ |
OLD | NEW |