Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Side by Side Diff: content/public/browser/platform_notification_service.h

Issue 1634933006: Use NotificationResources instead of a bare SkBitmap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unit tests. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/content_common.gypi ('k') | content/public/common/notification_resources.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 #include <vector>
11 12
12 #include "base/callback_forward.h" 13 #include "base/callback_forward.h"
13 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
14 #include "content/common/content_export.h" 15 #include "content/common/content_export.h"
15 #include "third_party/WebKit/public/platform/modules/notifications/WebNotificati onPermission.h" 16 #include "third_party/WebKit/public/platform/modules/notifications/WebNotificati onPermission.h"
16 17
17 class GURL; 18 class GURL;
18 class SkBitmap;
19 19
20 namespace content { 20 namespace content {
21 21
22 class BrowserContext; 22 class BrowserContext;
23 class DesktopNotificationDelegate; 23 class DesktopNotificationDelegate;
24 struct NotificationResources;
24 struct PlatformNotificationData; 25 struct PlatformNotificationData;
25 class ResourceContext; 26 class ResourceContext;
26 27
27 // 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
28 // should be a unique instance of the PlatformNotificationService depending 29 // should be a unique instance of the PlatformNotificationService depending
29 // on the browsing context being used. 30 // on the browsing context being used.
30 class CONTENT_EXPORT PlatformNotificationService { 31 class CONTENT_EXPORT PlatformNotificationService {
31 public: 32 public:
32 virtual ~PlatformNotificationService() {} 33 virtual ~PlatformNotificationService() {}
33 34
34 // Checks if |origin| has permission to display Web Notifications. 35 // Checks if |origin| has permission to display Web Notifications.
35 // This method must only be called on the UI thread. 36 // This method must only be called on the UI thread.
36 virtual blink::WebNotificationPermission CheckPermissionOnUIThread( 37 virtual blink::WebNotificationPermission CheckPermissionOnUIThread(
37 BrowserContext* browser_context, 38 BrowserContext* browser_context,
38 const GURL& origin, 39 const GURL& origin,
39 int render_process_id) = 0; 40 int render_process_id) = 0;
40 41
41 // Checks if |origin| has permission to display Web Notifications. This method 42 // Checks if |origin| has permission to display Web Notifications. This method
42 // exists to serve the synchronous IPC required by the Notification.permission 43 // exists to serve the synchronous IPC required by the Notification.permission
43 // JavaScript getter, and should not be used for other purposes. See 44 // JavaScript getter, and should not be used for other purposes. See
44 // https://crbug.com/446497 for the plan to deprecate this method. 45 // https://crbug.com/446497 for the plan to deprecate this method.
45 // This method must only be called on the IO thread. 46 // This method must only be called on the IO thread.
46 virtual blink::WebNotificationPermission CheckPermissionOnIOThread( 47 virtual blink::WebNotificationPermission CheckPermissionOnIOThread(
47 ResourceContext* resource_context, 48 ResourceContext* resource_context,
48 const GURL& origin, 49 const GURL& origin,
49 int render_process_id) = 0; 50 int render_process_id) = 0;
50 51
51 // Displays the notification described in |params| to the user. A closure 52 // Displays the notification described in |notification_data| to the user. A
52 // through which the notification can be closed will be stored in the 53 // closure 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 // |cancel_callback| argument. This method must be called on the UI thread.
54 virtual void DisplayNotification( 55 virtual void DisplayNotification(
55 BrowserContext* browser_context, 56 BrowserContext* browser_context,
56 const GURL& origin, 57 const GURL& origin,
57 const SkBitmap& icon,
58 const PlatformNotificationData& notification_data, 58 const PlatformNotificationData& notification_data,
59 const NotificationResources& notification_resources,
59 scoped_ptr<DesktopNotificationDelegate> delegate, 60 scoped_ptr<DesktopNotificationDelegate> delegate,
60 base::Closure* cancel_callback) = 0; 61 base::Closure* cancel_callback) = 0;
61 62
62 // Displays the persistent notification described in |notification_data| to 63 // Displays the persistent notification described in |notification_data| to
63 // the user. This method must be called on the UI thread. 64 // the user. This method must be called on the UI thread.
64 virtual void DisplayPersistentNotification( 65 virtual void DisplayPersistentNotification(
65 BrowserContext* browser_context, 66 BrowserContext* browser_context,
66 int64_t persistent_notification_id, 67 int64_t persistent_notification_id,
67 const GURL& origin, 68 const GURL& origin,
68 const SkBitmap& icon, 69 const PlatformNotificationData& notification_data,
69 const PlatformNotificationData& notification_data) = 0; 70 const NotificationResources& notification_resources) = 0;
70 71
71 // Closes the persistent notification identified by 72 // Closes the persistent notification identified by
72 // |persistent_notification_id|. This method must be called on the UI thread. 73 // |persistent_notification_id|. This method must be called on the UI thread.
73 virtual void ClosePersistentNotification( 74 virtual void ClosePersistentNotification(
74 BrowserContext* browser_context, 75 BrowserContext* browser_context,
75 int64_t persistent_notification_id) = 0; 76 int64_t persistent_notification_id) = 0;
76 77
77 // Writes the ids of all currently displaying persistent notifications for the 78 // Writes the ids of all currently displaying persistent notifications for the
78 // given |browser_context| to |displayed_notifications|. Returns whether the 79 // given |browser_context| to |displayed_notifications|. Returns whether the
79 // platform is able to provide such a set. 80 // platform is able to provide such a set.
80 virtual bool GetDisplayedPersistentNotifications( 81 virtual bool GetDisplayedPersistentNotifications(
81 BrowserContext* browser_context, 82 BrowserContext* browser_context,
82 std::set<std::string>* displayed_notifications) = 0; 83 std::set<std::string>* displayed_notifications) = 0;
83 }; 84 };
84 85
85 } // namespace content 86 } // namespace content
86 87
87 #endif // CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_SERVICE_H_ 88 #endif // CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_SERVICE_H_
OLDNEW
« no previous file with comments | « content/content_common.gypi ('k') | content/public/common/notification_resources.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698