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" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 virtual void DisableNotificationsFromSource( | 52 virtual void DisableNotificationsFromSource( |
53 const std::string& notification_id) = 0; | 53 const std::string& notification_id) = 0; |
54 | 54 |
55 // Request to show the notification settings (|notification_id| is used | 55 // Request to show the notification settings (|notification_id| is used |
56 // to identify the requesting browser context). | 56 // to identify the requesting browser context). |
57 virtual void ShowSettings(const std::string& notification_id) = 0; | 57 virtual void ShowSettings(const std::string& notification_id) = 0; |
58 | 58 |
59 // Request to show the notification settings dialog. |context| is necessary | 59 // Request to show the notification settings dialog. |context| is necessary |
60 // to create a new window. | 60 // to create a new window. |
61 virtual void ShowSettingsDialog(gfx::NativeView context) = 0; | 61 virtual void ShowSettingsDialog(gfx::NativeView context) = 0; |
62 | |
63 // Request to check if the notification has the listener of Clicked event. | |
64 virtual bool HasClickedListener(const std::string& notification_id) = 0; | |
65 }; | 62 }; |
66 | 63 |
67 // Called to set the delegate. Generally called only once, except in tests. | 64 // Called to set the delegate. Generally called only once, except in tests. |
68 // Changing the delegate does not affect notifications in its | 65 // Changing the delegate does not affect notifications in its |
69 // NotificationList. | 66 // NotificationList. |
70 virtual void SetDelegate(Delegate* delegate) = 0; | 67 virtual void SetDelegate(Delegate* delegate) = 0; |
71 | 68 |
72 // Management of the observer list. | 69 // Management of the observer list. |
73 virtual void AddObserver(MessageCenterObserver* observer) = 0; | 70 virtual void AddObserver(MessageCenterObserver* observer) = 0; |
74 virtual void RemoveObserver(MessageCenterObserver* observer) = 0; | 71 virtual void RemoveObserver(MessageCenterObserver* observer) = 0; |
(...skipping 13 matching lines...) Expand all Loading... |
88 // Basic operations of notification: add/remove/update. | 85 // Basic operations of notification: add/remove/update. |
89 | 86 |
90 // Adds a new notification. |id| is a unique identifier, used to update or | 87 // Adds a new notification. |id| is a unique identifier, used to update or |
91 // remove notifications. |title| and |meesage| describe the notification text. | 88 // remove notifications. |title| and |meesage| describe the notification text. |
92 // Use SetNotificationIcon, SetNotificationImage, or SetNotificationButtonIcon | 89 // Use SetNotificationIcon, SetNotificationImage, or SetNotificationButtonIcon |
93 // to set images. If |extension_id| is provided then 'Disable extension' will | 90 // to set images. If |extension_id| is provided then 'Disable extension' will |
94 // appear in a dropdown menu and the id will be used to disable notifications | 91 // appear in a dropdown menu and the id will be used to disable notifications |
95 // from the extension. Otherwise if |display_source| is provided, a menu item | 92 // from the extension. Otherwise if |display_source| is provided, a menu item |
96 // showing the source and allowing notifications from that source to be | 93 // showing the source and allowing notifications from that source to be |
97 // disabled will be shown. All actual disabling is handled by the Delegate. | 94 // disabled will be shown. All actual disabling is handled by the Delegate. |
98 virtual void AddNotification( | 95 virtual void AddNotification(NotificationType type, |
99 NotificationType type, | 96 const std::string& id, |
100 const std::string& id, | 97 const string16& title, |
101 const string16& title, | 98 const string16& message, |
102 const string16& message, | 99 const string16& display_source, |
103 const string16& display_source, | 100 const std::string& extension_id, |
104 const std::string& extension_id, | 101 const base::DictionaryValue* optional_fields, |
105 const base::DictionaryValue* optional_fields) = 0; | 102 NotificationDelegate* delegate) = 0; |
106 | 103 |
107 // Updates an existing notification with id = old_id and set its id to new_id. | 104 // Updates an existing notification with id = old_id and set its id to new_id. |
108 // |optional_fields| can be NULL in case of no updates on those fields. | 105 // |delegate| and |optional_fields| can be NULL in case of no updates on |
109 virtual void UpdateNotification( | 106 // those fields. |
110 const std::string& old_id, | 107 virtual void UpdateNotification(const std::string& old_id, |
111 const std::string& new_id, | 108 const std::string& new_id, |
112 const string16& title, | 109 const string16& title, |
113 const string16& message, | 110 const string16& message, |
114 const base::DictionaryValue* optional_fields) = 0; | 111 const base::DictionaryValue* optional_fields, |
| 112 NotificationDelegate* delegate) = 0; |
115 | 113 |
116 // Removes an existing notification. | 114 // Removes an existing notification. |
117 virtual void RemoveNotification(const std::string& id, bool by_user) = 0; | 115 virtual void RemoveNotification(const std::string& id, bool by_user) = 0; |
118 virtual void RemoveAllNotifications(bool by_user) = 0; | 116 virtual void RemoveAllNotifications(bool by_user) = 0; |
119 | 117 |
120 // Sets the icon image. Icon appears at the top-left of the notification. | 118 // Sets the icon image. Icon appears at the top-left of the notification. |
121 virtual void SetNotificationIcon(const std::string& notification_id, | 119 virtual void SetNotificationIcon(const std::string& notification_id, |
122 const gfx::Image& image) = 0; | 120 const gfx::Image& image) = 0; |
123 | 121 |
124 // Sets the large image for the notifications of type == TYPE_IMAGE. Specified | 122 // Sets the large image for the notifications of type == TYPE_IMAGE. Specified |
(...skipping 30 matching lines...) Expand all Loading... |
155 MessageCenter(); | 153 MessageCenter(); |
156 virtual ~MessageCenter(); | 154 virtual ~MessageCenter(); |
157 | 155 |
158 private: | 156 private: |
159 DISALLOW_COPY_AND_ASSIGN(MessageCenter); | 157 DISALLOW_COPY_AND_ASSIGN(MessageCenter); |
160 }; | 158 }; |
161 | 159 |
162 } // namespace message_center | 160 } // namespace message_center |
163 | 161 |
164 #endif // UI_MESSAGE_CENTER_MESSAGE_CENTER_H_ | 162 #endif // UI_MESSAGE_CENTER_MESSAGE_CENTER_H_ |
OLD | NEW |