Chromium Code Reviews| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 // fetching the manifest. | 48 // fetching the manifest. |
| 49 if (options.applicationServerKey.isEmpty()) { | 49 if (options.applicationServerKey.isEmpty()) { |
| 50 RenderFrameImpl::FromRoutingID(routing_id()) | 50 RenderFrameImpl::FromRoutingID(routing_id()) |
| 51 ->manifest_manager() | 51 ->manifest_manager() |
| 52 ->GetManifest(base::Bind( | 52 ->GetManifest(base::Bind( |
| 53 &PushMessagingDispatcher::DidGetManifest, base::Unretained(this), | 53 &PushMessagingDispatcher::DidGetManifest, base::Unretained(this), |
| 54 service_worker_registration, options, callbacks)); | 54 service_worker_registration, options, callbacks)); |
| 55 } else { | 55 } else { |
| 56 PushSubscriptionOptions content_options; | 56 PushSubscriptionOptions content_options; |
| 57 content_options.user_visible_only = options.userVisibleOnly; | 57 content_options.user_visible_only = options.userVisibleOnly; |
| 58 content_options.sender_info = options.applicationServerKey.utf8(); | 58 content_options.sender_info = options.applicationServerKey.latin1(); |
|
Michael van Ouwerkerk
2016/03/30 09:50:04
Same here.
harkness
2016/03/30 10:51:49
Done.
| |
| 59 DoSubscribe(service_worker_registration, content_options, callbacks); | 59 DoSubscribe(service_worker_registration, content_options, callbacks); |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 | 62 |
| 63 void PushMessagingDispatcher::DidGetManifest( | 63 void PushMessagingDispatcher::DidGetManifest( |
| 64 blink::WebServiceWorkerRegistration* service_worker_registration, | 64 blink::WebServiceWorkerRegistration* service_worker_registration, |
| 65 const blink::WebPushSubscriptionOptions& options, | 65 const blink::WebPushSubscriptionOptions& options, |
| 66 blink::WebPushSubscriptionCallbacks* callbacks, | 66 blink::WebPushSubscriptionCallbacks* callbacks, |
| 67 const Manifest& manifest) { | 67 const Manifest& manifest) { |
| 68 // Get the sender_info from the manifest since it wasn't provided by | 68 // Get the sender_info from the manifest since it wasn't provided by |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 131 : blink::WebPushError::ErrorTypeAbort; | 131 : blink::WebPushError::ErrorTypeAbort; |
| 132 | 132 |
| 133 callbacks->onError(blink::WebPushError( | 133 callbacks->onError(blink::WebPushError( |
| 134 error_type, | 134 error_type, |
| 135 blink::WebString::fromUTF8(PushRegistrationStatusToString(status)))); | 135 blink::WebString::fromUTF8(PushRegistrationStatusToString(status)))); |
| 136 | 136 |
| 137 subscription_callbacks_.Remove(request_id); | 137 subscription_callbacks_.Remove(request_id); |
| 138 } | 138 } |
| 139 | 139 |
| 140 } // namespace content | 140 } // namespace content |
| OLD | NEW |