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

Side by Side Diff: content/browser/frame_host/navigator_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: Address nit 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/navigator_impl.h" 5 #include "content/browser/frame_host/navigator_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 return; 168 return;
169 } 169 }
170 170
171 // This ensures that notifications about the end of the previous 171 // This ensures that notifications about the end of the previous
172 // navigation are sent before notifications about the start of the 172 // navigation are sent before notifications about the start of the
173 // new navigation. 173 // new navigation.
174 render_frame_host->SetNavigationHandle( 174 render_frame_host->SetNavigationHandle(
175 std::unique_ptr<NavigationHandleImpl>()); 175 std::unique_ptr<NavigationHandleImpl>());
176 } 176 }
177 177
178 NavigationEntry* pending_entry = controller_->GetPendingEntry(); 178 // It is safer to assume navigations are renderer-initiated unless shown
179 // otherwise. Browser navigations are generally more powerful, and they should
clamy 2016/05/18 13:53:36 nit: "navigations are more powerful" sounds a bit
dominickn 2016/05/19 07:25:45 Done.
180 // always have a pending NavigationEntry which can be used to differentiate.
181 bool is_renderer_initiated = true;
182 int pending_nav_entry_id = 0;
183 NavigationEntryImpl* pending_entry = controller_->GetPendingEntry();
184 if (pending_entry) {
185 is_renderer_initiated = pending_entry->is_renderer_initiated();
186 pending_nav_entry_id = pending_entry->GetUniqueID();
187 }
179 render_frame_host->SetNavigationHandle(NavigationHandleImpl::Create( 188 render_frame_host->SetNavigationHandle(NavigationHandleImpl::Create(
180 validated_url, render_frame_host->frame_tree_node(), 189 validated_url, render_frame_host->frame_tree_node(),
190 is_renderer_initiated,
181 false, // is_synchronous 191 false, // is_synchronous
182 is_iframe_srcdoc, // is_srcdoc 192 is_iframe_srcdoc, // is_srcdoc
183 navigation_start, pending_entry ? pending_entry->GetUniqueID() : 0)); 193 navigation_start, pending_nav_entry_id));
184 } 194 }
185 195
186 void NavigatorImpl::DidFailProvisionalLoadWithError( 196 void NavigatorImpl::DidFailProvisionalLoadWithError(
187 RenderFrameHostImpl* render_frame_host, 197 RenderFrameHostImpl* render_frame_host,
188 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { 198 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) {
189 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() 199 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec()
190 << ", error_code: " << params.error_code 200 << ", error_code: " << params.error_code
191 << ", error_description: " << params.error_description 201 << ", error_description: " << params.error_description
192 << ", showing_repost_interstitial: " << 202 << ", showing_repost_interstitial: " <<
193 params.showing_repost_interstitial 203 params.showing_repost_interstitial
(...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 if (pending_entry != controller_->GetVisibleEntry() || 1157 if (pending_entry != controller_->GetVisibleEntry() ||
1148 !should_preserve_entry) { 1158 !should_preserve_entry) {
1149 controller_->DiscardPendingEntry(true); 1159 controller_->DiscardPendingEntry(true);
1150 1160
1151 // Also force the UI to refresh. 1161 // Also force the UI to refresh.
1152 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); 1162 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL);
1153 } 1163 }
1154 } 1164 }
1155 1165
1156 } // namespace content 1166 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698