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_MESSAGE_POPUP_COLLECTION_H_ | 5 #ifndef UI_MESSAGE_CENTER_MESSAGE_POPUP_COLLECTION_H_ |
6 #define UI_MESSAGE_CENTER_MESSAGE_POPUP_COLLECTION_H_ | 6 #define UI_MESSAGE_CENTER_MESSAGE_POPUP_COLLECTION_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 | 10 |
11 #include "base/timer.h" | 11 #include "base/timer.h" |
12 #include "ui/message_center/message_bubble_base.h" | 12 #include "ui/message_center/message_bubble_base.h" |
13 #include "ui/message_center/message_center_export.h" | 13 #include "ui/message_center/message_center_export.h" |
14 #include "ui/message_center/notification_list.h" | |
15 #include "ui/views/widget/widget_observer.h" | 14 #include "ui/views/widget/widget_observer.h" |
16 | 15 |
17 namespace views { | 16 namespace views { |
18 class Widget; | 17 class Widget; |
19 } | 18 } |
20 | 19 |
21 namespace message_center { | 20 namespace message_center { |
22 | 21 |
| 22 class MessageCenter; |
23 class ToastContentsView; | 23 class ToastContentsView; |
24 | 24 |
25 // Container for popup toasts. Because each toast is a frameless window rather | 25 // 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. | 26 // 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 | 27 // 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 | 28 // contents of each toast are for the message center and layout strategy would |
29 // be slightly different. | 29 // be slightly different. |
30 class MESSAGE_CENTER_EXPORT MessagePopupCollection | 30 class MESSAGE_CENTER_EXPORT MessagePopupCollection |
31 : public views::WidgetObserver { | 31 : public views::WidgetObserver { |
32 public: | 32 public: |
33 // |context| specifies the context to create toast windows. It can be NULL | 33 // |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. | 34 // for non-aura environment. See comments in ui/views/widget/widget.h. |
35 MessagePopupCollection(gfx::NativeView context, | 35 MessagePopupCollection(gfx::NativeView context, |
36 NotificationList::Delegate* list_delegate); | 36 MessageCenter* message_center); |
37 virtual ~MessagePopupCollection(); | 37 virtual ~MessagePopupCollection(); |
38 | 38 |
39 void UpdatePopups(); | 39 void UpdatePopups(); |
40 | 40 |
41 void OnMouseEntered(); | 41 void OnMouseEntered(); |
42 void OnMouseExited(); | 42 void OnMouseExited(); |
43 | 43 |
44 private: | 44 private: |
45 typedef std::map<std::string, ToastContentsView*> ToastContainer; | 45 typedef std::map<std::string, ToastContentsView*> ToastContainer; |
46 | 46 |
47 void CloseAllWidgets(); | 47 void CloseAllWidgets(); |
48 | 48 |
49 // views::WidgetObserver overrides: | 49 // Overridden from views::WidgetObserver: |
50 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE; | 50 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE; |
51 | 51 |
52 gfx::NativeView context_; | 52 gfx::NativeView context_; |
53 NotificationList::Delegate* list_delegate_; | 53 MessageCenter* message_center_; |
54 ToastContainer toasts_; | 54 ToastContainer toasts_; |
55 | 55 |
56 DISALLOW_COPY_AND_ASSIGN(MessagePopupCollection); | 56 DISALLOW_COPY_AND_ASSIGN(MessagePopupCollection); |
57 }; | 57 }; |
58 | 58 |
59 } // namespace message_center | 59 } // namespace message_center |
60 | 60 |
61 #endif // UI_MESSAGE_CENTER_MESSAGE_POPUP_COLLECTION_H_ | 61 #endif // UI_MESSAGE_CENTER_MESSAGE_POPUP_COLLECTION_H_ |
OLD | NEW |