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

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: updates 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..918ffe6609450808d79fda25792821047bca35e0 100644
--- a/chrome/browser/chromeos/setting_level_bubble.h
+++ b/chrome/browser/chromeos/setting_level_bubble.h
@@ -9,21 +9,31 @@
#include "base/basictypes.h"
#include "base/time.h"
#include "base/timer.h"
-#include "chrome/browser/ui/views/bubble/bubble.h"
+#include "views/bubble/bubble_delegate.h"
class SkBitmap;
+namespace views {
+class Widget;
msw 2011/10/20 19:36:13 Forward decl probably not necessary with bubble_de
alicet1 2011/10/20 22:36:30 Done.
+}
namespace chromeos {
class SettingLevelBubbleView;
// Singleton class controlling a bubble displaying a level-based setting like
// volume or brightness.
-class SettingLevelBubble : public BubbleDelegate {
+class SettingLevelBubble : public views::BubbleDelegateView {
public:
- // Shows the bubble. |percent| should be in the range [0.0, 100.0].
- void ShowBubble(double percent, bool enabled);
- void HideBubble();
+ // Create the bubble delegate and view.
+ // |percent| should be in the range [0.0, 100.0].
+ static views::Widget* CreateSettingLevelBubble(
+ SkBitmap* increase_icon,
+ SkBitmap* decrease_icon,
+ SkBitmap* zero_icon,
+ double percent,
+ bool enabled);
+
+ virtual ~SettingLevelBubble();
// Updates the bubble's current level without showing the bubble onscreen.
// We _do_ still animate the level moving to |percent| in case the bubble is
@@ -42,17 +52,28 @@ class SettingLevelBubble : public BubbleDelegate {
// to 30%, rather than from 25% up to 30%.
void UpdateWithoutShowingBubble(double percent, bool enabled);
+ // Calculate target percent and icon to be used when setting level changes.
+ void UpdateSetting(double percent, bool enabled);
+
+ // Start the |hide_timer_| for this bubble.
+ void StartHideTimer();
+
+ // BubbleDelegate overrides:
+ virtual void Init() OVERRIDE;
+ virtual gfx::Point GetAnchorPoint() const OVERRIDE;
+ virtual views::BubbleBorder::ArrowLocation GetArrowLocation() const OVERRIDE;
msw 2011/10/20 19:36:13 GetAnchorPoint and GetArrowLocation overrides shou
alicet1 2011/10/20 22:36:30 Done.
+
+ // WidgetDeletgate overrides:
+ virtual void WindowClosing() OVERRIDE;
+
protected:
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;
+ // Calculate anchor point in screen coordinates.
+ void CalculateAnchorPoint();
// Callback for |hide_timer_|. Closes the bubble.
void OnHideTimeout();
@@ -89,9 +110,9 @@ class SettingLevelBubble : public BubbleDelegate {
SkBitmap* increase_icon_;
SkBitmap* decrease_icon_;
SkBitmap* disabled_icon_;
+ SkBitmap* current_icon_;
- // Currently shown bubble or NULL.
- Bubble* bubble_;
+ bool enabled_;
// Contents view owned by Bubble.
SettingLevelBubbleView* view_;
@@ -108,6 +129,9 @@ class SettingLevelBubble : public BubbleDelegate {
// Is |animation_timer_| currently running?
bool is_animating_;
+ // The |anchor_point_| of this bubble.
+ gfx::Point anchor_point_;
+
DISALLOW_COPY_AND_ASSIGN(SettingLevelBubble);
};

Powered by Google App Engine
This is Rietveld 408576698