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 21 matching lines...) Expand all Loading... |
32 IPC_BEGIN_MESSAGE_MAP(PushMessagingDispatcher, message) | 32 IPC_BEGIN_MESSAGE_MAP(PushMessagingDispatcher, message) |
33 IPC_MESSAGE_HANDLER(PushMessagingMsg_SubscribeFromDocumentSuccess, | 33 IPC_MESSAGE_HANDLER(PushMessagingMsg_SubscribeFromDocumentSuccess, |
34 OnSubscribeFromDocumentSuccess) | 34 OnSubscribeFromDocumentSuccess) |
35 IPC_MESSAGE_HANDLER(PushMessagingMsg_SubscribeFromDocumentError, | 35 IPC_MESSAGE_HANDLER(PushMessagingMsg_SubscribeFromDocumentError, |
36 OnSubscribeFromDocumentError) | 36 OnSubscribeFromDocumentError) |
37 IPC_MESSAGE_UNHANDLED(handled = false) | 37 IPC_MESSAGE_UNHANDLED(handled = false) |
38 IPC_END_MESSAGE_MAP() | 38 IPC_END_MESSAGE_MAP() |
39 return handled; | 39 return handled; |
40 } | 40 } |
41 | 41 |
| 42 void PushMessagingDispatcher::OnDestruct() { |
| 43 delete this; |
| 44 } |
| 45 |
42 void PushMessagingDispatcher::subscribe( | 46 void PushMessagingDispatcher::subscribe( |
43 blink::WebServiceWorkerRegistration* service_worker_registration, | 47 blink::WebServiceWorkerRegistration* service_worker_registration, |
44 const blink::WebPushSubscriptionOptions& options, | 48 const blink::WebPushSubscriptionOptions& options, |
45 blink::WebPushSubscriptionCallbacks* callbacks) { | 49 blink::WebPushSubscriptionCallbacks* callbacks) { |
46 DCHECK(service_worker_registration); | 50 DCHECK(service_worker_registration); |
47 DCHECK(callbacks); | 51 DCHECK(callbacks); |
48 // If a developer provided an application server key in |options|, skip | 52 // If a developer provided an application server key in |options|, skip |
49 // fetching the manifest. | 53 // fetching the manifest. |
50 if (options.applicationServerKey.isEmpty()) { | 54 if (options.applicationServerKey.isEmpty()) { |
51 RenderFrameImpl::FromRoutingID(routing_id()) | 55 RenderFrameImpl::FromRoutingID(routing_id()) |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 : blink::WebPushError::ErrorTypeAbort; | 139 : blink::WebPushError::ErrorTypeAbort; |
136 | 140 |
137 callbacks->onError(blink::WebPushError( | 141 callbacks->onError(blink::WebPushError( |
138 error_type, | 142 error_type, |
139 blink::WebString::fromUTF8(PushRegistrationStatusToString(status)))); | 143 blink::WebString::fromUTF8(PushRegistrationStatusToString(status)))); |
140 | 144 |
141 subscription_callbacks_.Remove(request_id); | 145 subscription_callbacks_.Remove(request_id); |
142 } | 146 } |
143 | 147 |
144 } // namespace content | 148 } // namespace content |
OLD | NEW |