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

Unified Diff: content/browser/frame_host/navigator_impl.cc

Issue 906283003: PlzNavigate: Support data urls (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/navigator_impl.cc
diff --git a/content/browser/frame_host/navigator_impl.cc b/content/browser/frame_host/navigator_impl.cc
index 547c5515f8f740f20db596244f4265a34057b461..d86ee350afd33d4b158c61ed3746640a1f04c946 100644
--- a/content/browser/frame_host/navigator_impl.cc
+++ b/content/browser/frame_host/navigator_impl.cc
@@ -91,10 +91,13 @@ void MakeNavigateParams(const NavigationEntryImpl& entry,
ui_timestamp = entry.intent_received_timestamp();
#endif
+ const GURL history_url_for_data_url =
+ entry.GetBaseURLForDataURL().is_empty()? GURL() : entry.GetVirtualURL();
Charlie Reis 2015/02/20 22:11:50 nit: Wrong indent. Also, maybe it makes sense to
clamy 2015/02/26 15:28:36 Done.
params->common_params = CommonNavigationParams(
entry.GetURL(), entry.GetReferrer(), entry.GetTransitionType(),
GetNavigationType(controller->GetBrowserContext(), entry, reload_type),
- !entry.IsViewSourceMode(), ui_timestamp, report_type);
+ !entry.IsViewSourceMode(), ui_timestamp, report_type,
+ entry.GetBaseURLForDataURL(), history_url_for_data_url);
params->commit_params = CommitNavigationParams(
entry.GetPageState(), entry.GetIsOverridingUserAgent(), navigation_start);
params->is_post = entry.GetHasPostData();
@@ -106,10 +109,6 @@ void MakeNavigateParams(const NavigationEntryImpl& entry,
entry.GetBrowserInitiatedPostData()->size());
}
- if (!entry.GetBaseURLForDataURL().is_empty()) {
- params->base_url_for_data_url = entry.GetBaseURLForDataURL();
- params->history_url_for_data_url = entry.GetVirtualURL();
- }
params->should_replace_current_entry = entry.should_replace_entry();
// This is used by the old performance infrastructure to set up DocumentState
// associated with the RenderView.
@@ -739,19 +738,22 @@ void NavigatorImpl::CommitNavigation(FrameTreeNode* frame_tree_node,
CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableBrowserSideNavigation));
+ NavigationRequest* navigation_request =
+ navigation_request_map_.get(frame_tree_node->frame_tree_node_id());
+ DCHECK(navigation_request);
+ DCHECK(response ||
+ !NavigationRequest::ShouldMakeNetworkRequest(
+ navigation_request->common_params().url));
+
// HTTP 204 (No Content) and HTTP 205 (Reset Content) responses should not
// commit; they leave the frame showing the previous page.
- if (response->head.headers.get() &&
+ if (response && response->head.headers.get() &&
(response->head.headers->response_code() == 204 ||
response->head.headers->response_code() == 205)) {
CancelNavigation(frame_tree_node);
return;
}
- NavigationRequest* navigation_request =
- navigation_request_map_.get(frame_tree_node->frame_tree_node_id());
- DCHECK(navigation_request);
-
// Select an appropriate renderer to commit the navigation.
RenderFrameHostImpl* render_frame_host =
frame_tree_node->render_manager()->GetFrameHostForNavigation(
@@ -870,12 +872,13 @@ void NavigatorImpl::BeginNavigation(FrameTreeNode* frame_tree_node) {
if (!navigation_request)
return;
- // First start the request on the IO thread.
- navigation_request->BeginNavigation();
-
- // Then notify the RenderFrameHostManager so it can speculatively create a
- // RenderFrameHost (and potentially a new renderer process) in parallel.
- frame_tree_node->render_manager()->BeginNavigation(*navigation_request);
+ // Start the request.
+ if (navigation_request->BeginNavigation()) {
+ // If the request was sent to the IO thread, notify the
+ // RenderFrameHostManager so it can speculatively create a RenderFrameHost
+ // (and potentially a new renderer process) in parallel.
+ frame_tree_node->render_manager()->BeginNavigation(*navigation_request);
+ }
}
void NavigatorImpl::RecordNavigationMetrics(

Powered by Google App Engine
This is Rietveld 408576698