OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/loader/cross_site_resource_handler.h" | 5 #include "content/browser/loader/cross_site_resource_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "content/browser/appcache/appcache_interceptor.h" | 12 #include "content/browser/appcache/appcache_interceptor.h" |
13 #include "content/browser/child_process_security_policy_impl.h" | 13 #include "content/browser/child_process_security_policy_impl.h" |
14 #include "content/browser/frame_host/cross_site_transferring_request.h" | 14 #include "content/browser/frame_host/cross_site_transferring_request.h" |
15 #include "content/browser/frame_host/render_frame_host_impl.h" | 15 #include "content/browser/frame_host/render_frame_host_impl.h" |
16 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 16 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
17 #include "content/browser/loader/resource_request_info_impl.h" | 17 #include "content/browser/loader/resource_request_info_impl.h" |
| 18 #include "content/browser/service_worker/service_worker_request_handler.h" |
18 #include "content/browser/site_instance_impl.h" | 19 #include "content/browser/site_instance_impl.h" |
19 #include "content/browser/transition_request_manager.h" | 20 #include "content/browser/transition_request_manager.h" |
20 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
21 #include "content/public/browser/content_browser_client.h" | 22 #include "content/public/browser/content_browser_client.h" |
22 #include "content/public/browser/global_request_id.h" | 23 #include "content/public/browser/global_request_id.h" |
23 #include "content/public/browser/resource_controller.h" | 24 #include "content/public/browser/resource_controller.h" |
24 #include "content/public/browser/site_instance.h" | 25 #include "content/public/browser/site_instance.h" |
25 #include "content/public/common/content_switches.h" | 26 #include "content/public/common/content_switches.h" |
26 #include "content/public/common/resource_response.h" | 27 #include "content/public/common/resource_response.h" |
27 #include "content/public/common/url_constants.h" | 28 #include "content/public/common/url_constants.h" |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 // The |transfer_url_chain| contains any redirect URLs that have already | 364 // The |transfer_url_chain| contains any redirect URLs that have already |
364 // occurred, plus the destination URL at the end. | 365 // occurred, plus the destination URL at the end. |
365 std::vector<GURL> transfer_url_chain; | 366 std::vector<GURL> transfer_url_chain; |
366 Referrer referrer; | 367 Referrer referrer; |
367 int render_frame_id = info->GetRenderFrameID(); | 368 int render_frame_id = info->GetRenderFrameID(); |
368 transfer_url_chain = request()->url_chain(); | 369 transfer_url_chain = request()->url_chain(); |
369 referrer = Referrer(GURL(request()->referrer()), info->GetReferrerPolicy()); | 370 referrer = Referrer(GURL(request()->referrer()), info->GetReferrerPolicy()); |
370 | 371 |
371 AppCacheInterceptor::PrepareForCrossSiteTransfer( | 372 AppCacheInterceptor::PrepareForCrossSiteTransfer( |
372 request(), global_id.child_id); | 373 request(), global_id.child_id); |
| 374 |
| 375 ServiceWorkerRequestHandler* handler = |
| 376 ServiceWorkerRequestHandler::GetHandler(request()); |
| 377 if (handler) |
| 378 handler->PrepareForCrossSiteTransfer(global_id.child_id); |
| 379 |
373 ResourceDispatcherHostImpl::Get()->MarkAsTransferredNavigation(global_id); | 380 ResourceDispatcherHostImpl::Get()->MarkAsTransferredNavigation(global_id); |
374 | 381 |
375 BrowserThread::PostTask( | 382 BrowserThread::PostTask( |
376 BrowserThread::UI, | 383 BrowserThread::UI, |
377 FROM_HERE, | 384 FROM_HERE, |
378 base::Bind( | 385 base::Bind( |
379 &OnCrossSiteResponseHelper, | 386 &OnCrossSiteResponseHelper, |
380 CrossSiteResponseParams(render_frame_id, | 387 CrossSiteResponseParams(render_frame_id, |
381 global_id, | 388 global_id, |
382 transfer_url_chain, | 389 transfer_url_chain, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 controller()->Resume(); | 431 controller()->Resume(); |
425 } | 432 } |
426 } | 433 } |
427 | 434 |
428 void CrossSiteResourceHandler::OnDidDefer() { | 435 void CrossSiteResourceHandler::OnDidDefer() { |
429 did_defer_ = true; | 436 did_defer_ = true; |
430 request()->LogBlockedBy("CrossSiteResourceHandler"); | 437 request()->LogBlockedBy("CrossSiteResourceHandler"); |
431 } | 438 } |
432 | 439 |
433 } // namespace content | 440 } // namespace content |
OLD | NEW |