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..501d3098116a8be5c303d3c89d15af07ae36b543 100644 |
--- a/chrome/browser/chromeos/setting_level_bubble.h |
+++ b/chrome/browser/chromeos/setting_level_bubble.h |
@@ -7,9 +7,10 @@ |
#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" |
class SkBitmap; |
@@ -19,11 +20,28 @@ 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, |
Daniel Erat
2011/10/24 19:53:10
Sorry to keep this review dragging on. :-(
The pa
alicet1
2011/10/25 00:51:39
sure, we can talk about it tomorrow. Just to menti
|
+ double percent, |
+ bool enabled); |
+ |
+ virtual ~SettingLevelBubble(); |
+ |
+ // BubbleDelegate overrides: |
+ 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,20 @@ 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: |
+ // BubbleDelegate overrides: |
+ virtual void Init() OVERRIDE; |
+ |
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 +108,10 @@ class SettingLevelBubble : public BubbleDelegate { |
SkBitmap* increase_icon_; |
SkBitmap* decrease_icon_; |
SkBitmap* disabled_icon_; |
+ SkBitmap* current_icon_; |
- // Currently shown bubble or NULL. |
- Bubble* bubble_; |
+ // Whether the content view, when shown, should be set to |enabled|. |
+ bool enabled_; |
// Contents view owned by Bubble. |
SettingLevelBubbleView* view_; |
@@ -108,6 +128,15 @@ class SettingLevelBubble : public BubbleDelegate { |
// Is |animation_timer_| currently running? |
bool is_animating_; |
+ // Monitor area associated with the top level widget. |
+ gfx::Rect monitor_area_; |
+ |
+ // Size of the child view. |
+ gfx::Size view_size_; |
+ |
+ FRIEND_TEST_ALL_PREFIXES(SettingLevelBubbleTest, CreateAndUpdate); |
+ FRIEND_TEST_ALL_PREFIXES(SettingLevelBubbleTest, ShowBubble); |
+ |
DISALLOW_COPY_AND_ASSIGN(SettingLevelBubble); |
}; |