Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(248)

Side by Side Diff: ui/message_center/views/message_popup_collection.h

Issue 14017014: Sends updated event for click on notifications. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
(...skipping 10 matching lines...) Expand all
21 class Widget; 21 class Widget;
22 } 22 }
23 23
24 namespace ash { 24 namespace ash {
25 FORWARD_DECLARE_TEST(WebNotificationTrayTest, ManyPopupNotifications); 25 FORWARD_DECLARE_TEST(WebNotificationTrayTest, ManyPopupNotifications);
26 } 26 }
27 27
28 namespace message_center { 28 namespace message_center {
29 namespace test { 29 namespace test {
30 class MessagePopupCollectionTest; 30 class MessagePopupCollectionTest;
31 class MessagePopupCollectionWidgetsTest;
31 } 32 }
32 33
33 class MessageCenter; 34 class MessageCenter;
34 class ToastContentsView; 35 class ToastContentsView;
35 36
36 // Container for popup toasts. Because each toast is a frameless window rather 37 // Container for popup toasts. Because each toast is a frameless window rather
37 // than a view in a bubble, now the container just manages all of those windows. 38 // than a view in a bubble, now the container just manages all of those windows.
38 // This is similar to chrome/browser/notifications/balloon_collection, but the 39 // This is similar to chrome/browser/notifications/balloon_collection, but the
39 // contents of each toast are for the message center and layout strategy would 40 // contents of each toast are for the message center and layout strategy would
40 // be slightly different. 41 // be slightly different.
41 class MESSAGE_CENTER_EXPORT MessagePopupCollection 42 class MESSAGE_CENTER_EXPORT MessagePopupCollection
42 : public views::WidgetObserver, 43 : public views::WidgetObserver,
43 public MessageCenterObserver, 44 public MessageCenterObserver,
44 public base::SupportsWeakPtr<MessagePopupCollection> { 45 public base::SupportsWeakPtr<MessagePopupCollection> {
45 public: 46 public:
46 // |parent| specifies the parent widget of the toast windows. The default 47 // |parent| specifies the parent widget of the toast windows. The default
47 // parent will be used for NULL. 48 // parent will be used for NULL.
48 MessagePopupCollection(gfx::NativeView parent, 49 MessagePopupCollection(gfx::NativeView parent,
49 MessageCenter* message_center); 50 MessageCenter* message_center);
50 virtual ~MessagePopupCollection(); 51 virtual ~MessagePopupCollection();
51 52
52 void OnMouseEntered(); 53 void OnMouseEntered();
53 void OnMouseExited(); 54 void OnMouseExited();
54 55
55 private: 56 private:
56 FRIEND_TEST_ALL_PREFIXES(ash::WebNotificationTrayTest, 57 FRIEND_TEST_ALL_PREFIXES(ash::WebNotificationTrayTest,
57 ManyPopupNotifications); 58 ManyPopupNotifications);
58 friend class test::MessagePopupCollectionTest; 59 friend class test::MessagePopupCollectionTest;
60 friend class test::MessagePopupCollectionWidgetsTest;
59 typedef std::map<std::string, ToastContentsView*> ToastContainer; 61 typedef std::map<std::string, ToastContentsView*> ToastContainer;
60 62
61 void CloseAllWidgets(); 63 void CloseAllWidgets();
62 64
63 // Returns the bottom-right position of the current work area. 65 // Returns the bottom-right position of the current work area.
64 gfx::Point GetWorkAreaBottomRight(); 66 gfx::Point GetWorkAreaBottomRight();
65 67
66 // Creates new widgets for new toast notifications, and updates |toasts_| and 68 // Creates new widgets for new toast notifications, and updates |toasts_| and
67 // |widgets_| correctly. 69 // |widgets_| correctly.
68 void UpdateWidgets(); 70 void UpdateWidgets();
(...skipping 10 matching lines...) Expand all
79 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE; 81 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE;
80 82
81 // Overridden from MessageCenterObserver: 83 // Overridden from MessageCenterObserver:
82 virtual void OnNotificationAdded(const std::string& notification_id) OVERRIDE; 84 virtual void OnNotificationAdded(const std::string& notification_id) OVERRIDE;
83 virtual void OnNotificationRemoved(const std::string& notification_id, 85 virtual void OnNotificationRemoved(const std::string& notification_id,
84 bool by_user) OVERRIDE; 86 bool by_user) OVERRIDE;
85 virtual void OnNotificationUpdated( 87 virtual void OnNotificationUpdated(
86 const std::string& notification_id) OVERRIDE; 88 const std::string& notification_id) OVERRIDE;
87 89
88 void SetWorkAreaForTest(const gfx::Rect& work_area); 90 void SetWorkAreaForTest(const gfx::Rect& work_area);
91 views::Widget* GetWidgetForId(const std::string& id);
89 92
90 gfx::NativeView parent_; 93 gfx::NativeView parent_;
91 MessageCenter* message_center_; 94 MessageCenter* message_center_;
92 ToastContainer toasts_; 95 ToastContainer toasts_;
93 std::list<views::Widget*> widgets_; 96 std::list<views::Widget*> widgets_;
94 gfx::Rect work_area_; 97 gfx::Rect work_area_;
95 98
96 DISALLOW_COPY_AND_ASSIGN(MessagePopupCollection); 99 DISALLOW_COPY_AND_ASSIGN(MessagePopupCollection);
97 }; 100 };
98 101
99 } // namespace message_center 102 } // namespace message_center
100 103
101 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_POPUP_COLLECTION_H_ 104 #endif // UI_MESSAGE_CENTER_VIEWS_MESSAGE_POPUP_COLLECTION_H_
OLDNEW
« no previous file with comments | « ui/message_center/message_center_impl.cc ('k') | ui/message_center/views/message_popup_collection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698