Chromium Code Reviews| 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..f7ea457fafe229385de2c54140080ae360b7319c 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, closing the view. |
| 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. |
|
Daniel Erat
2011/10/26 16:51:43
also mention that the caller needs to call Init()
alicet1
2011/10/26 17:55:18
Done.
|
| + 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); |
| }; |