Update broken references to image assets
[chromium-blink-merge.git] / content / public / browser / platform_notification_service.h
blob6c9e50904cf7506b451842b089cd6ae4ef82c32d
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 <set>
10 #include <string>
12 #include "base/callback_forward.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "content/common/content_export.h"
15 #include "third_party/WebKit/public/platform/modules/notifications/WebNotificationPermission.h"
17 class GURL;
18 class SkBitmap;
20 namespace content {
22 class BrowserContext;
23 class DesktopNotificationDelegate;
24 struct PlatformNotificationData;
25 class ResourceContext;
27 // The service using which notifications can be presented to the user. There
28 // should be a unique instance of the PlatformNotificationService depending
29 // on the browsing context being used.
30 class CONTENT_EXPORT PlatformNotificationService {
31 public:
32 virtual ~PlatformNotificationService() {}
34 // Checks if |origin| has permission to display Web Notifications.
35 // This method must only be called on the UI thread.
36 virtual blink::WebNotificationPermission CheckPermissionOnUIThread(
37 BrowserContext* browser_context,
38 const GURL& origin,
39 int render_process_id) = 0;
41 // Checks if |origin| has permission to display Web Notifications. This method
42 // exists to serve the synchronous IPC required by the Notification.permission
43 // JavaScript getter, and should not be used for other purposes. See
44 // https://crbug.com/446497 for the plan to deprecate this method.
45 // This method must only be called on the IO thread.
46 virtual blink::WebNotificationPermission CheckPermissionOnIOThread(
47 ResourceContext* resource_context,
48 const GURL& origin,
49 int render_process_id) = 0;
51 // Displays the notification described in |params| to the user. A closure
52 // through which the notification can be closed will be stored in the
53 // |cancel_callback| argument. This method must be called on the UI thread.
54 virtual void DisplayNotification(
55 BrowserContext* browser_context,
56 const GURL& origin,
57 const SkBitmap& icon,
58 const PlatformNotificationData& notification_data,
59 scoped_ptr<DesktopNotificationDelegate> delegate,
60 base::Closure* cancel_callback) = 0;
62 // Displays the persistent notification described in |notification_data| to
63 // the user. This method must be called on the UI thread.
64 virtual void DisplayPersistentNotification(
65 BrowserContext* browser_context,
66 int64_t persistent_notification_id,
67 const GURL& origin,
68 const SkBitmap& icon,
69 const PlatformNotificationData& notification_data) = 0;
71 // Closes the persistent notification identified by
72 // |persistent_notification_id|. This method must be called on the UI thread.
73 virtual void ClosePersistentNotification(
74 BrowserContext* browser_context,
75 int64_t persistent_notification_id) = 0;
77 // Writes the ids of all currently displaying persistent notifications for the
78 // given |browser_context| to |displayed_notifications|. Returns whether the
79 // platform is able to provide such a set.
80 virtual bool GetDisplayedPersistentNotifications(
81 BrowserContext* browser_context,
82 std::set<std::string>* displayed_notifications) = 0;
85 } // namespace content
87 #endif // CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_SERVICE_H_