| 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..43ed034e60a9f6add6444d7e51e42d54d13dd8b1 100644
|
| --- a/chrome/browser/chromeos/volume_bubble.cc
|
| +++ b/chrome/browser/chromeos/volume_bubble.cc
|
| @@ -7,22 +7,53 @@
|
| #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_ = NULL;
|
| +}
|
| +
|
| +void VolumeBubble::ShowBubble(double percent, bool enabled) {
|
| + if (!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);
|
| + }
|
| + SettingLevelBubble::ShowBubble(widget_, percent, enabled);
|
| +}
|
| +
|
| +void VolumeBubble::HideBubble() {
|
| + if (widget_) {
|
| + widget_->RemoveObserver(this);
|
| + widget_->Close();
|
| + widget_ = NULL;
|
| + }
|
| +}
|
| +
|
| +VolumeBubble::VolumeBubble()
|
| + : widget_(NULL) {}
|
| +
|
| +VolumeBubble::~VolumeBubble() {
|
| + if (widget_) {
|
| + widget_->RemoveObserver(this);
|
| + widget_ = NULL;
|
| + }
|
| +}
|
| +
|
| } // namespace chromeos
|
|
|