| 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/renderer/push_messaging/push_messaging_dispatcher.h" | 5 #include "content/renderer/push_messaging/push_messaging_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "content/child/service_worker/web_service_worker_registration_impl.h" | 8 #include "content/child/service_worker/web_service_worker_registration_impl.h" |
| 9 #include "content/common/push_messaging_messages.h" | 9 #include "content/common/push_messaging_messages.h" |
| 10 #include "content/renderer/manifest/manifest_manager.h" | 10 #include "content/renderer/manifest/manifest_manager.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 subscription_callbacks_.Remove(request_id); | 96 subscription_callbacks_.Remove(request_id); |
| 97 } | 97 } |
| 98 | 98 |
| 99 void PushMessagingDispatcher::OnSubscribeFromDocumentError( | 99 void PushMessagingDispatcher::OnSubscribeFromDocumentError( |
| 100 int32_t request_id, | 100 int32_t request_id, |
| 101 PushRegistrationStatus status) { | 101 PushRegistrationStatus status) { |
| 102 blink::WebPushSubscriptionCallbacks* callbacks = | 102 blink::WebPushSubscriptionCallbacks* callbacks = |
| 103 subscription_callbacks_.Lookup(request_id); | 103 subscription_callbacks_.Lookup(request_id); |
| 104 DCHECK(callbacks); | 104 DCHECK(callbacks); |
| 105 | 105 |
| 106 blink::WebPushError::ErrorType error_type = |
| 107 status == PUSH_REGISTRATION_STATUS_PERMISSION_DENIED |
| 108 ? blink::WebPushError::ErrorTypePermissionDenied |
| 109 : blink::WebPushError::ErrorTypeAbort; |
| 110 |
| 106 callbacks->onError(blink::WebPushError( | 111 callbacks->onError(blink::WebPushError( |
| 107 blink::WebPushError::ErrorTypeAbort, | 112 error_type, |
| 108 blink::WebString::fromUTF8(PushRegistrationStatusToString(status)))); | 113 blink::WebString::fromUTF8(PushRegistrationStatusToString(status)))); |
| 109 | 114 |
| 110 subscription_callbacks_.Remove(request_id); | 115 subscription_callbacks_.Remove(request_id); |
| 111 } | 116 } |
| 112 | 117 |
| 113 } // namespace content | 118 } // namespace content |
| OLD | NEW |