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

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

Issue 2797443005: PlzNavigate data pipe
Patch Set: cleanup Created 3 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/render_frame_host_impl.h" 5 #include "content/browser/frame_host/render_frame_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 2641 matching lines...) Expand 10 before | Expand all | Expand 10 after
2652 void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) { 2652 void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) {
2653 DCHECK(data_url.SchemeIs(url::kDataScheme)); 2653 DCHECK(data_url.SchemeIs(url::kDataScheme));
2654 CommonNavigationParams common_params( 2654 CommonNavigationParams common_params(
2655 data_url, Referrer(), ui::PAGE_TRANSITION_LINK, 2655 data_url, Referrer(), ui::PAGE_TRANSITION_LINK,
2656 FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT, false, false, 2656 FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT, false, false,
2657 base::TimeTicks::Now(), FrameMsg_UILoadMetricsReportType::NO_REPORT, 2657 base::TimeTicks::Now(), FrameMsg_UILoadMetricsReportType::NO_REPORT,
2658 GURL(), GURL(), PREVIEWS_OFF, base::TimeTicks::Now(), "GET", nullptr, 2658 GURL(), GURL(), PREVIEWS_OFF, base::TimeTicks::Now(), "GET", nullptr,
2659 base::Optional<SourceLocation>(), 2659 base::Optional<SourceLocation>(),
2660 CSPDisposition::CHECK /* should_check_main_world_csp */); 2660 CSPDisposition::CHECK /* should_check_main_world_csp */);
2661 if (IsBrowserSideNavigationEnabled()) { 2661 if (IsBrowserSideNavigationEnabled()) {
2662 CommitNavigation(nullptr, nullptr, common_params, RequestNavigationParams(), 2662 CommitNavigation(nullptr, mojo::ScopedDataPipeConsumerHandle(),
2663 false); 2663 common_params, RequestNavigationParams(), false);
2664 } else { 2664 } else {
2665 Navigate(common_params, StartNavigationParams(), RequestNavigationParams()); 2665 Navigate(common_params, StartNavigationParams(), RequestNavigationParams());
2666 } 2666 }
2667 } 2667 }
2668 2668
2669 void RenderFrameHostImpl::Stop() { 2669 void RenderFrameHostImpl::Stop() {
2670 Send(new FrameMsg_Stop(routing_id_)); 2670 Send(new FrameMsg_Stop(routing_id_));
2671 } 2671 }
2672 2672
2673 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_navigation, 2673 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_navigation,
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
2829 bool success, 2829 bool success,
2830 const base::string16& user_input) { 2830 const base::string16& user_input) {
2831 FrameHostMsg_RunJavaScriptDialog::WriteReplyParams(reply_msg, success, 2831 FrameHostMsg_RunJavaScriptDialog::WriteReplyParams(reply_msg, success,
2832 user_input); 2832 user_input);
2833 Send(reply_msg); 2833 Send(reply_msg);
2834 } 2834 }
2835 2835
2836 // PlzNavigate 2836 // PlzNavigate
2837 void RenderFrameHostImpl::CommitNavigation( 2837 void RenderFrameHostImpl::CommitNavigation(
2838 ResourceResponse* response, 2838 ResourceResponse* response,
2839 std::unique_ptr<StreamHandle> body, 2839 mojo::ScopedDataPipeConsumerHandle handle,
2840 const CommonNavigationParams& common_params, 2840 const CommonNavigationParams& common_params,
2841 const RequestNavigationParams& request_params, 2841 const RequestNavigationParams& request_params,
2842 bool is_view_source) { 2842 bool is_view_source) {
2843 DCHECK( 2843 DCHECK(
2844 (response && body.get()) || 2844 (response && handle.is_valid()) ||
2845 common_params.url.SchemeIs(url::kDataScheme) || 2845 common_params.url.SchemeIs(url::kDataScheme) ||
2846 !ShouldMakeNetworkRequestForURL(common_params.url) || 2846 !ShouldMakeNetworkRequestForURL(common_params.url) ||
2847 FrameMsg_Navigate_Type::IsSameDocument(common_params.navigation_type) || 2847 FrameMsg_Navigate_Type::IsSameDocument(common_params.navigation_type) ||
2848 IsRendererDebugURL(common_params.url)); 2848 IsRendererDebugURL(common_params.url));
2849 UpdatePermissionsForNavigation(common_params, request_params); 2849 UpdatePermissionsForNavigation(common_params, request_params);
2850 2850
2851 // Get back to a clean state, in case we start a new navigation without 2851 // Get back to a clean state, in case we start a new navigation without
2852 // completing an unload handler. 2852 // completing an unload handler.
2853 ResetWaitingState(); 2853 ResetWaitingState();
2854 2854
2855 // The renderer can exit view source mode when any error or cancellation 2855 // The renderer can exit view source mode when any error or cancellation
2856 // happen. When reusing the same renderer, overwrite to recover the mode. 2856 // happen. When reusing the same renderer, overwrite to recover the mode.
2857 if (is_view_source && 2857 if (is_view_source &&
2858 this == frame_tree_node_->render_manager()->current_frame_host()) { 2858 this == frame_tree_node_->render_manager()->current_frame_host()) {
2859 DCHECK(!GetParent()); 2859 DCHECK(!GetParent());
2860 render_view_host()->Send(new FrameMsg_EnableViewSourceMode(routing_id_)); 2860 render_view_host()->Send(new FrameMsg_EnableViewSourceMode(routing_id_));
2861 } 2861 }
2862 2862
2863 const GURL body_url = body.get() ? body->GetURL() : GURL();
2864 const ResourceResponseHead head = response ? 2863 const ResourceResponseHead head = response ?
2865 response->head : ResourceResponseHead(); 2864 response->head : ResourceResponseHead();
2866 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, common_params, 2865 Send(new FrameMsg_CommitNavigation(routing_id_, head, handle.release(),
2867 request_params)); 2866 common_params, request_params));
2868 2867
2869 // If a network request was made, update the Previews state. 2868 // If a network request was made, update the Previews state.
2870 if (ShouldMakeNetworkRequestForURL(common_params.url) && 2869 if (ShouldMakeNetworkRequestForURL(common_params.url) &&
2871 !FrameMsg_Navigate_Type::IsSameDocument(common_params.navigation_type)) { 2870 !FrameMsg_Navigate_Type::IsSameDocument(common_params.navigation_type)) {
2872 last_navigation_previews_state_ = common_params.previews_state; 2871 last_navigation_previews_state_ = common_params.previews_state;
2873 } 2872 }
2874 2873
2875 // TODO(clamy): Release the stream handle once the renderer has finished
2876 // reading it.
2877 stream_handle_ = std::move(body);
2878
2879 // When navigating to a debug url, no commit is expected from the 2874 // When navigating to a debug url, no commit is expected from the
2880 // RenderFrameHost, nor should the throbber start. The NavigationRequest is 2875 // RenderFrameHost, nor should the throbber start. The NavigationRequest is
2881 // also not stored in the FrameTreeNode. Therefore do not reset it, as this 2876 // also not stored in the FrameTreeNode. Therefore do not reset it, as this
2882 // could cancel an existing pending navigation. 2877 // could cancel an existing pending navigation.
2883 if (!IsRendererDebugURL(common_params.url)) { 2878 if (!IsRendererDebugURL(common_params.url)) {
2884 pending_commit_ = true; 2879 pending_commit_ = true;
2885 is_loading_ = true; 2880 is_loading_ = true;
2886 } 2881 }
2887 } 2882 }
2888 2883
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after
3678 service_manager::mojom::InterfaceProviderPtr provider; 3673 service_manager::mojom::InterfaceProviderPtr provider;
3679 BindInterfaceRegistryForRenderFrameHost(mojo::MakeRequest(&provider), this); 3674 BindInterfaceRegistryForRenderFrameHost(mojo::MakeRequest(&provider), this);
3680 java_interfaces_.reset(new service_manager::InterfaceProvider); 3675 java_interfaces_.reset(new service_manager::InterfaceProvider);
3681 java_interfaces_->Bind(std::move(provider)); 3676 java_interfaces_->Bind(std::move(provider));
3682 } 3677 }
3683 return java_interfaces_.get(); 3678 return java_interfaces_.get();
3684 } 3679 }
3685 #endif 3680 #endif
3686 3681
3687 } // namespace content 3682 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.h ('k') | content/browser/loader/navigation_resource_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698