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/gtest_prod_util.h" |
11 #include "base/timer.h" | 12 #include "base/timer.h" |
12 #include "ui/message_center/message_center_export.h" | 13 #include "ui/message_center/message_center_export.h" |
13 #include "ui/message_center/notification_list.h" | 14 #include "ui/message_center/notification_list.h" |
14 #include "ui/message_center/views/message_bubble_base.h" | 15 #include "ui/message_center/views/message_bubble_base.h" |
15 #include "ui/views/widget/widget_observer.h" | 16 #include "ui/views/widget/widget_observer.h" |
16 | 17 |
17 namespace views { | 18 namespace views { |
18 class Widget; | 19 class Widget; |
19 } | 20 } |
20 | 21 |
| 22 namespace ash { |
| 23 FORWARD_DECLARE_TEST(WebNotificationTrayTest, ManyPopupNotifications); |
| 24 } |
| 25 |
21 namespace message_center { | 26 namespace message_center { |
22 | 27 |
23 class ToastContentsView; | 28 class ToastContentsView; |
24 | 29 |
25 // 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 |
26 // 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. |
27 // This is similar to chrome/browser/notifications/balloon_collection, but the | 32 // This is similar to chrome/browser/notifications/balloon_collection, but the |
28 // 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 |
29 // be slightly different. | 34 // be slightly different. |
30 class MESSAGE_CENTER_EXPORT MessagePopupCollection | 35 class MESSAGE_CENTER_EXPORT MessagePopupCollection |
31 : public views::WidgetObserver { | 36 : public views::WidgetObserver { |
32 public: | 37 public: |
33 // |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 |
34 // 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. |
35 MessagePopupCollection(gfx::NativeView context, | 40 MessagePopupCollection(gfx::NativeView context, |
36 NotificationList::Delegate* list_delegate); | 41 NotificationList::Delegate* list_delegate); |
37 virtual ~MessagePopupCollection(); | 42 virtual ~MessagePopupCollection(); |
38 | 43 |
39 void UpdatePopups(); | 44 void UpdatePopups(); |
40 | 45 |
41 void OnMouseEntered(); | 46 void OnMouseEntered(); |
42 void OnMouseExited(); | 47 void OnMouseExited(); |
43 | 48 |
44 private: | 49 private: |
| 50 FRIEND_TEST_ALL_PREFIXES(ash::WebNotificationTrayTest, |
| 51 ManyPopupNotifications); |
45 typedef std::map<std::string, ToastContentsView*> ToastContainer; | 52 typedef std::map<std::string, ToastContentsView*> ToastContainer; |
46 | 53 |
47 void CloseAllWidgets(); | 54 void CloseAllWidgets(); |
48 | 55 |
49 // views::WidgetObserver overrides: | 56 // views::WidgetObserver overrides: |
50 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE; | 57 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE; |
51 | 58 |
52 gfx::NativeView context_; | 59 gfx::NativeView context_; |
53 NotificationList::Delegate* list_delegate_; | 60 NotificationList::Delegate* list_delegate_; |
54 ToastContainer toasts_; | 61 ToastContainer toasts_; |
55 | 62 |
56 DISALLOW_COPY_AND_ASSIGN(MessagePopupCollection); | 63 DISALLOW_COPY_AND_ASSIGN(MessagePopupCollection); |
57 }; | 64 }; |
58 | 65 |
59 } // namespace message_center | 66 } // namespace message_center |
60 | 67 |
61 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_POPUP_COLLECTION_H_ | 68 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_POPUP_COLLECTION_H_ |
OLD | NEW |