| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_CHROMEOS_VOLUME_BUBBLE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_VOLUME_BUBBLE_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_VOLUME_BUBBLE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_VOLUME_BUBBLE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "chrome/browser/chromeos/setting_level_bubble.h" | 10 #include "chrome/browser/chromeos/setting_level_bubble.h" |
| 11 #include "views/widget/widget.h" |
| 11 | 12 |
| 12 template <typename T> struct DefaultSingletonTraits; | 13 template <typename T> struct DefaultSingletonTraits; |
| 13 | 14 |
| 14 namespace chromeos { | 15 namespace chromeos { |
| 15 | 16 |
| 16 // Singleton class controlling volume bubble. | 17 // Singleton class controlling volume bubble. |
| 17 class VolumeBubble : public SettingLevelBubble { | 18 class VolumeBubble : public views::Widget::Observer { |
| 18 public: | 19 public: |
| 20 // Returns the singleton volume bubble instance. |
| 19 static VolumeBubble* GetInstance(); | 21 static VolumeBubble* GetInstance(); |
| 20 | 22 |
| 23 // views::Widget::Observer overrides: |
| 24 void OnWidgetClosing(views::Widget* widget) OVERRIDE; |
| 25 |
| 26 // Updates the target |percent| and icon to be used, sets |
| 27 // the bubble to |enabled| and shows the bubble. |
| 28 void ShowBubble(double percent, bool enabled); |
| 29 |
| 30 // Hides the bubble. |
| 31 void HideBubble(); |
| 32 |
| 21 private: | 33 private: |
| 22 friend struct DefaultSingletonTraits<VolumeBubble>; | 34 friend struct DefaultSingletonTraits<VolumeBubble>; |
| 23 | 35 |
| 24 VolumeBubble(); | 36 VolumeBubble(); |
| 25 virtual ~VolumeBubble() {} | 37 virtual ~VolumeBubble(); |
| 38 |
| 39 // Bubble widget. |
| 40 views::Widget* widget_; |
| 41 |
| 42 FRIEND_TEST_ALL_PREFIXES(VolumeBubbleTest, GetInstanceAndShow); |
| 26 | 43 |
| 27 DISALLOW_COPY_AND_ASSIGN(VolumeBubble); | 44 DISALLOW_COPY_AND_ASSIGN(VolumeBubble); |
| 28 }; | 45 }; |
| 29 | 46 |
| 30 } // namespace chromeos | 47 } // namespace chromeos |
| 31 | 48 |
| 32 #endif // CHROME_BROWSER_CHROMEOS_VOLUME_BUBBLE_H_ | 49 #endif // CHROME_BROWSER_CHROMEOS_VOLUME_BUBBLE_H_ |
| OLD | NEW |