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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 // Add a desktop notification. | 73 // Add a desktop notification. |
74 static std::string AddIconNotification(const GURL& origin_url, | 74 static std::string AddIconNotification(const GURL& origin_url, |
75 const base::string16& title, | 75 const base::string16& title, |
76 const base::string16& message, | 76 const base::string16& message, |
77 const gfx::Image& icon, | 77 const gfx::Image& icon, |
78 const base::string16& replace_id, | 78 const base::string16& replace_id, |
79 NotificationDelegate* delegate, | 79 NotificationDelegate* delegate, |
80 Profile* profile); | 80 Profile* profile); |
81 | 81 |
82 explicit DesktopNotificationService(Profile* profile); | 82 explicit DesktopNotificationService(Profile* profile); |
83 virtual ~DesktopNotificationService(); | 83 ~DesktopNotificationService() override; |
84 | 84 |
85 // Requests Web Notification permission for |requesting_frame|. The |callback| | 85 // Requests Web Notification permission for |requesting_frame|. The |callback| |
86 // will be invoked after the user has made a decision. | 86 // will be invoked after the user has made a decision. |
87 void RequestNotificationPermission( | 87 void RequestNotificationPermission( |
88 content::WebContents* web_contents, | 88 content::WebContents* web_contents, |
89 const PermissionRequestID& request_id, | 89 const PermissionRequestID& request_id, |
90 const GURL& requesting_origin, | 90 const GURL& requesting_origin, |
91 bool user_gesture, | 91 bool user_gesture, |
92 const NotificationPermissionCallback& callback); | 92 const NotificationPermissionCallback& callback); |
93 | 93 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 void OnNotificationPermissionRequested( | 126 void OnNotificationPermissionRequested( |
127 const base::Callback<void(blink::WebNotificationPermission)>& callback, | 127 const base::Callback<void(blink::WebNotificationPermission)>& callback, |
128 bool allowed); | 128 bool allowed); |
129 | 129 |
130 void FirePermissionLevelChangedEvent( | 130 void FirePermissionLevelChangedEvent( |
131 const message_center::NotifierId& notifier_id, | 131 const message_center::NotifierId& notifier_id, |
132 bool enabled); | 132 bool enabled); |
133 | 133 |
134 #if defined(ENABLE_EXTENSIONS) | 134 #if defined(ENABLE_EXTENSIONS) |
135 // extensions::ExtensionRegistryObserver: | 135 // extensions::ExtensionRegistryObserver: |
136 virtual void OnExtensionUninstalled( | 136 void OnExtensionUninstalled(content::BrowserContext* browser_context, |
137 content::BrowserContext* browser_context, | 137 const extensions::Extension* extension, |
138 const extensions::Extension* extension, | 138 extensions::UninstallReason reason) override; |
139 extensions::UninstallReason reason) override; | |
140 #endif | 139 #endif |
141 | 140 |
142 // PermissionContextBase: | 141 // PermissionContextBase: |
143 virtual void UpdateContentSetting(const GURL& requesting_origin, | 142 void UpdateContentSetting(const GURL& requesting_origin, |
144 const GURL& embedder_origin, | 143 const GURL& embedder_origin, |
145 bool allowed) override; | 144 bool allowed) override; |
146 | 145 |
147 // The profile which owns this object. | 146 // The profile which owns this object. |
148 Profile* profile_; | 147 Profile* profile_; |
149 | 148 |
150 // Prefs listener for disabled_extension_id. | 149 // Prefs listener for disabled_extension_id. |
151 StringListPrefMember disabled_extension_id_pref_; | 150 StringListPrefMember disabled_extension_id_pref_; |
152 | 151 |
153 // Prefs listener for disabled_system_component_id. | 152 // Prefs listener for disabled_system_component_id. |
154 StringListPrefMember disabled_system_component_id_pref_; | 153 StringListPrefMember disabled_system_component_id_pref_; |
155 | 154 |
156 // On-memory data for the availability of extensions. | 155 // On-memory data for the availability of extensions. |
157 std::set<std::string> disabled_extension_ids_; | 156 std::set<std::string> disabled_extension_ids_; |
158 | 157 |
159 // On-memory data for the availability of system_component. | 158 // On-memory data for the availability of system_component. |
160 std::set<std::string> disabled_system_component_ids_; | 159 std::set<std::string> disabled_system_component_ids_; |
161 | 160 |
162 #if defined(ENABLE_EXTENSIONS) | 161 #if defined(ENABLE_EXTENSIONS) |
163 // An observer to listen when extension is uninstalled. | 162 // An observer to listen when extension is uninstalled. |
164 ScopedObserver<extensions::ExtensionRegistry, | 163 ScopedObserver<extensions::ExtensionRegistry, |
165 extensions::ExtensionRegistryObserver> | 164 extensions::ExtensionRegistryObserver> |
166 extension_registry_observer_; | 165 extension_registry_observer_; |
167 #endif | 166 #endif |
168 | 167 |
169 base::WeakPtrFactory<DesktopNotificationService> weak_factory_; | 168 base::WeakPtrFactory<DesktopNotificationService> weak_factory_; |
170 | 169 |
171 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService); | 170 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService); |
172 }; | 171 }; |
173 | 172 |
174 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ | 173 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ |
OLD | NEW |