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_WEB_NOTIFICATION_WEB_NOTIFICATION_BUBBLE_H_ | 5 #ifndef UI_MESSAGE_CENTER_MESSAGE_BUBBLE_BASE_H_ |
6 #define ASH_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_BUBBLE_H_ | 6 #define UI_MESSAGE_CENTER_MESSAGE_BUBBLE_BASE_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | |
9 #include "ash/system/tray/tray_bubble_view.h" | |
10 #include "ash/system/web_notification/web_notification_list.h" | |
11 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "ui/message_center/message_center_export.h" |
| 10 #include "ui/message_center/notification_list.h" |
| 11 #include "ui/views/bubble/tray_bubble_view.h" |
12 | 12 |
13 namespace message_center { | 13 namespace message_center { |
14 | 14 |
15 class WebNotificationContentsView; | 15 class MESSAGE_CENTER_EXPORT MessageBubbleBase { |
16 class WebNotificationView; | 16 public: |
| 17 explicit MessageBubbleBase(NotificationList::Delegate* list_delegate); |
17 | 18 |
18 class ASH_EXPORT WebNotificationBubble { | 19 virtual ~MessageBubbleBase(); |
19 public: | |
20 explicit WebNotificationBubble(WebNotificationList::Delegate* list_delegate); | |
21 | |
22 virtual ~WebNotificationBubble(); | |
23 | 20 |
24 // Gets called when when the bubble view associated with this bubble is | 21 // Gets called when when the bubble view associated with this bubble is |
25 // destroyed. Clears |bubble_view_| and calls OnBubbleViewDestroyed. | 22 // destroyed. Clears |bubble_view_| and calls OnBubbleViewDestroyed. |
26 void BubbleViewDestroyed(); | 23 void BubbleViewDestroyed(); |
27 | 24 |
28 // Gets the init params for the implementation. | 25 // Gets the init params for the implementation. |
29 virtual TrayBubbleView::InitParams GetInitParams( | 26 virtual views::TrayBubbleView::InitParams GetInitParams( |
30 TrayBubbleView::AnchorAlignment anchor_alignment) = 0; | 27 views::TrayBubbleView::AnchorAlignment anchor_alignment) = 0; |
31 | 28 |
32 // Called after the bubble view has been constructed. Creates and initializes | 29 // Called after the bubble view has been constructed. Creates and initializes |
33 // the bubble contents. | 30 // the bubble contents. |
34 virtual void InitializeContents(TrayBubbleView* bubble_view) = 0; | 31 virtual void InitializeContents(views::TrayBubbleView* bubble_view) = 0; |
35 | 32 |
36 // Called from BubbleViewDestroyed for implementation specific details. | 33 // Called from BubbleViewDestroyed for implementation specific details. |
37 virtual void OnBubbleViewDestroyed() = 0; | 34 virtual void OnBubbleViewDestroyed() = 0; |
38 | 35 |
39 // Updates the bubble; implementation dependent. | 36 // Updates the bubble; implementation dependent. |
40 virtual void UpdateBubbleView() = 0; | 37 virtual void UpdateBubbleView() = 0; |
41 | 38 |
42 // Called when the mouse enters/exists the view. | 39 // Called when the mouse enters/exists the view. |
43 virtual void OnMouseEnteredView() = 0; | 40 virtual void OnMouseEnteredView() = 0; |
44 virtual void OnMouseExitedView() = 0; | 41 virtual void OnMouseExitedView() = 0; |
45 | 42 |
46 // Schedules bubble for layout after all notifications have been | 43 // Schedules bubble for layout after all notifications have been |
47 // added and icons have had a chance to load. | 44 // added and icons have had a chance to load. |
48 void ScheduleUpdate(); | 45 void ScheduleUpdate(); |
49 | 46 |
50 bool IsVisible() const; | 47 bool IsVisible() const; |
51 | 48 |
52 TrayBubbleView* bubble_view() const { return bubble_view_; } | 49 views::TrayBubbleView* bubble_view() const { return bubble_view_; } |
53 | 50 |
54 static const SkColor kBackgroundColor; | 51 static const SkColor kBackgroundColor; |
55 static const SkColor kHeaderBackgroundColorLight; | 52 static const SkColor kHeaderBackgroundColorLight; |
56 static const SkColor kHeaderBackgroundColorDark; | 53 static const SkColor kHeaderBackgroundColorDark; |
57 | 54 |
58 protected: | 55 protected: |
59 TrayBubbleView::InitParams GetDefaultInitParams( | 56 views::TrayBubbleView::InitParams GetDefaultInitParams( |
60 TrayBubbleView::AnchorAlignment anchor_alignment); | 57 views::TrayBubbleView::AnchorAlignment anchor_alignment); |
61 | 58 |
62 WebNotificationList::Delegate* list_delegate_; | 59 NotificationList::Delegate* list_delegate_; |
63 TrayBubbleView* bubble_view_; | 60 views::TrayBubbleView* bubble_view_; |
64 base::WeakPtrFactory<WebNotificationBubble> weak_ptr_factory_; | 61 base::WeakPtrFactory<MessageBubbleBase> weak_ptr_factory_; |
65 | 62 |
66 DISALLOW_COPY_AND_ASSIGN(WebNotificationBubble); | 63 DISALLOW_COPY_AND_ASSIGN(MessageBubbleBase); |
67 }; | 64 }; |
68 | 65 |
69 } // namespace message_center | 66 } // namespace message_center |
70 | 67 |
71 #endif // ASH_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_BUBBLE_H_ | 68 #endif // UI_MESSAGE_CENTER_MESSAGE_BUBBLE_BASE_H_ |
OLD | NEW |