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/service_worker/service_worker_script_context.h" | 5 #include "content/renderer/service_worker/service_worker_script_context.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "content/child/notifications/notification_data_conversions.h" | 10 #include "content/child/notifications/notification_data_conversions.h" |
11 #include "content/child/thread_safe_sender.h" | 11 #include "content/child/thread_safe_sender.h" |
12 #include "content/child/webmessageportchannel_impl.h" | 12 #include "content/child/webmessageportchannel_impl.h" |
13 #include "content/common/message_port_messages.h" | 13 #include "content/common/message_port_messages.h" |
14 #include "content/common/service_worker/service_worker_messages.h" | 14 #include "content/common/service_worker/service_worker_messages.h" |
| 15 #include "content/public/common/referrer.h" |
15 #include "content/renderer/service_worker/embedded_worker_context_client.h" | 16 #include "content/renderer/service_worker/embedded_worker_context_client.h" |
16 #include "ipc/ipc_message.h" | 17 #include "ipc/ipc_message.h" |
17 #include "third_party/WebKit/public/platform/WebCrossOriginServiceWorkerClient.h
" | 18 #include "third_party/WebKit/public/platform/WebCrossOriginServiceWorkerClient.h
" |
18 #include "third_party/WebKit/public/platform/WebNotificationData.h" | 19 #include "third_party/WebKit/public/platform/WebNotificationData.h" |
19 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" | 20 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" |
20 #include "third_party/WebKit/public/platform/WebServiceWorkerRequest.h" | 21 #include "third_party/WebKit/public/platform/WebServiceWorkerRequest.h" |
21 #include "third_party/WebKit/public/platform/WebString.h" | 22 #include "third_party/WebKit/public/platform/WebString.h" |
22 #include "third_party/WebKit/public/platform/WebURL.h" | 23 #include "third_party/WebKit/public/platform/WebURL.h" |
23 #include "third_party/WebKit/public/web/WebServiceWorkerContextClient.h" | 24 #include "third_party/WebKit/public/web/WebServiceWorkerContextClient.h" |
24 #include "third_party/WebKit/public/web/WebServiceWorkerContextProxy.h" | 25 #include "third_party/WebKit/public/web/WebServiceWorkerContextProxy.h" |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 for (ServiceWorkerHeaderMap::const_iterator it = request.headers.begin(); | 278 for (ServiceWorkerHeaderMap::const_iterator it = request.headers.begin(); |
278 it != request.headers.end(); | 279 it != request.headers.end(); |
279 ++it) { | 280 ++it) { |
280 webRequest.setHeader(blink::WebString::fromUTF8(it->first), | 281 webRequest.setHeader(blink::WebString::fromUTF8(it->first), |
281 blink::WebString::fromUTF8(it->second)); | 282 blink::WebString::fromUTF8(it->second)); |
282 } | 283 } |
283 if (!request.blob_uuid.empty()) { | 284 if (!request.blob_uuid.empty()) { |
284 webRequest.setBlob(blink::WebString::fromUTF8(request.blob_uuid), | 285 webRequest.setBlob(blink::WebString::fromUTF8(request.blob_uuid), |
285 request.blob_size); | 286 request.blob_size); |
286 } | 287 } |
287 webRequest.setReferrer(blink::WebString::fromUTF8(request.referrer.spec()), | 288 webRequest.setReferrer( |
288 blink::WebReferrerPolicyDefault); | 289 blink::WebString::fromUTF8(request.referrer.url.spec()), |
| 290 request.referrer.policy); |
289 webRequest.setMode(GetBlinkFetchRequestMode(request.mode)); | 291 webRequest.setMode(GetBlinkFetchRequestMode(request.mode)); |
290 webRequest.setCredentialsMode( | 292 webRequest.setCredentialsMode( |
291 GetBlinkFetchCredentialsMode(request.credentials_mode)); | 293 GetBlinkFetchCredentialsMode(request.credentials_mode)); |
292 webRequest.setRequestContext( | 294 webRequest.setRequestContext( |
293 GetBlinkRequestContext(request.request_context_type)); | 295 GetBlinkRequestContext(request.request_context_type)); |
294 webRequest.setFrameType(GetBlinkFrameType(request.frame_type)); | 296 webRequest.setFrameType(GetBlinkFrameType(request.frame_type)); |
295 webRequest.setIsReload(request.is_reload); | 297 webRequest.setIsReload(request.is_reload); |
296 fetch_start_timings_[request_id] = base::TimeTicks::Now(); | 298 fetch_start_timings_[request_id] = base::TimeTicks::Now(); |
297 proxy_->dispatchFetchEvent(request_id, webRequest); | 299 proxy_->dispatchFetchEvent(request_id, webRequest); |
298 } | 300 } |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 pending_skip_waiting_callbacks_.Lookup(request_id); | 448 pending_skip_waiting_callbacks_.Lookup(request_id); |
447 if (!callbacks) { | 449 if (!callbacks) { |
448 NOTREACHED() << "Got stray response: " << request_id; | 450 NOTREACHED() << "Got stray response: " << request_id; |
449 return; | 451 return; |
450 } | 452 } |
451 callbacks->onSuccess(); | 453 callbacks->onSuccess(); |
452 pending_skip_waiting_callbacks_.Remove(request_id); | 454 pending_skip_waiting_callbacks_.Remove(request_id); |
453 } | 455 } |
454 | 456 |
455 } // namespace content | 457 } // namespace content |
OLD | NEW |