OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 UI_MESSAGE_CENTER_VIEWS_MESSAGE_POPUP_COLLECTION_H_ | 5 #ifndef UI_MESSAGE_CENTER_VIEWS_MESSAGE_POPUP_COLLECTION_H_ |
6 #define UI_MESSAGE_CENTER_VIEWS_MESSAGE_POPUP_COLLECTION_H_ | 6 #define UI_MESSAGE_CENTER_VIEWS_MESSAGE_POPUP_COLLECTION_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 | 10 |
| 11 #include "base/compiler_specific.h" |
11 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
12 #include "base/timer.h" | 13 #include "ui/gfx/native_widget_types.h" |
13 #include "ui/message_center/message_center_export.h" | 14 #include "ui/message_center/message_center_export.h" |
14 #include "ui/message_center/notification_list.h" | |
15 #include "ui/message_center/views/message_bubble_base.h" | |
16 #include "ui/views/widget/widget_observer.h" | 15 #include "ui/views/widget/widget_observer.h" |
17 | 16 |
18 namespace views { | 17 namespace views { |
19 class Widget; | 18 class Widget; |
20 } | 19 } |
21 | 20 |
22 namespace ash { | 21 namespace ash { |
23 FORWARD_DECLARE_TEST(WebNotificationTrayTest, ManyPopupNotifications); | 22 FORWARD_DECLARE_TEST(WebNotificationTrayTest, ManyPopupNotifications); |
24 } | 23 } |
25 | 24 |
26 namespace message_center { | 25 namespace message_center { |
27 | 26 |
| 27 class MessageCenter; |
28 class ToastContentsView; | 28 class ToastContentsView; |
29 | 29 |
30 // Container for popup toasts. Because each toast is a frameless window rather | 30 // Container for popup toasts. Because each toast is a frameless window rather |
31 // than a view in a bubble, now the container just manages all of those windows. | 31 // than a view in a bubble, now the container just manages all of those windows. |
32 // This is similar to chrome/browser/notifications/balloon_collection, but the | 32 // This is similar to chrome/browser/notifications/balloon_collection, but the |
33 // contents of each toast are for the message center and layout strategy would | 33 // contents of each toast are for the message center and layout strategy would |
34 // be slightly different. | 34 // be slightly different. |
35 class MESSAGE_CENTER_EXPORT MessagePopupCollection | 35 class MESSAGE_CENTER_EXPORT MessagePopupCollection |
36 : public views::WidgetObserver { | 36 : public views::WidgetObserver { |
37 public: | 37 public: |
38 // |context| specifies the context to create toast windows. It can be NULL | 38 // |context| specifies the context to create toast windows. It can be NULL |
39 // for non-aura environment. See comments in ui/views/widget/widget.h. | 39 // for non-aura environment. See comments in ui/views/widget/widget.h. |
40 MessagePopupCollection(gfx::NativeView context, | 40 MessagePopupCollection(gfx::NativeView context, |
41 NotificationList::Delegate* list_delegate); | 41 MessageCenter* message_center); |
42 virtual ~MessagePopupCollection(); | 42 virtual ~MessagePopupCollection(); |
43 | 43 |
44 void UpdatePopups(); | 44 void UpdatePopups(); |
45 | 45 |
46 void OnMouseEntered(); | 46 void OnMouseEntered(); |
47 void OnMouseExited(); | 47 void OnMouseExited(); |
48 | 48 |
49 private: | 49 private: |
50 FRIEND_TEST_ALL_PREFIXES(ash::WebNotificationTrayTest, | 50 FRIEND_TEST_ALL_PREFIXES(ash::WebNotificationTrayTest, |
51 ManyPopupNotifications); | 51 ManyPopupNotifications); |
52 typedef std::map<std::string, ToastContentsView*> ToastContainer; | 52 typedef std::map<std::string, ToastContentsView*> ToastContainer; |
53 | 53 |
54 void CloseAllWidgets(); | 54 void CloseAllWidgets(); |
55 | 55 |
56 // views::WidgetObserver overrides: | 56 // Overridden from views::WidgetObserver: |
57 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE; | 57 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE; |
58 | 58 |
59 gfx::NativeView context_; | 59 gfx::NativeView context_; |
60 NotificationList::Delegate* list_delegate_; | 60 MessageCenter* message_center_; |
61 ToastContainer toasts_; | 61 ToastContainer toasts_; |
62 | 62 |
63 DISALLOW_COPY_AND_ASSIGN(MessagePopupCollection); | 63 DISALLOW_COPY_AND_ASSIGN(MessagePopupCollection); |
64 }; | 64 }; |
65 | 65 |
66 } // namespace message_center | 66 } // namespace message_center |
67 | 67 |
68 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_POPUP_COLLECTION_H_ | 68 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_POPUP_COLLECTION_H_ |
OLD | NEW |