| 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/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "content/child/push_messaging/push_provider.h" | 9 #include "content/child/push_messaging/push_provider.h" |
| 10 #include "content/child/service_worker/web_service_worker_registration_impl.h" | 10 #include "content/child/service_worker/web_service_worker_registration_impl.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 } | 95 } |
| 96 | 96 |
| 97 void PushMessagingDispatcher::DoSubscribe( | 97 void PushMessagingDispatcher::DoSubscribe( |
| 98 blink::WebServiceWorkerRegistration* service_worker_registration, | 98 blink::WebServiceWorkerRegistration* service_worker_registration, |
| 99 const PushSubscriptionOptions& options, | 99 const PushSubscriptionOptions& options, |
| 100 blink::WebPushSubscriptionCallbacks* callbacks) { | 100 blink::WebPushSubscriptionCallbacks* callbacks) { |
| 101 int request_id = subscription_callbacks_.Add(callbacks); | 101 int request_id = subscription_callbacks_.Add(callbacks); |
| 102 int64_t service_worker_registration_id = | 102 int64_t service_worker_registration_id = |
| 103 static_cast<WebServiceWorkerRegistrationImpl*>( | 103 static_cast<WebServiceWorkerRegistrationImpl*>( |
| 104 service_worker_registration) | 104 service_worker_registration) |
| 105 ->registration_id(); | 105 ->registrationId(); |
| 106 | 106 |
| 107 if (options.sender_info.empty()) { | 107 if (options.sender_info.empty()) { |
| 108 OnSubscribeFromDocumentError(request_id, | 108 OnSubscribeFromDocumentError(request_id, |
| 109 PUSH_REGISTRATION_STATUS_NO_SENDER_ID); | 109 PUSH_REGISTRATION_STATUS_NO_SENDER_ID); |
| 110 return; | 110 return; |
| 111 } | 111 } |
| 112 Send(new PushMessagingHostMsg_Subscribe( | 112 Send(new PushMessagingHostMsg_Subscribe( |
| 113 routing_id(), request_id, service_worker_registration_id, options)); | 113 routing_id(), request_id, service_worker_registration_id, options)); |
| 114 } | 114 } |
| 115 | 115 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 136 blink::WebPushSubscriptionCallbacks* callbacks = | 136 blink::WebPushSubscriptionCallbacks* callbacks = |
| 137 subscription_callbacks_.Lookup(request_id); | 137 subscription_callbacks_.Lookup(request_id); |
| 138 DCHECK(callbacks); | 138 DCHECK(callbacks); |
| 139 | 139 |
| 140 callbacks->onError(PushRegistrationStatusToWebPushError(status)); | 140 callbacks->onError(PushRegistrationStatusToWebPushError(status)); |
| 141 | 141 |
| 142 subscription_callbacks_.Remove(request_id); | 142 subscription_callbacks_.Remove(request_id); |
| 143 } | 143 } |
| 144 | 144 |
| 145 } // namespace content | 145 } // namespace content |
| OLD | NEW |