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 ASH_SYSTEM_WEB_NOTIFICATION_MESSAGE_CENTER_H_ | 5 #ifndef UI_MESSAGE_CENTER_MESSAGE_CENTER_H_ |
6 #define ASH_SYSTEM_WEB_NOTIFICATION_MESSAGE_CENTER_H_ | 6 #define UI_MESSAGE_CENTER_MESSAGE_CENTER_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | |
9 #include "ash/system/web_notification/web_notification_list.h" | |
10 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "ui/message_center/message_center_export.h" |
| 10 #include "ui/message_center/notification_list.h" |
11 | 11 |
12 // Class for managing the WebNotificationList. The client (e.g. Chrome) calls | 12 // Class for managing the NotificationList. The client (e.g. Chrome) calls |
13 // [Add|Remove|Update]Notification to create and update notifications in the | 13 // [Add|Remove|Update]Notification to create and update notifications in the |
14 // list. It can also implement Delegate to receive callbacks when a | 14 // list. It can also implement Delegate to receive callbacks when a |
15 // notification is removed (closed), or clicked on. | 15 // notification is removed (closed), or clicked on. |
16 // If a Host is provided, it will be informed when the notification list | 16 // If a Host is provided, it will be informed when the notification list |
17 // changes, and is expected to handle creating, showing, and hiding of any | 17 // changes, and is expected to handle creating, showing, and hiding of any |
18 // bubbles. | 18 // bubbles. |
19 | 19 |
20 namespace message_center { | 20 namespace message_center { |
21 | 21 |
22 class ASH_EXPORT MessageCenter : public WebNotificationList::Delegate { | 22 class MESSAGE_CENTER_EXPORT MessageCenter : public NotificationList::Delegate { |
23 public: | 23 public: |
24 // Class that hosts the message center. | 24 // Class that hosts the message center. |
25 class ASH_EXPORT Host { | 25 class MESSAGE_CENTER_EXPORT Host { |
26 public: | 26 public: |
27 // Called when the notification list has changed. |new_notification| will | 27 // Called when the notification list has changed. |new_notification| will |
28 // be true if a notification was added or updated. | 28 // be true if a notification was added or updated. |
29 virtual void MessageCenterChanged(bool new_notification) = 0; | 29 virtual void MessageCenterChanged(bool new_notification) = 0; |
30 | 30 |
31 protected: | 31 protected: |
32 virtual ~Host() {} | 32 virtual ~Host() {} |
33 }; | 33 }; |
34 | 34 |
35 class ASH_EXPORT Delegate { | 35 class MESSAGE_CENTER_EXPORT Delegate { |
36 public: | 36 public: |
37 // Called when the notification associated with |notification_id| is | 37 // Called when the notification associated with |notification_id| is |
38 // removed (i.e. closed by the user). | 38 // removed (i.e. closed by the user). |
39 virtual void NotificationRemoved(const std::string& notifcation_id) = 0; | 39 virtual void NotificationRemoved(const std::string& notifcation_id) = 0; |
40 | 40 |
41 // Request to disable the extension associated with |notification_id|. | 41 // Request to disable the extension associated with |notification_id|. |
42 virtual void DisableExtension(const std::string& notifcation_id) = 0; | 42 virtual void DisableExtension(const std::string& notifcation_id) = 0; |
43 | 43 |
44 // Request to disable notifications from the source of |notification_id|. | 44 // Request to disable notifications from the source of |notification_id|. |
45 virtual void DisableNotificationsFromSource( | 45 virtual void DisableNotificationsFromSource( |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 const string16& title, | 93 const string16& title, |
94 const string16& message); | 94 const string16& message); |
95 | 95 |
96 // Removes an existing notification. | 96 // Removes an existing notification. |
97 void RemoveNotification(const std::string& id); | 97 void RemoveNotification(const std::string& id); |
98 | 98 |
99 // Sets the notification image. | 99 // Sets the notification image. |
100 void SetNotificationImage(const std::string& id, | 100 void SetNotificationImage(const std::string& id, |
101 const gfx::ImageSkia& image); | 101 const gfx::ImageSkia& image); |
102 | 102 |
103 WebNotificationList* notification_list() { return notification_list_.get(); } | 103 NotificationList* notification_list() { return notification_list_.get(); } |
104 | 104 |
105 // Overridden from WebNotificationList::Delegate. | 105 // Overridden from NotificationList::Delegate. |
106 virtual void SendRemoveNotification(const std::string& id) OVERRIDE; | 106 virtual void SendRemoveNotification(const std::string& id) OVERRIDE; |
107 virtual void SendRemoveAllNotifications() OVERRIDE; | 107 virtual void SendRemoveAllNotifications() OVERRIDE; |
108 virtual void DisableNotificationByExtension(const std::string& id) OVERRIDE; | 108 virtual void DisableNotificationByExtension(const std::string& id) OVERRIDE; |
109 virtual void DisableNotificationByUrl(const std::string& id) OVERRIDE; | 109 virtual void DisableNotificationByUrl(const std::string& id) OVERRIDE; |
110 virtual void ShowNotificationSettings(const std::string& id) OVERRIDE; | 110 virtual void ShowNotificationSettings(const std::string& id) OVERRIDE; |
111 virtual void OnNotificationClicked(const std::string& id) OVERRIDE; | 111 virtual void OnNotificationClicked(const std::string& id) OVERRIDE; |
112 virtual message_center::WebNotificationList* GetNotificationList() OVERRIDE; | 112 virtual NotificationList* GetNotificationList() OVERRIDE; |
113 | 113 |
114 private: | 114 private: |
115 scoped_ptr<WebNotificationList> notification_list_; | 115 scoped_ptr<NotificationList> notification_list_; |
116 Host* host_; | 116 Host* host_; |
117 Delegate* delegate_; | 117 Delegate* delegate_; |
118 | 118 |
119 DISALLOW_COPY_AND_ASSIGN(MessageCenter); | 119 DISALLOW_COPY_AND_ASSIGN(MessageCenter); |
120 }; | 120 }; |
121 | 121 |
122 } // namespace message_center | 122 } // namespace message_center |
123 | 123 |
124 #endif // ASH_SYSTEM_WEB_NOTIFICATION_MESSAGE_CENTER_H_ | 124 #endif // UI_MESSAGE_CENTER_MESSAGE_CENTER_H_ |
OLD | NEW |