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> |
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/prefs/public/pref_member.h" | 14 #include "base/prefs/public/pref_member.h" |
15 #include "base/string16.h" | 15 #include "base/string16.h" |
16 #include "chrome/browser/content_settings/content_settings_provider.h" | 16 #include "chrome/browser/content_settings/content_settings_provider.h" |
17 #include "chrome/browser/profiles/profile_keyed_service.h" | 17 #include "chrome/browser/profiles/profile_keyed_service.h" |
18 #include "chrome/common/content_settings.h" | 18 #include "chrome/common/content_settings.h" |
19 #include "content/public/browser/notification_observer.h" | 19 #include "content/public/browser/notification_observer.h" |
20 #include "content/public/browser/notification_registrar.h" | 20 #include "content/public/browser/notification_registrar.h" |
21 #include "googleurl/src/gurl.h" | 21 #include "googleurl/src/gurl.h" |
22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNotificationPresen
ter.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNotificationPresen
ter.h" |
23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h" | 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h" |
24 | 24 |
25 class ContentSettingsPattern; | 25 class ContentSettingsPattern; |
26 class Notification; | 26 class Notification; |
27 class NotificationDelegate; | 27 class NotificationDelegate; |
28 class NotificationUIManager; | 28 class NotificationUIManager; |
29 class PrefServiceSyncable; | 29 class PrefRegistrySyncable; |
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 gfx { | 37 namespace gfx { |
38 class ImageSkia; | 38 class ImageSkia; |
39 } | 39 } |
40 | 40 |
41 // The DesktopNotificationService is an object, owned by the Profile, | 41 // The DesktopNotificationService is an object, owned by the Profile, |
42 // which provides the creation of desktop "toasts" to web pages and workers. | 42 // which provides the creation of desktop "toasts" to web pages and workers. |
43 class DesktopNotificationService : public content::NotificationObserver, | 43 class DesktopNotificationService : public content::NotificationObserver, |
44 public ProfileKeyedService { | 44 public ProfileKeyedService { |
45 public: | 45 public: |
46 enum DesktopNotificationSource { | 46 enum DesktopNotificationSource { |
47 PageNotification, | 47 PageNotification, |
48 WorkerNotification | 48 WorkerNotification |
49 }; | 49 }; |
50 | 50 |
51 // Register profile-specific prefs of notifications. | 51 // Register profile-specific prefs of notifications. |
52 static void RegisterUserPrefs(PrefServiceSyncable* prefs); | 52 static void RegisterUserPrefs(PrefRegistrySyncable* prefs); |
53 | 53 |
54 DesktopNotificationService(Profile* profile, | 54 DesktopNotificationService(Profile* profile, |
55 NotificationUIManager* ui_manager); | 55 NotificationUIManager* ui_manager); |
56 virtual ~DesktopNotificationService(); | 56 virtual ~DesktopNotificationService(); |
57 | 57 |
58 // Requests permission (using an info-bar) for a given origin. | 58 // Requests permission (using an info-bar) for a given origin. |
59 // |callback_context| contains an opaque value to pass back to the | 59 // |callback_context| contains an opaque value to pass back to the |
60 // requesting process when the info-bar finishes. | 60 // requesting process when the info-bar finishes. |
61 void RequestPermission(const GURL& origin, | 61 void RequestPermission(const GURL& origin, |
62 int process_id, | 62 int process_id, |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 // Prefs listener for disabled_extension_id. | 190 // Prefs listener for disabled_extension_id. |
191 StringListPrefMember disabled_extension_id_pref_; | 191 StringListPrefMember disabled_extension_id_pref_; |
192 | 192 |
193 // On-memory data for the availability of extensions. | 193 // On-memory data for the availability of extensions. |
194 std::set<std::string> disabled_extension_ids_; | 194 std::set<std::string> disabled_extension_ids_; |
195 | 195 |
196 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService); | 196 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService); |
197 }; | 197 }; |
198 | 198 |
199 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ | 199 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ |
OLD | NEW |