Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: content/browser/service_worker/service_worker_request_handler.cc

Issue 1914593002: Limit requests for which link headers can install service workers to secure contexts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/service_worker/service_worker_request_handler.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 if (!provider_host || !provider_host->IsContextAlive()) 171 if (!provider_host || !provider_host->IsContextAlive())
172 return; 172 return;
173 173
174 FinalizeHandlerInitialization(request, provider_host, blob_storage_context, 174 FinalizeHandlerInitialization(request, provider_host, blob_storage_context,
175 skip_service_worker, request_mode, 175 skip_service_worker, request_mode,
176 credentials_mode, redirect_mode, resource_type, 176 credentials_mode, redirect_mode, resource_type,
177 request_context_type, frame_type, body); 177 request_context_type, frame_type, body);
178 } 178 }
179 179
180 ServiceWorkerRequestHandler* ServiceWorkerRequestHandler::GetHandler( 180 ServiceWorkerRequestHandler* ServiceWorkerRequestHandler::GetHandler(
181 net::URLRequest* request) { 181 const net::URLRequest* request) {
182 return static_cast<ServiceWorkerRequestHandler*>( 182 return static_cast<ServiceWorkerRequestHandler*>(
183 request->GetUserData(&kUserDataKey)); 183 request->GetUserData(&kUserDataKey));
184 } 184 }
185 185
186 std::unique_ptr<net::URLRequestInterceptor> 186 std::unique_ptr<net::URLRequestInterceptor>
187 ServiceWorkerRequestHandler::CreateInterceptor( 187 ServiceWorkerRequestHandler::CreateInterceptor(
188 ResourceContext* resource_context) { 188 ResourceContext* resource_context) {
189 return std::unique_ptr<net::URLRequestInterceptor>( 189 return std::unique_ptr<net::URLRequestInterceptor>(
190 new ServiceWorkerRequestInterceptor(resource_context)); 190 new ServiceWorkerRequestInterceptor(resource_context));
191 } 191 }
192 192
193 bool ServiceWorkerRequestHandler::IsControlledByServiceWorker( 193 bool ServiceWorkerRequestHandler::IsControlledByServiceWorker(
194 net::URLRequest* request) { 194 const net::URLRequest* request) {
195 ServiceWorkerRequestHandler* handler = GetHandler(request); 195 ServiceWorkerRequestHandler* handler = GetHandler(request);
196 if (!handler || !handler->provider_host_) 196 if (!handler || !handler->provider_host_)
197 return false; 197 return false;
198 return handler->provider_host_->associated_registration() || 198 return handler->provider_host_->associated_registration() ||
199 handler->provider_host_->running_hosted_version(); 199 handler->provider_host_->running_hosted_version();
200 } 200 }
201 201
202 ServiceWorkerProviderHost* ServiceWorkerRequestHandler::GetProviderHost(
203 const net::URLRequest* request) {
204 ServiceWorkerRequestHandler* handler = GetHandler(request);
205 return handler ? handler->provider_host_.get() : nullptr;
206 }
207
202 void ServiceWorkerRequestHandler::PrepareForCrossSiteTransfer( 208 void ServiceWorkerRequestHandler::PrepareForCrossSiteTransfer(
203 int old_process_id) { 209 int old_process_id) {
204 CHECK(!IsBrowserSideNavigationEnabled()); 210 CHECK(!IsBrowserSideNavigationEnabled());
205 if (!provider_host_ || !context_) 211 if (!provider_host_ || !context_)
206 return; 212 return;
207 old_process_id_ = old_process_id; 213 old_process_id_ = old_process_id;
208 old_provider_id_ = provider_host_->provider_id(); 214 old_provider_id_ = provider_host_->provider_id();
209 host_for_cross_site_transfer_ = context_->TransferProviderHostOut( 215 host_for_cross_site_transfer_ = context_->TransferProviderHostOut(
210 old_process_id, provider_host_->provider_id()); 216 old_process_id, provider_host_->provider_id());
211 DCHECK_EQ(provider_host_.get(), host_for_cross_site_transfer_.get()); 217 DCHECK_EQ(provider_host_.get(), host_for_cross_site_transfer_.get());
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 ResourceType resource_type) 255 ResourceType resource_type)
250 : context_(context), 256 : context_(context),
251 provider_host_(provider_host), 257 provider_host_(provider_host),
252 blob_storage_context_(blob_storage_context), 258 blob_storage_context_(blob_storage_context),
253 resource_type_(resource_type), 259 resource_type_(resource_type),
254 old_process_id_(0), 260 old_process_id_(0),
255 old_provider_id_(kInvalidServiceWorkerProviderId) { 261 old_provider_id_(kInvalidServiceWorkerProviderId) {
256 } 262 }
257 263
258 } // namespace content 264 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/service_worker/service_worker_request_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698