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

Side by Side Diff: content/child/push_messaging/push_provider.h

Issue 2133673002: Push API: Implement and ship PushSubscription.options (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add MODULES_EXPORT Created 4 years, 5 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
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_CHILD_PUSH_MESSAGING_PUSH_PROVIDER_H_ 5 #ifndef CONTENT_CHILD_PUSH_MESSAGING_PUSH_PROVIDER_H_
6 #define CONTENT_CHILD_PUSH_MESSAGING_PUSH_PROVIDER_H_ 6 #define CONTENT_CHILD_PUSH_MESSAGING_PUSH_PROVIDER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/id_map.h" 12 #include "base/id_map.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "content/child/push_messaging/push_dispatcher.h" 15 #include "content/child/push_messaging/push_dispatcher.h"
16 #include "content/public/child/worker_thread.h" 16 #include "content/public/child/worker_thread.h"
17 #include "content/public/common/push_messaging_status.h" 17 #include "content/public/common/push_messaging_status.h"
18 #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushError .h" 18 #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushError .h"
19 #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushProvi der.h" 19 #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushProvi der.h"
20 20
21 class GURL; 21 class GURL;
22 22
23 namespace blink { 23 namespace blink {
24 struct WebPushSubscriptionOptions; 24 struct WebPushSubscriptionOptions;
25 } 25 }
26 26
27 namespace content { 27 namespace content {
28 28
29 class ThreadSafeSender; 29 class ThreadSafeSender;
30 struct PushSubscriptionOptions;
30 31
31 class PushProvider : public blink::WebPushProvider, 32 class PushProvider : public blink::WebPushProvider,
32 public WorkerThread::Observer { 33 public WorkerThread::Observer {
33 public: 34 public:
34 ~PushProvider() override; 35 ~PushProvider() override;
35 36
36 // The |thread_safe_sender| and |push_dispatcher| are used if calling this 37 // The |thread_safe_sender| and |push_dispatcher| are used if calling this
37 // leads to construction. 38 // leads to construction.
38 static PushProvider* ThreadSpecificInstance( 39 static PushProvider* ThreadSpecificInstance(
39 ThreadSafeSender* thread_safe_sender, 40 ThreadSafeSender* thread_safe_sender,
(...skipping 21 matching lines...) Expand all
61 // Called by the PushDispatcher. 62 // Called by the PushDispatcher.
62 bool OnMessageReceived(const IPC::Message& message); 63 bool OnMessageReceived(const IPC::Message& message);
63 64
64 private: 65 private:
65 PushProvider(ThreadSafeSender* thread_safe_sender, 66 PushProvider(ThreadSafeSender* thread_safe_sender,
66 PushDispatcher* push_dispatcher); 67 PushDispatcher* push_dispatcher);
67 68
68 // IPC message handlers. 69 // IPC message handlers.
69 void OnSubscribeFromWorkerSuccess(int request_id, 70 void OnSubscribeFromWorkerSuccess(int request_id,
70 const GURL& endpoint, 71 const GURL& endpoint,
72 const PushSubscriptionOptions& options,
71 const std::vector<uint8_t>& p256dh, 73 const std::vector<uint8_t>& p256dh,
72 const std::vector<uint8_t>& auth); 74 const std::vector<uint8_t>& auth);
73 void OnSubscribeFromWorkerError(int request_id, 75 void OnSubscribeFromWorkerError(int request_id,
74 PushRegistrationStatus status); 76 PushRegistrationStatus status);
75 void OnUnsubscribeSuccess(int request_id, bool did_unsubscribe); 77 void OnUnsubscribeSuccess(int request_id, bool did_unsubscribe);
76 void OnUnsubscribeError(int request_id, 78 void OnUnsubscribeError(int request_id,
77 blink::WebPushError::ErrorType error_type, 79 blink::WebPushError::ErrorType error_type,
78 const std::string& error_message); 80 const std::string& error_message);
79 void OnGetSubscriptionSuccess(int request_id, 81 void OnGetSubscriptionSuccess(int request_id,
80 const GURL& endpoint, 82 const GURL& endpoint,
83 const PushSubscriptionOptions& options,
81 const std::vector<uint8_t>& p256dh, 84 const std::vector<uint8_t>& p256dh,
82 const std::vector<uint8_t>& auth); 85 const std::vector<uint8_t>& auth);
83 void OnGetSubscriptionError(int request_id, PushGetRegistrationStatus status); 86 void OnGetSubscriptionError(int request_id, PushGetRegistrationStatus status);
84 void OnGetPermissionStatusSuccess(int request_id, 87 void OnGetPermissionStatusSuccess(int request_id,
85 blink::WebPushPermissionStatus status); 88 blink::WebPushPermissionStatus status);
86 void OnGetPermissionStatusError(int request_id, 89 void OnGetPermissionStatusError(int request_id,
87 blink::WebPushError::ErrorType error); 90 blink::WebPushError::ErrorType error);
88 91
89 scoped_refptr<ThreadSafeSender> thread_safe_sender_; 92 scoped_refptr<ThreadSafeSender> thread_safe_sender_;
90 scoped_refptr<PushDispatcher> push_dispatcher_; 93 scoped_refptr<PushDispatcher> push_dispatcher_;
(...skipping 12 matching lines...) Expand all
103 // the callbacks. 106 // the callbacks.
104 IDMap<blink::WebPushUnsubscribeCallbacks, IDMapOwnPointer> 107 IDMap<blink::WebPushUnsubscribeCallbacks, IDMapOwnPointer>
105 unsubscribe_callbacks_; 108 unsubscribe_callbacks_;
106 109
107 DISALLOW_COPY_AND_ASSIGN(PushProvider); 110 DISALLOW_COPY_AND_ASSIGN(PushProvider);
108 }; 111 };
109 112
110 } // namespace content 113 } // namespace content
111 114
112 #endif // CONTENT_CHILD_PUSH_MESSAGING_PUSH_PROVIDER_H_ 115 #endif // CONTENT_CHILD_PUSH_MESSAGING_PUSH_PROVIDER_H_
OLDNEW
« no previous file with comments | « content/browser/push_messaging/push_messaging_message_filter.cc ('k') | content/child/push_messaging/push_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698