| 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 3137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3148 // TODO(nasko): When the top-level frame is remote, there is no document. | 3148 // TODO(nasko): When the top-level frame is remote, there is no document. |
| 3149 // This is broken and should be fixed to propagate the first party. | 3149 // This is broken and should be fixed to propagate the first party. |
| 3150 WebFrame* top = frame->top(); | 3150 WebFrame* top = frame->top(); |
| 3151 if (top->isWebLocalFrame()) { | 3151 if (top->isWebLocalFrame()) { |
| 3152 request.setFirstPartyForCookies( | 3152 request.setFirstPartyForCookies( |
| 3153 frame->top()->document().firstPartyForCookies()); | 3153 frame->top()->document().firstPartyForCookies()); |
| 3154 } | 3154 } |
| 3155 } | 3155 } |
| 3156 } | 3156 } |
| 3157 | 3157 |
| 3158 WebFrame* top_frame = frame->top(); | 3158 WebDataSource* provisional_data_source = frame->provisionalDataSource(); |
| 3159 // TODO(nasko): Hack around asking about top-frame data source. This means | |
| 3160 // for out-of-process iframes we are treating the current frame as the | |
| 3161 // top-level frame, which is wrong. | |
| 3162 if (!top_frame || top_frame->isWebRemoteFrame()) | |
| 3163 top_frame = frame; | |
| 3164 WebDataSource* provisional_data_source = top_frame->provisionalDataSource(); | |
| 3165 WebDataSource* top_data_source = top_frame->dataSource(); | |
| 3166 WebDataSource* data_source = | 3159 WebDataSource* data_source = |
| 3167 provisional_data_source ? provisional_data_source : top_data_source; | 3160 provisional_data_source ? provisional_data_source : frame->dataSource(); |
| 3168 | 3161 |
| 3169 DocumentState* document_state = DocumentState::FromDataSource(data_source); | 3162 DocumentState* document_state = DocumentState::FromDataSource(data_source); |
| 3170 DCHECK(document_state); | 3163 DCHECK(document_state); |
| 3171 InternalDocumentStateData* internal_data = | 3164 InternalDocumentStateData* internal_data = |
| 3172 InternalDocumentStateData::FromDocumentState(document_state); | 3165 InternalDocumentStateData::FromDocumentState(document_state); |
| 3173 NavigationStateImpl* navigation_state = | 3166 NavigationStateImpl* navigation_state = |
| 3174 static_cast<NavigationStateImpl*>(document_state->navigation_state()); | 3167 static_cast<NavigationStateImpl*>(document_state->navigation_state()); |
| 3175 ui::PageTransition transition_type = navigation_state->GetTransitionType(); | 3168 ui::PageTransition transition_type = navigation_state->GetTransitionType(); |
| 3176 WebDataSource* frame_ds = frame->provisionalDataSource(); | 3169 if (provisional_data_source && provisional_data_source->isClientRedirect()) { |
| 3177 if (frame_ds && frame_ds->isClientRedirect()) { | |
| 3178 transition_type = ui::PageTransitionFromInt( | 3170 transition_type = ui::PageTransitionFromInt( |
| 3179 transition_type | ui::PAGE_TRANSITION_CLIENT_REDIRECT); | 3171 transition_type | ui::PAGE_TRANSITION_CLIENT_REDIRECT); |
| 3180 } | 3172 } |
| 3181 | 3173 |
| 3182 GURL request_url(request.url()); | 3174 GURL request_url(request.url()); |
| 3183 GURL new_url; | 3175 GURL new_url; |
| 3184 if (GetContentClient()->renderer()->WillSendRequest( | 3176 if (GetContentClient()->renderer()->WillSendRequest( |
| 3185 frame, | 3177 frame, |
| 3186 transition_type, | 3178 transition_type, |
| 3187 request_url, | 3179 request_url, |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3296 extra_data->set_transition_type(transition_type); | 3288 extra_data->set_transition_type(transition_type); |
| 3297 extra_data->set_should_replace_current_entry(should_replace_current_entry); | 3289 extra_data->set_should_replace_current_entry(should_replace_current_entry); |
| 3298 extra_data->set_transferred_request_child_id( | 3290 extra_data->set_transferred_request_child_id( |
| 3299 navigation_state->start_params().transferred_request_child_id); | 3291 navigation_state->start_params().transferred_request_child_id); |
| 3300 extra_data->set_transferred_request_request_id( | 3292 extra_data->set_transferred_request_request_id( |
| 3301 navigation_state->start_params().transferred_request_request_id); | 3293 navigation_state->start_params().transferred_request_request_id); |
| 3302 extra_data->set_service_worker_provider_id(provider_id); | 3294 extra_data->set_service_worker_provider_id(provider_id); |
| 3303 extra_data->set_stream_override(stream_override.Pass()); | 3295 extra_data->set_stream_override(stream_override.Pass()); |
| 3304 request.setExtraData(extra_data); | 3296 request.setExtraData(extra_data); |
| 3305 | 3297 |
| 3306 DocumentState* top_document_state = | 3298 // TODO(creis): Update prefetching to work with out-of-process iframes. |
| 3307 DocumentState::FromDataSource(top_data_source); | 3299 WebFrame* top_frame = frame->top(); |
| 3308 if (top_document_state) { | 3300 if (top_frame && top_frame->isWebLocalFrame()) { |
| 3309 // TODO(gavinp): separate out prefetching and prerender field trials | 3301 DocumentState* top_document_state = |
| 3310 // if the rel=prerender rel type is sticking around. | 3302 DocumentState::FromDataSource(top_frame->dataSource()); |
| 3311 if (request.requestContext() == WebURLRequest::RequestContextPrefetch) | 3303 if (top_document_state) { |
| 3312 top_document_state->set_was_prefetcher(true); | 3304 // TODO(gavinp): separate out prefetching and prerender field trials |
| 3305 // if the rel=prerender rel type is sticking around. |
| 3306 if (request.requestContext() == WebURLRequest::RequestContextPrefetch) |
| 3307 top_document_state->set_was_prefetcher(true); |
| 3308 } |
| 3313 } | 3309 } |
| 3314 | 3310 |
| 3315 // This is an instance where we embed a copy of the routing id | 3311 // This is an instance where we embed a copy of the routing id |
| 3316 // into the data portion of the message. This can cause problems if we | 3312 // into the data portion of the message. This can cause problems if we |
| 3317 // don't register this id on the browser side, since the download manager | 3313 // don't register this id on the browser side, since the download manager |
| 3318 // expects to find a RenderViewHost based off the id. | 3314 // expects to find a RenderViewHost based off the id. |
| 3319 request.setRequestorID(render_view_->GetRoutingID()); | 3315 request.setRequestorID(render_view_->GetRoutingID()); |
| 3320 request.setHasUserGesture(WebUserGestureIndicator::isProcessingUserGesture()); | 3316 request.setHasUserGesture(WebUserGestureIndicator::isProcessingUserGesture()); |
| 3321 | 3317 |
| 3322 if (!navigation_state->start_params().extra_headers.empty()) { | 3318 if (!navigation_state->start_params().extra_headers.empty()) { |
| (...skipping 1721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5044 void RenderFrameImpl::RegisterMojoServices() { | 5040 void RenderFrameImpl::RegisterMojoServices() { |
| 5045 // Only main frame have ImageDownloader service. | 5041 // Only main frame have ImageDownloader service. |
| 5046 if (!frame_->parent()) { | 5042 if (!frame_->parent()) { |
| 5047 GetServiceRegistry()->AddService<image_downloader::ImageDownloader>( | 5043 GetServiceRegistry()->AddService<image_downloader::ImageDownloader>( |
| 5048 base::Bind(&ImageDownloaderImpl::CreateMojoService, | 5044 base::Bind(&ImageDownloaderImpl::CreateMojoService, |
| 5049 base::Unretained(this))); | 5045 base::Unretained(this))); |
| 5050 } | 5046 } |
| 5051 } | 5047 } |
| 5052 | 5048 |
| 5053 } // namespace content | 5049 } // namespace content |
| OLD | NEW |