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

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

Issue 1861683002: Background service worker push message processing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dcheck ordering Created 4 years, 8 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 | « chrome/common/pref_names.cc ('k') | content/public/browser/push_messaging_service.cc » ('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_PUSH_MESSAGING_SERVICE_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_PUSH_MESSAGING_SERVICE_H_
6 #define CONTENT_PUBLIC_BROWSER_PUSH_MESSAGING_SERVICE_H_ 6 #define CONTENT_PUBLIC_BROWSER_PUSH_MESSAGING_SERVICE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 23 matching lines...) Expand all
34 34
35 using EncryptionInfoCallback = base::Callback<void( 35 using EncryptionInfoCallback = base::Callback<void(
36 bool success, 36 bool success,
37 const std::vector<uint8_t>& p256dh, 37 const std::vector<uint8_t>& p256dh,
38 const std::vector<uint8_t>& auth)>; 38 const std::vector<uint8_t>& auth)>;
39 39
40 using StringCallback = base::Callback<void(const std::string& data, 40 using StringCallback = base::Callback<void(const std::string& data,
41 bool success, 41 bool success,
42 bool not_found)>; 42 bool not_found)>;
43 43
44 using ResultCallback = base::Callback<void(bool success)>;
45
46 virtual ~PushMessagingService() {} 44 virtual ~PushMessagingService() {}
47 45
48 // Returns the absolute URL exposed by the push server where the webapp server 46 // Returns the absolute URL exposed by the push server where the webapp server
49 // can send push messages. This is currently assumed to be the same for all 47 // can send push messages. This is currently assumed to be the same for all
50 // origins and push registrations. 48 // origins and push registrations.
51 virtual GURL GetPushEndpoint() = 0; 49 virtual GURL GetPushEndpoint() = 0;
52 50
53 // Subscribe the given |options.sender_info| with the push messaging service 51 // Subscribe the given |options.sender_info| with the push messaging service
54 // in a document context. The frame is known and a permission UI may be 52 // in a document context. The frame is known and a permission UI may be
55 // displayed to the user. 53 // displayed to the user.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // resulting in visible effects to the user. 85 // resulting in visible effects to the user.
88 virtual blink::WebPushPermissionStatus GetPermissionStatus( 86 virtual blink::WebPushPermissionStatus GetPermissionStatus(
89 const GURL& origin, 87 const GURL& origin,
90 bool user_visible) = 0; 88 bool user_visible) = 0;
91 89
92 // Returns whether subscriptions that do not mandate user visible UI upon 90 // Returns whether subscriptions that do not mandate user visible UI upon
93 // receiving a push message are supported. Influences permission request and 91 // receiving a push message are supported. Influences permission request and
94 // permission check behaviour. 92 // permission check behaviour.
95 virtual bool SupportNonVisibleMessages() = 0; 93 virtual bool SupportNonVisibleMessages() = 0;
96 94
97 // Provide a storage mechanism to read/write an opaque
98 // "notifications_shown_by_last_few_pushes" string associated with a Service
99 // Worker registration. Stored data is deleted when the associated
100 // registration is deleted.
101 static void GetNotificationsShownByLastFewPushes(
102 ServiceWorkerContext* service_worker_context,
103 int64_t service_worker_registration_id,
104 const StringCallback& callback);
105 static void SetNotificationsShownByLastFewPushes(
106 ServiceWorkerContext* service_worker_context,
107 int64_t service_worker_registration_id,
108 const GURL& origin,
109 const std::string& notifications_shown,
110 const ResultCallback& callback);
111
112 protected: 95 protected:
113 static void GetSenderId(BrowserContext* browser_context, 96 static void GetSenderId(BrowserContext* browser_context,
114 const GURL& origin, 97 const GURL& origin,
115 int64_t service_worker_registration_id, 98 int64_t service_worker_registration_id,
116 const StringCallback& callback); 99 const StringCallback& callback);
117 100
118 // Clear the push subscription id stored in the service worker with the given 101 // Clear the push subscription id stored in the service worker with the given
119 // |service_worker_registration_id| for the given |origin|. 102 // |service_worker_registration_id| for the given |origin|.
120 static void ClearPushSubscriptionID(BrowserContext* browser_context, 103 static void ClearPushSubscriptionID(BrowserContext* browser_context,
121 const GURL& origin, 104 const GURL& origin,
122 int64_t service_worker_registration_id, 105 int64_t service_worker_registration_id,
123 const base::Closure& callback); 106 const base::Closure& callback);
124 }; 107 };
125 108
126 } // namespace content 109 } // namespace content
127 110
128 #endif // CONTENT_PUBLIC_BROWSER_PUSH_MESSAGING_SERVICE_H_ 111 #endif // CONTENT_PUBLIC_BROWSER_PUSH_MESSAGING_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/common/pref_names.cc ('k') | content/public/browser/push_messaging_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698