OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_SERVICE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_SERVICE_H_ |
6 #define CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_SERVICE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_SERVICE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <set> | 11 #include <set> |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/callback_forward.h" | 15 #include "base/callback_forward.h" |
16 #include "components/permissions/permission_status.mojom.h" | |
17 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
| 17 #include "third_party/WebKit/public/platform/modules/permissions/permission_stat
us.mojom.h" |
18 | 18 |
19 class GURL; | 19 class GURL; |
20 | 20 |
21 namespace content { | 21 namespace content { |
22 | 22 |
23 class BrowserContext; | 23 class BrowserContext; |
24 class DesktopNotificationDelegate; | 24 class DesktopNotificationDelegate; |
25 struct NotificationResources; | 25 struct NotificationResources; |
26 struct PlatformNotificationData; | 26 struct PlatformNotificationData; |
27 class ResourceContext; | 27 class ResourceContext; |
28 | 28 |
29 // The service using which notifications can be presented to the user. There | 29 // The service using which notifications can be presented to the user. There |
30 // should be a unique instance of the PlatformNotificationService depending | 30 // should be a unique instance of the PlatformNotificationService depending |
31 // on the browsing context being used. | 31 // on the browsing context being used. |
32 class CONTENT_EXPORT PlatformNotificationService { | 32 class CONTENT_EXPORT PlatformNotificationService { |
33 public: | 33 public: |
34 virtual ~PlatformNotificationService() {} | 34 virtual ~PlatformNotificationService() {} |
35 | 35 |
36 // Checks if |origin| has permission to display Web Notifications. | 36 // Checks if |origin| has permission to display Web Notifications. |
37 // This method must only be called on the UI thread. | 37 // This method must only be called on the UI thread. |
38 virtual permissions::mojom::PermissionStatus CheckPermissionOnUIThread( | 38 virtual blink::mojom::PermissionStatus CheckPermissionOnUIThread( |
39 BrowserContext* browser_context, | 39 BrowserContext* browser_context, |
40 const GURL& origin, | 40 const GURL& origin, |
41 int render_process_id) = 0; | 41 int render_process_id) = 0; |
42 | 42 |
43 // Checks if |origin| has permission to display Web Notifications. This method | 43 // Checks if |origin| has permission to display Web Notifications. This method |
44 // exists to serve the synchronous IPC required by the Notification.permission | 44 // exists to serve the synchronous IPC required by the Notification.permission |
45 // JavaScript getter, and should not be used for other purposes. See | 45 // JavaScript getter, and should not be used for other purposes. See |
46 // https://crbug.com/446497 for the plan to deprecate this method. | 46 // https://crbug.com/446497 for the plan to deprecate this method. |
47 // This method must only be called on the IO thread. | 47 // This method must only be called on the IO thread. |
48 virtual permissions::mojom::PermissionStatus CheckPermissionOnIOThread( | 48 virtual blink::mojom::PermissionStatus CheckPermissionOnIOThread( |
49 ResourceContext* resource_context, | 49 ResourceContext* resource_context, |
50 const GURL& origin, | 50 const GURL& origin, |
51 int render_process_id) = 0; | 51 int render_process_id) = 0; |
52 | 52 |
53 // Displays the notification described in |notification_data| to the user. A | 53 // Displays the notification described in |notification_data| to the user. A |
54 // closure through which the notification can be closed will be stored in the | 54 // closure through which the notification can be closed will be stored in the |
55 // |cancel_callback| argument. This method must be called on the UI thread. | 55 // |cancel_callback| argument. This method must be called on the UI thread. |
56 virtual void DisplayNotification( | 56 virtual void DisplayNotification( |
57 BrowserContext* browser_context, | 57 BrowserContext* browser_context, |
58 const GURL& origin, | 58 const GURL& origin, |
(...skipping 21 matching lines...) Expand all Loading... |
80 // given |browser_context| to |displayed_notifications|. Returns whether the | 80 // given |browser_context| to |displayed_notifications|. Returns whether the |
81 // platform is able to provide such a set. | 81 // platform is able to provide such a set. |
82 virtual bool GetDisplayedPersistentNotifications( | 82 virtual bool GetDisplayedPersistentNotifications( |
83 BrowserContext* browser_context, | 83 BrowserContext* browser_context, |
84 std::set<std::string>* displayed_notifications) = 0; | 84 std::set<std::string>* displayed_notifications) = 0; |
85 }; | 85 }; |
86 | 86 |
87 } // namespace content | 87 } // namespace content |
88 | 88 |
89 #endif // CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_SERVICE_H_ | 89 #endif // CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_SERVICE_H_ |
OLD | NEW |