OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "chrome/browser/notifications/notification.h" | 11 #include "chrome/browser/notifications/notification.h" |
| 12 #include "chrome/common/content_settings.h" |
12 #include "chrome/common/notification_observer.h" | 13 #include "chrome/common/notification_observer.h" |
13 #include "chrome/common/notification_registrar.h" | 14 #include "chrome/common/notification_registrar.h" |
14 #include "chrome/common/notification_service.h" | 15 #include "chrome/common/notification_service.h" |
15 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
16 | 17 |
17 class NotificationUIManager; | 18 class NotificationUIManager; |
18 class NotificationsPrefsCache; | 19 class NotificationsPrefsCache; |
19 class PrefService; | 20 class PrefService; |
20 class Profile; | 21 class Profile; |
21 class Task; | 22 class Task; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 const NotificationDetails& details); | 79 const NotificationDetails& details); |
79 | 80 |
80 NotificationsPrefsCache* prefs_cache() { return prefs_cache_; } | 81 NotificationsPrefsCache* prefs_cache() { return prefs_cache_; } |
81 | 82 |
82 // Creates a data:xxxx URL which contains the full HTML for a notification | 83 // Creates a data:xxxx URL which contains the full HTML for a notification |
83 // using supplied icon, title, and text, run through a template which contains | 84 // using supplied icon, title, and text, run through a template which contains |
84 // the standard formatting for notifications. | 85 // the standard formatting for notifications. |
85 static string16 CreateDataUrl(const GURL& icon_url, const string16& title, | 86 static string16 CreateDataUrl(const GURL& icon_url, const string16& title, |
86 const string16& body); | 87 const string16& body); |
87 | 88 |
| 89 ContentSetting GetDefaultContentSetting(); |
| 90 void SetDefaultContentSetting(ContentSetting setting); |
| 91 |
88 static void RegisterUserPrefs(PrefService* user_prefs); | 92 static void RegisterUserPrefs(PrefService* user_prefs); |
89 private: | 93 private: |
90 void InitPrefs(); | 94 void InitPrefs(); |
91 void StartObserving(); | 95 void StartObserving(); |
92 void StopObserving(); | 96 void StopObserving(); |
93 | 97 |
94 // Save a permission change to the profile. | 98 // Save a permission change to the profile. |
95 void PersistPermissionChange(const GURL& origin, bool is_allowed); | 99 void PersistPermissionChange(const GURL& origin, bool is_allowed); |
96 | 100 |
97 // Returns a display name for an origin, to be used in permission infobar | 101 // Returns a display name for an origin, to be used in permission infobar |
98 // or on the frame of the notification toast. Different from the origin | 102 // or on the frame of the notification toast. Different from the origin |
99 // itself when dealing with extensions. | 103 // itself when dealing with extensions. |
100 std::wstring DisplayNameForOrigin(const GURL& origin); | 104 std::wstring DisplayNameForOrigin(const GURL& origin); |
101 | 105 |
102 // The profile which owns this object. | 106 // The profile which owns this object. |
103 Profile* profile_; | 107 Profile* profile_; |
104 | 108 |
105 // A cache of preferences which is accessible only on the IO thread | 109 // A cache of preferences which is accessible only on the IO thread |
106 // to service synchronous IPCs. | 110 // to service synchronous IPCs. |
107 scoped_refptr<NotificationsPrefsCache> prefs_cache_; | 111 scoped_refptr<NotificationsPrefsCache> prefs_cache_; |
108 | 112 |
109 // Non-owned pointer to the notification manager which manages the | 113 // Non-owned pointer to the notification manager which manages the |
110 // UI for desktop toasts. | 114 // UI for desktop toasts. |
111 NotificationUIManager* ui_manager_; | 115 NotificationUIManager* ui_manager_; |
112 | 116 |
113 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService); | 117 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService); |
114 }; | 118 }; |
115 | 119 |
116 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ | 120 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ |
OLD | NEW |