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

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 1155713005: Use a resource throttle to implement shouldOverrideUrlLoading. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add flag showing that shouldOverrideUrl cancelled the navigation Created 5 years, 6 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/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 2845 matching lines...) Expand 10 before | Expand all | Expand 10 after
2856 GetContentClient()->renderer()->GetNavigationErrorStrings( 2856 GetContentClient()->renderer()->GetNavigationErrorStrings(
2857 render_view_.get(), 2857 render_view_.get(),
2858 frame, 2858 frame,
2859 failed_request, 2859 failed_request,
2860 error, 2860 error,
2861 NULL, 2861 NULL,
2862 &error_description); 2862 &error_description);
2863 Send(new FrameHostMsg_DidFailLoadWithError(routing_id_, 2863 Send(new FrameHostMsg_DidFailLoadWithError(routing_id_,
2864 failed_request.url(), 2864 failed_request.url(),
2865 error.reason, 2865 error.reason,
2866 error_description)); 2866 error_description,
2867 error.wasIgnoredByHandler));
2867 } 2868 }
2868 2869
2869 void RenderFrameImpl::didFinishLoad(blink::WebLocalFrame* frame) { 2870 void RenderFrameImpl::didFinishLoad(blink::WebLocalFrame* frame) {
2870 TRACE_EVENT1("navigation", "RenderFrameImpl::didFinishLoad", 2871 TRACE_EVENT1("navigation", "RenderFrameImpl::didFinishLoad",
2871 "id", routing_id_); 2872 "id", routing_id_);
2872 DCHECK(!frame_ || frame_ == frame); 2873 DCHECK(!frame_ || frame_ == frame);
2873 WebDataSource* ds = frame->dataSource(); 2874 WebDataSource* ds = frame->dataSource();
2874 DocumentState* document_state = DocumentState::FromDataSource(ds); 2875 DocumentState* document_state = DocumentState::FromDataSource(ds);
2875 if (document_state->finish_load_time().is_null()) { 2876 if (document_state->finish_load_time().is_null()) {
2876 if (!frame->parent()) { 2877 if (!frame->parent()) {
(...skipping 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after
4106 // TODO(clamy): see if initial commits in subframes should be handled 4107 // TODO(clamy): see if initial commits in subframes should be handled
4107 // separately. 4108 // separately.
4108 bool replace = is_reload || is_history_navigation || 4109 bool replace = is_reload || is_history_navigation ||
4109 common_params.url == GetLoadingUrl(); 4110 common_params.url == GetLoadingUrl();
4110 LoadNavigationErrorPage(failed_request, error, replace); 4111 LoadNavigationErrorPage(failed_request, error, replace);
4111 } 4112 }
4112 4113
4113 WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( 4114 WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation(
4114 RenderFrame* render_frame, 4115 RenderFrame* render_frame,
4115 const NavigationPolicyInfo& info) { 4116 const NavigationPolicyInfo& info) {
4116 #ifdef OS_ANDROID
4117 // The handlenavigation API is deprecated and will be removed once
4118 // crbug.com/325351 is resolved.
4119 if (info.urlRequest.url() != GURL(kSwappedOutURL) &&
4120 GetContentClient()->renderer()->HandleNavigation(
4121 render_frame,
4122 static_cast<DocumentState*>(info.extraData),
4123 render_view_->opener_id_,
4124 info.frame,
4125 info.urlRequest,
4126 info.navigationType,
4127 info.defaultPolicy,
4128 info.isRedirect)) {
4129 return blink::WebNavigationPolicyIgnore;
4130 }
4131 #endif
4132 4117
4133 Referrer referrer(RenderViewImpl::GetReferrerFromRequest(info.frame, 4118 Referrer referrer(RenderViewImpl::GetReferrerFromRequest(info.frame,
4134 info.urlRequest)); 4119 info.urlRequest));
4135 const base::CommandLine& command_line = 4120 const base::CommandLine& command_line =
4136 *base::CommandLine::ForCurrentProcess(); 4121 *base::CommandLine::ForCurrentProcess();
4137 4122
4138 if (command_line.HasSwitch(switches::kSitePerProcess) && is_subframe_) { 4123 if (command_line.HasSwitch(switches::kSitePerProcess) && is_subframe_) {
4139 // There's no reason to ignore navigations on subframes, since the swap out 4124 // There's no reason to ignore navigations on subframes, since the swap out
4140 // logic no longer applies. 4125 // logic no longer applies.
4141 } else { 4126 } else {
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
4737 bool show_repost_interstitial = (error.reason == net::ERR_CACHE_MISS && 4722 bool show_repost_interstitial = (error.reason == net::ERR_CACHE_MISS &&
4738 EqualsASCII(request.httpMethod(), "POST")); 4723 EqualsASCII(request.httpMethod(), "POST"));
4739 4724
4740 FrameHostMsg_DidFailProvisionalLoadWithError_Params params; 4725 FrameHostMsg_DidFailProvisionalLoadWithError_Params params;
4741 params.error_code = error.reason; 4726 params.error_code = error.reason;
4742 GetContentClient()->renderer()->GetNavigationErrorStrings( 4727 GetContentClient()->renderer()->GetNavigationErrorStrings(
4743 render_view_.get(), frame, request, error, NULL, 4728 render_view_.get(), frame, request, error, NULL,
4744 &params.error_description); 4729 &params.error_description);
4745 params.url = error.unreachableURL; 4730 params.url = error.unreachableURL;
4746 params.showing_repost_interstitial = show_repost_interstitial; 4731 params.showing_repost_interstitial = show_repost_interstitial;
4732 params.was_ignored_by_handler = error.wasIgnoredByHandler;
4747 Send(new FrameHostMsg_DidFailProvisionalLoadWithError(routing_id_, params)); 4733 Send(new FrameHostMsg_DidFailProvisionalLoadWithError(routing_id_, params));
4748 } 4734 }
4749 4735
4750 bool RenderFrameImpl::ShouldDisplayErrorPageForFailedLoad( 4736 bool RenderFrameImpl::ShouldDisplayErrorPageForFailedLoad(
4751 int error_code, 4737 int error_code,
4752 const GURL& unreachable_url) { 4738 const GURL& unreachable_url) {
4753 // Don't display an error page if this is simply a cancelled load. Aside 4739 // Don't display an error page if this is simply a cancelled load. Aside
4754 // from being dumb, Blink doesn't expect it and it will cause a crash. 4740 // from being dumb, Blink doesn't expect it and it will cause a crash.
4755 if (error_code == net::ERR_ABORTED) 4741 if (error_code == net::ERR_ABORTED)
4756 return false; 4742 return false;
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
4917 #elif defined(ENABLE_BROWSER_CDMS) 4903 #elif defined(ENABLE_BROWSER_CDMS)
4918 cdm_manager_, 4904 cdm_manager_,
4919 #endif 4905 #endif
4920 this); 4906 this);
4921 } 4907 }
4922 4908
4923 return cdm_factory_; 4909 return cdm_factory_;
4924 } 4910 }
4925 4911
4926 } // namespace content 4912 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698