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/site_instance_impl.h" | 19 #include "content/browser/site_instance_impl.h" |
20 #include "content/common/resource_request_body_impl.h" | 20 #include "content/common/resource_request_body_impl.h" |
21 #include "content/public/browser/browser_context.h" | 21 #include "content/public/browser/browser_context.h" |
22 #include "content/public/browser/navigation_controller.h" | 22 #include "content/public/browser/navigation_controller.h" |
23 #include "content/public/browser/navigation_data.h" | 23 #include "content/public/browser/navigation_data.h" |
| 24 #include "content/public/browser/navigation_ui_data.h" |
24 #include "content/public/browser/storage_partition.h" | 25 #include "content/public/browser/storage_partition.h" |
25 #include "content/public/browser/stream_handle.h" | 26 #include "content/public/browser/stream_handle.h" |
26 #include "content/public/common/content_client.h" | 27 #include "content/public/common/content_client.h" |
27 #include "content/public/common/request_context_type.h" | 28 #include "content/public/common/request_context_type.h" |
28 #include "content/public/common/resource_response.h" | 29 #include "content/public/common/resource_response.h" |
29 #include "net/base/load_flags.h" | 30 #include "net/base/load_flags.h" |
30 #include "net/http/http_request_headers.h" | 31 #include "net/http/http_request_headers.h" |
31 #include "net/url_request/redirect_info.h" | 32 #include "net/url_request/redirect_info.h" |
32 #include "third_party/WebKit/public/web/WebSandboxFlags.h" | 33 #include "third_party/WebKit/public/web/WebSandboxFlags.h" |
33 | 34 |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 browser_context, navigating_frame_host->GetSiteInstance()); | 399 browser_context, navigating_frame_host->GetSiteInstance()); |
399 DCHECK(partition); | 400 DCHECK(partition); |
400 | 401 |
401 ServiceWorkerContextWrapper* service_worker_context = | 402 ServiceWorkerContextWrapper* service_worker_context = |
402 static_cast<ServiceWorkerContextWrapper*>( | 403 static_cast<ServiceWorkerContextWrapper*>( |
403 partition->GetServiceWorkerContext()); | 404 partition->GetServiceWorkerContext()); |
404 | 405 |
405 // Mark the fetch_start (Navigation Timing API). | 406 // Mark the fetch_start (Navigation Timing API). |
406 request_params_.navigation_timing.fetch_start = base::TimeTicks::Now(); | 407 request_params_.navigation_timing.fetch_start = base::TimeTicks::Now(); |
407 | 408 |
| 409 std::unique_ptr<NavigationUIData> navigation_ui_data; |
| 410 if (navigation_handle_->navigation_ui_data()) |
| 411 navigation_ui_data = navigation_handle_->navigation_ui_data()->Clone(); |
| 412 |
408 loader_ = NavigationURLLoader::Create( | 413 loader_ = NavigationURLLoader::Create( |
409 frame_tree_node_->navigator()->GetController()->GetBrowserContext(), | 414 frame_tree_node_->navigator()->GetController()->GetBrowserContext(), |
410 std::move(info_), service_worker_context, this); | 415 std::move(info_), std::move(navigation_ui_data), service_worker_context, |
| 416 this); |
411 } | 417 } |
412 | 418 |
413 void NavigationRequest::OnRedirectChecksComplete( | 419 void NavigationRequest::OnRedirectChecksComplete( |
414 NavigationThrottle::ThrottleCheckResult result) { | 420 NavigationThrottle::ThrottleCheckResult result) { |
415 CHECK(result != NavigationThrottle::DEFER); | 421 CHECK(result != NavigationThrottle::DEFER); |
416 | 422 |
417 // Abort the request if needed. This will destroy the NavigationRequest. | 423 // Abort the request if needed. This will destroy the NavigationRequest. |
418 if (result == NavigationThrottle::CANCEL_AND_IGNORE || | 424 if (result == NavigationThrottle::CANCEL_AND_IGNORE || |
419 result == NavigationThrottle::CANCEL) { | 425 result == NavigationThrottle::CANCEL) { |
420 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. | 426 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 | 466 |
461 TransferNavigationHandleOwnership(render_frame_host); | 467 TransferNavigationHandleOwnership(render_frame_host); |
462 render_frame_host->CommitNavigation(response_.get(), std::move(body_), | 468 render_frame_host->CommitNavigation(response_.get(), std::move(body_), |
463 common_params_, request_params_, | 469 common_params_, request_params_, |
464 is_view_source_); | 470 is_view_source_); |
465 | 471 |
466 frame_tree_node_->ResetNavigationRequest(true); | 472 frame_tree_node_->ResetNavigationRequest(true); |
467 } | 473 } |
468 | 474 |
469 } // namespace content | 475 } // namespace content |
OLD | NEW |