| 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/child_process_security_policy_impl.h" | 9 #include "content/browser/child_process_security_policy_impl.h" |
| 10 #include "content/browser/devtools/render_frame_devtools_agent_host.h" | 10 #include "content/browser/devtools/render_frame_devtools_agent_host.h" |
| 11 #include "content/browser/frame_host/frame_tree.h" | 11 #include "content/browser/frame_host/frame_tree.h" |
| 12 #include "content/browser/frame_host/frame_tree_node.h" | 12 #include "content/browser/frame_host/frame_tree_node.h" |
| 13 #include "content/browser/frame_host/navigation_controller_impl.h" | 13 #include "content/browser/frame_host/navigation_controller_impl.h" |
| 14 #include "content/browser/frame_host/navigation_handle_impl.h" | 14 #include "content/browser/frame_host/navigation_handle_impl.h" |
| 15 #include "content/browser/frame_host/navigation_request_info.h" | 15 #include "content/browser/frame_host/navigation_request_info.h" |
| 16 #include "content/browser/frame_host/navigator.h" | 16 #include "content/browser/frame_host/navigator.h" |
| 17 #include "content/browser/frame_host/navigator_impl.h" | 17 #include "content/browser/frame_host/navigator_impl.h" |
| 18 #include "content/browser/loader/navigation_url_loader.h" | 18 #include "content/browser/loader/navigation_url_loader.h" |
| 19 #include "content/browser/loader/resource_message_filter.h" |
| 19 #include "content/browser/renderer_host/render_process_host_impl.h" | 20 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 20 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 21 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
| 21 #include "content/browser/service_worker/service_worker_navigation_handle.h" | 22 #include "content/browser/service_worker/service_worker_navigation_handle.h" |
| 22 #include "content/browser/site_instance_impl.h" | 23 #include "content/browser/site_instance_impl.h" |
| 23 #include "content/common/resource_request_body_impl.h" | 24 #include "content/common/resource_request_body_impl.h" |
| 24 #include "content/public/browser/browser_context.h" | 25 #include "content/public/browser/browser_context.h" |
| 25 #include "content/public/browser/content_browser_client.h" | 26 #include "content/public/browser/content_browser_client.h" |
| 26 #include "content/public/browser/navigation_controller.h" | 27 #include "content/public/browser/navigation_controller.h" |
| 27 #include "content/public/browser/navigation_data.h" | 28 #include "content/public/browser/navigation_data.h" |
| 28 #include "content/public/browser/navigation_ui_data.h" | 29 #include "content/public/browser/navigation_ui_data.h" |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 // Only initialize the ServiceWorkerNavigationHandle if it can be created for | 489 // Only initialize the ServiceWorkerNavigationHandle if it can be created for |
| 489 // this frame. | 490 // this frame. |
| 490 bool can_create_service_worker = | 491 bool can_create_service_worker = |
| 491 (frame_tree_node_->pending_sandbox_flags() & | 492 (frame_tree_node_->pending_sandbox_flags() & |
| 492 blink::WebSandboxFlags::Origin) != blink::WebSandboxFlags::Origin; | 493 blink::WebSandboxFlags::Origin) != blink::WebSandboxFlags::Origin; |
| 493 request_params_.should_create_service_worker = can_create_service_worker; | 494 request_params_.should_create_service_worker = can_create_service_worker; |
| 494 if (can_create_service_worker) { | 495 if (can_create_service_worker) { |
| 495 ServiceWorkerContextWrapper* service_worker_context = | 496 ServiceWorkerContextWrapper* service_worker_context = |
| 496 static_cast<ServiceWorkerContextWrapper*>( | 497 static_cast<ServiceWorkerContextWrapper*>( |
| 497 partition->GetServiceWorkerContext()); | 498 partition->GetServiceWorkerContext()); |
| 498 navigation_handle_->InitServiceWorkerHandle(service_worker_context); | 499 navigation_handle_->InitServiceWorkerHandle( |
| 500 service_worker_context, |
| 501 static_cast<ResourceMessageFilter*>( |
| 502 navigating_frame_host->GetProcess()->GetResourceMessageFilter())); |
| 499 } | 503 } |
| 500 | 504 |
| 501 // Mark the fetch_start (Navigation Timing API). | 505 // Mark the fetch_start (Navigation Timing API). |
| 502 request_params_.navigation_timing.fetch_start = base::TimeTicks::Now(); | 506 request_params_.navigation_timing.fetch_start = base::TimeTicks::Now(); |
| 503 | 507 |
| 504 // TODO(mkwst): This is incorrect. It ought to use the definition from | 508 // TODO(mkwst): This is incorrect. It ought to use the definition from |
| 505 // 'Document::firstPartyForCookies()' in Blink, which walks the ancestor tree | 509 // 'Document::firstPartyForCookies()' in Blink, which walks the ancestor tree |
| 506 // and verifies that all origins are PSL-matches (and special-cases extension | 510 // and verifies that all origins are PSL-matches (and special-cases extension |
| 507 // URLs). | 511 // URLs). |
| 508 const GURL& first_party_for_cookies = | 512 const GURL& first_party_for_cookies = |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); | 593 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); |
| 590 | 594 |
| 591 render_frame_host->CommitNavigation(response_.get(), std::move(body_), | 595 render_frame_host->CommitNavigation(response_.get(), std::move(body_), |
| 592 common_params_, request_params_, | 596 common_params_, request_params_, |
| 593 is_view_source_); | 597 is_view_source_); |
| 594 | 598 |
| 595 frame_tree_node_->ResetNavigationRequest(true); | 599 frame_tree_node_->ResetNavigationRequest(true); |
| 596 } | 600 } |
| 597 | 601 |
| 598 } // namespace content | 602 } // namespace content |
| OLD | NEW |