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/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 | 8 |
| 9 #include "content/browser/service_worker/service_worker_context_core.h" | 9 #include "content/browser/service_worker/service_worker_context_core.h" |
| 10 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 10 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
| 11 #include "content/browser/service_worker/service_worker_provider_host.h" | 11 #include "content/browser/service_worker/service_worker_provider_host.h" |
| 12 #include "content/browser/service_worker/service_worker_registration.h" | 12 #include "content/browser/service_worker/service_worker_registration.h" |
| 13 #include "content/browser/service_worker/service_worker_url_request_job.h" | 13 #include "content/browser/service_worker/service_worker_url_request_job.h" |
| 14 #include "content/browser/service_worker/service_worker_utils.h" | 14 #include "content/browser/service_worker/service_worker_utils.h" |
| 15 #include "content/common/resource_request_body.h" | 15 #include "content/common/resource_request_body.h" |
| 16 #include "content/common/service_worker/service_worker_types.h" | 16 #include "content/common/service_worker/service_worker_types.h" |
| 17 #include "content/public/browser/resource_context.h" | 17 #include "content/public/browser/resource_context.h" |
| 18 #include "net/base/load_flags.h" | |
| 18 #include "net/base/net_util.h" | 19 #include "net/base/net_util.h" |
| 19 #include "net/url_request/url_request.h" | 20 #include "net/url_request/url_request.h" |
| 20 #include "net/url_request/url_request_interceptor.h" | 21 #include "net/url_request/url_request_interceptor.h" |
| 21 #include "storage/browser/blob/blob_storage_context.h" | 22 #include "storage/browser/blob/blob_storage_context.h" |
| 22 | 23 |
| 23 namespace content { | 24 namespace content { |
| 24 | 25 |
| 25 namespace { | 26 namespace { |
| 26 | 27 |
| 27 int kUserDataKey; // Key value is not important. | 28 int kUserDataKey; // Key value is not important. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 73 | 74 |
| 74 ServiceWorkerProviderHost* provider_host = | 75 ServiceWorkerProviderHost* provider_host = |
| 75 context_wrapper->context()->GetProviderHost(process_id, provider_id); | 76 context_wrapper->context()->GetProviderHost(process_id, provider_id); |
| 76 if (!provider_host || !provider_host->IsContextAlive()) | 77 if (!provider_host || !provider_host->IsContextAlive()) |
| 77 return; | 78 return; |
| 78 | 79 |
| 79 if (skip_service_worker) { | 80 if (skip_service_worker) { |
| 80 if (ServiceWorkerUtils::IsMainResourceType(resource_type)) { | 81 if (ServiceWorkerUtils::IsMainResourceType(resource_type)) { |
| 81 provider_host->SetDocumentUrl(net::SimplifyUrlForRequest(request->url())); | 82 provider_host->SetDocumentUrl(net::SimplifyUrlForRequest(request->url())); |
| 82 provider_host->SetTopmostFrameUrl(request->first_party_for_cookies()); | 83 provider_host->SetTopmostFrameUrl(request->first_party_for_cookies()); |
| 84 if (request->load_flags() & net::LOAD_BYPASS_CACHE) | |
|
falken
2015/06/22 06:04:02
I'm a bit worried we're adding this if() without b
xiang
2015/06/23 09:01:36
I changed to iterate all live registrations and ma
| |
| 85 provider_host->CopyMatchingRegistrations(); | |
| 83 } | 86 } |
| 84 return; | 87 return; |
| 85 } | 88 } |
| 86 | 89 |
| 87 scoped_ptr<ServiceWorkerRequestHandler> handler( | 90 scoped_ptr<ServiceWorkerRequestHandler> handler( |
| 88 provider_host->CreateRequestHandler(request_mode, | 91 provider_host->CreateRequestHandler(request_mode, |
| 89 credentials_mode, | 92 credentials_mode, |
| 90 resource_type, | 93 resource_type, |
| 91 request_context_type, | 94 request_context_type, |
| 92 frame_type, | 95 frame_type, |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 163 ResourceType resource_type) | 166 ResourceType resource_type) |
| 164 : context_(context), | 167 : context_(context), |
| 165 provider_host_(provider_host), | 168 provider_host_(provider_host), |
| 166 blob_storage_context_(blob_storage_context), | 169 blob_storage_context_(blob_storage_context), |
| 167 resource_type_(resource_type), | 170 resource_type_(resource_type), |
| 168 old_process_id_(0), | 171 old_process_id_(0), |
| 169 old_provider_id_(kInvalidServiceWorkerProviderId) { | 172 old_provider_id_(kInvalidServiceWorkerProviderId) { |
| 170 } | 173 } |
| 171 | 174 |
| 172 } // namespace content | 175 } // namespace content |
| OLD | NEW |