| 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 #include "content/child/push_messaging/push_provider.h" | 5 #include "content/child/push_messaging/push_provider.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 int request_id, | 160 int request_id, |
| 161 const GURL& endpoint, | 161 const GURL& endpoint, |
| 162 const PushSubscriptionOptions& options, | 162 const PushSubscriptionOptions& options, |
| 163 const std::vector<uint8_t>& p256dh, | 163 const std::vector<uint8_t>& p256dh, |
| 164 const std::vector<uint8_t>& auth) { | 164 const std::vector<uint8_t>& auth) { |
| 165 blink::WebPushSubscriptionCallbacks* callbacks = | 165 blink::WebPushSubscriptionCallbacks* callbacks = |
| 166 subscription_callbacks_.Lookup(request_id); | 166 subscription_callbacks_.Lookup(request_id); |
| 167 if (!callbacks) | 167 if (!callbacks) |
| 168 return; | 168 return; |
| 169 | 169 |
| 170 callbacks->onSuccess(base::WrapUnique(new blink::WebPushSubscription( | 170 callbacks->onSuccess(base::MakeUnique<blink::WebPushSubscription>( |
| 171 endpoint, options.user_visible_only, | 171 endpoint, options.user_visible_only, |
| 172 blink::WebString::fromLatin1(options.sender_info), p256dh, auth))); | 172 blink::WebString::fromLatin1(options.sender_info), p256dh, auth)); |
| 173 | 173 |
| 174 subscription_callbacks_.Remove(request_id); | 174 subscription_callbacks_.Remove(request_id); |
| 175 } | 175 } |
| 176 | 176 |
| 177 void PushProvider::OnSubscribeFromWorkerError(int request_id, | 177 void PushProvider::OnSubscribeFromWorkerError(int request_id, |
| 178 PushRegistrationStatus status) { | 178 PushRegistrationStatus status) { |
| 179 blink::WebPushSubscriptionCallbacks* callbacks = | 179 blink::WebPushSubscriptionCallbacks* callbacks = |
| 180 subscription_callbacks_.Lookup(request_id); | 180 subscription_callbacks_.Lookup(request_id); |
| 181 if (!callbacks) | 181 if (!callbacks) |
| 182 return; | 182 return; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 int request_id, | 222 int request_id, |
| 223 const GURL& endpoint, | 223 const GURL& endpoint, |
| 224 const PushSubscriptionOptions& options, | 224 const PushSubscriptionOptions& options, |
| 225 const std::vector<uint8_t>& p256dh, | 225 const std::vector<uint8_t>& p256dh, |
| 226 const std::vector<uint8_t>& auth) { | 226 const std::vector<uint8_t>& auth) { |
| 227 blink::WebPushSubscriptionCallbacks* callbacks = | 227 blink::WebPushSubscriptionCallbacks* callbacks = |
| 228 subscription_callbacks_.Lookup(request_id); | 228 subscription_callbacks_.Lookup(request_id); |
| 229 if (!callbacks) | 229 if (!callbacks) |
| 230 return; | 230 return; |
| 231 | 231 |
| 232 callbacks->onSuccess(base::WrapUnique(new blink::WebPushSubscription( | 232 callbacks->onSuccess(base::MakeUnique<blink::WebPushSubscription>( |
| 233 endpoint, options.user_visible_only, | 233 endpoint, options.user_visible_only, |
| 234 blink::WebString::fromLatin1(options.sender_info), p256dh, auth))); | 234 blink::WebString::fromLatin1(options.sender_info), p256dh, auth)); |
| 235 | 235 |
| 236 subscription_callbacks_.Remove(request_id); | 236 subscription_callbacks_.Remove(request_id); |
| 237 } | 237 } |
| 238 | 238 |
| 239 void PushProvider::OnGetSubscriptionError(int request_id, | 239 void PushProvider::OnGetSubscriptionError(int request_id, |
| 240 PushGetRegistrationStatus status) { | 240 PushGetRegistrationStatus status) { |
| 241 blink::WebPushSubscriptionCallbacks* callbacks = | 241 blink::WebPushSubscriptionCallbacks* callbacks = |
| 242 subscription_callbacks_.Lookup(request_id); | 242 subscription_callbacks_.Lookup(request_id); |
| 243 if (!callbacks) | 243 if (!callbacks) |
| 244 return; | 244 return; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 "supported."; | 277 "supported."; |
| 278 } | 278 } |
| 279 | 279 |
| 280 callbacks->onError( | 280 callbacks->onError( |
| 281 blink::WebPushError(error, blink::WebString::fromUTF8(error_message))); | 281 blink::WebPushError(error, blink::WebString::fromUTF8(error_message))); |
| 282 | 282 |
| 283 permission_status_callbacks_.Remove(request_id); | 283 permission_status_callbacks_.Remove(request_id); |
| 284 } | 284 } |
| 285 | 285 |
| 286 } // namespace content | 286 } // namespace content |
| OLD | NEW |