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

Side by Side Diff: chrome/browser/chromeos/brightness_bubble.cc

Issue 8319008: aura: brightness and volume bubble. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: minor cleanup. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 views::Widget* BrightnessBubble::widget_ = NULL;
14 : SettingLevelBubble( 15
15 ResourceBundle::GetSharedInstance().GetBitmapNamed( 16 BrightnessBubble::BrightnessBubble() {}
17
18 void BrightnessBubble::ShowBubble(double percent, bool enabled) {
19 if (!widget_) {
20 widget_= SettingLevelBubble::ConstructSettingLevelBubble(
21 ResourceBundle::GetSharedInstance().GetBitmapNamed(
22 IDR_BRIGHTNESS_BUBBLE_ICON),
23 ResourceBundle::GetSharedInstance().GetBitmapNamed(
16 IDR_BRIGHTNESS_BUBBLE_ICON), 24 IDR_BRIGHTNESS_BUBBLE_ICON),
17 ResourceBundle::GetSharedInstance().GetBitmapNamed( 25 ResourceBundle::GetSharedInstance().GetBitmapNamed(
18 IDR_BRIGHTNESS_BUBBLE_ICON), 26 IDR_BRIGHTNESS_BUBBLE_ICON),
19 ResourceBundle::GetSharedInstance().GetBitmapNamed( 27 percent,
20 IDR_BRIGHTNESS_BUBBLE_ICON)) { 28 enabled);
29 } else {
30 static_cast<SettingLevelBubble*>(widget_->widget_delegate())
31 ->UpdateSettingLevelInternal(percent, enabled);
Daniel Erat 2011/10/19 17:28:09 nit: it seems strange to be calling a method named
alicet1 2011/10/20 15:03:08 Done.
32 }
33 widget_->Show();
34 static_cast<SettingLevelBubble*>(widget_->widget_delegate())
35 ->StartHideTimer();
36 }
37
38 void BrightnessBubble::UpdateWithoutShowingBubble(int level, bool enabled) {
39 if (widget_)
40 static_cast<SettingLevelBubble*>(widget_->widget_delegate())
41 ->UpdateWithoutShowingBubble(level, enabled);
42 }
43
44 void BrightnessBubble::HideBubble() {
45 if (widget_)
46 widget_->Close();
21 } 47 }
22 48
23 // static 49 // static
24 BrightnessBubble* BrightnessBubble::GetInstance() { 50 BrightnessBubble* BrightnessBubble::GetInstance() {
25 return Singleton<BrightnessBubble>::get(); 51 return Singleton<BrightnessBubble>::get();
26 } 52 }
27 53
28 } // namespace chromeos 54 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698