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

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

Issue 1964863002: Persist prompt/block download limiter state on renderer-initiated loads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Implement DidFinishNavigation Created 4 years, 7 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 <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 11 matching lines...) Expand all
22 #include "content/browser/bluetooth/web_bluetooth_service_impl.h" 22 #include "content/browser/bluetooth/web_bluetooth_service_impl.h"
23 #include "content/browser/child_process_security_policy_impl.h" 23 #include "content/browser/child_process_security_policy_impl.h"
24 #include "content/browser/child_process_security_policy_impl.h" 24 #include "content/browser/child_process_security_policy_impl.h"
25 #include "content/browser/devtools/render_frame_devtools_agent_host.h" 25 #include "content/browser/devtools/render_frame_devtools_agent_host.h"
26 #include "content/browser/download/mhtml_generation_manager.h" 26 #include "content/browser/download/mhtml_generation_manager.h"
27 #include "content/browser/frame_host/cross_process_frame_connector.h" 27 #include "content/browser/frame_host/cross_process_frame_connector.h"
28 #include "content/browser/frame_host/cross_site_transferring_request.h" 28 #include "content/browser/frame_host/cross_site_transferring_request.h"
29 #include "content/browser/frame_host/frame_mojo_shell.h" 29 #include "content/browser/frame_host/frame_mojo_shell.h"
30 #include "content/browser/frame_host/frame_tree.h" 30 #include "content/browser/frame_host/frame_tree.h"
31 #include "content/browser/frame_host/frame_tree_node.h" 31 #include "content/browser/frame_host/frame_tree_node.h"
32 #include "content/browser/frame_host/navigation_entry_impl.h"
32 #include "content/browser/frame_host/navigation_handle_impl.h" 33 #include "content/browser/frame_host/navigation_handle_impl.h"
33 #include "content/browser/frame_host/navigation_request.h" 34 #include "content/browser/frame_host/navigation_request.h"
34 #include "content/browser/frame_host/navigator.h" 35 #include "content/browser/frame_host/navigator.h"
35 #include "content/browser/frame_host/navigator_impl.h" 36 #include "content/browser/frame_host/navigator_impl.h"
36 #include "content/browser/frame_host/render_frame_host_delegate.h" 37 #include "content/browser/frame_host/render_frame_host_delegate.h"
37 #include "content/browser/frame_host/render_frame_proxy_host.h" 38 #include "content/browser/frame_host/render_frame_proxy_host.h"
38 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" 39 #include "content/browser/frame_host/render_widget_host_view_child_frame.h"
39 #include "content/browser/geolocation/geolocation_service_context.h" 40 #include "content/browser/geolocation/geolocation_service_context.h"
40 #include "content/browser/loader/resource_dispatcher_host_impl.h" 41 #include "content/browser/loader/resource_dispatcher_host_impl.h"
41 #include "content/browser/permissions/permission_service_context.h" 42 #include "content/browser/permissions/permission_service_context.h"
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 // If the URL does not match what the NavigationHandle expects, treat the 1054 // If the URL does not match what the NavigationHandle expects, treat the
1054 // commit as a new navigation. This can happen if an ongoing slow 1055 // commit as a new navigation. This can happen if an ongoing slow
1055 // same-process navigation is interrupted by a synchronous renderer-initiated 1056 // same-process navigation is interrupted by a synchronous renderer-initiated
1056 // navigation. 1057 // navigation.
1057 // TODO(csharrison): Data navigations loaded with LoadDataWithBaseURL get 1058 // TODO(csharrison): Data navigations loaded with LoadDataWithBaseURL get
1058 // reset here, because the NavigationHandle tracks the URL but the 1059 // reset here, because the NavigationHandle tracks the URL but the
1059 // validated_params.url tracks the data. The trick of saving the old entry ids 1060 // validated_params.url tracks the data. The trick of saving the old entry ids
1060 // for these navigations should go away when this is properly handled. See 1061 // for these navigations should go away when this is properly handled. See
1061 // crbug.com/588317. 1062 // crbug.com/588317.
1062 int entry_id_for_data_nav = 0; 1063 int entry_id_for_data_nav = 0;
1064 bool is_renderer_initiated = false;
Charlie Reis 2016/05/11 21:50:04 As before, better assume true unless we know other
clamy 2016/05/12 04:04:44 In this case is_renderer_initiated _really_ has to
dominickn 2016/05/12 04:22:58 Done.
1063 if (navigation_handle_ && 1065 if (navigation_handle_ &&
1064 (navigation_handle_->GetURL() != validated_params.url)) { 1066 (navigation_handle_->GetURL() != validated_params.url)) {
1065 // Make sure that the pending entry was really loaded via 1067 // Make sure that the pending entry was really loaded via
1066 // LoadDataWithBaseURL and that it matches this handle. 1068 // LoadDataWithBaseURL and that it matches this handle.
1067 NavigationEntry* pending_entry = 1069 NavigationEntryImpl* pending_entry =
1068 frame_tree_node()->navigator()->GetController()->GetPendingEntry(); 1070 NavigationEntryImpl::FromNavigationEntry(
1071 frame_tree_node()->navigator()->GetController()->GetPendingEntry());
1069 bool pending_entry_matches_handle = 1072 bool pending_entry_matches_handle =
1070 pending_entry && 1073 pending_entry &&
1071 pending_entry->GetUniqueID() == 1074 pending_entry->GetUniqueID() ==
1072 navigation_handle_->pending_nav_entry_id(); 1075 navigation_handle_->pending_nav_entry_id();
1073 // TODO(csharrison): The pending entry's base url should equal 1076 // TODO(csharrison): The pending entry's base url should equal
1074 // |validated_params.base_url|. This is not the case for loads with invalid 1077 // |validated_params.base_url|. This is not the case for loads with invalid
1075 // base urls. 1078 // base urls.
1076 if (navigation_handle_->GetURL() == validated_params.base_url && 1079 if (navigation_handle_->GetURL() == validated_params.base_url &&
1077 pending_entry_matches_handle && 1080 pending_entry_matches_handle &&
1078 !pending_entry->GetBaseURLForDataURL().is_empty()) { 1081 !pending_entry->GetBaseURLForDataURL().is_empty()) {
1079 entry_id_for_data_nav = navigation_handle_->pending_nav_entry_id(); 1082 entry_id_for_data_nav = navigation_handle_->pending_nav_entry_id();
1083 is_renderer_initiated = pending_entry->is_renderer_initiated();
1080 } 1084 }
1081 navigation_handle_.reset(); 1085 navigation_handle_.reset();
1082 } 1086 }
1083 1087
1084 // Synchronous renderer-initiated navigations will send a 1088 // Synchronous renderer-initiated navigations will send a
1085 // DidCommitProvisionalLoad IPC without a prior DidStartProvisionalLoad 1089 // DidCommitProvisionalLoad IPC without a prior DidStartProvisionalLoad
1086 // message. 1090 // message.
1087 if (!navigation_handle_) { 1091 if (!navigation_handle_) {
1088 // There is no pending NavigationEntry in these cases, so pass 0 as the 1092 // There is no pending NavigationEntry in these cases, so pass 0 as the
1089 // nav_id. If the previous handle was a prematurely aborted navigation 1093 // nav_id. If the previous handle was a prematurely aborted navigation
1090 // loaded via LoadDataWithBaseURL, propogate the entry id. 1094 // loaded via LoadDataWithBaseURL, propogate the entry id.
1091 navigation_handle_ = NavigationHandleImpl::Create( 1095 navigation_handle_ = NavigationHandleImpl::Create(
1092 validated_params.url, frame_tree_node_, 1096 validated_params.url, frame_tree_node_,
1097 is_renderer_initiated,
1093 true, // is_synchronous 1098 true, // is_synchronous
1094 validated_params.is_srcdoc, base::TimeTicks::Now(), 1099 validated_params.is_srcdoc, base::TimeTicks::Now(),
1095 entry_id_for_data_nav); 1100 entry_id_for_data_nav);
1096 // PlzNavigate 1101 // PlzNavigate
1097 if (IsBrowserSideNavigationEnabled()) { 1102 if (IsBrowserSideNavigationEnabled()) {
1098 // PlzNavigate: synchronous loads happen in the renderer, and the browser 1103 // PlzNavigate: synchronous loads happen in the renderer, and the browser
1099 // has not been notified about the start of the load yet. Do it now. 1104 // has not been notified about the start of the load yet. Do it now.
1100 if (!is_loading()) { 1105 if (!is_loading()) {
1101 bool was_loading = frame_tree_node()->frame_tree()->IsLoading(); 1106 bool was_loading = frame_tree_node()->frame_tree()->IsLoading();
1102 is_loading_ = true; 1107 is_loading_ = true;
(...skipping 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after
2764 // handler after it's destroyed so it can't run after the RFHI is destroyed. 2769 // handler after it's destroyed so it can't run after the RFHI is destroyed.
2765 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( 2770 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind(
2766 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); 2771 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this)));
2767 } 2772 }
2768 2773
2769 void RenderFrameHostImpl::DeleteWebBluetoothService() { 2774 void RenderFrameHostImpl::DeleteWebBluetoothService() {
2770 web_bluetooth_service_.reset(); 2775 web_bluetooth_service_.reset();
2771 } 2776 }
2772 2777
2773 } // namespace content 2778 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698