Chromium Code Reviews| Index: content/renderer/render_frame_impl.cc |
| diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc |
| index a0e63e38b01b243425dc0d84c684cd7ba423fe18..081ac24f8b923aba3ea3d5b57a239ffc3b2a897e 100644 |
| --- a/content/renderer/render_frame_impl.cc |
| +++ b/content/renderer/render_frame_impl.cc |
| @@ -1091,22 +1091,8 @@ void RenderFrameImpl::OnNavigate(const FrameMsg_Navigate_Params& params) { |
| CHECK(entry->root().urlString() != WebString::fromUTF8(kSwappedOutURL)); |
| render_view_->history_controller()->GoToEntry(entry.Pass(), cache_policy); |
| } |
| - } else if (!params.base_url_for_data_url.is_empty()) { |
| - // A loadData request with a specified base URL. |
| - std::string mime_type, charset, data; |
| - if (net::DataURL::Parse( |
| - params.common_params.url, &mime_type, &charset, &data)) { |
| - frame->loadData( |
| - WebData(data.c_str(), data.length()), |
| - WebString::fromUTF8(mime_type), |
| - WebString::fromUTF8(charset), |
| - params.base_url_for_data_url, |
| - params.history_url_for_data_url, |
| - false); |
| - } else { |
| - CHECK(false) << "Invalid URL passed: " |
| - << params.common_params.url.possibly_invalid_spec(); |
| - } |
| + } else if (!params.common_params.base_url_for_data_url.is_empty()) { |
| + LoadDataURL(params.common_params, frame); |
| } else { |
| // Navigate to the given URL. |
| WebURLRequest request = |
| @@ -3883,6 +3869,12 @@ void RenderFrameImpl::OnCommitNavigation( |
| GetContentClient()->SetActiveURL(common_params.url); |
| + if (!common_params.base_url_for_data_url.is_empty() || |
| + common_params.url.SchemeIs(url::kDataScheme)) { |
|
carlosk
2015/02/17 12:35:09
Shouldn't this be a call to ShouldMakeNetworkReque
clamy
2015/02/17 12:54:28
The goal is for ShouldMakeNetworkRequestForNavigat
carlosk
2015/02/17 14:11:23
Acknowledged.
|
| + LoadDataURL(common_params, frame_); |
| + return; |
| + } |
| + |
| // Create a WebURLRequest that blink can use to get access to the body of the |
| // response through a stream in the browser. Blink will then commit the |
| // navigation. |
| @@ -4134,8 +4126,8 @@ WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( |
| if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| switches::kEnableBrowserSideNavigation) && |
| info.urlRequest.checkForBrowserSideNavigation()) { |
| - BeginNavigation(&info.urlRequest); |
| - return blink::WebNavigationPolicyIgnore; |
| + if (BeginNavigation(&info.urlRequest)) |
| + return blink::WebNavigationPolicyIgnore; |
|
Charlie Reis
2015/02/18 00:43:25
What if we're navigating a RemoteFrame and it need
clamy
2015/02/20 17:05:59
Done.
|
| } |
| return info.defaultPolicy; |
| @@ -4347,7 +4339,7 @@ bool RenderFrameImpl::PrepareRenderViewForNavigation( |
| return true; |
| } |
| -void RenderFrameImpl::BeginNavigation(blink::WebURLRequest* request) { |
| +bool RenderFrameImpl::BeginNavigation(blink::WebURLRequest* request) { |
| CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
| switches::kEnableBrowserSideNavigation)); |
| DCHECK(request); |
| @@ -4376,6 +4368,27 @@ void RenderFrameImpl::BeginNavigation(blink::WebURLRequest* request) { |
| GetLoadFlagsForWebURLRequest(*request), |
| request->hasUserGesture()), |
| GetRequestBodyForWebURLRequest(*request))); |
| + return ShouldMakeNetworkRequestForNavigation(request->url()); |
| +} |
| + |
| +void RenderFrameImpl::LoadDataURL(const CommonNavigationParams& params, |
| + WebFrame* frame) { |
| + // A loadData request with a specified base URL. |
| + std::string mime_type, charset, data; |
| + if (net::DataURL::Parse(params.url, &mime_type, &charset, &data)) { |
| + const GURL base_url = params.base_url_for_data_url.is_empty() ? |
| + params.url : params.base_url_for_data_url; |
| + frame->loadData( |
| + WebData(data.c_str(), data.length()), |
| + WebString::fromUTF8(mime_type), |
| + WebString::fromUTF8(charset), |
| + base_url, |
| + params.history_url_for_data_url, |
| + false); |
| + } else { |
| + CHECK(false) << "Invalid URL passed: " |
| + << params.url.possibly_invalid_spec(); |
| + } |
| } |
| GURL RenderFrameImpl::GetLoadingUrl() const { |