Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(605)

Side by Side Diff: content/browser/frame_host/navigation_request.cc

Issue 2335133003: PlzNavigate: support the WebRequest API (Closed)
Patch Set: Addressed comments + changes to NavigationHandleImpl following 2364943002 Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 // and verifies that all origins are PSL-matches (and special-cases extension 476 // and verifies that all origins are PSL-matches (and special-cases extension
476 // URLs). 477 // URLs).
477 const GURL& first_party_for_cookies = 478 const GURL& first_party_for_cookies =
478 frame_tree_node_->IsMainFrame() 479 frame_tree_node_->IsMainFrame()
479 ? common_params_.url 480 ? common_params_.url
480 : frame_tree_node_->frame_tree()->root()->current_url(); 481 : frame_tree_node_->frame_tree()->root()->current_url();
481 bool parent_is_main_frame = !frame_tree_node_->parent() 482 bool parent_is_main_frame = !frame_tree_node_->parent()
482 ? false 483 ? false
483 : frame_tree_node_->parent()->IsMainFrame(); 484 : frame_tree_node_->parent()->IsMainFrame();
484 485
486 std::unique_ptr<NavigationUIData> navigation_ui_data;
487 if (navigation_handle_->navigation_ui_data())
488 navigation_ui_data = navigation_handle_->navigation_ui_data()->Clone();
489
485 loader_ = NavigationURLLoader::Create( 490 loader_ = NavigationURLLoader::Create(
486 frame_tree_node_->navigator()->GetController()->GetBrowserContext(), 491 frame_tree_node_->navigator()->GetController()->GetBrowserContext(),
487 base::MakeUnique<NavigationRequestInfo>( 492 base::MakeUnique<NavigationRequestInfo>(
488 common_params_, begin_params_, first_party_for_cookies, 493 common_params_, begin_params_, first_party_for_cookies,
489 frame_tree_node_->current_origin(), frame_tree_node_->IsMainFrame(), 494 frame_tree_node_->current_origin(), frame_tree_node_->IsMainFrame(),
490 parent_is_main_frame, IsSecureFrame(frame_tree_node_->parent()), 495 parent_is_main_frame, IsSecureFrame(frame_tree_node_->parent()),
491 frame_tree_node_->frame_tree_node_id()), 496 frame_tree_node_->frame_tree_node_id()),
497 std::move(navigation_ui_data),
492 navigation_handle_->service_worker_handle(), this); 498 navigation_handle_->service_worker_handle(), this);
493 } 499 }
494 500
495 void NavigationRequest::OnRedirectChecksComplete( 501 void NavigationRequest::OnRedirectChecksComplete(
496 NavigationThrottle::ThrottleCheckResult result) { 502 NavigationThrottle::ThrottleCheckResult result) {
497 CHECK(result != NavigationThrottle::DEFER); 503 CHECK(result != NavigationThrottle::DEFER);
498 504
499 // Abort the request if needed. This will destroy the NavigationRequest. 505 // Abort the request if needed. This will destroy the NavigationRequest.
500 if (result == NavigationThrottle::CANCEL_AND_IGNORE || 506 if (result == NavigationThrottle::CANCEL_AND_IGNORE ||
501 result == NavigationThrottle::CANCEL) { 507 result == NavigationThrottle::CANCEL) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 548
543 TransferNavigationHandleOwnership(render_frame_host); 549 TransferNavigationHandleOwnership(render_frame_host);
544 render_frame_host->CommitNavigation(response_.get(), std::move(body_), 550 render_frame_host->CommitNavigation(response_.get(), std::move(body_),
545 common_params_, request_params_, 551 common_params_, request_params_,
546 is_view_source_); 552 is_view_source_);
547 553
548 frame_tree_node_->ResetNavigationRequest(true); 554 frame_tree_node_->ResetNavigationRequest(true);
549 } 555 }
550 556
551 } // namespace content 557 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698