OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/service_worker/service_worker_context_client.h" | 5 #include "content/renderer/service_worker/service_worker_context_client.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <memory> | 8 #include <memory> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 #include "net/http/http_response_headers.h" | 58 #include "net/http/http_response_headers.h" |
59 #include "third_party/WebKit/public/platform/InterfaceProvider.h" | 59 #include "third_party/WebKit/public/platform/InterfaceProvider.h" |
60 #include "third_party/WebKit/public/platform/URLConversion.h" | 60 #include "third_party/WebKit/public/platform/URLConversion.h" |
61 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h" | 61 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h" |
62 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" | 62 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" |
63 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 63 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
64 #include "third_party/WebKit/public/platform/WebString.h" | 64 #include "third_party/WebKit/public/platform/WebString.h" |
65 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 65 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
66 #include "third_party/WebKit/public/platform/modules/background_fetch/WebBackgro
undFetchSettledFetch.h" | 66 #include "third_party/WebKit/public/platform/modules/background_fetch/WebBackgro
undFetchSettledFetch.h" |
67 #include "third_party/WebKit/public/platform/modules/notifications/WebNotificati
onData.h" | 67 #include "third_party/WebKit/public/platform/modules/notifications/WebNotificati
onData.h" |
68 #include "third_party/WebKit/public/platform/modules/payments/WebPaymentAppReque
st.h" | |
69 #include "third_party/WebKit/public/platform/modules/payments/WebPaymentAppRespo
nse.h" | 68 #include "third_party/WebKit/public/platform/modules/payments/WebPaymentAppRespo
nse.h" |
| 69 #include "third_party/WebKit/public/platform/modules/payments/WebPaymentRequestE
ventData.h" |
70 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerClientQueryOptions.h" | 70 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerClientQueryOptions.h" |
71 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerError.h" | 71 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerError.h" |
72 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerNetworkProvider.h" | 72 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerNetworkProvider.h" |
73 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerRequest.h" | 73 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerRequest.h" |
74 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerResponse.h" | 74 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerResponse.h" |
75 #include "third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerCo
ntextClient.h" | 75 #include "third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerCo
ntextClient.h" |
76 #include "third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerCo
ntextProxy.h" | 76 #include "third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerCo
ntextProxy.h" |
77 | 77 |
78 namespace content { | 78 namespace content { |
79 | 79 |
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1208 last_chance); | 1208 last_chance); |
1209 | 1209 |
1210 // TODO(jkarlin): Make this blink::WebString::FromUTF8Lenient once | 1210 // TODO(jkarlin): Make this blink::WebString::FromUTF8Lenient once |
1211 // https://crrev.com/1768063002/ lands. | 1211 // https://crrev.com/1768063002/ lands. |
1212 proxy_->DispatchSyncEvent(request_id, blink::WebString::FromUTF8(tag), | 1212 proxy_->DispatchSyncEvent(request_id, blink::WebString::FromUTF8(tag), |
1213 web_last_chance); | 1213 web_last_chance); |
1214 } | 1214 } |
1215 | 1215 |
1216 void ServiceWorkerContextClient::DispatchPaymentRequestEvent( | 1216 void ServiceWorkerContextClient::DispatchPaymentRequestEvent( |
1217 int payment_request_id, | 1217 int payment_request_id, |
1218 payments::mojom::PaymentAppRequestPtr app_request, | 1218 payments::mojom::PaymentRequestEventDataPtr eventData, |
1219 payments::mojom::PaymentAppResponseCallbackPtr response_callback, | 1219 payments::mojom::PaymentAppResponseCallbackPtr response_callback, |
1220 DispatchPaymentRequestEventCallback callback) { | 1220 DispatchPaymentRequestEventCallback callback) { |
1221 TRACE_EVENT0("ServiceWorker", | 1221 TRACE_EVENT0("ServiceWorker", |
1222 "ServiceWorkerContextClient::DispatchPaymentRequestEvent"); | 1222 "ServiceWorkerContextClient::DispatchPaymentRequestEvent"); |
1223 context_->payment_response_callbacks.insert( | 1223 context_->payment_response_callbacks.insert( |
1224 std::make_pair(payment_request_id, std::move(response_callback))); | 1224 std::make_pair(payment_request_id, std::move(response_callback))); |
1225 context_->payment_request_event_callbacks.insert( | 1225 context_->payment_request_event_callbacks.insert( |
1226 std::make_pair(payment_request_id, std::move(callback))); | 1226 std::make_pair(payment_request_id, std::move(callback))); |
1227 | 1227 |
1228 blink::WebPaymentAppRequest webAppRequest = | 1228 blink::WebPaymentRequestEventData webEventData = |
1229 mojo::ConvertTo<blink::WebPaymentAppRequest>(std::move(app_request)); | 1229 mojo::ConvertTo<blink::WebPaymentRequestEventData>(std::move(eventData)); |
1230 proxy_->DispatchPaymentRequestEvent(payment_request_id, webAppRequest); | 1230 proxy_->DispatchPaymentRequestEvent(payment_request_id, webEventData); |
1231 } | 1231 } |
1232 | 1232 |
1233 void ServiceWorkerContextClient::Send(IPC::Message* message) { | 1233 void ServiceWorkerContextClient::Send(IPC::Message* message) { |
1234 sender_->Send(message); | 1234 sender_->Send(message); |
1235 } | 1235 } |
1236 | 1236 |
1237 void ServiceWorkerContextClient::SendWorkerStarted() { | 1237 void ServiceWorkerContextClient::SendWorkerStarted() { |
1238 DCHECK(worker_task_runner_->RunsTasksInCurrentSequence()); | 1238 DCHECK(worker_task_runner_->RunsTasksInCurrentSequence()); |
1239 TRACE_EVENT_ASYNC_END0("ServiceWorker", | 1239 TRACE_EVENT_ASYNC_END0("ServiceWorker", |
1240 "ServiceWorkerContextClient::StartingWorkerContext", | 1240 "ServiceWorkerContextClient::StartingWorkerContext", |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1698 } | 1698 } |
1699 | 1699 |
1700 base::WeakPtr<ServiceWorkerContextClient> | 1700 base::WeakPtr<ServiceWorkerContextClient> |
1701 ServiceWorkerContextClient::GetWeakPtr() { | 1701 ServiceWorkerContextClient::GetWeakPtr() { |
1702 DCHECK(worker_task_runner_->RunsTasksInCurrentSequence()); | 1702 DCHECK(worker_task_runner_->RunsTasksInCurrentSequence()); |
1703 DCHECK(context_); | 1703 DCHECK(context_); |
1704 return context_->weak_factory.GetWeakPtr(); | 1704 return context_->weak_factory.GetWeakPtr(); |
1705 } | 1705 } |
1706 | 1706 |
1707 } // namespace content | 1707 } // namespace content |
OLD | NEW |