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 "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" | 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; | |
25 struct NotificationResources; | 24 struct NotificationResources; |
26 struct PlatformNotificationData; | 25 struct PlatformNotificationData; |
27 class ResourceContext; | 26 class ResourceContext; |
28 | 27 |
29 // The service using which notifications can be presented to the user. There | 28 // The service using which notifications can be presented to the user. There |
30 // should be a unique instance of the PlatformNotificationService depending | 29 // should be a unique instance of the PlatformNotificationService depending |
31 // on the browsing context being used. | 30 // on the browsing context being used. |
32 class CONTENT_EXPORT PlatformNotificationService { | 31 class CONTENT_EXPORT PlatformNotificationService { |
33 public: | 32 public: |
34 virtual ~PlatformNotificationService() {} | 33 virtual ~PlatformNotificationService() {} |
(...skipping 21 matching lines...) Expand all Loading... |
56 | 55 |
57 // Displays the notification described in |notification_data| to the user. A | 56 // Displays the notification described in |notification_data| to the user. A |
58 // closure through which the notification can be closed will be stored in the | 57 // closure through which the notification can be closed will be stored in the |
59 // |cancel_callback| argument. This method must be called on the UI thread. | 58 // |cancel_callback| argument. This method must be called on the UI thread. |
60 virtual void DisplayNotification( | 59 virtual void DisplayNotification( |
61 BrowserContext* browser_context, | 60 BrowserContext* browser_context, |
62 const std::string& notification_id, | 61 const std::string& notification_id, |
63 const GURL& origin, | 62 const GURL& origin, |
64 const PlatformNotificationData& notification_data, | 63 const PlatformNotificationData& notification_data, |
65 const NotificationResources& notification_resources, | 64 const NotificationResources& notification_resources, |
66 std::unique_ptr<DesktopNotificationDelegate> delegate, | |
67 base::Closure* cancel_callback) = 0; | 65 base::Closure* cancel_callback) = 0; |
68 | 66 |
69 // Displays the persistent notification described in |notification_data| to | 67 // Displays the persistent notification described in |notification_data| to |
70 // the user. This method must be called on the UI thread. | 68 // the user. This method must be called on the UI thread. |
71 virtual void DisplayPersistentNotification( | 69 virtual void DisplayPersistentNotification( |
72 BrowserContext* browser_context, | 70 BrowserContext* browser_context, |
73 const std::string& notification_id, | 71 const std::string& notification_id, |
74 const GURL& service_worker_origin, | 72 const GURL& service_worker_origin, |
75 const GURL& origin, | 73 const GURL& origin, |
76 const PlatformNotificationData& notification_data, | 74 const PlatformNotificationData& notification_data, |
77 const NotificationResources& notification_resources) = 0; | 75 const NotificationResources& notification_resources) = 0; |
78 | 76 |
79 // Closes the persistent notification identified by | 77 // Closes the persistent notification identified by |
80 // |persistent_notification_id|. This method must be called on the UI thread. | 78 // |persistent_notification_id|. This method must be called on the UI thread. |
81 virtual void ClosePersistentNotification( | 79 virtual void ClosePersistentNotification( |
82 BrowserContext* browser_context, | 80 BrowserContext* browser_context, |
83 const std::string& notification_id) = 0; | 81 const std::string& notification_id) = 0; |
84 | 82 |
85 // Retrieves the ids of all currently displaying notifications and | 83 // Retrieves the ids of all currently displaying notifications and |
86 // posts |callback| with the result. | 84 // posts |callback| with the result. |
87 virtual void GetDisplayedNotifications( | 85 virtual void GetDisplayedNotifications( |
88 BrowserContext* browser_context, | 86 BrowserContext* browser_context, |
89 const DisplayedNotificationsCallback& callback) = 0; | 87 const DisplayedNotificationsCallback& callback) = 0; |
90 }; | 88 }; |
91 | 89 |
92 } // namespace content | 90 } // namespace content |
93 | 91 |
94 #endif // CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_SERVICE_H_ | 92 #endif // CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_SERVICE_H_ |
OLD | NEW |