OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_VOLUME_BUBBLE_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_VOLUME_BUBBLE_H_ |
| 7 |
| 8 #include "app/active_window_watcher_x.h" |
| 9 #include "app/slide_animation.h" |
| 10 #include "base/singleton.h" |
| 11 #include "chrome/browser/views/info_bubble.h" |
| 12 |
| 13 namespace chromeos { |
| 14 |
| 15 class VolumeBubbleView; |
| 16 |
| 17 // Singleton class controlling volume bubble. |
| 18 class VolumeBubble : public InfoBubbleDelegate, |
| 19 public AnimationDelegate { |
| 20 public: |
| 21 static VolumeBubble* instance() { |
| 22 return Singleton<VolumeBubble>::get(); |
| 23 } |
| 24 |
| 25 void ShowVolumeBubble(int percent); |
| 26 |
| 27 private: |
| 28 friend struct DefaultSingletonTraits<VolumeBubble>; |
| 29 |
| 30 VolumeBubble(); |
| 31 void OnTimeout(); |
| 32 |
| 33 // Overridden from InfoBubbleDelegate. |
| 34 virtual void InfoBubbleClosing(InfoBubble* info_bubble, |
| 35 bool closed_by_escape); |
| 36 virtual bool CloseOnEscape() { return true; } |
| 37 virtual bool FadeInOnShow() { return false; } |
| 38 |
| 39 // Overridden from AnimationDelegate. |
| 40 virtual void AnimationEnded(const Animation* animation); |
| 41 virtual void AnimationProgressed(const Animation* animation); |
| 42 |
| 43 // Previous and current volume percentages, -1 if not yet shown. |
| 44 int previous_percent_; |
| 45 int current_percent_; |
| 46 |
| 47 // Currently shown bubble or NULL. |
| 48 InfoBubble* bubble_; |
| 49 |
| 50 // Its contents view, owned by InfoBubble. |
| 51 VolumeBubbleView* view_; |
| 52 |
| 53 SlideAnimation animation_; |
| 54 base::OneShotTimer<VolumeBubble> timeout_timer_; |
| 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(VolumeBubble); |
| 57 }; |
| 58 |
| 59 } // namespace |
| 60 |
| 61 #endif // CHROME_BROWSER_CHROMEOS_VOLUME_BUBBLE_H_ |
OLD | NEW |