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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 namespace gfx { | 49 namespace gfx { |
50 class Image; | 50 class Image; |
51 } | 51 } |
52 | 52 |
53 namespace user_prefs { | 53 namespace user_prefs { |
54 class PrefRegistrySyncable; | 54 class PrefRegistrySyncable; |
55 } | 55 } |
56 | 56 |
57 // Callback to be invoked when the result of a permission request is known. | 57 // Callback to be invoked when the result of a permission request is known. |
58 typedef base::Callback<void(blink::WebNotificationPermission)> | 58 typedef base::Callback<void(blink::WebNotificationPermission)> |
59 NotificationPermissionCallback; | 59 NotificationPermissionCallback; |
Peter Beverloo
2014/10/20 17:32:16
Remove this |typedef| if we're not going to use it
Miguel Garcia
2014/10/21 17:17:12
Done.
| |
60 | 60 |
61 // The DesktopNotificationService is an object, owned by the Profile, | 61 // The DesktopNotificationService is an object, owned by the Profile, |
62 // which provides the creation of desktop "toasts" to web pages and workers. | 62 // which provides the creation of desktop "toasts" to web pages and workers. |
63 class DesktopNotificationService : public PermissionContextBase | 63 class DesktopNotificationService : public PermissionContextBase |
64 #if defined(ENABLE_EXTENSIONS) | 64 #if defined(ENABLE_EXTENSIONS) |
65 , | 65 , |
66 public extensions::ExtensionRegistryObserver | 66 public extensions::ExtensionRegistryObserver |
67 #endif | 67 #endif |
68 { | 68 { |
69 public: | 69 public: |
(...skipping 12 matching lines...) Expand all Loading... | |
82 explicit DesktopNotificationService(Profile* profile); | 82 explicit DesktopNotificationService(Profile* profile); |
83 virtual ~DesktopNotificationService(); | 83 virtual ~DesktopNotificationService(); |
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 base::Callback<void(bool)>& result_callback); |
93 | 93 |
94 // Show a desktop notification. If |cancel_callback| is non-null, it's set to | 94 // Show a desktop notification. If |cancel_callback| is non-null, it's set to |
95 // a callback which can be used to cancel the notification. | 95 // a callback which can be used to cancel the notification. |
96 void ShowDesktopNotification( | 96 void ShowDesktopNotification( |
97 const content::ShowDesktopNotificationHostMsgParams& params, | 97 const content::ShowDesktopNotificationHostMsgParams& params, |
98 content::RenderFrameHost* render_frame_host, | 98 content::RenderFrameHost* render_frame_host, |
99 scoped_ptr<content::DesktopNotificationDelegate> delegate, | 99 scoped_ptr<content::DesktopNotificationDelegate> delegate, |
100 base::Closure* cancel_callback); | 100 base::Closure* cancel_callback); |
101 | 101 |
102 // Returns true if the notifier with |notifier_id| is allowed to send | 102 // Returns true if the notifier with |notifier_id| is allowed to send |
(...skipping 11 matching lines...) Expand all Loading... | |
114 base::string16 DisplayNameForOriginInProcessId(const GURL& origin, | 114 base::string16 DisplayNameForOriginInProcessId(const GURL& origin, |
115 int process_id); | 115 int process_id); |
116 | 116 |
117 // Called when the string list pref has been changed. | 117 // Called when the string list pref has been changed. |
118 void OnStringListPrefChanged( | 118 void OnStringListPrefChanged( |
119 const char* pref_name, std::set<std::string>* ids_field); | 119 const char* pref_name, std::set<std::string>* ids_field); |
120 | 120 |
121 // Called when the disabled_extension_id pref has been changed. | 121 // Called when the disabled_extension_id pref has been changed. |
122 void OnDisabledExtensionIdsChanged(); | 122 void OnDisabledExtensionIdsChanged(); |
123 | 123 |
124 // Used as a callback once a permission has been decided to convert |allowed| | |
125 // to one of the blink::WebNotificationPermission values. | |
126 void OnNotificationPermissionRequested( | |
127 const base::Callback<void(blink::WebNotificationPermission)>& callback, | |
128 bool allowed); | |
129 | |
130 void FirePermissionLevelChangedEvent( | 124 void FirePermissionLevelChangedEvent( |
131 const message_center::NotifierId& notifier_id, | 125 const message_center::NotifierId& notifier_id, |
132 bool enabled); | 126 bool enabled); |
133 | 127 |
134 #if defined(ENABLE_EXTENSIONS) | 128 #if defined(ENABLE_EXTENSIONS) |
135 // extensions::ExtensionRegistryObserver: | 129 // extensions::ExtensionRegistryObserver: |
136 virtual void OnExtensionUninstalled( | 130 virtual void OnExtensionUninstalled( |
137 content::BrowserContext* browser_context, | 131 content::BrowserContext* browser_context, |
138 const extensions::Extension* extension, | 132 const extensions::Extension* extension, |
139 extensions::UninstallReason reason) override; | 133 extensions::UninstallReason reason) override; |
(...skipping 25 matching lines...) Expand all Loading... | |
165 extensions::ExtensionRegistryObserver> | 159 extensions::ExtensionRegistryObserver> |
166 extension_registry_observer_; | 160 extension_registry_observer_; |
167 #endif | 161 #endif |
168 | 162 |
169 base::WeakPtrFactory<DesktopNotificationService> weak_factory_; | 163 base::WeakPtrFactory<DesktopNotificationService> weak_factory_; |
170 | 164 |
171 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService); | 165 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService); |
172 }; | 166 }; |
173 | 167 |
174 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ | 168 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ |
OLD | NEW |