| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "core/loader/WorkerFetchContext.h" | 5 #include "core/loader/WorkerFetchContext.h" |
| 6 | 6 |
| 7 #include "core/frame/Deprecation.h" | 7 #include "core/frame/Deprecation.h" |
| 8 #include "core/frame/UseCounter.h" | 8 #include "core/frame/UseCounter.h" |
| 9 #include "core/workers/WorkerClients.h" | 9 #include "core/workers/WorkerClients.h" |
| 10 #include "core/workers/WorkerGlobalScope.h" | 10 #include "core/workers/WorkerGlobalScope.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 return web_context_->CreateURLLoader(); | 158 return web_context_->CreateURLLoader(); |
| 159 } | 159 } |
| 160 | 160 |
| 161 bool WorkerFetchContext::IsControlledByServiceWorker() const { | 161 bool WorkerFetchContext::IsControlledByServiceWorker() const { |
| 162 return web_context_->IsControlledByServiceWorker(); | 162 return web_context_->IsControlledByServiceWorker(); |
| 163 } | 163 } |
| 164 | 164 |
| 165 void WorkerFetchContext::PrepareRequest(ResourceRequest& request, | 165 void WorkerFetchContext::PrepareRequest(ResourceRequest& request, |
| 166 RedirectType) { | 166 RedirectType) { |
| 167 request.OverrideLoadingIPCType(WebURLRequest::LoadingIPCType::kMojo); | 167 request.OverrideLoadingIPCType(WebURLRequest::LoadingIPCType::kMojo); |
| 168 if (request.RequestorOrigin()->IsUnique()) |
| 169 request.SetRequestorOrigin(worker_global_scope_->GetSecurityOrigin()); |
| 168 WrappedResourceRequest webreq(request); | 170 WrappedResourceRequest webreq(request); |
| 169 web_context_->WillSendRequest(webreq); | 171 web_context_->WillSendRequest(webreq); |
| 170 } | 172 } |
| 171 | 173 |
| 172 RefPtr<WebTaskRunner> WorkerFetchContext::LoadingTaskRunner() const { | 174 RefPtr<WebTaskRunner> WorkerFetchContext::LoadingTaskRunner() const { |
| 173 return loading_task_runner_; | 175 return loading_task_runner_; |
| 174 } | 176 } |
| 175 | 177 |
| 176 void WorkerFetchContext::AddAdditionalRequestHeaders(ResourceRequest& request, | 178 void WorkerFetchContext::AddAdditionalRequestHeaders(ResourceRequest& request, |
| 177 FetchResourceType type) { | 179 FetchResourceType type) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 194 void ProvideWorkerFetchContextToWorker( | 196 void ProvideWorkerFetchContextToWorker( |
| 195 WorkerClients* clients, | 197 WorkerClients* clients, |
| 196 std::unique_ptr<WebWorkerFetchContext> web_context) { | 198 std::unique_ptr<WebWorkerFetchContext> web_context) { |
| 197 DCHECK(clients); | 199 DCHECK(clients); |
| 198 WorkerFetchContextHolder::ProvideTo( | 200 WorkerFetchContextHolder::ProvideTo( |
| 199 *clients, WorkerFetchContextHolder::SupplementName(), | 201 *clients, WorkerFetchContextHolder::SupplementName(), |
| 200 new WorkerFetchContextHolder(std::move(web_context))); | 202 new WorkerFetchContextHolder(std::move(web_context))); |
| 201 } | 203 } |
| 202 | 204 |
| 203 } // namespace blink | 205 } // namespace blink |
| OLD | NEW |