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

Unified Diff: chrome/browser/chromeos/setting_level_bubble.h

Issue 8319008: aura: brightness and volume bubble. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: update 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/setting_level_bubble.h
diff --git a/chrome/browser/chromeos/setting_level_bubble.h b/chrome/browser/chromeos/setting_level_bubble.h
index 6496dde84c82efd9bbfa3c422986c87b0355c434..d775161305d3add1853efd031f2314ebfc75269d 100644
--- a/chrome/browser/chromeos/setting_level_bubble.h
+++ b/chrome/browser/chromeos/setting_level_bubble.h
@@ -7,9 +7,11 @@
#pragma once
#include "base/basictypes.h"
+#include "base/gtest_prod_util.h"
#include "base/time.h"
#include "base/timer.h"
-#include "chrome/browser/ui/views/bubble/bubble.h"
+#include "views/bubble/bubble_delegate.h"
+#include "views/widget/widget.h"
class SkBitmap;
@@ -17,12 +19,15 @@ namespace chromeos {
class SettingLevelBubbleView;
-// Singleton class controlling a bubble displaying a level-based setting like
+// Controls a bubble displaying a level-based setting like
// volume or brightness.
-class SettingLevelBubble : public BubbleDelegate {
+class SettingLevelBubble : public views::Widget::Observer {
public:
- // Shows the bubble. |percent| should be in the range [0.0, 100.0].
+ // Shows the bubble with the target |percent| and |enabled| setting.
+ // |percent| should be in the range [0.0, 100.0].
void ShowBubble(double percent, bool enabled);
+
+ // Hides the Bubble, closing the view.
void HideBubble();
// Updates the bubble's current level without showing the bubble onscreen.
@@ -46,15 +51,23 @@ class SettingLevelBubble : public BubbleDelegate {
SettingLevelBubble(SkBitmap* increase_icon,
SkBitmap* decrease_icon,
SkBitmap* zero_icon);
+
virtual ~SettingLevelBubble();
private:
- // Overridden from BubbleDelegate.
- virtual void BubbleClosing(Bubble* bubble, bool closed_by_escape) OVERRIDE;
- virtual bool CloseOnEscape() OVERRIDE;
- virtual bool FadeInOnShow() OVERRIDE;
+ FRIEND_TEST_ALL_PREFIXES(SettingLevelBubbleTest, CreateAndUpdate);
+ FRIEND_TEST_ALL_PREFIXES(SettingLevelBubbleTest, ShowBubble);
+ FRIEND_TEST_ALL_PREFIXES(BrightnessBubbleTest, UpdateWithoutShowing);
+ FRIEND_TEST_ALL_PREFIXES(VolumeBubbleTest, GetInstanceAndShow);
+
+ // views::Widget::Observer overrides:
+ void OnWidgetClosing(views::Widget* widget) OVERRIDE;
- // Callback for |hide_timer_|. Closes the bubble.
+ // Creates the bubble content view.
+ // Caller should call Init() on the returned SettingLevelBubbleView.
+ SettingLevelBubbleView* CreateView();
+
+ // Callback for |hide_timer_|. Starts fading out.
void OnHideTimeout();
// Callback for |animation_timer_|. Updates the level displayed by the view,
@@ -90,9 +103,6 @@ class SettingLevelBubble : public BubbleDelegate {
SkBitmap* decrease_icon_;
SkBitmap* disabled_icon_;
- // Currently shown bubble or NULL.
- Bubble* bubble_;
-
// Contents view owned by Bubble.
SettingLevelBubbleView* view_;
« no previous file with comments | « chrome/browser/chromeos/brightness_bubble_browsertest.cc ('k') | chrome/browser/chromeos/setting_level_bubble.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698