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

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

Issue 1865913005: Nuke WebPassOwnPtr<T> and replace it with std::unique_ptr<T>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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
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 #include "content/child/push_messaging/push_provider.h" 5 #include "content/child/push_messaging/push_provider.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/memory/ptr_util.h"
8 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
9 #include "base/stl_util.h" 10 #include "base/stl_util.h"
10 #include "base/threading/thread_local.h" 11 #include "base/threading/thread_local.h"
11 #include "content/child/push_messaging/push_dispatcher.h" 12 #include "content/child/push_messaging/push_dispatcher.h"
12 #include "content/child/service_worker/web_service_worker_registration_impl.h" 13 #include "content/child/service_worker/web_service_worker_registration_impl.h"
13 #include "content/child/thread_safe_sender.h" 14 #include "content/child/thread_safe_sender.h"
14 #include "content/common/push_messaging_messages.h" 15 #include "content/common/push_messaging_messages.h"
15 #include "third_party/WebKit/public/platform/WebString.h" 16 #include "third_party/WebKit/public/platform/WebString.h"
16 #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushSubsc ription.h" 17 #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushSubsc ription.h"
17 #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushSubsc riptionOptions.h" 18 #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushSubsc riptionOptions.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 void PushProvider::OnSubscribeFromWorkerSuccess( 155 void PushProvider::OnSubscribeFromWorkerSuccess(
155 int request_id, 156 int request_id,
156 const GURL& endpoint, 157 const GURL& endpoint,
157 const std::vector<uint8_t>& p256dh, 158 const std::vector<uint8_t>& p256dh,
158 const std::vector<uint8_t>& auth) { 159 const std::vector<uint8_t>& auth) {
159 blink::WebPushSubscriptionCallbacks* callbacks = 160 blink::WebPushSubscriptionCallbacks* callbacks =
160 subscription_callbacks_.Lookup(request_id); 161 subscription_callbacks_.Lookup(request_id);
161 if (!callbacks) 162 if (!callbacks)
162 return; 163 return;
163 164
164 callbacks->onSuccess(blink::adoptWebPtr( 165 callbacks->onSuccess(
165 new blink::WebPushSubscription(endpoint, p256dh, auth))); 166 base::WrapUnique(new blink::WebPushSubscription(endpoint, p256dh, auth)));
166 167
167 subscription_callbacks_.Remove(request_id); 168 subscription_callbacks_.Remove(request_id);
168 } 169 }
169 170
170 void PushProvider::OnSubscribeFromWorkerError(int request_id, 171 void PushProvider::OnSubscribeFromWorkerError(int request_id,
171 PushRegistrationStatus status) { 172 PushRegistrationStatus status) {
172 blink::WebPushSubscriptionCallbacks* callbacks = 173 blink::WebPushSubscriptionCallbacks* callbacks =
173 subscription_callbacks_.Lookup(request_id); 174 subscription_callbacks_.Lookup(request_id);
174 if (!callbacks) 175 if (!callbacks)
175 return; 176 return;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 void PushProvider::OnGetSubscriptionSuccess( 215 void PushProvider::OnGetSubscriptionSuccess(
215 int request_id, 216 int request_id,
216 const GURL& endpoint, 217 const GURL& endpoint,
217 const std::vector<uint8_t>& p256dh, 218 const std::vector<uint8_t>& p256dh,
218 const std::vector<uint8_t>& auth) { 219 const std::vector<uint8_t>& auth) {
219 blink::WebPushSubscriptionCallbacks* callbacks = 220 blink::WebPushSubscriptionCallbacks* callbacks =
220 subscription_callbacks_.Lookup(request_id); 221 subscription_callbacks_.Lookup(request_id);
221 if (!callbacks) 222 if (!callbacks)
222 return; 223 return;
223 224
224 callbacks->onSuccess(blink::adoptWebPtr( 225 callbacks->onSuccess(
225 new blink::WebPushSubscription(endpoint, p256dh, auth))); 226 base::WrapUnique(new blink::WebPushSubscription(endpoint, p256dh, auth)));
226 227
227 subscription_callbacks_.Remove(request_id); 228 subscription_callbacks_.Remove(request_id);
228 } 229 }
229 230
230 void PushProvider::OnGetSubscriptionError(int request_id, 231 void PushProvider::OnGetSubscriptionError(int request_id,
231 PushGetRegistrationStatus status) { 232 PushGetRegistrationStatus status) {
232 blink::WebPushSubscriptionCallbacks* callbacks = 233 blink::WebPushSubscriptionCallbacks* callbacks =
233 subscription_callbacks_.Lookup(request_id); 234 subscription_callbacks_.Lookup(request_id);
234 if (!callbacks) 235 if (!callbacks)
235 return; 236 return;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 "supported."; 269 "supported.";
269 } 270 }
270 271
271 callbacks->onError( 272 callbacks->onError(
272 blink::WebPushError(error, blink::WebString::fromUTF8(error_message))); 273 blink::WebPushError(error, blink::WebString::fromUTF8(error_message)));
273 274
274 permission_status_callbacks_.Remove(request_id); 275 permission_status_callbacks_.Remove(request_id);
275 } 276 }
276 277
277 } // namespace content 278 } // namespace content
OLDNEW
« no previous file with comments | « content/child/permissions/permission_dispatcher.cc ('k') | content/child/service_worker/service_worker_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698