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 CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ |
6 #define CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ | 6 #define CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 const base::string16& title, | 98 const base::string16& title, |
99 const base::string16& body, | 99 const base::string16& body, |
100 blink::WebTextDirection dir); | 100 blink::WebTextDirection dir); |
101 | 101 |
102 // Creates a data:xxxx URL which contains the full HTML for a notification | 102 // Creates a data:xxxx URL which contains the full HTML for a notification |
103 // using resource template which contains the standard formatting for | 103 // using resource template which contains the standard formatting for |
104 // notifications. | 104 // notifications. |
105 static base::string16 CreateDataUrl(int resource, | 105 static base::string16 CreateDataUrl(int resource, |
106 const std::vector<std::string>& subst); | 106 const std::vector<std::string>& subst); |
107 | 107 |
108 // Add a desktop notification. On non-Ash platforms this will generate a HTML | 108 // Add a desktop notification. |
109 // notification from the input parameters. On Ash it will generate a normal | |
110 // ash notification. Returns the notification id. | |
111 // TODO(mukai): remove these methods. HTML notifications are no longer | |
112 // supported. | |
113 static std::string AddNotification(const GURL& origin_url, | |
114 const base::string16& title, | |
115 const base::string16& message, | |
116 const GURL& icon_url, | |
117 const base::string16& replace_id, | |
118 NotificationDelegate* delegate, | |
119 Profile* profile); | |
120 | |
121 // Same as above, but takes a gfx::Image for the icon instead. | |
122 static std::string AddIconNotification(const GURL& origin_url, | 109 static std::string AddIconNotification(const GURL& origin_url, |
123 const base::string16& title, | 110 const base::string16& title, |
124 const base::string16& message, | 111 const base::string16& message, |
125 const gfx::Image& icon, | 112 const gfx::Image& icon, |
126 const base::string16& replace_id, | 113 const base::string16& replace_id, |
127 NotificationDelegate* delegate, | 114 NotificationDelegate* delegate, |
128 Profile* profile); | 115 Profile* profile); |
129 | 116 |
130 // Remove any active notification corresponding to |notification_id|. | |
131 static void RemoveNotification(const std::string& notification_id); | |
132 | |
133 // The default content setting determines how to handle origins that haven't | 117 // The default content setting determines how to handle origins that haven't |
134 // been allowed or denied yet. If |provider_id| is not NULL, the id of the | 118 // been allowed or denied yet. If |provider_id| is not NULL, the id of the |
135 // provider which provided the default setting is assigned to it. | 119 // provider which provided the default setting is assigned to it. |
136 ContentSetting GetDefaultContentSetting(std::string* provider_id); | 120 ContentSetting GetDefaultContentSetting(std::string* provider_id); |
137 void SetDefaultContentSetting(ContentSetting setting); | 121 void SetDefaultContentSetting(ContentSetting setting); |
138 | 122 |
139 // NOTE: This should only be called on the UI thread. | 123 // NOTE: This should only be called on the UI thread. |
140 void ResetToDefaultContentSetting(); | 124 void ResetToDefaultContentSetting(); |
141 | 125 |
142 // Returns all notifications settings. |settings| is cleared before | 126 // Returns all notifications settings. |settings| is cleared before |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 // Registrar for the other kind of notifications (event signaling). | 212 // Registrar for the other kind of notifications (event signaling). |
229 content::NotificationRegistrar registrar_; | 213 content::NotificationRegistrar registrar_; |
230 | 214 |
231 // Welcome Notification | 215 // Welcome Notification |
232 scoped_ptr<ExtensionWelcomeNotification> chrome_now_welcome_notification_; | 216 scoped_ptr<ExtensionWelcomeNotification> chrome_now_welcome_notification_; |
233 | 217 |
234 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService); | 218 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService); |
235 }; | 219 }; |
236 | 220 |
237 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ | 221 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ |
OLD | NEW |