OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/chromeos/brightness_bubble.h" | 5 #include "chrome/browser/chromeos/brightness_bubble.h" |
6 | 6 |
7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
8 #include "grit/theme_resources.h" | 8 #include "grit/theme_resources.h" |
9 #include "ui/base/resource/resource_bundle.h" | 9 #include "ui/base/resource/resource_bundle.h" |
10 #include "views/widget/widget.h" | |
10 | 11 |
11 namespace chromeos { | 12 namespace chromeos { |
12 | 13 |
13 BrightnessBubble::BrightnessBubble() | 14 BrightnessBubble::BrightnessBubble() : widget_(NULL) {} |
msw
2011/10/21 02:42:06
Move the ctor and dtor below the public functions,
alicet1
2011/10/21 18:11:36
Done.
| |
14 : SettingLevelBubble( | 15 |
15 ResourceBundle::GetSharedInstance().GetBitmapNamed( | 16 BrightnessBubble::~BrightnessBubble() { |
16 IDR_BRIGHTNESS_BUBBLE_ICON), | 17 delete widget_; |
17 ResourceBundle::GetSharedInstance().GetBitmapNamed( | 18 widget_ = NULL; |
18 IDR_BRIGHTNESS_BUBBLE_ICON), | 19 } |
19 ResourceBundle::GetSharedInstance().GetBitmapNamed( | 20 |
20 IDR_BRIGHTNESS_BUBBLE_ICON)) { | 21 void BrightnessBubble::ShowBubble(double percent, bool enabled) { |
22 widget_= SettingLevelBubble::ShowBubble( | |
Daniel Erat
2011/10/21 00:25:21
nit: space between 'widget_' and '='
alicet1
2011/10/21 18:11:36
Done.
| |
23 widget_, | |
24 ResourceBundle::GetSharedInstance().GetBitmapNamed( | |
25 IDR_BRIGHTNESS_BUBBLE_ICON), | |
26 ResourceBundle::GetSharedInstance().GetBitmapNamed( | |
27 IDR_BRIGHTNESS_BUBBLE_ICON), | |
28 ResourceBundle::GetSharedInstance().GetBitmapNamed( | |
29 IDR_BRIGHTNESS_BUBBLE_ICON), | |
30 percent, | |
31 enabled); | |
32 } | |
33 | |
34 void BrightnessBubble::UpdateWithoutShowingBubble(int level, bool enabled) { | |
35 if (widget_) | |
36 static_cast<SettingLevelBubble*>(widget_->widget_delegate()) | |
37 ->UpdateWithoutShowingBubble(level, enabled); | |
38 } | |
39 | |
40 void BrightnessBubble::HideBubble() { | |
41 if (widget_) | |
42 widget_->Close(); | |
21 } | 43 } |
22 | 44 |
23 // static | 45 // static |
24 BrightnessBubble* BrightnessBubble::GetInstance() { | 46 BrightnessBubble* BrightnessBubble::GetInstance() { |
25 return Singleton<BrightnessBubble>::get(); | 47 return Singleton<BrightnessBubble>::get(); |
26 } | 48 } |
27 | 49 |
28 } // namespace chromeos | 50 } // namespace chromeos |
OLD | NEW |