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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
13 #include "content/public/common/show_desktop_notification_params.h" | |
14 #include "third_party/WebKit/public/platform/WebNotificationPermission.h" | 13 #include "third_party/WebKit/public/platform/WebNotificationPermission.h" |
15 | 14 |
16 class GURL; | 15 class GURL; |
| 16 class SkBitmap; |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 class BrowserContext; | 20 class BrowserContext; |
21 class DesktopNotificationDelegate; | 21 class DesktopNotificationDelegate; |
| 22 struct PlatformNotificationData; |
22 class ResourceContext; | 23 class ResourceContext; |
23 | 24 |
24 // The service using which notifications can be presented to the user. There | 25 // The service using which notifications can be presented to the user. There |
25 // should be a unique instance of the PlatformNotificationService depending | 26 // should be a unique instance of the PlatformNotificationService depending |
26 // on the browsing context being used. | 27 // on the browsing context being used. |
27 class CONTENT_EXPORT PlatformNotificationService { | 28 class CONTENT_EXPORT PlatformNotificationService { |
28 public: | 29 public: |
29 virtual ~PlatformNotificationService() {} | 30 virtual ~PlatformNotificationService() {} |
30 | 31 |
31 // Checks if |origin| has permission to display Web Notifications. This method | 32 // Checks if |origin| has permission to display Web Notifications. This method |
32 // must be called on the IO thread. | 33 // must be called on the IO thread. |
33 virtual blink::WebNotificationPermission CheckPermission( | 34 virtual blink::WebNotificationPermission CheckPermission( |
34 ResourceContext* resource_context, | 35 ResourceContext* resource_context, |
35 const GURL& origin, | 36 const GURL& origin, |
36 int render_process_id) = 0; | 37 int render_process_id) = 0; |
37 | 38 |
38 // Displays the notification described in |params| to the user. A closure | 39 // Displays the notification described in |params| to the user. A closure |
39 // through which the notification can be closed will be stored in the | 40 // through which the notification can be closed will be stored in the |
40 // |cancel_callback| argument. This method must be called on the UI thread. | 41 // |cancel_callback| argument. This method must be called on the UI thread. |
41 virtual void DisplayNotification( | 42 virtual void DisplayNotification( |
42 BrowserContext* browser_context, | 43 BrowserContext* browser_context, |
43 const ShowDesktopNotificationHostMsgParams& params, | 44 const GURL& origin, |
| 45 const SkBitmap& icon, |
| 46 const PlatformNotificationData& notification_data, |
44 scoped_ptr<DesktopNotificationDelegate> delegate, | 47 scoped_ptr<DesktopNotificationDelegate> delegate, |
45 int render_process_id, | 48 int render_process_id, |
46 base::Closure* cancel_callback) = 0; | 49 base::Closure* cancel_callback) = 0; |
47 | 50 |
48 // Displays the persistent notification described in |notification_data| to | 51 // Displays the persistent notification described in |notification_data| to |
49 // the user. This method must be called on the UI thread. | 52 // the user. This method must be called on the UI thread. |
50 virtual void DisplayPersistentNotification( | 53 virtual void DisplayPersistentNotification( |
51 BrowserContext* browser_context, | 54 BrowserContext* browser_context, |
52 int64 service_worker_registration_id, | 55 int64 service_worker_registration_id, |
53 const ShowDesktopNotificationHostMsgParams& params, | 56 const GURL& origin, |
| 57 const SkBitmap& icon, |
| 58 const PlatformNotificationData& notification_data, |
54 int render_process_id) = 0; | 59 int render_process_id) = 0; |
55 | 60 |
56 // Closes the persistent notification identified by | 61 // Closes the persistent notification identified by |
57 // |persistent_notification_id|. This method must be called on the UI thread. | 62 // |persistent_notification_id|. This method must be called on the UI thread. |
58 virtual void ClosePersistentNotification( | 63 virtual void ClosePersistentNotification( |
59 BrowserContext* browser_context, | 64 BrowserContext* browser_context, |
60 const std::string& persistent_notification_id) = 0; | 65 const std::string& persistent_notification_id) = 0; |
61 }; | 66 }; |
62 | 67 |
63 } // namespace content | 68 } // namespace content |
64 | 69 |
65 #endif // CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_SERVICE_H_ | 70 #endif // CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_SERVICE_H_ |
OLD | NEW |