OLD | NEW |
---|---|
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/frame_host/navigation_request.h" | 5 #include "content/browser/frame_host/navigation_request.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "content/browser/appcache/appcache_navigation_handle.h" | |
10 #include "content/browser/appcache/chrome_appcache_service.h" | |
9 #include "content/browser/child_process_security_policy_impl.h" | 11 #include "content/browser/child_process_security_policy_impl.h" |
10 #include "content/browser/devtools/render_frame_devtools_agent_host.h" | 12 #include "content/browser/devtools/render_frame_devtools_agent_host.h" |
11 #include "content/browser/frame_host/frame_tree.h" | 13 #include "content/browser/frame_host/frame_tree.h" |
12 #include "content/browser/frame_host/frame_tree_node.h" | 14 #include "content/browser/frame_host/frame_tree_node.h" |
13 #include "content/browser/frame_host/navigation_controller_impl.h" | 15 #include "content/browser/frame_host/navigation_controller_impl.h" |
14 #include "content/browser/frame_host/navigation_handle_impl.h" | 16 #include "content/browser/frame_host/navigation_handle_impl.h" |
15 #include "content/browser/frame_host/navigation_request_info.h" | 17 #include "content/browser/frame_host/navigation_request_info.h" |
16 #include "content/browser/frame_host/navigator.h" | 18 #include "content/browser/frame_host/navigator.h" |
17 #include "content/browser/frame_host/navigator_impl.h" | 19 #include "content/browser/frame_host/navigator_impl.h" |
18 #include "content/browser/loader/navigation_url_loader.h" | 20 #include "content/browser/loader/navigation_url_loader.h" |
19 #include "content/browser/renderer_host/render_process_host_impl.h" | 21 #include "content/browser/renderer_host/render_process_host_impl.h" |
20 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 22 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
21 #include "content/browser/service_worker/service_worker_navigation_handle.h" | 23 #include "content/browser/service_worker/service_worker_navigation_handle.h" |
22 #include "content/browser/site_instance_impl.h" | 24 #include "content/browser/site_instance_impl.h" |
23 #include "content/common/resource_request_body_impl.h" | 25 #include "content/common/resource_request_body_impl.h" |
24 #include "content/public/browser/browser_context.h" | 26 #include "content/public/browser/browser_context.h" |
25 #include "content/public/browser/content_browser_client.h" | 27 #include "content/public/browser/content_browser_client.h" |
26 #include "content/public/browser/global_request_id.h" | 28 #include "content/public/browser/global_request_id.h" |
27 #include "content/public/browser/navigation_controller.h" | 29 #include "content/public/browser/navigation_controller.h" |
28 #include "content/public/browser/navigation_data.h" | 30 #include "content/public/browser/navigation_data.h" |
29 #include "content/public/browser/navigation_ui_data.h" | 31 #include "content/public/browser/navigation_ui_data.h" |
30 #include "content/public/browser/storage_partition.h" | 32 #include "content/public/browser/storage_partition.h" |
31 #include "content/public/browser/stream_handle.h" | 33 #include "content/public/browser/stream_handle.h" |
34 #include "content/public/common/appcache_info.h" | |
32 #include "content/public/common/content_client.h" | 35 #include "content/public/common/content_client.h" |
33 #include "content/public/common/request_context_type.h" | 36 #include "content/public/common/request_context_type.h" |
34 #include "content/public/common/resource_response.h" | 37 #include "content/public/common/resource_response.h" |
35 #include "content/public/common/url_constants.h" | 38 #include "content/public/common/url_constants.h" |
36 #include "net/base/load_flags.h" | 39 #include "net/base/load_flags.h" |
37 #include "net/base/url_util.h" | 40 #include "net/base/url_util.h" |
38 #include "net/http/http_request_headers.h" | 41 #include "net/http/http_request_headers.h" |
39 #include "net/url_request/redirect_info.h" | 42 #include "net/url_request/redirect_info.h" |
40 #include "third_party/WebKit/public/web/WebSandboxFlags.h" | 43 #include "third_party/WebKit/public/web/WebSandboxFlags.h" |
41 | 44 |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
398 navigation_handle_->service_worker_handle() && | 401 navigation_handle_->service_worker_handle() && |
399 navigation_handle_->service_worker_handle() | 402 navigation_handle_->service_worker_handle() |
400 ->service_worker_provider_host_id() != | 403 ->service_worker_provider_host_id() != |
401 kInvalidServiceWorkerProviderId; | 404 kInvalidServiceWorkerProviderId; |
402 request_params_.service_worker_provider_id = | 405 request_params_.service_worker_provider_id = |
403 did_create_service_worker_host | 406 did_create_service_worker_host |
404 ? navigation_handle_->service_worker_handle() | 407 ? navigation_handle_->service_worker_handle() |
405 ->service_worker_provider_host_id() | 408 ->service_worker_provider_host_id() |
406 : kInvalidServiceWorkerProviderId; | 409 : kInvalidServiceWorkerProviderId; |
407 | 410 |
411 request_params_.appcache_host_id = | |
412 navigation_handle_->appcache_handle() | |
413 ? navigation_handle_->appcache_handle()->appcache_host_id() | |
414 : kAppCacheNoHostId; | |
415 | |
408 // Update the lofi state of the request. | 416 // Update the lofi state of the request. |
409 if (response->head.is_using_lofi) | 417 if (response->head.is_using_lofi) |
410 common_params_.lofi_state = LOFI_ON; | 418 common_params_.lofi_state = LOFI_ON; |
411 else | 419 else |
412 common_params_.lofi_state = LOFI_OFF; | 420 common_params_.lofi_state = LOFI_OFF; |
413 | 421 |
414 // Select an appropriate renderer to commit the navigation. | 422 // Select an appropriate renderer to commit the navigation. |
415 RenderFrameHostImpl* render_frame_host = | 423 RenderFrameHostImpl* render_frame_host = |
416 frame_tree_node_->render_manager()->GetFrameHostForNavigation(*this); | 424 frame_tree_node_->render_manager()->GetFrameHostForNavigation(*this); |
417 NavigatorImpl::CheckWebUIRendererDoesNotDisplayNormalURL(render_frame_host, | 425 NavigatorImpl::CheckWebUIRendererDoesNotDisplayNormalURL(render_frame_host, |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
503 (frame_tree_node_->pending_sandbox_flags() & | 511 (frame_tree_node_->pending_sandbox_flags() & |
504 blink::WebSandboxFlags::Origin) != blink::WebSandboxFlags::Origin; | 512 blink::WebSandboxFlags::Origin) != blink::WebSandboxFlags::Origin; |
505 request_params_.should_create_service_worker = can_create_service_worker; | 513 request_params_.should_create_service_worker = can_create_service_worker; |
506 if (can_create_service_worker) { | 514 if (can_create_service_worker) { |
507 ServiceWorkerContextWrapper* service_worker_context = | 515 ServiceWorkerContextWrapper* service_worker_context = |
508 static_cast<ServiceWorkerContextWrapper*>( | 516 static_cast<ServiceWorkerContextWrapper*>( |
509 partition->GetServiceWorkerContext()); | 517 partition->GetServiceWorkerContext()); |
510 navigation_handle_->InitServiceWorkerHandle(service_worker_context); | 518 navigation_handle_->InitServiceWorkerHandle(service_worker_context); |
511 } | 519 } |
512 | 520 |
521 if (common_params_.url.SchemeIsHTTPOrHTTPS()) { | |
michaeln
2016/12/03 00:58:58
i think we should use IsSchemeSupportedForAppCache
ananta
2016/12/03 14:55:04
Done.
| |
522 navigation_handle_->InitAppCacheHandle( | |
523 static_cast<ChromeAppCacheService*>(partition->GetAppCacheService())); | |
524 } | |
525 | |
513 // Mark the fetch_start (Navigation Timing API). | 526 // Mark the fetch_start (Navigation Timing API). |
514 request_params_.navigation_timing.fetch_start = base::TimeTicks::Now(); | 527 request_params_.navigation_timing.fetch_start = base::TimeTicks::Now(); |
515 | 528 |
516 // TODO(mkwst): This is incorrect. It ought to use the definition from | 529 // TODO(mkwst): This is incorrect. It ought to use the definition from |
517 // 'Document::firstPartyForCookies()' in Blink, which walks the ancestor tree | 530 // 'Document::firstPartyForCookies()' in Blink, which walks the ancestor tree |
518 // and verifies that all origins are PSL-matches (and special-cases extension | 531 // and verifies that all origins are PSL-matches (and special-cases extension |
519 // URLs). | 532 // URLs). |
520 const GURL& first_party_for_cookies = | 533 const GURL& first_party_for_cookies = |
521 frame_tree_node_->IsMainFrame() | 534 frame_tree_node_->IsMainFrame() |
522 ? common_params_.url | 535 ? common_params_.url |
(...skipping 15 matching lines...) Expand all Loading... | |
538 | 551 |
539 loader_ = NavigationURLLoader::Create( | 552 loader_ = NavigationURLLoader::Create( |
540 frame_tree_node_->navigator()->GetController()->GetBrowserContext(), | 553 frame_tree_node_->navigator()->GetController()->GetBrowserContext(), |
541 base::MakeUnique<NavigationRequestInfo>( | 554 base::MakeUnique<NavigationRequestInfo>( |
542 common_params_, begin_params_, first_party_for_cookies, | 555 common_params_, begin_params_, first_party_for_cookies, |
543 frame_tree_node_->current_origin(), frame_tree_node_->IsMainFrame(), | 556 frame_tree_node_->current_origin(), frame_tree_node_->IsMainFrame(), |
544 parent_is_main_frame, IsSecureFrame(frame_tree_node_->parent()), | 557 parent_is_main_frame, IsSecureFrame(frame_tree_node_->parent()), |
545 frame_tree_node_->frame_tree_node_id(), is_for_guests_only, | 558 frame_tree_node_->frame_tree_node_id(), is_for_guests_only, |
546 report_raw_headers), | 559 report_raw_headers), |
547 std::move(navigation_ui_data), | 560 std::move(navigation_ui_data), |
548 navigation_handle_->service_worker_handle(), this); | 561 navigation_handle_->service_worker_handle(), |
562 navigation_handle_->appcache_handle(), this); | |
549 } | 563 } |
550 | 564 |
551 void NavigationRequest::OnRedirectChecksComplete( | 565 void NavigationRequest::OnRedirectChecksComplete( |
552 NavigationThrottle::ThrottleCheckResult result) { | 566 NavigationThrottle::ThrottleCheckResult result) { |
553 CHECK(result != NavigationThrottle::DEFER); | 567 CHECK(result != NavigationThrottle::DEFER); |
554 | 568 |
555 // Abort the request if needed. This will destroy the NavigationRequest. | 569 // Abort the request if needed. This will destroy the NavigationRequest. |
556 if (result == NavigationThrottle::CANCEL_AND_IGNORE || | 570 if (result == NavigationThrottle::CANCEL_AND_IGNORE || |
557 result == NavigationThrottle::CANCEL) { | 571 result == NavigationThrottle::CANCEL) { |
558 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. | 572 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
599 TransferNavigationHandleOwnership(render_frame_host); | 613 TransferNavigationHandleOwnership(render_frame_host); |
600 | 614 |
601 render_frame_host->CommitNavigation(response_.get(), std::move(body_), | 615 render_frame_host->CommitNavigation(response_.get(), std::move(body_), |
602 common_params_, request_params_, | 616 common_params_, request_params_, |
603 is_view_source_); | 617 is_view_source_); |
604 | 618 |
605 frame_tree_node_->ResetNavigationRequest(true); | 619 frame_tree_node_->ResetNavigationRequest(true); |
606 } | 620 } |
607 | 621 |
608 } // namespace content | 622 } // namespace content |
OLD | NEW |