Index: chrome/browser/chromeos/brightness_bubble.cc |
diff --git a/chrome/browser/chromeos/brightness_bubble.cc b/chrome/browser/chromeos/brightness_bubble.cc |
index 7c149aacde2b3e23cb1fcf20960756688df41a0c..1822850c25e1ecd3dafbb17cd5695fced739bc08 100644 |
--- a/chrome/browser/chromeos/brightness_bubble.cc |
+++ b/chrome/browser/chromeos/brightness_bubble.cc |
@@ -7,17 +7,48 @@ |
#include "base/memory/singleton.h" |
#include "grit/theme_resources.h" |
#include "ui/base/resource/resource_bundle.h" |
+#include "views/bubble/bubble_view.h" |
msw
2011/10/20 19:36:13
merge and remove bubble_view.h
alicet1
2011/10/20 22:36:30
Done.
|
+#include "views/widget/widget.h" |
namespace chromeos { |
-BrightnessBubble::BrightnessBubble() |
- : SettingLevelBubble( |
- ResourceBundle::GetSharedInstance().GetBitmapNamed( |
- IDR_BRIGHTNESS_BUBBLE_ICON), |
- ResourceBundle::GetSharedInstance().GetBitmapNamed( |
+BrightnessBubble::BrightnessBubble() : widget_(NULL) {} |
+ |
+BrightnessBubble::~BrightnessBubble() { |
+ if (widget_) |
+ delete widget_; |
Daniel Erat
2011/10/20 15:43:39
nit: deleting a null pointer is fine, so you can r
alicet1
2011/10/20 22:36:30
Done.
|
+} |
+ |
+void BrightnessBubble::ShowBubble(double percent, bool enabled) { |
+ if (!widget_) { |
+ widget_= SettingLevelBubble::CreateSettingLevelBubble( |
+ ResourceBundle::GetSharedInstance().GetBitmapNamed( |
+ IDR_BRIGHTNESS_BUBBLE_ICON), |
+ ResourceBundle::GetSharedInstance().GetBitmapNamed( |
IDR_BRIGHTNESS_BUBBLE_ICON), |
- ResourceBundle::GetSharedInstance().GetBitmapNamed( |
- IDR_BRIGHTNESS_BUBBLE_ICON)) { |
+ ResourceBundle::GetSharedInstance().GetBitmapNamed( |
+ IDR_BRIGHTNESS_BUBBLE_ICON), |
+ percent, |
+ enabled); |
+ } else { |
+ static_cast<SettingLevelBubble*>(widget_->widget_delegate()) |
+ ->UpdateSetting(percent, enabled); |
+ } |
+ // Starts a new fade out animation and show. |
+ widget_->client_view()->AsBubbleView()->StartFade(/*fade_in=*/false); |
Daniel Erat
2011/10/20 15:43:39
nit: comment style i've seen more frequently for p
Daniel Erat
2011/10/20 15:43:39
does this mean that we start fading the bubble out
alicet1
2011/10/20 22:36:30
Done.
alicet1
2011/10/20 22:36:30
yup, changed.
|
+ static_cast<SettingLevelBubble*>(widget_->widget_delegate()) |
+ ->StartHideTimer(); |
+} |
+ |
+void BrightnessBubble::UpdateWithoutShowingBubble(int level, bool enabled) { |
+ if (widget_) |
+ static_cast<SettingLevelBubble*>(widget_->widget_delegate()) |
+ ->UpdateWithoutShowingBubble(level, enabled); |
+} |
+ |
+void BrightnessBubble::HideBubble() { |
msw
2011/10/20 19:36:13
Is this called anywhere?
alicet1
2011/10/20 22:36:30
yeah, in SystemKeyEventListener::ShowVolumeBubble,
|
+ if (widget_) |
+ widget_->Close(); |
} |
// static |