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/service_worker/web_service_worker_registration_impl.h" | 9 #include "content/child/service_worker/web_service_worker_registration_impl.h" |
10 #include "content/common/push_messaging_messages.h" | 10 #include "content/common/push_messaging_messages.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 int64_t service_worker_registration_id = | 95 int64_t service_worker_registration_id = |
96 static_cast<WebServiceWorkerRegistrationImpl*>( | 96 static_cast<WebServiceWorkerRegistrationImpl*>( |
97 service_worker_registration) | 97 service_worker_registration) |
98 ->registration_id(); | 98 ->registration_id(); |
99 | 99 |
100 if (options.sender_info.empty()) { | 100 if (options.sender_info.empty()) { |
101 OnSubscribeFromDocumentError(request_id, | 101 OnSubscribeFromDocumentError(request_id, |
102 PUSH_REGISTRATION_STATUS_NO_SENDER_ID); | 102 PUSH_REGISTRATION_STATUS_NO_SENDER_ID); |
103 return; | 103 return; |
104 } | 104 } |
105 Send(new PushMessagingHostMsg_SubscribeFromDocument( | 105 Send(new PushMessagingHostMsg_Subscribe( |
106 routing_id(), request_id, options, service_worker_registration_id)); | 106 routing_id(), request_id, service_worker_registration_id, options)); |
107 } | 107 } |
108 | 108 |
109 void PushMessagingDispatcher::OnSubscribeFromDocumentSuccess( | 109 void PushMessagingDispatcher::OnSubscribeFromDocumentSuccess( |
110 int32_t request_id, | 110 int32_t request_id, |
111 const GURL& endpoint, | 111 const GURL& endpoint, |
112 const std::vector<uint8_t>& p256dh, | 112 const std::vector<uint8_t>& p256dh, |
113 const std::vector<uint8_t>& auth) { | 113 const std::vector<uint8_t>& auth) { |
114 blink::WebPushSubscriptionCallbacks* callbacks = | 114 blink::WebPushSubscriptionCallbacks* callbacks = |
115 subscription_callbacks_.Lookup(request_id); | 115 subscription_callbacks_.Lookup(request_id); |
116 DCHECK(callbacks); | 116 DCHECK(callbacks); |
(...skipping 17 matching lines...) Expand all Loading... |
134 : blink::WebPushError::ErrorTypeAbort; | 134 : blink::WebPushError::ErrorTypeAbort; |
135 | 135 |
136 callbacks->onError(blink::WebPushError( | 136 callbacks->onError(blink::WebPushError( |
137 error_type, | 137 error_type, |
138 blink::WebString::fromUTF8(PushRegistrationStatusToString(status)))); | 138 blink::WebString::fromUTF8(PushRegistrationStatusToString(status)))); |
139 | 139 |
140 subscription_callbacks_.Remove(request_id); | 140 subscription_callbacks_.Remove(request_id); |
141 } | 141 } |
142 | 142 |
143 } // namespace content | 143 } // namespace content |
OLD | NEW |