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/browser/service_worker/service_worker_request_handler.h" | 5 #include "content/browser/service_worker/service_worker_request_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 ServiceWorkerProviderHost* provider_host, | 60 ServiceWorkerProviderHost* provider_host, |
61 storage::BlobStorageContext* blob_storage_context, | 61 storage::BlobStorageContext* blob_storage_context, |
62 bool skip_service_worker, | 62 bool skip_service_worker, |
63 FetchRequestMode request_mode, | 63 FetchRequestMode request_mode, |
64 FetchCredentialsMode credentials_mode, | 64 FetchCredentialsMode credentials_mode, |
65 FetchRedirectMode redirect_mode, | 65 FetchRedirectMode redirect_mode, |
66 ResourceType resource_type, | 66 ResourceType resource_type, |
67 RequestContextType request_context_type, | 67 RequestContextType request_context_type, |
68 RequestContextFrameType frame_type, | 68 RequestContextFrameType frame_type, |
69 scoped_refptr<ResourceRequestBodyImpl> body) { | 69 scoped_refptr<ResourceRequestBodyImpl> body) { |
70 if (skip_service_worker) { | |
71 // TODO(horo): Does this work properly for PlzNavigate? | |
72 if (ServiceWorkerUtils::IsMainResourceType(resource_type)) { | |
73 provider_host->SetDocumentUrl(net::SimplifyUrlForRequest(request->url())); | |
74 provider_host->SetTopmostFrameUrl(request->first_party_for_cookies()); | |
75 } | |
76 return; | |
77 } | |
78 | |
79 std::unique_ptr<ServiceWorkerRequestHandler> handler( | 70 std::unique_ptr<ServiceWorkerRequestHandler> handler( |
80 provider_host->CreateRequestHandler( | 71 provider_host->CreateRequestHandler( |
81 request_mode, credentials_mode, redirect_mode, resource_type, | 72 request_mode, credentials_mode, redirect_mode, resource_type, |
82 request_context_type, frame_type, blob_storage_context->AsWeakPtr(), | 73 request_context_type, frame_type, blob_storage_context->AsWeakPtr(), |
83 body)); | 74 body, skip_service_worker)); |
84 if (!handler) | 75 if (!handler) |
85 return; | 76 return; |
86 | 77 |
87 request->SetUserData(&kUserDataKey, handler.release()); | 78 request->SetUserData(&kUserDataKey, handler.release()); |
88 } | 79 } |
89 | 80 |
90 } // namespace | 81 } // namespace |
91 | 82 |
92 // PlzNavigate | 83 // PlzNavigate |
93 void ServiceWorkerRequestHandler::InitializeForNavigation( | 84 void ServiceWorkerRequestHandler::InitializeForNavigation( |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 ResourceType resource_type) | 245 ResourceType resource_type) |
255 : context_(context), | 246 : context_(context), |
256 provider_host_(provider_host), | 247 provider_host_(provider_host), |
257 blob_storage_context_(blob_storage_context), | 248 blob_storage_context_(blob_storage_context), |
258 resource_type_(resource_type), | 249 resource_type_(resource_type), |
259 old_process_id_(0), | 250 old_process_id_(0), |
260 old_provider_id_(kInvalidServiceWorkerProviderId) { | 251 old_provider_id_(kInvalidServiceWorkerProviderId) { |
261 } | 252 } |
262 | 253 |
263 } // namespace content | 254 } // namespace content |
OLD | NEW |