OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/chromeos/volume_bubble_view_views.h" |
| 6 |
| 7 #include "base/memory/singleton.h" |
| 8 #include "chrome/browser/chromeos/setting_level_bubble_view_views.h" |
| 9 #include "grit/theme_resources.h" |
| 10 #include "ui/base/resource/resource_bundle.h" |
| 11 #include "views/widget/widget.h" |
| 12 |
| 13 namespace chromeos { |
| 14 |
| 15 views::Widget* VolumeBubble::widget_ = NULL; |
| 16 |
| 17 VolumeBubble::VolumeBubble() {} |
| 18 |
| 19 void VolumeBubble::ShowBubble(double percent, bool enabled) { |
| 20 if (!widget_) { |
| 21 widget_= SettingLevelBubbleViewViews::ConstructSettingLevelBubble( |
| 22 ResourceBundle::GetSharedInstance().GetBitmapNamed( |
| 23 IDR_VOLUME_BUBBLE_UP_ICON), |
| 24 ResourceBundle::GetSharedInstance().GetBitmapNamed( |
| 25 IDR_VOLUME_BUBBLE_DOWN_ICON), |
| 26 ResourceBundle::GetSharedInstance().GetBitmapNamed( |
| 27 IDR_VOLUME_BUBBLE_MUTE_ICON), |
| 28 percent, enabled); |
| 29 } else { |
| 30 static_cast<SettingLevelBubbleViewViews*>(widget_->widget_delegate()) |
| 31 ->UpdateSettingLevel(percent, enabled); |
| 32 } |
| 33 widget_->Show(); |
| 34 static_cast<SettingLevelBubbleViewViews*>(widget_->widget_delegate()) |
| 35 ->StartHideTimer(); |
| 36 } |
| 37 |
| 38 void VolumeBubble::HideBubble() { |
| 39 if (widget_) |
| 40 widget_->Close(); |
| 41 } |
| 42 |
| 43 // static |
| 44 VolumeBubble* VolumeBubble::GetInstance() { |
| 45 return Singleton<VolumeBubble>::get(); |
| 46 } |
| 47 } // namespace chromeos |
OLD | NEW |