Index: chrome/browser/chromeos/setting_level_bubble.h |
diff --git a/chrome/browser/chromeos/setting_level_bubble.h b/chrome/browser/chromeos/setting_level_bubble.h |
index 6496dde84c82efd9bbfa3c422986c87b0355c434..9e9afa2225eb90b40d7fede355b6541c29ebdffd 100644 |
--- a/chrome/browser/chromeos/setting_level_bubble.h |
+++ b/chrome/browser/chromeos/setting_level_bubble.h |
@@ -7,9 +7,11 @@ |
#pragma once |
#include "base/basictypes.h" |
+#include "base/gtest_prod_util.h" |
#include "base/time.h" |
#include "base/timer.h" |
-#include "chrome/browser/ui/views/bubble/bubble.h" |
+#include "views/bubble/bubble_delegate.h" |
+#include "views/widget/widget.h" |
class SkBitmap; |
@@ -17,12 +19,15 @@ namespace chromeos { |
class SettingLevelBubbleView; |
-// Singleton class controlling a bubble displaying a level-based setting like |
+// Controls a bubble displaying a level-based setting like |
// volume or brightness. |
-class SettingLevelBubble : public BubbleDelegate { |
+class SettingLevelBubble : public views::Widget::Observer { |
public: |
- // Shows the bubble. |percent| should be in the range [0.0, 100.0]. |
+ // Shows the bubble with the target |percent| and |enabled| setting. |
+ // |percent| should be in the range [0.0, 100.0]. |
void ShowBubble(double percent, bool enabled); |
+ |
+ // Hides the Bubble, close the view. |
Daniel Erat
2011/10/26 05:08:01
nit: ", closing the view"
alicet1
2011/10/26 16:12:48
Done.
|
void HideBubble(); |
// Updates the bubble's current level without showing the bubble onscreen. |
@@ -46,15 +51,17 @@ class SettingLevelBubble : public BubbleDelegate { |
SettingLevelBubble(SkBitmap* increase_icon, |
SkBitmap* decrease_icon, |
SkBitmap* zero_icon); |
+ |
virtual ~SettingLevelBubble(); |
private: |
- // Overridden from BubbleDelegate. |
- virtual void BubbleClosing(Bubble* bubble, bool closed_by_escape) OVERRIDE; |
- virtual bool CloseOnEscape() OVERRIDE; |
- virtual bool FadeInOnShow() OVERRIDE; |
+ // views::Widget::Observer overrides: |
+ void OnWidgetClosing(views::Widget* widget) OVERRIDE; |
+ |
+ // Creates the bubble content view. |
+ SettingLevelBubbleView* CreateView(); |
- // Callback for |hide_timer_|. Closes the bubble. |
+ // Callback for |hide_timer_|. Starts fading out. |
void OnHideTimeout(); |
// Callback for |animation_timer_|. Updates the level displayed by the view, |
@@ -90,9 +97,6 @@ class SettingLevelBubble : public BubbleDelegate { |
SkBitmap* decrease_icon_; |
SkBitmap* disabled_icon_; |
- // Currently shown bubble or NULL. |
- Bubble* bubble_; |
- |
// Contents view owned by Bubble. |
SettingLevelBubbleView* view_; |
@@ -108,6 +112,11 @@ class SettingLevelBubble : public BubbleDelegate { |
// Is |animation_timer_| currently running? |
bool is_animating_; |
+ FRIEND_TEST_ALL_PREFIXES(SettingLevelBubbleTest, CreateAndUpdate); |
+ FRIEND_TEST_ALL_PREFIXES(SettingLevelBubbleTest, ShowBubble); |
+ FRIEND_TEST_ALL_PREFIXES(BrightnessBubbleTest, UpdateWithoutShowing); |
+ FRIEND_TEST_ALL_PREFIXES(VolumeBubbleTest, GetInstanceAndShow); |
+ |
DISALLOW_COPY_AND_ASSIGN(SettingLevelBubble); |
}; |