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

Side by Side Diff: ash/system/web_notification/web_notification_list.h

Issue 11189099: Re-factor Ash Message Center code part 4/4 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 ASH_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_LIST_H_ 5 #ifndef ASH_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_LIST_H_
6 #define ASH_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_LIST_H_ 6 #define ASH_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_LIST_H_
7 7
8 #include <list> 8 #include <list>
9 #include <string> 9 #include <string>
10 10
(...skipping 26 matching lines...) Expand all
37 // Called when a notification is clicked on. 37 // Called when a notification is clicked on.
38 virtual void OnNotificationClicked(const std::string& id) = 0; 38 virtual void OnNotificationClicked(const std::string& id) = 0;
39 39
40 // Returns the list of notifications to display. 40 // Returns the list of notifications to display.
41 virtual WebNotificationList* GetNotificationList() = 0; 41 virtual WebNotificationList* GetNotificationList() = 0;
42 }; 42 };
43 43
44 explicit WebNotificationList(Delegate* delegate); 44 explicit WebNotificationList(Delegate* delegate);
45 virtual ~WebNotificationList(); 45 virtual ~WebNotificationList();
46 46
47 // Affects whether or not a message has been "read".
47 void SetMessageCenterVisible(bool visible); 48 void SetMessageCenterVisible(bool visible);
48 49
49 void AddNotification(const std::string& id, 50 void AddNotification(const std::string& id,
50 const string16& title, 51 const string16& title,
51 const string16& message, 52 const string16& message,
52 const string16& display_source, 53 const string16& display_source,
53 const std::string& extension_id); 54 const std::string& extension_id);
54 55
55 void UpdateNotificationMessage(const std::string& old_id, 56 void UpdateNotificationMessage(const std::string& old_id,
56 const std::string& new_id, 57 const std::string& new_id,
(...skipping 20 matching lines...) Expand all
77 bool HasPopupNotifications(); 78 bool HasPopupNotifications();
78 79
79 // Modifies |notifications| to contain the |kMaxVisiblePopupNotifications| 80 // Modifies |notifications| to contain the |kMaxVisiblePopupNotifications|
80 // least recent notifications that have not been shown as a popup. 81 // least recent notifications that have not been shown as a popup.
81 void GetPopupNotifications(Notifications* notifications); 82 void GetPopupNotifications(Notifications* notifications);
82 83
83 // Marks the popups returned by GetPopupNotifications() as shown. 84 // Marks the popups returned by GetPopupNotifications() as shown.
84 void MarkPopupsAsShown(); 85 void MarkPopupsAsShown();
85 86
86 const Notifications& notifications() const { return notifications_; } 87 const Notifications& notifications() const { return notifications_; }
87 int unread_count() const { return unread_count_; } 88 size_t unread_count() const { return unread_count_; }
88 89
89 static const size_t kMaxVisiblePopupNotifications; 90 static const size_t kMaxVisiblePopupNotifications;
90 static const size_t kMaxVisibleMessageCenterNotifications; 91 static const size_t kMaxVisibleMessageCenterNotifications;
91 92
92 private: 93 private:
93 // Iterates through the list and returns the first notification matching |id| 94 // Iterates through the list and returns the first notification matching |id|
94 // (should always be unique). 95 // (should always be unique).
95 Notifications::iterator GetNotification(const std::string& id); 96 Notifications::iterator GetNotification(const std::string& id);
96 97
97 void EraseNotification(Notifications::iterator iter); 98 void EraseNotification(Notifications::iterator iter);
98 99
99 void PushNotification(WebNotification& notification); 100 void PushNotification(WebNotification& notification);
100 101
101 // Returns the |kMaxVisiblePopupNotifications| least recent notifications 102 // Returns the |kMaxVisiblePopupNotifications| least recent notifications
102 // that have not been shown as a popup. 103 // that have not been shown as a popup.
103 void GetPopupIterators(Notifications::iterator& first, 104 void GetPopupIterators(Notifications::iterator& first,
104 Notifications::iterator& last); 105 Notifications::iterator& last);
105 106
106 Delegate* delegate_; 107 Delegate* delegate_;
107 Notifications notifications_; 108 Notifications notifications_;
108 bool message_center_visible_; 109 bool message_center_visible_;
109 int unread_count_; 110 size_t unread_count_;
110 111
111 DISALLOW_COPY_AND_ASSIGN(WebNotificationList); 112 DISALLOW_COPY_AND_ASSIGN(WebNotificationList);
112 }; 113 };
113 114
114 } // namespace message_center 115 } // namespace message_center
115 116
116 #endif // ASH_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_LIST_H_ 117 #endif // ASH_SYSTEM_WEB_NOTIFICATION_WEB_NOTIFICATION_LIST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698