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/WebNotificationPresen
ter.h" |
24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h" | 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h" |
25 | 26 |
26 class Extension; | 27 class Extension; |
27 class Notification; | 28 class Notification; |
28 class NotificationDelegate; | 29 class NotificationDelegate; |
29 class NotificationUIManager; | 30 class NotificationUIManager; |
30 class NotificationsPrefsCache; | 31 class NotificationsPrefsCache; |
31 class PrefService; | 32 class PrefService; |
32 class Profile; | 33 class Profile; |
33 class TabContents; | 34 class TabContents; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 void ResetBlockedOrigin(const GURL& origin); | 121 void ResetBlockedOrigin(const GURL& origin); |
121 | 122 |
122 // Clears the sets of explicitly allowed and denied origins. | 123 // Clears the sets of explicitly allowed and denied origins. |
123 void ResetAllOrigins(); | 124 void ResetAllOrigins(); |
124 | 125 |
125 static void RegisterUserPrefs(PrefService* user_prefs); | 126 static void RegisterUserPrefs(PrefService* user_prefs); |
126 | 127 |
127 ContentSetting GetContentSetting(const GURL& origin); | 128 ContentSetting GetContentSetting(const GURL& origin); |
128 | 129 |
129 // Checks to see if a given origin has permission to create desktop | 130 // Checks to see if a given origin has permission to create desktop |
130 // notifications. Returns a constant from WebNotificationPresenter | 131 // notifications. |
131 // class. | 132 WebKit::WebNotificationPresenter::Permission |
132 int HasPermission(const GURL& origin); | 133 HasPermission(const GURL& origin); |
133 | 134 |
134 private: | 135 private: |
135 void InitPrefs(); | 136 void InitPrefs(); |
136 void StartObserving(); | 137 void StartObserving(); |
137 void StopObserving(); | 138 void StopObserving(); |
138 | 139 |
139 void OnPrefsChanged(const std::string& pref_name); | 140 void OnPrefsChanged(const std::string& pref_name); |
140 | 141 |
141 // Takes a notification object and shows it in the UI. | 142 // Takes a notification object and shows it in the UI. |
142 void ShowNotification(const Notification& notification); | 143 void ShowNotification(const Notification& notification); |
(...skipping 19 matching lines...) Expand all Loading... |
162 | 163 |
163 scoped_ptr<content_settings::NotificationProvider> provider_; | 164 scoped_ptr<content_settings::NotificationProvider> provider_; |
164 | 165 |
165 PrefChangeRegistrar prefs_registrar_; | 166 PrefChangeRegistrar prefs_registrar_; |
166 NotificationRegistrar notification_registrar_; | 167 NotificationRegistrar notification_registrar_; |
167 | 168 |
168 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService); | 169 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService); |
169 }; | 170 }; |
170 | 171 |
171 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ | 172 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ |
OLD | NEW |