OLD | NEW |
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_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_MESSAGE_FILTER_H_ | 5 #ifndef CONTENT_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_MESSAGE_FILTER_H_ |
6 #define CONTENT_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_MESSAGE_FILTER_H_ | 6 #define CONTENT_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_MESSAGE_FILTER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 void OnSubscribe(int render_frame_id, | 52 void OnSubscribe(int render_frame_id, |
53 int request_id, | 53 int request_id, |
54 int64_t service_worker_registration_id, | 54 int64_t service_worker_registration_id, |
55 const PushSubscriptionOptions& options); | 55 const PushSubscriptionOptions& options); |
56 | 56 |
57 void DidCheckForExistingRegistration( | 57 void DidCheckForExistingRegistration( |
58 const RegisterData& data, | 58 const RegisterData& data, |
59 const std::vector<std::string>& push_registration_id, | 59 const std::vector<std::string>& push_registration_id, |
60 ServiceWorkerStatusCode service_worker_status); | 60 ServiceWorkerStatusCode service_worker_status); |
61 | 61 |
62 void DidGetEncryptionKeys(const RegisterData& data, | |
63 const std::string& push_registration_id, | |
64 bool success, | |
65 const std::vector<uint8_t>& p256dh, | |
66 const std::vector<uint8_t>& auth); | |
67 | |
68 void DidGetSenderIdFromStorage(const RegisterData& data, | 62 void DidGetSenderIdFromStorage(const RegisterData& data, |
69 const std::vector<std::string>& sender_id, | 63 const std::vector<std::string>& sender_id, |
70 ServiceWorkerStatusCode service_worker_status); | 64 ServiceWorkerStatusCode service_worker_status); |
71 | 65 |
72 // Called via PostTask from UI thread. | 66 // Called via PostTask from UI thread. |
73 void PersistRegistrationOnIO(const RegisterData& data, | 67 void PersistRegistrationOnIO(const RegisterData& data, |
74 const std::string& push_registration_id, | 68 const std::string& push_registration_id, |
75 const std::vector<uint8_t>& p256dh, | 69 const std::vector<uint8_t>& p256dh, |
76 const std::vector<uint8_t>& auth); | 70 const std::vector<uint8_t>& auth); |
77 | 71 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 105 |
112 void OnGetSubscription(int request_id, | 106 void OnGetSubscription(int request_id, |
113 int64_t service_worker_registration_id); | 107 int64_t service_worker_registration_id); |
114 | 108 |
115 void DidGetSubscription( | 109 void DidGetSubscription( |
116 int request_id, | 110 int request_id, |
117 int64_t service_worker_registration_id, | 111 int64_t service_worker_registration_id, |
118 const std::vector<std::string>& push_subscription_id_and_sender_info, | 112 const std::vector<std::string>& push_subscription_id_and_sender_info, |
119 ServiceWorkerStatusCode service_worker_status); | 113 ServiceWorkerStatusCode service_worker_status); |
120 | 114 |
121 void DidGetSubscriptionKeys(int request_id, | |
122 const GURL& endpoint, | |
123 const std::string& sender_info, | |
124 bool success, | |
125 const std::vector<uint8_t>& p256dh, | |
126 const std::vector<uint8_t>& auth); | |
127 | |
128 // GetPermission methods on IO thread ---------------------------------------- | 115 // GetPermission methods on IO thread ---------------------------------------- |
129 | 116 |
130 void OnGetPermissionStatus(int request_id, | 117 void OnGetPermissionStatus(int request_id, |
131 int64_t service_worker_registration_id, | 118 int64_t service_worker_registration_id, |
132 bool user_visible); | 119 bool user_visible); |
133 | 120 |
134 // Helper methods on IO thread ----------------------------------------------- | 121 // Helper methods on IO thread ----------------------------------------------- |
135 | 122 |
136 // Called via PostTask from UI thread. | 123 // Called via PostTask from UI thread. |
137 void SendIPC(std::unique_ptr<IPC::Message> message); | 124 void SendIPC(std::unique_ptr<IPC::Message> message); |
138 | 125 |
139 // Helper methods on either thread ------------------------------------------- | 126 // Helper methods on either thread ------------------------------------------- |
140 | 127 |
141 // Creates an endpoint for |subscription_id| with either the default protocol, | 128 // Creates an endpoint for |subscription_id| with either the default protocol, |
142 // or the standardized Web Push Protocol, depending on |standard_protocol|. | 129 // or the standardized Web Push Protocol, depending on |standard_protocol|. |
143 GURL CreateEndpoint(bool standard_protocol, | 130 GURL CreateEndpoint(bool standard_protocol, |
144 const std::string& subscription_id) const; | 131 const std::string& subscription_id) const; |
145 | 132 |
146 // Inner core of this message filter which lives on the UI thread. | 133 // Inner core of this message filter which lives on the UI thread. |
147 std::unique_ptr<Core, BrowserThread::DeleteOnUIThread> ui_core_; | 134 std::unique_ptr<Core, BrowserThread::DeleteOnUIThread> ui_core_; |
| 135 base::WeakPtr<Core> ui_core_weak_ptr_; |
148 | 136 |
149 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; | 137 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; |
150 | 138 |
151 // Whether the PushMessagingService was available when constructed. | 139 // Whether the PushMessagingService was available when constructed. |
152 bool service_available_; | 140 bool service_available_; |
153 | 141 |
154 GURL default_endpoint_; | 142 GURL default_endpoint_; |
155 GURL web_push_protocol_endpoint_; | 143 GURL web_push_protocol_endpoint_; |
156 | 144 |
157 base::WeakPtrFactory<PushMessagingMessageFilter> weak_factory_io_to_io_; | 145 base::WeakPtrFactory<PushMessagingMessageFilter> weak_factory_io_to_io_; |
158 | 146 |
159 DISALLOW_COPY_AND_ASSIGN(PushMessagingMessageFilter); | 147 DISALLOW_COPY_AND_ASSIGN(PushMessagingMessageFilter); |
160 }; | 148 }; |
161 | 149 |
162 } // namespace content | 150 } // namespace content |
163 | 151 |
164 #endif // CONTENT_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_MESSAGE_FILTER_H_ | 152 #endif // CONTENT_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_MESSAGE_FILTER_H_ |
OLD | NEW |