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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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; |
183 | 183 |
184 blink::WebPushError::ErrorType error_type = | 184 blink::WebPushError::ErrorType error_type = |
185 status == PUSH_REGISTRATION_STATUS_PERMISSION_DENIED | 185 status == PUSH_REGISTRATION_STATUS_PERMISSION_DENIED |
186 ? blink::WebPushError::ErrorTypePermissionDenied | 186 ? blink::WebPushError::ErrorTypeNotAllowed |
187 : blink::WebPushError::ErrorTypeAbort; | 187 : blink::WebPushError::ErrorTypeAbort; |
188 | 188 |
189 callbacks->onError(blink::WebPushError( | 189 callbacks->onError(blink::WebPushError( |
190 error_type, | 190 error_type, |
191 blink::WebString::fromUTF8(PushRegistrationStatusToString(status)))); | 191 blink::WebString::fromUTF8(PushRegistrationStatusToString(status)))); |
192 | 192 |
193 subscription_callbacks_.Remove(request_id); | 193 subscription_callbacks_.Remove(request_id); |
194 } | 194 } |
195 | 195 |
196 void PushProvider::OnUnsubscribeSuccess(int request_id, bool did_unsubscribe) { | 196 void PushProvider::OnUnsubscribeSuccess(int request_id, bool did_unsubscribe) { |
(...skipping 80 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 |