OLD | NEW |
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 3081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3092 // TODO(nasko): When the top-level frame is remote, there is no document. | 3092 // TODO(nasko): When the top-level frame is remote, there is no document. |
3093 // This is broken and should be fixed to propagate the first party. | 3093 // This is broken and should be fixed to propagate the first party. |
3094 WebFrame* top = frame->top(); | 3094 WebFrame* top = frame->top(); |
3095 if (top->isWebLocalFrame()) { | 3095 if (top->isWebLocalFrame()) { |
3096 request.setFirstPartyForCookies( | 3096 request.setFirstPartyForCookies( |
3097 frame->top()->document().firstPartyForCookies()); | 3097 frame->top()->document().firstPartyForCookies()); |
3098 } | 3098 } |
3099 } | 3099 } |
3100 } | 3100 } |
3101 | 3101 |
3102 WebFrame* top_frame = frame->top(); | 3102 WebDataSource* provisional_data_source = frame->provisionalDataSource(); |
3103 // TODO(nasko): Hack around asking about top-frame data source. This means | |
3104 // for out-of-process iframes we are treating the current frame as the | |
3105 // top-level frame, which is wrong. | |
3106 if (!top_frame || top_frame->isWebRemoteFrame()) | |
3107 top_frame = frame; | |
3108 WebDataSource* provisional_data_source = top_frame->provisionalDataSource(); | |
3109 WebDataSource* top_data_source = top_frame->dataSource(); | |
3110 WebDataSource* data_source = | 3103 WebDataSource* data_source = |
3111 provisional_data_source ? provisional_data_source : top_data_source; | 3104 provisional_data_source ? provisional_data_source : frame->dataSource(); |
3112 | 3105 |
3113 DocumentState* document_state = DocumentState::FromDataSource(data_source); | 3106 DocumentState* document_state = DocumentState::FromDataSource(data_source); |
3114 DCHECK(document_state); | 3107 DCHECK(document_state); |
3115 InternalDocumentStateData* internal_data = | 3108 InternalDocumentStateData* internal_data = |
3116 InternalDocumentStateData::FromDocumentState(document_state); | 3109 InternalDocumentStateData::FromDocumentState(document_state); |
3117 NavigationStateImpl* navigation_state = | 3110 NavigationStateImpl* navigation_state = |
3118 static_cast<NavigationStateImpl*>(document_state->navigation_state()); | 3111 static_cast<NavigationStateImpl*>(document_state->navigation_state()); |
3119 ui::PageTransition transition_type = navigation_state->GetTransitionType(); | 3112 ui::PageTransition transition_type = navigation_state->GetTransitionType(); |
3120 WebDataSource* frame_ds = frame->provisionalDataSource(); | 3113 WebDataSource* frame_ds = frame->provisionalDataSource(); |
3121 if (frame_ds && frame_ds->isClientRedirect()) { | 3114 if (frame_ds && frame_ds->isClientRedirect()) { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3240 extra_data->set_transition_type(transition_type); | 3233 extra_data->set_transition_type(transition_type); |
3241 extra_data->set_should_replace_current_entry(should_replace_current_entry); | 3234 extra_data->set_should_replace_current_entry(should_replace_current_entry); |
3242 extra_data->set_transferred_request_child_id( | 3235 extra_data->set_transferred_request_child_id( |
3243 navigation_state->start_params().transferred_request_child_id); | 3236 navigation_state->start_params().transferred_request_child_id); |
3244 extra_data->set_transferred_request_request_id( | 3237 extra_data->set_transferred_request_request_id( |
3245 navigation_state->start_params().transferred_request_request_id); | 3238 navigation_state->start_params().transferred_request_request_id); |
3246 extra_data->set_service_worker_provider_id(provider_id); | 3239 extra_data->set_service_worker_provider_id(provider_id); |
3247 extra_data->set_stream_override(stream_override.Pass()); | 3240 extra_data->set_stream_override(stream_override.Pass()); |
3248 request.setExtraData(extra_data); | 3241 request.setExtraData(extra_data); |
3249 | 3242 |
3250 DocumentState* top_document_state = | 3243 // TODO(creis): Update prefetching to work with out-of-process iframes. |
3251 DocumentState::FromDataSource(top_data_source); | 3244 WebFrame* top_frame = frame->top(); |
3252 if (top_document_state) { | 3245 if (top_frame && top_frame->isWebLocalFrame()) { |
3253 // TODO(gavinp): separate out prefetching and prerender field trials | 3246 DocumentState* top_document_state = |
3254 // if the rel=prerender rel type is sticking around. | 3247 DocumentState::FromDataSource(top_frame->dataSource()); |
3255 if (request.requestContext() == WebURLRequest::RequestContextPrefetch) | 3248 if (top_document_state) { |
3256 top_document_state->set_was_prefetcher(true); | 3249 // TODO(gavinp): separate out prefetching and prerender field trials |
| 3250 // if the rel=prerender rel type is sticking around. |
| 3251 if (request.requestContext() == WebURLRequest::RequestContextPrefetch) |
| 3252 top_document_state->set_was_prefetcher(true); |
| 3253 } |
3257 } | 3254 } |
3258 | 3255 |
3259 // This is an instance where we embed a copy of the routing id | 3256 // This is an instance where we embed a copy of the routing id |
3260 // into the data portion of the message. This can cause problems if we | 3257 // into the data portion of the message. This can cause problems if we |
3261 // don't register this id on the browser side, since the download manager | 3258 // don't register this id on the browser side, since the download manager |
3262 // expects to find a RenderViewHost based off the id. | 3259 // expects to find a RenderViewHost based off the id. |
3263 request.setRequestorID(render_view_->GetRoutingID()); | 3260 request.setRequestorID(render_view_->GetRoutingID()); |
3264 request.setHasUserGesture(WebUserGestureIndicator::isProcessingUserGesture()); | 3261 request.setHasUserGesture(WebUserGestureIndicator::isProcessingUserGesture()); |
3265 | 3262 |
3266 if (!navigation_state->start_params().extra_headers.empty()) { | 3263 if (!navigation_state->start_params().extra_headers.empty()) { |
(...skipping 1745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5012 void RenderFrameImpl::RegisterMojoServices() { | 5009 void RenderFrameImpl::RegisterMojoServices() { |
5013 // Only main frame have ImageDownloader service. | 5010 // Only main frame have ImageDownloader service. |
5014 if (!frame_->parent()) { | 5011 if (!frame_->parent()) { |
5015 GetServiceRegistry()->AddService<image_downloader::ImageDownloader>( | 5012 GetServiceRegistry()->AddService<image_downloader::ImageDownloader>( |
5016 base::Bind(&ImageDownloaderImpl::CreateMojoService, | 5013 base::Bind(&ImageDownloaderImpl::CreateMojoService, |
5017 base::Unretained(this))); | 5014 base::Unretained(this))); |
5018 } | 5015 } |
5019 } | 5016 } |
5020 | 5017 |
5021 } // namespace content | 5018 } // namespace content |
OLD | NEW |