Separate Simple Backend creation from initialization.
[chromium-blink-merge.git] / ui / message_center / views / message_popup_collection.h
blob6a8d10a021473139d26562d7f77c22b4b58e85f1
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
3 // found in the LICENSE file.
5 #ifndef UI_MESSAGE_CENTER_VIEWS_MESSAGE_POPUP_COLLECTION_H_
6 #define UI_MESSAGE_CENTER_VIEWS_MESSAGE_POPUP_COLLECTION_H_
8 #include <list>
9 #include <map>
11 #include "base/compiler_specific.h"
12 #include "base/gtest_prod_util.h"
13 #include "base/memory/weak_ptr.h"
14 #include "ui/gfx/native_widget_types.h"
15 #include "ui/message_center/message_center_export.h"
16 #include "ui/views/widget/widget_observer.h"
18 namespace views {
19 class Widget;
22 namespace ash {
23 FORWARD_DECLARE_TEST(WebNotificationTrayTest, ManyPopupNotifications);
26 namespace message_center {
28 class MessageCenter;
29 class ToastContentsView;
31 // Container for popup toasts. Because each toast is a frameless window rather
32 // than a view in a bubble, now the container just manages all of those windows.
33 // This is similar to chrome/browser/notifications/balloon_collection, but the
34 // contents of each toast are for the message center and layout strategy would
35 // be slightly different.
36 class MESSAGE_CENTER_EXPORT MessagePopupCollection
37 : public views::WidgetObserver,
38 public base::SupportsWeakPtr<MessagePopupCollection> {
39 public:
40 // |parent| specifies the parent widget of the toast windows. The default
41 // parent will be used for NULL.
42 MessagePopupCollection(gfx::NativeView parent,
43 MessageCenter* message_center);
44 virtual ~MessagePopupCollection();
46 void UpdatePopups();
48 void OnMouseEntered();
49 void OnMouseExited();
51 private:
52 FRIEND_TEST_ALL_PREFIXES(ash::WebNotificationTrayTest,
53 ManyPopupNotifications);
54 typedef std::map<std::string, ToastContentsView*> ToastContainer;
56 void CloseAllWidgets();
58 // Overridden from views::WidgetObserver:
59 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE;
61 gfx::NativeView parent_;
62 MessageCenter* message_center_;
63 ToastContainer toasts_;
65 DISALLOW_COPY_AND_ASSIGN(MessagePopupCollection);
68 } // namespace message_center
70 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_POPUP_COLLECTION_H_