Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1138)

Unified Diff: chrome/browser/chromeos/brightness_bubble.cc

Issue 8319008: aura: brightness and volume bubble. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: updates Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698