| 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 "base/observer_list.h" | 11 #include "base/observer_list.h" |
| 12 #include "ui/gfx/native_widget_types.h" | 12 #include "ui/gfx/native_widget_types.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" | 14 #include "ui/message_center/notification_list.h" |
| 15 #include "ui/notifications/notification_types.h" | 15 #include "ui/message_center/notification_types.h" |
| 16 | 16 |
| 17 namespace base { | 17 namespace base { |
| 18 class DictionaryValue; | 18 class DictionaryValue; |
| 19 } | 19 } |
| 20 | 20 |
| 21 // Class for managing the NotificationList. The client (e.g. Chrome) calls | 21 // Class for managing the NotificationList. The client (e.g. Chrome) calls |
| 22 // [Add|Remove|Update]Notification to create and update notifications in the | 22 // [Add|Remove|Update]Notification to create and update notifications in the |
| 23 // list. It can also implement Delegate to receive callbacks when a | 23 // list. It can also implement Delegate to receive callbacks when a |
| 24 // notification is removed (closed), or clicked on. | 24 // notification is removed (closed), or clicked on. |
| 25 // If an Observer is provided, it will be informed when the notification list | 25 // If an Observer is provided, it will be informed when the notification list |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 bool HasPopupNotifications() const; | 99 bool HasPopupNotifications() const; |
| 100 | 100 |
| 101 // Adds a new notification. |id| is a unique identifier, used to update or | 101 // Adds a new notification. |id| is a unique identifier, used to update or |
| 102 // remove notifications. |title| and |meesage| describe the notification text. | 102 // remove notifications. |title| and |meesage| describe the notification text. |
| 103 // Use SetNotificationIcon, SetNotificationImage, or SetNotificationButtonIcon | 103 // Use SetNotificationIcon, SetNotificationImage, or SetNotificationButtonIcon |
| 104 // to set images. If |extension_id| is provided then 'Disable extension' will | 104 // to set images. If |extension_id| is provided then 'Disable extension' will |
| 105 // appear in a dropdown menu and the id will be used to disable notifications | 105 // appear in a dropdown menu and the id will be used to disable notifications |
| 106 // from the extension. Otherwise if |display_source| is provided, a menu item | 106 // from the extension. Otherwise if |display_source| is provided, a menu item |
| 107 // showing the source and allowing notifications from that source to be | 107 // showing the source and allowing notifications from that source to be |
| 108 // disabled will be shown. All actual disabling is handled by the Delegate. | 108 // disabled will be shown. All actual disabling is handled by the Delegate. |
| 109 void AddNotification(ui::notifications::NotificationType type, | 109 void AddNotification(NotificationType type, |
| 110 const std::string& id, | 110 const std::string& id, |
| 111 const string16& title, | 111 const string16& title, |
| 112 const string16& message, | 112 const string16& message, |
| 113 const string16& display_source, | 113 const string16& display_source, |
| 114 const std::string& extension_id, | 114 const std::string& extension_id, |
| 115 const base::DictionaryValue* optional_fields); | 115 const base::DictionaryValue* optional_fields); |
| 116 | 116 |
| 117 // Updates an existing notification with id = old_id and set its id to new_id. | 117 // Updates an existing notification with id = old_id and set its id to new_id. |
| 118 // |optional_fields| can be NULL in case of no updates on those fields. | 118 // |optional_fields| can be NULL in case of no updates on those fields. |
| 119 void UpdateNotification(const std::string& old_id, | 119 void UpdateNotification(const std::string& old_id, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 scoped_ptr<NotificationList> notification_list_; | 158 scoped_ptr<NotificationList> notification_list_; |
| 159 ObserverList<Observer> observer_list_; | 159 ObserverList<Observer> observer_list_; |
| 160 Delegate* delegate_; | 160 Delegate* delegate_; |
| 161 | 161 |
| 162 DISALLOW_COPY_AND_ASSIGN(MessageCenter); | 162 DISALLOW_COPY_AND_ASSIGN(MessageCenter); |
| 163 }; | 163 }; |
| 164 | 164 |
| 165 } // namespace message_center | 165 } // namespace message_center |
| 166 | 166 |
| 167 #endif // UI_MESSAGE_CENTER_MESSAGE_CENTER_H_ | 167 #endif // UI_MESSAGE_CENTER_MESSAGE_CENTER_H_ |
| OLD | NEW |