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 16 matching lines...) Expand all Loading... |
27 class Notification; | 27 class Notification; |
28 class NotificationDelegate; | 28 class NotificationDelegate; |
29 class NotificationUIManager; | 29 class NotificationUIManager; |
30 class Profile; | 30 class Profile; |
31 | 31 |
32 namespace content { | 32 namespace content { |
33 class WebContents; | 33 class WebContents; |
34 struct ShowDesktopNotificationHostMsgParams; | 34 struct ShowDesktopNotificationHostMsgParams; |
35 } | 35 } |
36 | 36 |
| 37 namespace extensions { |
| 38 class Extension; |
| 39 } |
| 40 |
37 namespace gfx { | 41 namespace gfx { |
38 class Image; | 42 class Image; |
39 } | 43 } |
40 | 44 |
41 namespace user_prefs { | 45 namespace user_prefs { |
42 class PrefRegistrySyncable; | 46 class PrefRegistrySyncable; |
43 } | 47 } |
44 | 48 |
45 // The DesktopNotificationService is an object, owned by the Profile, | 49 // The DesktopNotificationService is an object, owned by the Profile, |
46 // which provides the creation of desktop "toasts" to web pages and workers. | 50 // which provides the creation of desktop "toasts" to web pages and workers. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 // Clears the notifications setting for the given pattern. | 148 // Clears the notifications setting for the given pattern. |
145 void ClearSetting(const ContentSettingsPattern& pattern); | 149 void ClearSetting(const ContentSettingsPattern& pattern); |
146 | 150 |
147 // Clears the sets of explicitly allowed and denied origins. | 151 // Clears the sets of explicitly allowed and denied origins. |
148 void ResetAllOrigins(); | 152 void ResetAllOrigins(); |
149 | 153 |
150 ContentSetting GetContentSetting(const GURL& origin); | 154 ContentSetting GetContentSetting(const GURL& origin); |
151 | 155 |
152 // Checks to see if a given origin has permission to create desktop | 156 // Checks to see if a given origin has permission to create desktop |
153 // notifications. | 157 // notifications. |
154 WebKit::WebNotificationPresenter::Permission | 158 WebKit::WebNotificationPresenter::Permission HasPermission(const GURL& origin, |
155 HasPermission(const GURL& origin); | 159 int process_id); |
156 | 160 |
157 // Returns true if the notifier with |notifier_id| is allowed to send | 161 // Returns true if the notifier with |notifier_id| is allowed to send |
158 // notifications. | 162 // notifications. |
159 bool IsNotifierEnabled(const message_center::NotifierId& notifier_id); | 163 bool IsNotifierEnabled(const message_center::NotifierId& notifier_id); |
160 | 164 |
161 // Updates the availability of the notifier. | 165 // Updates the availability of the notifier. |
162 void SetNotifierEnabled(const message_center::NotifierId& notifier_id, | 166 void SetNotifierEnabled(const message_center::NotifierId& notifier_id, |
163 bool enabled); | 167 bool enabled); |
164 | 168 |
165 private: | 169 private: |
(...skipping 21 matching lines...) Expand all Loading... |
187 void OnDisabledSystemComponentIdsChanged(); | 191 void OnDisabledSystemComponentIdsChanged(); |
188 | 192 |
189 // Called when the enabled_sync_notifier_id pref has been changed. | 193 // Called when the enabled_sync_notifier_id pref has been changed. |
190 void OnEnabledSyncNotifierIdsChanged(); | 194 void OnEnabledSyncNotifierIdsChanged(); |
191 | 195 |
192 // content::NotificationObserver: | 196 // content::NotificationObserver: |
193 virtual void Observe(int type, | 197 virtual void Observe(int type, |
194 const content::NotificationSource& source, | 198 const content::NotificationSource& source, |
195 const content::NotificationDetails& details) OVERRIDE; | 199 const content::NotificationDetails& details) OVERRIDE; |
196 | 200 |
| 201 bool ExtensionApplies(const extensions::Extension* extension); |
| 202 |
197 // The profile which owns this object. | 203 // The profile which owns this object. |
198 Profile* profile_; | 204 Profile* profile_; |
199 | 205 |
200 // Non-owned pointer to the notification manager which manages the | 206 // Non-owned pointer to the notification manager which manages the |
201 // UI for desktop toasts. | 207 // UI for desktop toasts. |
202 NotificationUIManager* ui_manager_; | 208 NotificationUIManager* ui_manager_; |
203 | 209 |
204 // Prefs listener for disabled_extension_id. | 210 // Prefs listener for disabled_extension_id. |
205 StringListPrefMember disabled_extension_id_pref_; | 211 StringListPrefMember disabled_extension_id_pref_; |
206 | 212 |
(...skipping 12 matching lines...) Expand all Loading... |
219 // On-memory data for the availability of sync notifiers. | 225 // On-memory data for the availability of sync notifiers. |
220 std::set<std::string> enabled_sync_notifier_ids_; | 226 std::set<std::string> enabled_sync_notifier_ids_; |
221 | 227 |
222 // Registrar for the other kind of notifications (event signaling). | 228 // Registrar for the other kind of notifications (event signaling). |
223 content::NotificationRegistrar registrar_; | 229 content::NotificationRegistrar registrar_; |
224 | 230 |
225 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService); | 231 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService); |
226 }; | 232 }; |
227 | 233 |
228 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ | 234 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ |
OLD | NEW |