Chromium Code Reviews| 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/command_line.h" | |
| 9 #include "base/macros.h" | 10 #include "base/macros.h" |
| 10 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 11 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
| 11 #include "content/browser/service_worker/service_worker_response_info.h" | 12 #include "content/browser/service_worker/service_worker_response_info.h" |
| 12 #include "content/browser/service_worker/service_worker_url_request_job.h" | 13 #include "content/browser/service_worker/service_worker_url_request_job.h" |
| 13 #include "content/common/resource_request_body_impl.h" | 14 #include "content/common/resource_request_body_impl.h" |
| 14 #include "content/common/service_worker/service_worker_utils.h" | 15 #include "content/common/service_worker/service_worker_utils.h" |
| 16 #include "content/public/common/content_client.h" | |
| 17 #include "content/public/common/content_switches.h" | |
| 18 #include "content/public/common/origin_trial_policy.h" | |
| 15 #include "net/url_request/url_request.h" | 19 #include "net/url_request/url_request.h" |
| 16 #include "net/url_request/url_request_interceptor.h" | 20 #include "net/url_request/url_request_interceptor.h" |
| 17 #include "storage/browser/blob/blob_storage_context.h" | 21 #include "storage/browser/blob/blob_storage_context.h" |
| 18 | 22 |
| 19 namespace content { | 23 namespace content { |
| 20 | 24 |
| 21 namespace { | 25 namespace { |
| 22 | 26 |
| 23 int kUserDataKey; // Only address is used. | 27 int kUserDataKey; // Only address is used. |
| 24 | 28 |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 53 int provider_id, | 57 int provider_id, |
| 54 SkipServiceWorker skip_service_worker, | 58 SkipServiceWorker skip_service_worker, |
| 55 FetchRequestMode request_mode, | 59 FetchRequestMode request_mode, |
| 56 FetchCredentialsMode credentials_mode, | 60 FetchCredentialsMode credentials_mode, |
| 57 FetchRedirectMode redirect_mode, | 61 FetchRedirectMode redirect_mode, |
| 58 ResourceType resource_type, | 62 ResourceType resource_type, |
| 59 RequestContextType request_context_type, | 63 RequestContextType request_context_type, |
| 60 RequestContextFrameType frame_type, | 64 RequestContextFrameType frame_type, |
| 61 scoped_refptr<ResourceRequestBodyImpl> body, | 65 scoped_refptr<ResourceRequestBodyImpl> body, |
| 62 bool initiated_in_secure_context) { | 66 bool initiated_in_secure_context) { |
| 67 OriginTrialPolicy* origin_trial_policy = | |
| 68 GetContentClient()->GetOriginTrialPolicy(); | |
| 69 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | |
|
pfeldman
2016/08/12 18:49:23
If I did not specify the experimental-web-platform
Marijn Kruisselbrink
2016/08/12 19:15:40
Ah, good point. I was trying to mimic what TrialTo
| |
| 70 switches::kEnableExperimentalWebPlatformFeatures) && | |
| 71 origin_trial_policy && | |
| 72 origin_trial_policy->IsFeatureDisabled("ForeignFetch")) { | |
| 73 return; | |
| 74 } | |
| 75 | |
| 63 if (!context_wrapper) | 76 if (!context_wrapper) |
| 64 return; | 77 return; |
| 65 | 78 |
| 66 if (skip_service_worker == SkipServiceWorker::ALL) | 79 if (skip_service_worker == SkipServiceWorker::ALL) |
| 67 return; | 80 return; |
| 68 | 81 |
| 69 if (!initiated_in_secure_context) | 82 if (!initiated_in_secure_context) |
| 70 return; | 83 return; |
| 71 | 84 |
| 72 if (ServiceWorkerUtils::IsMainResourceType(resource_type)) | 85 if (ServiceWorkerUtils::IsMainResourceType(resource_type)) |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 228 } | 241 } |
| 229 return target_worker_.get(); | 242 return target_worker_.get(); |
| 230 } | 243 } |
| 231 | 244 |
| 232 void ForeignFetchRequestHandler::ClearJob() { | 245 void ForeignFetchRequestHandler::ClearJob() { |
| 233 job_.reset(); | 246 job_.reset(); |
| 234 target_worker_ = nullptr; | 247 target_worker_ = nullptr; |
| 235 } | 248 } |
| 236 | 249 |
| 237 } // namespace content | 250 } // namespace content |
| OLD | NEW |