OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/string16.h" | 15 #include "base/string16.h" |
16 #include "chrome/browser/content_settings/content_settings_notification_provider
.h" | 16 #include "chrome/browser/content_settings/content_settings_notification_provider
.h" |
17 #include "chrome/browser/content_settings/content_settings_provider.h" | 17 #include "chrome/browser/content_settings/content_settings_provider.h" |
18 #include "chrome/browser/prefs/pref_change_registrar.h" | 18 #include "chrome/browser/prefs/pref_change_registrar.h" |
19 #include "chrome/browser/profiles/profile_keyed_service.h" | 19 #include "chrome/browser/profiles/profile_keyed_service.h" |
20 #include "chrome/common/content_settings.h" | 20 #include "chrome/common/content_settings.h" |
21 #include "content/common/notification_observer.h" | 21 #include "content/common/notification_observer.h" |
22 #include "content/common/notification_registrar.h" | 22 #include "content/common/notification_registrar.h" |
23 #include "googleurl/src/gurl.h" | 23 #include "googleurl/src/gurl.h" |
24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h" | 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h" |
25 | 25 |
| 26 class Extension; |
26 class Notification; | 27 class Notification; |
| 28 class NotificationDelegate; |
27 class NotificationUIManager; | 29 class NotificationUIManager; |
28 class NotificationsPrefsCache; | 30 class NotificationsPrefsCache; |
29 class PrefService; | 31 class PrefService; |
30 class Profile; | 32 class Profile; |
31 class TabContents; | 33 class TabContents; |
32 struct DesktopNotificationHostMsg_Show_Params; | 34 struct DesktopNotificationHostMsg_Show_Params; |
33 | 35 |
34 // The DesktopNotificationService is an object, owned by the Profile, | 36 // The DesktopNotificationService is an object, owned by the Profile, |
35 // which provides the creation of desktop "toasts" to web pages and workers. | 37 // which provides the creation of desktop "toasts" to web pages and workers. |
36 class DesktopNotificationService : public NotificationObserver, | 38 class DesktopNotificationService : public NotificationObserver, |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 // Removes an origin from the "explicitly denied" set. | 119 // Removes an origin from the "explicitly denied" set. |
118 void ResetBlockedOrigin(const GURL& origin); | 120 void ResetBlockedOrigin(const GURL& origin); |
119 | 121 |
120 // Clears the sets of explicitly allowed and denied origins. | 122 // Clears the sets of explicitly allowed and denied origins. |
121 void ResetAllOrigins(); | 123 void ResetAllOrigins(); |
122 | 124 |
123 static void RegisterUserPrefs(PrefService* user_prefs); | 125 static void RegisterUserPrefs(PrefService* user_prefs); |
124 | 126 |
125 ContentSetting GetContentSetting(const GURL& origin); | 127 ContentSetting GetContentSetting(const GURL& origin); |
126 | 128 |
| 129 // Checks to see if a given origin has permission to create desktop |
| 130 // notifications. Returns a constant from WebNotificationPresenter |
| 131 // class. |
| 132 int HasPermission(const GURL& origin); |
| 133 |
127 private: | 134 private: |
128 void InitPrefs(); | 135 void InitPrefs(); |
129 void StartObserving(); | 136 void StartObserving(); |
130 void StopObserving(); | 137 void StopObserving(); |
131 | 138 |
132 void OnPrefsChanged(const std::string& pref_name); | 139 void OnPrefsChanged(const std::string& pref_name); |
133 | 140 |
134 // Takes a notification object and shows it in the UI. | 141 // Takes a notification object and shows it in the UI. |
135 void ShowNotification(const Notification& notification); | 142 void ShowNotification(const Notification& notification); |
136 | 143 |
(...skipping 18 matching lines...) Expand all Loading... |
155 | 162 |
156 scoped_ptr<content_settings::NotificationProvider> provider_; | 163 scoped_ptr<content_settings::NotificationProvider> provider_; |
157 | 164 |
158 PrefChangeRegistrar prefs_registrar_; | 165 PrefChangeRegistrar prefs_registrar_; |
159 NotificationRegistrar notification_registrar_; | 166 NotificationRegistrar notification_registrar_; |
160 | 167 |
161 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService); | 168 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService); |
162 }; | 169 }; |
163 | 170 |
164 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ | 171 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ |
OLD | NEW |