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..101f11386e99d6a04d52e8dde068799d5cdd6bc6 100644 |
--- a/chrome/browser/chromeos/setting_level_bubble.h |
+++ b/chrome/browser/chromeos/setting_level_bubble.h |
@@ -9,21 +9,31 @@ |
#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; |
+namespace views { |
+class Widget; |
+} |
namespace chromeos { |
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* ConstructSettingLevelBubble( |
Daniel Erat
2011/10/19 17:28:09
naming nit: s/Construct/Create/ (which i think is
alicet1
2011/10/20 15:03:08
Done.
|
+ SkBitmap* increase_icon, |
+ SkBitmap* decrease_icon, |
+ SkBitmap* zero_icon, |
+ double percent, |
+ bool enabled); |
+ |
+ virtual ~SettingLevelBubble(); |
// 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,17 +52,28 @@ class SettingLevelBubble : public BubbleDelegate { |
// to 30%, rather than from 25% up to 30%. |
void UpdateWithoutShowingBubble(double percent, bool enabled); |
+ // Calculate target percent and icon to be used when setting level changes. |
+ void UpdateSettingLevelInternal(double percent, bool enabled); |
+ |
+ // Start the hide_timer_ for this bubble. |
Daniel Erat
2011/10/19 17:28:09
nit: |hide_timer_|
alicet1
2011/10/20 15:03:08
Done.
|
+ void StartHideTimer(); |
+ |
+ // BubbleDelegate overrides: |
+ virtual void Init() OVERRIDE; |
+ virtual gfx::Point GetAnchorPoint() const OVERRIDE; |
+ virtual views::BubbleBorder::ArrowLocation GetArrowLocation() const OVERRIDE; |
+ |
+ // WidgetDeletgate overrides: |
+ virtual void WindowClosing() OVERRIDE; |
+ |
protected: |
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; |
+ // Calculate anchor point in screen coordinates. |
+ void CalculateAnchorPoint(); |
// Callback for |hide_timer_|. Closes the bubble. |
void OnHideTimeout(); |
@@ -89,10 +110,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_; |
Daniel Erat
2011/10/19 17:28:09
nit: leave a blank line between this and the next
alicet1
2011/10/20 15:03:08
Done.
|
// Contents view owned by Bubble. |
SettingLevelBubbleView* view_; |
@@ -108,6 +128,7 @@ class SettingLevelBubble : public BubbleDelegate { |
// Is |animation_timer_| currently running? |
bool is_animating_; |
+ gfx::Point anchor_point_; |
Daniel Erat
2011/10/19 17:28:09
nit: leave a blank line after this
alicet1
2011/10/20 15:03:08
Done.
|
DISALLOW_COPY_AND_ASSIGN(SettingLevelBubble); |
}; |