Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / content / public / browser / platform_notification_service.h
blobafcc31921f340fdc322bcb9ea7c6092848f66591
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_SERVICE_H_
6 #define CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_SERVICE_H_
8 #include <stdint.h>
9 #include <string>
11 #include "base/callback_forward.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "content/common/content_export.h"
14 #include "third_party/WebKit/public/platform/modules/notifications/WebNotificationPermission.h"
16 class GURL;
17 class SkBitmap;
19 namespace content {
21 class BrowserContext;
22 class DesktopNotificationDelegate;
23 struct PlatformNotificationData;
24 class ResourceContext;
26 // The service using which notifications can be presented to the user. There
27 // should be a unique instance of the PlatformNotificationService depending
28 // on the browsing context being used.
29 class CONTENT_EXPORT PlatformNotificationService {
30 public:
31 virtual ~PlatformNotificationService() {}
33 // Checks if |origin| has permission to display Web Notifications.
34 // This method must only be called on the UI thread.
35 virtual blink::WebNotificationPermission CheckPermissionOnUIThread(
36 BrowserContext* browser_context,
37 const GURL& origin,
38 int render_process_id) = 0;
40 // Checks if |origin| has permission to display Web Notifications. This method
41 // exists to serve the synchronous IPC required by the Notification.permission
42 // JavaScript getter, and should not be used for other purposes. See
43 // https://crbug.com/446497 for the plan to deprecate this method.
44 // This method must only be called on the IO thread.
45 virtual blink::WebNotificationPermission CheckPermissionOnIOThread(
46 ResourceContext* resource_context,
47 const GURL& origin,
48 int render_process_id) = 0;
50 // Displays the notification described in |params| to the user. A closure
51 // through which the notification can be closed will be stored in the
52 // |cancel_callback| argument. This method must be called on the UI thread.
53 virtual void DisplayNotification(
54 BrowserContext* browser_context,
55 const GURL& origin,
56 const SkBitmap& icon,
57 const PlatformNotificationData& notification_data,
58 scoped_ptr<DesktopNotificationDelegate> delegate,
59 base::Closure* cancel_callback) = 0;
61 // Displays the persistent notification described in |notification_data| to
62 // the user. This method must be called on the UI thread.
63 virtual void DisplayPersistentNotification(
64 BrowserContext* browser_context,
65 int64_t persistent_notification_id,
66 const GURL& origin,
67 const SkBitmap& icon,
68 const PlatformNotificationData& notification_data) = 0;
70 // Closes the persistent notification identified by
71 // |persistent_notification_id|. This method must be called on the UI thread.
72 virtual void ClosePersistentNotification(
73 BrowserContext* browser_context,
74 int64_t persistent_notification_id) = 0;
77 } // namespace content
79 #endif // CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_SERVICE_H_