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/devtools/render_frame_devtools_agent_host.h" | 9 #include "content/browser/devtools/render_frame_devtools_agent_host.h" |
10 #include "content/browser/frame_host/frame_tree.h" | 10 #include "content/browser/frame_host/frame_tree.h" |
11 #include "content/browser/frame_host/frame_tree_node.h" | 11 #include "content/browser/frame_host/frame_tree_node.h" |
12 #include "content/browser/frame_host/navigation_controller_impl.h" | 12 #include "content/browser/frame_host/navigation_controller_impl.h" |
13 #include "content/browser/frame_host/navigation_handle_impl.h" | 13 #include "content/browser/frame_host/navigation_handle_impl.h" |
14 #include "content/browser/frame_host/navigation_request_info.h" | 14 #include "content/browser/frame_host/navigation_request_info.h" |
15 #include "content/browser/frame_host/navigator.h" | 15 #include "content/browser/frame_host/navigator.h" |
16 #include "content/browser/frame_host/navigator_impl.h" | 16 #include "content/browser/frame_host/navigator_impl.h" |
17 #include "content/browser/loader/navigation_url_loader.h" | 17 #include "content/browser/loader/navigation_url_loader.h" |
18 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 18 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
19 #include "content/browser/service_worker/service_worker_navigation_handle.h" | 19 #include "content/browser/service_worker/service_worker_navigation_handle.h" |
20 #include "content/browser/site_instance_impl.h" | 20 #include "content/browser/site_instance_impl.h" |
21 #include "content/common/resource_request_body_impl.h" | 21 #include "content/common/resource_request_body_impl.h" |
22 #include "content/public/browser/browser_context.h" | 22 #include "content/public/browser/browser_context.h" |
23 #include "content/public/browser/content_browser_client.h" | 23 #include "content/public/browser/content_browser_client.h" |
24 #include "content/public/browser/navigation_controller.h" | 24 #include "content/public/browser/navigation_controller.h" |
25 #include "content/public/browser/navigation_data.h" | 25 #include "content/public/browser/navigation_data.h" |
| 26 #include "content/public/browser/navigation_ui_data.h" |
26 #include "content/public/browser/storage_partition.h" | 27 #include "content/public/browser/storage_partition.h" |
27 #include "content/public/browser/stream_handle.h" | 28 #include "content/public/browser/stream_handle.h" |
28 #include "content/public/common/content_client.h" | 29 #include "content/public/common/content_client.h" |
29 #include "content/public/common/request_context_type.h" | 30 #include "content/public/common/request_context_type.h" |
30 #include "content/public/common/resource_response.h" | 31 #include "content/public/common/resource_response.h" |
31 #include "net/base/load_flags.h" | 32 #include "net/base/load_flags.h" |
32 #include "net/base/url_util.h" | 33 #include "net/base/url_util.h" |
33 #include "net/http/http_request_headers.h" | 34 #include "net/http/http_request_headers.h" |
34 #include "net/url_request/redirect_info.h" | 35 #include "net/url_request/redirect_info.h" |
35 #include "third_party/WebKit/public/web/WebSandboxFlags.h" | 36 #include "third_party/WebKit/public/web/WebSandboxFlags.h" |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 // and verifies that all origins are PSL-matches (and special-cases extension | 479 // and verifies that all origins are PSL-matches (and special-cases extension |
479 // URLs). | 480 // URLs). |
480 const GURL& first_party_for_cookies = | 481 const GURL& first_party_for_cookies = |
481 frame_tree_node_->IsMainFrame() | 482 frame_tree_node_->IsMainFrame() |
482 ? common_params_.url | 483 ? common_params_.url |
483 : frame_tree_node_->frame_tree()->root()->current_url(); | 484 : frame_tree_node_->frame_tree()->root()->current_url(); |
484 bool parent_is_main_frame = !frame_tree_node_->parent() | 485 bool parent_is_main_frame = !frame_tree_node_->parent() |
485 ? false | 486 ? false |
486 : frame_tree_node_->parent()->IsMainFrame(); | 487 : frame_tree_node_->parent()->IsMainFrame(); |
487 | 488 |
| 489 std::unique_ptr<NavigationUIData> navigation_ui_data; |
| 490 if (navigation_handle_->navigation_ui_data()) |
| 491 navigation_ui_data = navigation_handle_->navigation_ui_data()->Clone(); |
| 492 |
488 loader_ = NavigationURLLoader::Create( | 493 loader_ = NavigationURLLoader::Create( |
489 frame_tree_node_->navigator()->GetController()->GetBrowserContext(), | 494 frame_tree_node_->navigator()->GetController()->GetBrowserContext(), |
490 base::MakeUnique<NavigationRequestInfo>( | 495 base::MakeUnique<NavigationRequestInfo>( |
491 common_params_, begin_params_, first_party_for_cookies, | 496 common_params_, begin_params_, first_party_for_cookies, |
492 frame_tree_node_->current_origin(), frame_tree_node_->IsMainFrame(), | 497 frame_tree_node_->current_origin(), frame_tree_node_->IsMainFrame(), |
493 parent_is_main_frame, IsSecureFrame(frame_tree_node_->parent()), | 498 parent_is_main_frame, IsSecureFrame(frame_tree_node_->parent()), |
494 frame_tree_node_->frame_tree_node_id()), | 499 frame_tree_node_->frame_tree_node_id()), |
| 500 std::move(navigation_ui_data), |
495 navigation_handle_->service_worker_handle(), this); | 501 navigation_handle_->service_worker_handle(), this); |
496 } | 502 } |
497 | 503 |
498 void NavigationRequest::OnRedirectChecksComplete( | 504 void NavigationRequest::OnRedirectChecksComplete( |
499 NavigationThrottle::ThrottleCheckResult result) { | 505 NavigationThrottle::ThrottleCheckResult result) { |
500 CHECK(result != NavigationThrottle::DEFER); | 506 CHECK(result != NavigationThrottle::DEFER); |
501 | 507 |
502 // Abort the request if needed. This will destroy the NavigationRequest. | 508 // Abort the request if needed. This will destroy the NavigationRequest. |
503 if (result == NavigationThrottle::CANCEL_AND_IGNORE || | 509 if (result == NavigationThrottle::CANCEL_AND_IGNORE || |
504 result == NavigationThrottle::CANCEL) { | 510 result == NavigationThrottle::CANCEL) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 | 551 |
546 TransferNavigationHandleOwnership(render_frame_host); | 552 TransferNavigationHandleOwnership(render_frame_host); |
547 render_frame_host->CommitNavigation(response_.get(), std::move(body_), | 553 render_frame_host->CommitNavigation(response_.get(), std::move(body_), |
548 common_params_, request_params_, | 554 common_params_, request_params_, |
549 is_view_source_); | 555 is_view_source_); |
550 | 556 |
551 frame_tree_node_->ResetNavigationRequest(true); | 557 frame_tree_node_->ResetNavigationRequest(true); |
552 } | 558 } |
553 | 559 |
554 } // namespace content | 560 } // namespace content |
OLD | NEW |