Index: content/renderer/render_view_impl.cc |
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc |
index 9cf33c0fae0ef84d7c4d81dea6cba0e09f9b2e1c..88f42fad272af1b3829248cc9901dee555edd61f 100644 |
--- a/content/renderer/render_view_impl.cc |
+++ b/content/renderer/render_view_impl.cc |
@@ -3987,6 +3987,29 @@ void RenderViewImpl::assignIdentifierToRequest( |
// Ignore |
} |
+void RenderViewImpl::willRequestAfterPreconnect(WebFrame* frame, |
+ WebURLRequest& request) { |
+ WebKit::WebReferrerPolicy referrer_policy = WebKit::WebReferrerPolicyDefault; |
+ WebString custom_user_agent; |
+ |
+ if(request.extraData()) { |
jam
2013/07/26 04:59:39
nit: "if ("
kouhei (in TOK)
2013/07/26 10:50:02
Done.
|
+ // This will only be called before willSendRequest, so only ExtraData |
+ // members we have to copy here is on WebURLRequestExtraDataImpl. |
+ webkit_glue::WebURLRequestExtraDataImpl* old_extra_data = |
+ static_cast<webkit_glue::WebURLRequestExtraDataImpl*>( |
+ request.extraData()); |
+ |
+ referrer_policy = old_extra_data->referrer_policy(); |
+ custom_user_agent = old_extra_data->custom_user_agent(); |
+ } |
+ |
+ bool was_after_preconnect_request = true; |
+ // The args after |was_after_preconnect_request| are not used, and set to |
+ // correct values at |willSendRequest|. |
+ request.setExtraData(new webkit_glue::WebURLRequestExtraDataImpl( |
+ referrer_policy, custom_user_agent, was_after_preconnect_request)); |
+} |
+ |
void RenderViewImpl::willSendRequest(WebFrame* frame, |
unsigned identifier, |
WebURLRequest& request, |
@@ -4037,11 +4060,14 @@ void RenderViewImpl::willSendRequest(WebFrame* frame, |
// agent. This needs to be done here, after WebKit is through with setting the |
// user agent on its own. |
WebString custom_user_agent; |
+ bool was_after_preconnect_request = false; |
if (request.extraData()) { |
webkit_glue::WebURLRequestExtraDataImpl* old_extra_data = |
static_cast<webkit_glue::WebURLRequestExtraDataImpl*>( |
request.extraData()); |
custom_user_agent = old_extra_data->custom_user_agent(); |
+ was_after_preconnect_request = |
+ old_extra_data->was_after_preconnect_request(); |
if (!custom_user_agent.isNull()) { |
if (custom_user_agent.isEmpty()) |
@@ -4054,6 +4080,7 @@ void RenderViewImpl::willSendRequest(WebFrame* frame, |
request.setExtraData( |
new RequestExtraData(referrer_policy, |
custom_user_agent, |
+ was_after_preconnect_request, |
(frame == top_frame), |
frame->identifier(), |
frame->parent() == top_frame, |
@@ -4065,11 +4092,15 @@ void RenderViewImpl::willSendRequest(WebFrame* frame, |
DocumentState* top_document_state = |
DocumentState::FromDataSource(top_data_source); |
- // TODO(gavinp): separate out prefetching and prerender field trials |
- // if the rel=prerender rel type is sticking around. |
- if (top_document_state && |
- request.targetType() == WebURLRequest::TargetIsPrefetch) |
- top_document_state->set_was_prefetcher(true); |
+ if (top_document_state) { |
+ // TODO(gavinp): separate out prefetching and prerender field trials |
+ // if the rel=prerender rel type is sticking around. |
+ if(request.targetType() == WebURLRequest::TargetIsPrefetch) |
jam
2013/07/26 04:59:39
ditto and also below
kouhei (in TOK)
2013/07/26 10:50:02
Done.
|
+ top_document_state->set_was_prefetcher(true); |
+ |
+ if(was_after_preconnect_request) |
+ top_document_state->set_was_after_preconnect_request(true); |
+ } |
request.setRequestorID(routing_id_); |
request.setHasUserGesture(WebUserGestureIndicator::isProcessingUserGesture()); |