| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 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_STATUS_STATUS_AREA_BUBBLE_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_BUBBLE_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "base/timer.h" | |
| 10 #include "ui/views/widget/widget.h" | |
| 11 | |
| 12 namespace views { | |
| 13 class Label; | |
| 14 } | |
| 15 | |
| 16 namespace chromeos { | |
| 17 | |
| 18 // StatusAreaBubbleContentView is used as the content view of | |
| 19 // StatusAreaBubbleController. | |
| 20 // It can be also used to show a bubble-like menu under the status area. | |
| 21 class StatusAreaBubbleContentView : public views::View { | |
| 22 public: | |
| 23 // |icon_view| is used to show icon, |this| will take its ownership. | |
| 24 StatusAreaBubbleContentView(views::View* icon_view, const string16& message); | |
| 25 virtual ~StatusAreaBubbleContentView(); | |
| 26 | |
| 27 string16 GetMessage() const; | |
| 28 void SetMessage(const string16& message); | |
| 29 | |
| 30 views::View* icon_view() const { return icon_view_; } | |
| 31 | |
| 32 // views::View override | |
| 33 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | |
| 34 | |
| 35 private: | |
| 36 views::View* icon_view_; | |
| 37 views::Label* message_view_; | |
| 38 | |
| 39 DISALLOW_COPY_AND_ASSIGN(StatusAreaBubbleContentView); | |
| 40 }; | |
| 41 | |
| 42 // StatusAreaBubbleController is used to show a bubble under the status area | |
| 43 class StatusAreaBubbleController : public views::Widget::Observer { | |
| 44 public: | |
| 45 virtual ~StatusAreaBubbleController(); | |
| 46 | |
| 47 // Show bubble under |view| for a while. | |
| 48 static StatusAreaBubbleController* ShowBubbleUnderViewForAWhile( | |
| 49 views::View* view, | |
| 50 StatusAreaBubbleContentView* content); | |
| 51 | |
| 52 // views::Widget::Observer override | |
| 53 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; | |
| 54 | |
| 55 bool IsBubbleShown() const; | |
| 56 void HideBubble(); | |
| 57 | |
| 58 private: | |
| 59 class StatusAreaBubbleDelegateView; | |
| 60 | |
| 61 StatusAreaBubbleController(); | |
| 62 | |
| 63 StatusAreaBubbleDelegateView* bubble_; | |
| 64 // A timer to hide this bubble. | |
| 65 base::OneShotTimer<StatusAreaBubbleController> timer_; | |
| 66 | |
| 67 DISALLOW_COPY_AND_ASSIGN(StatusAreaBubbleController); | |
| 68 }; | |
| 69 | |
| 70 } // namespace chromeos | |
| 71 | |
| 72 #endif // CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_BUBBLE_H_ | |
| OLD | NEW |