OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ASH_SYSTEM_NOTIFICATION_WEB_NOTIFICATION_BUBBLE_H_ | 5 #ifndef ASH_SYSTEM_NOTIFICATION_WEB_NOTIFICATION_BUBBLE_H_ |
6 #define ASH_SYSTEM_NOTIFICATION_WEB_NOTIFICATION_BUBBLE_H_ | 6 #define ASH_SYSTEM_NOTIFICATION_WEB_NOTIFICATION_BUBBLE_H_ |
7 | 7 |
8 #include "ash/system/tray/tray_bubble_view.h" | 8 #include "ash/system/tray/tray_bubble_view.h" |
9 #include "ui/views/widget/widget_observer.h" | 9 #include "base/memory/scoped_ptr.h" |
10 | 10 |
11 namespace ash { | 11 namespace ash { |
12 | 12 |
13 class WebNotificationTray; | 13 class WebNotificationTray; |
14 | 14 |
15 using internal::TrayBubbleView; | 15 namespace internal { |
| 16 class TrayBubbleWrapper; |
| 17 } |
16 | 18 |
17 namespace message_center { | 19 namespace message_center { |
18 | 20 |
19 class WebNotificationContentsView; | 21 class WebNotificationContentsView; |
20 class WebNotificationView; | 22 class WebNotificationView; |
21 | 23 |
22 class WebNotificationBubble : public TrayBubbleView::Host, | 24 class WebNotificationBubble : public TrayBubbleView::Delegate { |
23 public views::WidgetObserver { | |
24 public: | 25 public: |
25 explicit WebNotificationBubble(WebNotificationTray* tray); | 26 explicit WebNotificationBubble(WebNotificationTray* tray); |
26 | 27 |
27 virtual ~WebNotificationBubble(); | 28 virtual ~WebNotificationBubble(); |
28 | 29 |
29 void Initialize(views::View* contents_view); | 30 void Initialize(views::View* contents_view); |
30 | 31 |
31 // Updates the bubble; implementation dependent. | 32 // Updates the bubble; implementation dependent. |
32 virtual void UpdateBubbleView() = 0; | 33 virtual void UpdateBubbleView() = 0; |
33 | 34 |
34 // Schedules bubble for layout after all notifications have been | 35 // Schedules bubble for layout after all notifications have been |
35 // added and icons have had a chance to load. | 36 // added and icons have had a chance to load. |
36 void ScheduleUpdate(); | 37 void ScheduleUpdate(); |
37 | 38 |
38 bool IsVisible() const; | 39 bool IsVisible() const; |
39 | 40 |
40 views::Widget* bubble_widget() const { return bubble_widget_; } | |
41 TrayBubbleView* bubble_view() const { return bubble_view_; } | 41 TrayBubbleView* bubble_view() const { return bubble_view_; } |
42 | 42 |
43 // Overridden from TrayBubbleView::Host. | 43 // Overridden from TrayBubbleView::Delegate. |
44 virtual void BubbleViewDestroyed() OVERRIDE; | 44 virtual void BubbleViewDestroyed() OVERRIDE; |
45 | |
46 virtual void OnMouseEnteredView() OVERRIDE; | 45 virtual void OnMouseEnteredView() OVERRIDE; |
47 | |
48 virtual void OnMouseExitedView() OVERRIDE; | 46 virtual void OnMouseExitedView() OVERRIDE; |
49 | |
50 virtual void OnClickedOutsideView() OVERRIDE; | |
51 | |
52 virtual string16 GetAccessibleName() OVERRIDE; | 47 virtual string16 GetAccessibleName() OVERRIDE; |
53 | 48 virtual gfx::Rect GetAnchorRect(views::Widget* anchor_widget, |
54 // Overridden from views::WidgetObserver: | 49 AnchorType anchor_type, |
55 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; | 50 AnchorAlignment anchor_alignment) OVERRIDE; |
56 | 51 |
57 protected: | 52 protected: |
58 TrayBubbleView::InitParams GetInitParams(); | 53 TrayBubbleView::InitParams GetInitParams(); |
59 | 54 |
60 WebNotificationTray* tray_; | 55 WebNotificationTray* tray_; |
61 TrayBubbleView* bubble_view_; | 56 TrayBubbleView* bubble_view_; |
62 views::Widget* bubble_widget_; | 57 scoped_ptr<internal::TrayBubbleWrapper> bubble_wrapper_; |
63 base::WeakPtrFactory<WebNotificationBubble> weak_ptr_factory_; | 58 base::WeakPtrFactory<WebNotificationBubble> weak_ptr_factory_; |
64 | 59 |
65 DISALLOW_COPY_AND_ASSIGN(WebNotificationBubble); | 60 DISALLOW_COPY_AND_ASSIGN(WebNotificationBubble); |
66 }; | 61 }; |
67 | 62 |
68 } // namespace message_center | 63 } // namespace message_center |
69 | 64 |
70 } // namespace ash | 65 } // namespace ash |
71 | 66 |
72 #endif // ASH_SYSTEM_NOTIFICATION_WEB_NOTIFICATION_BUBBLE_H_ | 67 #endif // ASH_SYSTEM_NOTIFICATION_WEB_NOTIFICATION_BUBBLE_H_ |
OLD | NEW |