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..bc38910843c8ed6f1ff2a46db8b70cbd28008c55 100644 |
--- a/chrome/browser/chromeos/setting_level_bubble.h |
+++ b/chrome/browser/chromeos/setting_level_bubble.h |
@@ -9,7 +9,7 @@ |
#include "base/basictypes.h" |
#include "base/time.h" |
#include "base/timer.h" |
-#include "chrome/browser/ui/views/bubble/bubble.h" |
+#include "views/bubble/bubble_delegate.h" |
class SkBitmap; |
@@ -19,11 +19,29 @@ class SettingLevelBubbleView; |
// Singleton class controlling a bubble displaying a level-based setting like |
// volume or brightness. |
-class SettingLevelBubble : public BubbleDelegate { |
+class SettingLevelBubble : public views::BubbleDelegateView { |
public: |
- // Shows the bubble. |percent| should be in the range [0.0, 100.0]. |
- void ShowBubble(double percent, bool enabled); |
- void HideBubble(); |
+ // Create the bubble delegate and view. |
+ // |percent| should be in the range [0.0, 100.0]. |
+ static views::Widget* CreateBubble(SkBitmap* increase_icon, |
+ SkBitmap* decrease_icon, |
+ SkBitmap* zero_icon, |
+ double percent, |
+ bool enabled); |
+ |
+ // Show the setting level bubble for this |widget|. |
+ static void ShowBubble(views::Widget* widget, |
+ double percent, |
+ bool enabled); |
+ |
+ virtual ~SettingLevelBubble(); |
+ |
+ // BubbleDelegate overrides: |
+ virtual void Init() OVERRIDE; |
msw
2011/10/22 00:44:48
BubbleDelegateView::Init is declared protected, th
alicet1
2011/10/24 15:46:38
Done.
|
+ virtual gfx::Point GetAnchorPoint() const OVERRIDE; |
+ |
+ // WidgetDelegate overrides: |
+ virtual void WindowClosing() OVERRIDE; |
// Updates the bubble's current level without showing the bubble onscreen. |
// We _do_ still animate the level moving to |percent| in case the bubble is |
@@ -42,19 +60,17 @@ class SettingLevelBubble : public BubbleDelegate { |
// to 30%, rather than from 25% up to 30%. |
void UpdateWithoutShowingBubble(double percent, bool enabled); |
+ // Start the |hide_timer_| for this bubble. |
+ void StartHideTimer(); |
+ |
protected: |
SettingLevelBubble(SkBitmap* increase_icon, |
SkBitmap* decrease_icon, |
- SkBitmap* zero_icon); |
- virtual ~SettingLevelBubble(); |
+ SkBitmap* zero_icon, |
+ const gfx::Rect& monitor_area); |
private: |
- // Overridden from BubbleDelegate. |
- virtual void BubbleClosing(Bubble* bubble, bool closed_by_escape) OVERRIDE; |
- virtual bool CloseOnEscape() OVERRIDE; |
- virtual bool FadeInOnShow() OVERRIDE; |
- |
- // 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, |
@@ -89,9 +105,9 @@ class SettingLevelBubble : public BubbleDelegate { |
SkBitmap* increase_icon_; |
SkBitmap* decrease_icon_; |
SkBitmap* disabled_icon_; |
+ SkBitmap* current_icon_; |
- // Currently shown bubble or NULL. |
- Bubble* bubble_; |
+ bool enabled_; |
msw
2011/10/22 00:44:48
Comment?
alicet1
2011/10/24 15:46:38
Done.
|
// Contents view owned by Bubble. |
SettingLevelBubbleView* view_; |
@@ -108,6 +124,12 @@ class SettingLevelBubble : public BubbleDelegate { |
// Is |animation_timer_| currently running? |
bool is_animating_; |
+ // |monitor_area_| associated with the top level widget. |
msw
2011/10/22 00:44:48
I think plain text "Monitor area" makes more sense
alicet1
2011/10/24 15:46:38
Done.
|
+ gfx::Rect monitor_area_; |
+ |
+ // size of the child view. |
msw
2011/10/22 00:44:48
capitalize 'size'
alicet1
2011/10/24 15:46:38
Done.
|
+ gfx::Size view_size_; |
+ |
DISALLOW_COPY_AND_ASSIGN(SettingLevelBubble); |
}; |