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

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

Issue 8319008: aura: brightness and volume bubble. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: update the icon 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/volume_bubble.cc
diff --git a/chrome/browser/chromeos/volume_bubble.cc b/chrome/browser/chromeos/volume_bubble.cc
index d5c8c9726c81f385343448fe4e5e88477c56596e..9af8fc656c0dccc839f508c3a5b97cc2290a56b5 100644
--- a/chrome/browser/chromeos/volume_bubble.cc
+++ b/chrome/browser/chromeos/volume_bubble.cc
@@ -7,22 +7,58 @@
#include "base/memory/singleton.h"
#include "grit/theme_resources.h"
#include "ui/base/resource/resource_bundle.h"
+#include "views/widget/widget.h"
namespace chromeos {
-VolumeBubble::VolumeBubble()
- : SettingLevelBubble(
- ResourceBundle::GetSharedInstance().GetBitmapNamed(
- IDR_VOLUME_BUBBLE_UP_ICON),
- ResourceBundle::GetSharedInstance().GetBitmapNamed(
- IDR_VOLUME_BUBBLE_DOWN_ICON),
- ResourceBundle::GetSharedInstance().GetBitmapNamed(
- IDR_VOLUME_BUBBLE_MUTE_ICON)) {
-}
-
// static
VolumeBubble* VolumeBubble::GetInstance() {
return Singleton<VolumeBubble>::get();
}
+void VolumeBubble::OnWidgetClosing(views::Widget* widget) {
+ // Bubble faded out.
+ if (widget_ == widget)
+ widget_closed_ = true;
+}
+
+void VolumeBubble::ShowBubble(double percent, bool enabled) {
+ if (widget_closed_ || !widget_) {
+ widget_ = SettingLevelBubble::CreateBubble(
+ ResourceBundle::GetSharedInstance().GetBitmapNamed(
+ IDR_VOLUME_BUBBLE_UP_ICON),
+ ResourceBundle::GetSharedInstance().GetBitmapNamed(
+ IDR_VOLUME_BUBBLE_DOWN_ICON),
+ ResourceBundle::GetSharedInstance().GetBitmapNamed(
+ IDR_VOLUME_BUBBLE_MUTE_ICON),
+ percent,
+ enabled);
+ widget_->AddObserver(this);
+ widget_closed_ = false;
+ }
+ if (!widget_closed_) {
+ SettingLevelBubble::ShowBubble(widget_, percent, enabled);
+ }
+}
+
+void VolumeBubble::HideBubble() {
+ if (widget_) {
+ widget_->RemoveObserver(this);
+ widget_->Close();
+ widget_closed_ = true;
+ }
+}
+
+VolumeBubble::VolumeBubble()
+ : widget_(NULL),
+ widget_closed_(false) {}
+
+VolumeBubble::~VolumeBubble() {
+ if (widget_) {
+ widget_->RemoveObserver(this);
+ delete widget_;
+ widget_ = NULL;
+ }
+}
+
} // namespace chromeos
« chrome/browser/chromeos/setting_level_bubble.cc ('K') | « chrome/browser/chromeos/volume_bubble.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698