| OLD | NEW |
| 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 UI_MESSAGE_CENTER_MESSAGE_CENTER_H_ | 5 #ifndef UI_MESSAGE_CENTER_MESSAGE_CENTER_H_ |
| 6 #define UI_MESSAGE_CENTER_MESSAGE_CENTER_H_ | 6 #define UI_MESSAGE_CENTER_MESSAGE_CENTER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "ui/message_center/message_center_export.h" | 11 #include "ui/message_center/message_center_export.h" |
| 12 #include "ui/message_center/message_center_types.h" | 12 #include "ui/message_center/message_center_types.h" |
| 13 #include "ui/message_center/notification_list.h" | 13 #include "ui/message_center/notification_list.h" |
| 14 | 14 |
| 15 namespace base { | 15 namespace base { |
| 16 class DictionaryValue; | 16 class DictionaryValue; |
| 17 } | 17 } |
| 18 | 18 |
| 19 // Interface to manage the NotificationList. The client (e.g. Chrome) calls | 19 // Interface to manage the NotificationList. The client (e.g. Chrome) calls |
| 20 // [Add|Remove|Update]Notification to create and update notifications in the | 20 // [Add|Remove|Update]Notification to create and update notifications in the |
| 21 // list. It also sends those changes to its observers when a notification | 21 // list. It also sends those changes to its observers when a notification |
| 22 // is shown, closed, or clicked on. | 22 // is shown, closed, or clicked on. |
| 23 // |
| 24 // MessageCenter is agnostic of profiles; it uses the string returned by |
| 25 // message_center::Notification::id() to uniquely identify a notification. It is |
| 26 // the caller's responsibility to formulate the id so that 2 different |
| 27 // notification should have different ids. For example, if the caller supports |
| 28 // multiple profiles, then caller should encode both profile characteristics and |
| 29 // notification front end's notification id into a new id and set it into the |
| 30 // notification instance before passing that in. Consequently the id passed to |
| 31 // observers will be this unique id, which can be used with MessageCenter |
| 32 // interface but probably not higher level interfaces. |
| 23 | 33 |
| 24 namespace message_center { | 34 namespace message_center { |
| 25 | 35 |
| 26 namespace test { | 36 namespace test { |
| 27 class MessagePopupCollectionTest; | 37 class MessagePopupCollectionTest; |
| 28 } | 38 } |
| 29 | 39 |
| 30 class MessageCenterObserver; | 40 class MessageCenterObserver; |
| 31 class NotificationBlocker; | 41 class NotificationBlocker; |
| 32 class NotifierSettingsProvider; | 42 class NotifierSettingsProvider; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 44 static void Shutdown(); | 54 static void Shutdown(); |
| 45 | 55 |
| 46 // Management of the observer list. | 56 // Management of the observer list. |
| 47 virtual void AddObserver(MessageCenterObserver* observer) = 0; | 57 virtual void AddObserver(MessageCenterObserver* observer) = 0; |
| 48 virtual void RemoveObserver(MessageCenterObserver* observer) = 0; | 58 virtual void RemoveObserver(MessageCenterObserver* observer) = 0; |
| 49 | 59 |
| 50 // Queries of current notification list status. | 60 // Queries of current notification list status. |
| 51 virtual size_t NotificationCount() const = 0; | 61 virtual size_t NotificationCount() const = 0; |
| 52 virtual size_t UnreadNotificationCount() const = 0; | 62 virtual size_t UnreadNotificationCount() const = 0; |
| 53 virtual bool HasPopupNotifications() const = 0; | 63 virtual bool HasPopupNotifications() const = 0; |
| 54 virtual bool HasNotification(const std::string& id) = 0; | |
| 55 virtual bool IsQuietMode() const = 0; | 64 virtual bool IsQuietMode() const = 0; |
| 56 virtual bool HasClickedListener(const std::string& id) = 0; | 65 virtual bool HasClickedListener(const std::string& id) = 0; |
| 57 | 66 |
| 67 // Find the notification with the corresponding id. Returns NULL if not found. |
| 68 // The returned instance is owned by the message center. |
| 69 virtual message_center::Notification* FindVisibleNotificationById( |
| 70 const std::string& id) = 0; |
| 71 |
| 58 // Gets all notifications to be shown to the user in the message center. Note | 72 // Gets all notifications to be shown to the user in the message center. Note |
| 59 // that queued changes due to the message center being open are not reflected | 73 // that queued changes due to the message center being open are not reflected |
| 60 // in this list. | 74 // in this list. |
| 61 virtual const NotificationList::Notifications& GetVisibleNotifications() = 0; | 75 virtual const NotificationList::Notifications& GetVisibleNotifications() = 0; |
| 62 | 76 |
| 63 // Gets all notifications being shown as popups. This should not be affected | 77 // Gets all notifications being shown as popups. This should not be affected |
| 64 // by the change queue since notifications are not held up while the state is | 78 // by the change queue since notifications are not held up while the state is |
| 65 // VISIBILITY_TRANSIENT or VISIBILITY_SETTINGS. | 79 // VISIBILITY_TRANSIENT or VISIBILITY_SETTINGS. |
| 66 virtual NotificationList::PopupNotifications GetPopupNotifications() = 0; | 80 virtual NotificationList::PopupNotifications GetPopupNotifications() = 0; |
| 67 | 81 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 MessageCenter(); | 179 MessageCenter(); |
| 166 virtual ~MessageCenter(); | 180 virtual ~MessageCenter(); |
| 167 | 181 |
| 168 private: | 182 private: |
| 169 DISALLOW_COPY_AND_ASSIGN(MessageCenter); | 183 DISALLOW_COPY_AND_ASSIGN(MessageCenter); |
| 170 }; | 184 }; |
| 171 | 185 |
| 172 } // namespace message_center | 186 } // namespace message_center |
| 173 | 187 |
| 174 #endif // UI_MESSAGE_CENTER_MESSAGE_CENTER_H_ | 188 #endif // UI_MESSAGE_CENTER_MESSAGE_CENTER_H_ |
| OLD | NEW |