| 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/browser/service_worker/foreign_fetch_request_handler.h" | 5 #include "content/browser/service_worker/foreign_fetch_request_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 10 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 } // namespace | 46 } // namespace |
| 47 | 47 |
| 48 void ForeignFetchRequestHandler::InitializeHandler( | 48 void ForeignFetchRequestHandler::InitializeHandler( |
| 49 net::URLRequest* request, | 49 net::URLRequest* request, |
| 50 ServiceWorkerContextWrapper* context_wrapper, | 50 ServiceWorkerContextWrapper* context_wrapper, |
| 51 storage::BlobStorageContext* blob_storage_context, | 51 storage::BlobStorageContext* blob_storage_context, |
| 52 int process_id, | 52 int process_id, |
| 53 int provider_id, | 53 int provider_id, |
| 54 bool skip_service_worker, | 54 SkipServiceWorker skip_service_worker, |
| 55 FetchRequestMode request_mode, | 55 FetchRequestMode request_mode, |
| 56 FetchCredentialsMode credentials_mode, | 56 FetchCredentialsMode credentials_mode, |
| 57 FetchRedirectMode redirect_mode, | 57 FetchRedirectMode redirect_mode, |
| 58 ResourceType resource_type, | 58 ResourceType resource_type, |
| 59 RequestContextType request_context_type, | 59 RequestContextType request_context_type, |
| 60 RequestContextFrameType frame_type, | 60 RequestContextFrameType frame_type, |
| 61 scoped_refptr<ResourceRequestBodyImpl> body, | 61 scoped_refptr<ResourceRequestBodyImpl> body, |
| 62 bool initiated_in_secure_context) { | 62 bool initiated_in_secure_context) { |
| 63 if (!context_wrapper) { | 63 if (!context_wrapper) |
| 64 return; | 64 return; |
| 65 } | 65 |
| 66 if (skip_service_worker == SkipServiceWorker::ALL) |
| 67 return; |
| 66 | 68 |
| 67 if (!initiated_in_secure_context) | 69 if (!initiated_in_secure_context) |
| 68 return; | 70 return; |
| 69 | 71 |
| 70 if (!context_wrapper->OriginHasForeignFetchRegistrations( | 72 if (!context_wrapper->OriginHasForeignFetchRegistrations( |
| 71 request->url().GetOrigin())) { | 73 request->url().GetOrigin())) { |
| 72 return; | 74 return; |
| 73 } | 75 } |
| 74 | 76 |
| 75 if (request->initiator().IsSameOriginWith(url::Origin(request->url()))) | 77 if (request->initiator().IsSameOriginWith(url::Origin(request->url()))) |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 } | 228 } |
| 227 return target_worker_.get(); | 229 return target_worker_.get(); |
| 228 } | 230 } |
| 229 | 231 |
| 230 void ForeignFetchRequestHandler::ClearJob() { | 232 void ForeignFetchRequestHandler::ClearJob() { |
| 231 job_.reset(); | 233 job_.reset(); |
| 232 target_worker_ = nullptr; | 234 target_worker_ = nullptr; |
| 233 } | 235 } |
| 234 | 236 |
| 235 } // namespace content | 237 } // namespace content |
| OLD | NEW |