summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/setting_level_bubble.h
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/chromeos/setting_level_bubble.h')
-rw-r--r--chrome/browser/chromeos/setting_level_bubble.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/chrome/browser/chromeos/setting_level_bubble.h b/chrome/browser/chromeos/setting_level_bubble.h
new file mode 100644
index 0000000..2d36a87
--- /dev/null
+++ b/chrome/browser/chromeos/setting_level_bubble.h
@@ -0,0 +1,65 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_H_
+#define CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_H_
+#pragma once
+
+#include "app/animation_delegate.h"
+#include "app/slide_animation.h"
+#include "base/timer.h"
+#include "chrome/browser/views/info_bubble.h"
+
+class SkBitmap;
+
+namespace chromeos {
+
+class SettingLevelBubbleView;
+
+// Singleton class controlling a bubble displaying a level-based setting like
+// volume or brightness.
+class SettingLevelBubble : public InfoBubbleDelegate,
+ public AnimationDelegate {
+ public:
+ void ShowBubble(int percent);
+
+ protected:
+ explicit SettingLevelBubble(SkBitmap* icon);
+ virtual ~SettingLevelBubble() {}
+
+ private:
+ void OnTimeout();
+
+ // Overridden from InfoBubbleDelegate.
+ virtual void InfoBubbleClosing(InfoBubble* info_bubble,
+ bool closed_by_escape);
+ virtual bool CloseOnEscape() { return true; }
+ virtual bool FadeInOnShow() { return false; }
+
+ // Overridden from AnimationDelegate.
+ virtual void AnimationEnded(const Animation* animation);
+ virtual void AnimationProgressed(const Animation* animation);
+
+ // Previous and current percentages, or -1 if not yet shown.
+ int previous_percent_;
+ int current_percent_;
+
+ // Icon displayed in the bubble. Not owned by us.
+ SkBitmap* icon_;
+
+ // Currently shown bubble or NULL.
+ InfoBubble* bubble_;
+
+ // Its contents view, owned by InfoBubble.
+ SettingLevelBubbleView* view_;
+
+ SlideAnimation animation_;
+ base::OneShotTimer<SettingLevelBubble> timeout_timer_;
+
+ DISALLOW_COPY_AND_ASSIGN(SettingLevelBubble);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_H_