Chromium Code Reviews| 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/brightness_bubble_view_views.h" | |
| 6 | |
| 7 #include "base/memory/singleton.h" | |
| 8 #include "grit/theme_resources.h" | |
| 9 #include "ui/base/resource/resource_bundle.h" | |
| 10 #include "views/widget/widget.h" | |
| 11 | |
| 12 namespace chromeos { | |
| 13 | |
| 14 views::Widget* BrightnessBubble::widget_ = NULL; | |
| 15 | |
| 16 BrightnessBubble::BrightnessBubble() {} | |
| 17 | |
| 18 void BrightnessBubble::ShowBubble(double percent, bool enabled) { | |
| 19 if (!widget_) { | |
| 20 widget_= SettingLevelBubbleViewViews::ConstructSettingLevelBubble( | |
| 21 ResourceBundle::GetSharedInstance().GetBitmapNamed( | |
|
Daniel Erat
2011/10/18 17:55:12
nit: indent four spaces, not six
alicet1
2011/10/19 14:59:16
Done.
| |
| 22 IDR_BRIGHTNESS_BUBBLE_ICON), | |
| 23 ResourceBundle::GetSharedInstance().GetBitmapNamed( | |
| 24 IDR_BRIGHTNESS_BUBBLE_ICON), | |
| 25 ResourceBundle::GetSharedInstance().GetBitmapNamed( | |
| 26 IDR_BRIGHTNESS_BUBBLE_ICON), | |
| 27 percent, enabled); | |
| 28 } else { | |
| 29 static_cast<SettingLevelBubbleViewViews*>(widget_->widget_delegate()) | |
| 30 ->UpdateSettingLevel(percent, enabled); | |
| 31 } | |
| 32 widget_->Show(); | |
| 33 static_cast<SettingLevelBubbleViewViews*>(widget_->widget_delegate()) | |
| 34 ->StartHideTimer(); | |
| 35 } | |
| 36 | |
| 37 void BrightnessBubble::UpdateWithoutShowingBubble(int level, bool enabled) { | |
| 38 if (widget_) | |
| 39 static_cast<SettingLevelBubbleViewViews*>(widget_->widget_delegate()) | |
| 40 ->UpdateWithoutShowingBubble(level, enabled); | |
| 41 } | |
| 42 | |
| 43 void BrightnessBubble::HideBubble() { | |
| 44 if (widget_) | |
| 45 widget_->Close(); | |
| 46 } | |
| 47 | |
| 48 // static | |
| 49 BrightnessBubble* BrightnessBubble::GetInstance() { | |
| 50 return Singleton<BrightnessBubble>::get(); | |
| 51 } | |
| 52 | |
| 53 } // namespace chromeos | |
| OLD | NEW |