Chromium Code Reviews| 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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 406 | 406 |
| 407 if (url.GetOrigin() != GURL(opener->document().url()).GetOrigin()) | 407 if (url.GetOrigin() != GURL(opener->document().url()).GetOrigin()) |
| 408 return true; | 408 return true; |
| 409 } | 409 } |
| 410 return false; | 410 return false; |
| 411 } | 411 } |
| 412 | 412 |
| 413 WebURLRequest CreateURLRequestForNavigation( | 413 WebURLRequest CreateURLRequestForNavigation( |
| 414 const CommonNavigationParams& common_params, | 414 const CommonNavigationParams& common_params, |
| 415 scoped_ptr<StreamOverrideParameters> stream_override, | 415 scoped_ptr<StreamOverrideParameters> stream_override, |
| 416 int navigation_provider_id, | |
| 416 bool is_view_source_mode_enabled) { | 417 bool is_view_source_mode_enabled) { |
| 417 WebURLRequest request(common_params.url); | 418 WebURLRequest request(common_params.url); |
| 418 if (is_view_source_mode_enabled) | 419 if (is_view_source_mode_enabled) |
| 419 request.setCachePolicy(WebURLRequest::ReturnCacheDataElseLoad); | 420 request.setCachePolicy(WebURLRequest::ReturnCacheDataElseLoad); |
| 420 | 421 |
| 421 if (common_params.referrer.url.is_valid()) { | 422 if (common_params.referrer.url.is_valid()) { |
| 422 WebString web_referrer = WebSecurityPolicy::generateReferrerHeader( | 423 WebString web_referrer = WebSecurityPolicy::generateReferrerHeader( |
| 423 common_params.referrer.policy, | 424 common_params.referrer.policy, |
| 424 common_params.url, | 425 common_params.url, |
| 425 WebString::fromUTF8(common_params.referrer.url.spec())); | 426 WebString::fromUTF8(common_params.referrer.url.spec())); |
| 426 if (!web_referrer.isEmpty()) | 427 if (!web_referrer.isEmpty()) |
| 427 request.setHTTPReferrer(web_referrer, common_params.referrer.policy); | 428 request.setHTTPReferrer(web_referrer, common_params.referrer.policy); |
| 428 } | 429 } |
| 429 | 430 |
| 430 RequestExtraData* extra_data = new RequestExtraData(); | 431 RequestExtraData* extra_data = new RequestExtraData(); |
| 431 extra_data->set_stream_override(stream_override.Pass()); | 432 extra_data->set_stream_override(stream_override.Pass()); |
| 433 extra_data->set_navigation_provider_id(navigation_provider_id); | |
| 432 request.setExtraData(extra_data); | 434 request.setExtraData(extra_data); |
| 433 | 435 |
| 434 // Set the ui timestamp for this navigation. Currently the timestamp here is | 436 // Set the ui timestamp for this navigation. Currently the timestamp here is |
| 435 // only non empty when the navigation was triggered by an Android intent. The | 437 // only non empty when the navigation was triggered by an Android intent. The |
| 436 // timestamp is converted to a double version supported by blink. It will be | 438 // timestamp is converted to a double version supported by blink. It will be |
| 437 // passed back to the browser in the DidCommitProvisionalLoad and the | 439 // passed back to the browser in the DidCommitProvisionalLoad and the |
| 438 // DocumentLoadComplete IPCs. | 440 // DocumentLoadComplete IPCs. |
| 439 base::TimeDelta ui_timestamp = common_params.ui_timestamp - base::TimeTicks(); | 441 base::TimeDelta ui_timestamp = common_params.ui_timestamp - base::TimeTicks(); |
| 440 request.setUiStartTime(ui_timestamp.InSecondsF()); | 442 request.setUiStartTime(ui_timestamp.InSecondsF()); |
| 441 request.setInputPerfMetricReportPolicy( | 443 request.setInputPerfMetricReportPolicy( |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1070 | 1072 |
| 1071 void RenderFrameImpl::OnNavigate( | 1073 void RenderFrameImpl::OnNavigate( |
| 1072 const CommonNavigationParams& common_params, | 1074 const CommonNavigationParams& common_params, |
| 1073 const StartNavigationParams& start_params, | 1075 const StartNavigationParams& start_params, |
| 1074 const RequestNavigationParams& request_params) { | 1076 const RequestNavigationParams& request_params) { |
| 1075 DCHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch( | 1077 DCHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1076 switches::kEnableBrowserSideNavigation)); | 1078 switches::kEnableBrowserSideNavigation)); |
| 1077 TRACE_EVENT2("navigation", "RenderFrameImpl::OnNavigate", "id", routing_id_, | 1079 TRACE_EVENT2("navigation", "RenderFrameImpl::OnNavigate", "id", routing_id_, |
| 1078 "url", common_params.url.possibly_invalid_spec()); | 1080 "url", common_params.url.possibly_invalid_spec()); |
| 1079 NavigateInternal(common_params, start_params, request_params, | 1081 NavigateInternal(common_params, start_params, request_params, |
| 1080 scoped_ptr<StreamOverrideParameters>()); | 1082 scoped_ptr<StreamOverrideParameters>(), |
| 1083 kInvalidServiceWorkerProviderId); | |
| 1081 } | 1084 } |
| 1082 | 1085 |
| 1083 void RenderFrameImpl::NavigateToSwappedOutURL() { | 1086 void RenderFrameImpl::NavigateToSwappedOutURL() { |
| 1084 // We use loadRequest instead of loadHTMLString because the former commits | 1087 // We use loadRequest instead of loadHTMLString because the former commits |
| 1085 // synchronously. Otherwise a new navigation can interrupt the navigation | 1088 // synchronously. Otherwise a new navigation can interrupt the navigation |
| 1086 // to kSwappedOutURL. If that happens to be to the page we had been | 1089 // to kSwappedOutURL. If that happens to be to the page we had been |
| 1087 // showing, then WebKit will never send a commit and we'll be left spinning. | 1090 // showing, then WebKit will never send a commit and we'll be left spinning. |
| 1088 // Set the is_swapped_out_ bit to true, so IPC filtering is in effect and | 1091 // Set the is_swapped_out_ bit to true, so IPC filtering is in effect and |
| 1089 // the navigation to swappedout:// is not announced to the browser side. | 1092 // the navigation to swappedout:// is not announced to the browser side. |
| 1090 is_swapped_out_ = true; | 1093 is_swapped_out_ = true; |
| (...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2503 // does not exist (When navigation happens within a page, the provider already | 2506 // does not exist (When navigation happens within a page, the provider already |
| 2504 // exists). | 2507 // exists). |
| 2505 if (!ServiceWorkerNetworkProvider::FromDocumentState( | 2508 if (!ServiceWorkerNetworkProvider::FromDocumentState( |
| 2506 DocumentState::FromDataSource(datasource))) { | 2509 DocumentState::FromDataSource(datasource))) { |
| 2507 ServiceWorkerProviderType provider_type = | 2510 ServiceWorkerProviderType provider_type = |
| 2508 SERVICE_WORKER_PROVIDER_FOR_WINDOW; | 2511 SERVICE_WORKER_PROVIDER_FOR_WINDOW; |
| 2509 if ((frame->effectiveSandboxFlags() & blink::WebSandboxFlags::Origin) == | 2512 if ((frame->effectiveSandboxFlags() & blink::WebSandboxFlags::Origin) == |
| 2510 blink::WebSandboxFlags::Origin) { | 2513 blink::WebSandboxFlags::Origin) { |
| 2511 provider_type = SERVICE_WORKER_PROVIDER_FOR_SANDBOXED_FRAME; | 2514 provider_type = SERVICE_WORKER_PROVIDER_FOR_SANDBOXED_FRAME; |
| 2512 } | 2515 } |
| 2516 const WebURLRequest& original_request = datasource->originalRequest(); | |
| 2517 int navigation_provider_id = kInvalidServiceWorkerProviderId; | |
| 2518 if (original_request.extraData()) { | |
| 2519 RequestExtraData* extra_data = | |
| 2520 static_cast<RequestExtraData*>(original_request.extraData()); | |
| 2521 navigation_provider_id = extra_data->navigation_provider_id(); | |
| 2522 } | |
| 2513 scoped_ptr<ServiceWorkerNetworkProvider> network_provider( | 2523 scoped_ptr<ServiceWorkerNetworkProvider> network_provider( |
| 2514 new ServiceWorkerNetworkProvider(routing_id_, provider_type)); | 2524 new ServiceWorkerNetworkProvider(routing_id_, provider_type, |
| 2525 navigation_provider_id)); | |
| 2526 | |
| 2515 ServiceWorkerNetworkProvider::AttachToDocumentState( | 2527 ServiceWorkerNetworkProvider::AttachToDocumentState( |
| 2516 DocumentState::FromDataSource(datasource), | 2528 DocumentState::FromDataSource(datasource), |
| 2517 network_provider.Pass()); | 2529 network_provider.Pass()); |
| 2518 } | 2530 } |
| 2519 } | 2531 } |
| 2520 | 2532 |
| 2521 void RenderFrameImpl::didStartProvisionalLoad(blink::WebLocalFrame* frame, | 2533 void RenderFrameImpl::didStartProvisionalLoad(blink::WebLocalFrame* frame, |
| 2522 double triggering_event_time) { | 2534 double triggering_event_time) { |
| 2523 DCHECK(!frame_ || frame_ == frame); | 2535 DCHECK(!frame_ || frame_ == frame); |
| 2524 WebDataSource* ds = frame->provisionalDataSource(); | 2536 WebDataSource* ds = frame->provisionalDataSource(); |
| (...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3191 | 3203 |
| 3192 // The request's extra data may indicate that we should set a custom user | 3204 // The request's extra data may indicate that we should set a custom user |
| 3193 // agent. This needs to be done here, after WebKit is through with setting the | 3205 // agent. This needs to be done here, after WebKit is through with setting the |
| 3194 // user agent on its own. Similarly, it may indicate that we should set an | 3206 // user agent on its own. Similarly, it may indicate that we should set an |
| 3195 // X-Requested-With header. This must be done here to avoid breaking CORS | 3207 // X-Requested-With header. This must be done here to avoid breaking CORS |
| 3196 // checks. | 3208 // checks. |
| 3197 // PlzNavigate: there may also be a stream url associated with the request. | 3209 // PlzNavigate: there may also be a stream url associated with the request. |
| 3198 WebString custom_user_agent; | 3210 WebString custom_user_agent; |
| 3199 WebString requested_with; | 3211 WebString requested_with; |
| 3200 scoped_ptr<StreamOverrideParameters> stream_override; | 3212 scoped_ptr<StreamOverrideParameters> stream_override; |
| 3213 int navigation_provider_id = kInvalidServiceWorkerProviderId; | |
| 3201 if (request.extraData()) { | 3214 if (request.extraData()) { |
| 3202 RequestExtraData* old_extra_data = | 3215 RequestExtraData* old_extra_data = |
| 3203 static_cast<RequestExtraData*>(request.extraData()); | 3216 static_cast<RequestExtraData*>(request.extraData()); |
| 3204 | 3217 |
| 3205 custom_user_agent = old_extra_data->custom_user_agent(); | 3218 custom_user_agent = old_extra_data->custom_user_agent(); |
| 3206 if (!custom_user_agent.isNull()) { | 3219 if (!custom_user_agent.isNull()) { |
| 3207 if (custom_user_agent.isEmpty()) | 3220 if (custom_user_agent.isEmpty()) |
| 3208 request.clearHTTPHeaderField("User-Agent"); | 3221 request.clearHTTPHeaderField("User-Agent"); |
| 3209 else | 3222 else |
| 3210 request.setHTTPHeaderField("User-Agent", custom_user_agent); | 3223 request.setHTTPHeaderField("User-Agent", custom_user_agent); |
| 3211 } | 3224 } |
| 3212 | 3225 |
| 3213 requested_with = old_extra_data->requested_with(); | 3226 requested_with = old_extra_data->requested_with(); |
| 3214 if (!requested_with.isNull()) { | 3227 if (!requested_with.isNull()) { |
| 3215 if (requested_with.isEmpty()) | 3228 if (requested_with.isEmpty()) |
| 3216 request.clearHTTPHeaderField("X-Requested-With"); | 3229 request.clearHTTPHeaderField("X-Requested-With"); |
| 3217 else | 3230 else |
| 3218 request.setHTTPHeaderField("X-Requested-With", requested_with); | 3231 request.setHTTPHeaderField("X-Requested-With", requested_with); |
| 3219 } | 3232 } |
| 3220 stream_override = old_extra_data->TakeStreamOverrideOwnership(); | 3233 stream_override = old_extra_data->TakeStreamOverrideOwnership(); |
| 3234 navigation_provider_id = old_extra_data->navigation_provider_id(); | |
| 3221 } | 3235 } |
| 3222 | 3236 |
| 3223 // Add the default accept header for frame request if it has not been set | 3237 // Add the default accept header for frame request if it has not been set |
| 3224 // already. | 3238 // already. |
| 3225 if ((request.frameType() == blink::WebURLRequest::FrameTypeTopLevel || | 3239 if ((request.frameType() == blink::WebURLRequest::FrameTypeTopLevel || |
| 3226 request.frameType() == blink::WebURLRequest::FrameTypeNested) && | 3240 request.frameType() == blink::WebURLRequest::FrameTypeNested) && |
| 3227 request.httpHeaderField(WebString::fromUTF8(kAcceptHeader)).isEmpty()) { | 3241 request.httpHeaderField(WebString::fromUTF8(kAcceptHeader)).isEmpty()) { |
| 3228 request.setHTTPHeaderField(WebString::fromUTF8(kAcceptHeader), | 3242 request.setHTTPHeaderField(WebString::fromUTF8(kAcceptHeader), |
| 3229 WebString::fromUTF8(kDefaultAcceptHeader)); | 3243 WebString::fromUTF8(kDefaultAcceptHeader)); |
| 3230 } | 3244 } |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3290 extra_data->set_allow_download( | 3304 extra_data->set_allow_download( |
| 3291 navigation_state->common_params().allow_download); | 3305 navigation_state->common_params().allow_download); |
| 3292 extra_data->set_transition_type(transition_type); | 3306 extra_data->set_transition_type(transition_type); |
| 3293 extra_data->set_should_replace_current_entry(should_replace_current_entry); | 3307 extra_data->set_should_replace_current_entry(should_replace_current_entry); |
| 3294 extra_data->set_transferred_request_child_id( | 3308 extra_data->set_transferred_request_child_id( |
| 3295 navigation_state->start_params().transferred_request_child_id); | 3309 navigation_state->start_params().transferred_request_child_id); |
| 3296 extra_data->set_transferred_request_request_id( | 3310 extra_data->set_transferred_request_request_id( |
| 3297 navigation_state->start_params().transferred_request_request_id); | 3311 navigation_state->start_params().transferred_request_request_id); |
| 3298 extra_data->set_service_worker_provider_id(provider_id); | 3312 extra_data->set_service_worker_provider_id(provider_id); |
| 3299 extra_data->set_stream_override(stream_override.Pass()); | 3313 extra_data->set_stream_override(stream_override.Pass()); |
| 3314 extra_data->set_navigation_provider_id(navigation_provider_id); | |
| 3300 request.setExtraData(extra_data); | 3315 request.setExtraData(extra_data); |
| 3301 | 3316 |
| 3302 // TODO(creis): Update prefetching to work with out-of-process iframes. | 3317 // TODO(creis): Update prefetching to work with out-of-process iframes. |
| 3303 WebFrame* top_frame = frame->top(); | 3318 WebFrame* top_frame = frame->top(); |
| 3304 if (top_frame && top_frame->isWebLocalFrame()) { | 3319 if (top_frame && top_frame->isWebLocalFrame()) { |
| 3305 DocumentState* top_document_state = | 3320 DocumentState* top_document_state = |
| 3306 DocumentState::FromDataSource(top_frame->dataSource()); | 3321 DocumentState::FromDataSource(top_frame->dataSource()); |
| 3307 if (top_document_state) { | 3322 if (top_document_state) { |
| 3308 // TODO(gavinp): separate out prefetching and prerender field trials | 3323 // TODO(gavinp): separate out prefetching and prerender field trials |
| 3309 // if the rel=prerender rel type is sticking around. | 3324 // if the rel=prerender rel type is sticking around. |
| (...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4110 void RenderFrameImpl::FocusedNodeChangedForAccessibility(const WebNode& node) { | 4125 void RenderFrameImpl::FocusedNodeChangedForAccessibility(const WebNode& node) { |
| 4111 if (renderer_accessibility()) | 4126 if (renderer_accessibility()) |
| 4112 renderer_accessibility()->AccessibilityFocusedNodeChanged(node); | 4127 renderer_accessibility()->AccessibilityFocusedNodeChanged(node); |
| 4113 } | 4128 } |
| 4114 | 4129 |
| 4115 // PlzNavigate | 4130 // PlzNavigate |
| 4116 void RenderFrameImpl::OnCommitNavigation( | 4131 void RenderFrameImpl::OnCommitNavigation( |
| 4117 const ResourceResponseHead& response, | 4132 const ResourceResponseHead& response, |
| 4118 const GURL& stream_url, | 4133 const GURL& stream_url, |
| 4119 const CommonNavigationParams& common_params, | 4134 const CommonNavigationParams& common_params, |
| 4120 const RequestNavigationParams& request_params) { | 4135 const RequestNavigationParams& request_params, |
| 4136 int navigation_provider_id) { | |
| 4121 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( | 4137 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 4122 switches::kEnableBrowserSideNavigation)); | 4138 switches::kEnableBrowserSideNavigation)); |
| 4123 // This will override the url requested by the WebURLLoader, as well as | 4139 // This will override the url requested by the WebURLLoader, as well as |
| 4124 // provide it with the response to the request. | 4140 // provide it with the response to the request. |
| 4125 scoped_ptr<StreamOverrideParameters> stream_override( | 4141 scoped_ptr<StreamOverrideParameters> stream_override( |
| 4126 new StreamOverrideParameters()); | 4142 new StreamOverrideParameters()); |
| 4127 stream_override->stream_url = stream_url; | 4143 stream_override->stream_url = stream_url; |
| 4128 stream_override->response = response; | 4144 stream_override->response = response; |
| 4129 | 4145 |
| 4130 NavigateInternal(common_params, StartNavigationParams(), request_params, | 4146 NavigateInternal(common_params, StartNavigationParams(), request_params, |
| 4131 stream_override.Pass()); | 4147 stream_override.Pass(), navigation_provider_id); |
| 4132 } | 4148 } |
| 4133 | 4149 |
| 4134 void RenderFrameImpl::OnFailedNavigation( | 4150 void RenderFrameImpl::OnFailedNavigation( |
| 4135 const CommonNavigationParams& common_params, | 4151 const CommonNavigationParams& common_params, |
| 4136 const RequestNavigationParams& request_params, | 4152 const RequestNavigationParams& request_params, |
| 4137 bool has_stale_copy_in_cache, | 4153 bool has_stale_copy_in_cache, |
| 4138 int error_code) { | 4154 int error_code) { |
| 4139 bool is_reload = IsReload(common_params.navigation_type); | 4155 bool is_reload = IsReload(common_params.navigation_type); |
| 4140 bool is_history_navigation = request_params.page_state.IsValid(); | 4156 bool is_history_navigation = request_params.page_state.IsValid(); |
| 4141 WebURLRequest::CachePolicy cache_policy = | 4157 WebURLRequest::CachePolicy cache_policy = |
| 4142 WebURLRequest::UseProtocolCachePolicy; | 4158 WebURLRequest::UseProtocolCachePolicy; |
| 4143 RenderFrameImpl::PrepareRenderViewForNavigation( | 4159 RenderFrameImpl::PrepareRenderViewForNavigation( |
| 4144 common_params.url, request_params, &is_reload, &cache_policy); | 4160 common_params.url, request_params, &is_reload, &cache_policy); |
| 4145 | 4161 |
| 4146 GetContentClient()->SetActiveURL(common_params.url); | 4162 GetContentClient()->SetActiveURL(common_params.url); |
| 4147 | 4163 |
| 4148 pending_navigation_params_.reset(new NavigationParams( | 4164 pending_navigation_params_.reset(new NavigationParams( |
| 4149 common_params, StartNavigationParams(), request_params)); | 4165 common_params, StartNavigationParams(), request_params)); |
| 4150 | 4166 |
| 4151 // Inform the browser of the start of the provisional load. This is needed so | 4167 // Inform the browser of the start of the provisional load. This is needed so |
| 4152 // that the load is properly tracked by the WebNavigation API. | 4168 // that the load is properly tracked by the WebNavigation API. |
| 4153 Send(new FrameHostMsg_DidStartProvisionalLoadForFrame( | 4169 Send(new FrameHostMsg_DidStartProvisionalLoadForFrame( |
| 4154 routing_id_, common_params.url)); | 4170 routing_id_, common_params.url)); |
| 4155 | 4171 |
| 4156 // Send the provisional load failure. | 4172 // Send the provisional load failure. |
| 4157 blink::WebURLError error = | 4173 blink::WebURLError error = |
| 4158 CreateWebURLError(common_params.url, has_stale_copy_in_cache, error_code); | 4174 CreateWebURLError(common_params.url, has_stale_copy_in_cache, error_code); |
| 4159 WebURLRequest failed_request = CreateURLRequestForNavigation( | 4175 WebURLRequest failed_request = CreateURLRequestForNavigation( |
| 4160 common_params, scoped_ptr<StreamOverrideParameters>(), | 4176 common_params, scoped_ptr<StreamOverrideParameters>(), |
| 4161 frame_->isViewSourceModeEnabled()); | 4177 kInvalidServiceWorkerProviderId, frame_->isViewSourceModeEnabled()); |
| 4162 SendFailedProvisionalLoad(failed_request, error, frame_); | 4178 SendFailedProvisionalLoad(failed_request, error, frame_); |
| 4163 | 4179 |
| 4164 if (!ShouldDisplayErrorPageForFailedLoad(error_code, common_params.url)) { | 4180 if (!ShouldDisplayErrorPageForFailedLoad(error_code, common_params.url)) { |
| 4165 // TODO(avi): Remove this; we shouldn't ever be dropping navigations. | 4181 // TODO(avi): Remove this; we shouldn't ever be dropping navigations. |
| 4166 // http://crbug.com/501960 | 4182 // http://crbug.com/501960 |
| 4167 Send(new FrameHostMsg_DidDropNavigation(routing_id_)); | 4183 Send(new FrameHostMsg_DidDropNavigation(routing_id_)); |
| 4168 return; | 4184 return; |
| 4169 } | 4185 } |
| 4170 | 4186 |
| 4171 // Make sure errors are not shown in view source mode. | 4187 // Make sure errors are not shown in view source mode. |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4411 WebUserGestureIndicator::consumeUserGesture(); | 4427 WebUserGestureIndicator::consumeUserGesture(); |
| 4412 } | 4428 } |
| 4413 | 4429 |
| 4414 Send(new FrameHostMsg_OpenURL(routing_id_, params)); | 4430 Send(new FrameHostMsg_OpenURL(routing_id_, params)); |
| 4415 } | 4431 } |
| 4416 | 4432 |
| 4417 void RenderFrameImpl::NavigateInternal( | 4433 void RenderFrameImpl::NavigateInternal( |
| 4418 const CommonNavigationParams& common_params, | 4434 const CommonNavigationParams& common_params, |
| 4419 const StartNavigationParams& start_params, | 4435 const StartNavigationParams& start_params, |
| 4420 const RequestNavigationParams& request_params, | 4436 const RequestNavigationParams& request_params, |
| 4421 scoped_ptr<StreamOverrideParameters> stream_params) { | 4437 scoped_ptr<StreamOverrideParameters> stream_params, |
| 4438 int navigation_provider_id) { | |
| 4422 bool browser_side_navigation = | 4439 bool browser_side_navigation = |
| 4423 base::CommandLine::ForCurrentProcess()->HasSwitch( | 4440 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 4424 switches::kEnableBrowserSideNavigation); | 4441 switches::kEnableBrowserSideNavigation); |
| 4425 bool is_reload = IsReload(common_params.navigation_type); | 4442 bool is_reload = IsReload(common_params.navigation_type); |
| 4426 bool is_history_navigation = request_params.page_state.IsValid(); | 4443 bool is_history_navigation = request_params.page_state.IsValid(); |
| 4427 WebURLRequest::CachePolicy cache_policy = | 4444 WebURLRequest::CachePolicy cache_policy = |
| 4428 WebURLRequest::UseProtocolCachePolicy; | 4445 WebURLRequest::UseProtocolCachePolicy; |
| 4429 RenderFrameImpl::PrepareRenderViewForNavigation( | 4446 RenderFrameImpl::PrepareRenderViewForNavigation( |
| 4430 common_params.url, request_params, &is_reload, &cache_policy); | 4447 common_params.url, request_params, &is_reload, &cache_policy); |
| 4431 | 4448 |
| 4432 GetContentClient()->SetActiveURL(common_params.url); | 4449 GetContentClient()->SetActiveURL(common_params.url); |
| 4433 | 4450 |
| 4434 // If this frame isn't in the same process as the main frame, it may naively | 4451 // If this frame isn't in the same process as the main frame, it may naively |
| 4435 // assume that this is the first navigation in the iframe, but this may not | 4452 // assume that this is the first navigation in the iframe, but this may not |
| 4436 // actually be the case. Inform the frame's state machine if this frame has | 4453 // actually be the case. Inform the frame's state machine if this frame has |
| 4437 // already committed other loads. | 4454 // already committed other loads. |
| 4438 if (request_params.has_committed_real_load && frame_->parent()) | 4455 if (request_params.has_committed_real_load && frame_->parent()) |
| 4439 frame_->setCommittedFirstRealLoad(); | 4456 frame_->setCommittedFirstRealLoad(); |
| 4440 | 4457 |
| 4441 if (is_reload && !render_view_->history_controller()->GetCurrentEntry()) { | 4458 if (is_reload && !render_view_->history_controller()->GetCurrentEntry()) { |
| 4442 // We cannot reload if we do not have any history state. This happens, for | 4459 // We cannot reload if we do not have any history state. This happens, for |
| 4443 // example, when recovering from a crash. | 4460 // example, when recovering from a crash. |
| 4444 is_reload = false; | 4461 is_reload = false; |
| 4445 cache_policy = WebURLRequest::ReloadIgnoringCacheData; | 4462 cache_policy = WebURLRequest::ReloadIgnoringCacheData; |
| 4446 } | 4463 } |
| 4447 | 4464 |
| 4448 pending_navigation_params_.reset( | 4465 pending_navigation_params_.reset( |
|
michaeln
2015/07/30 01:35:08
According to the comments about this data member,
Fabrice (no longer in Chrome)
2015/08/06 15:39:15
Yes, CommonNavigationParams seems like a better us
| |
| 4449 new NavigationParams(common_params, start_params, request_params)); | 4466 new NavigationParams(common_params, start_params, request_params)); |
| 4450 | 4467 |
| 4451 // Create parameters for a standard navigation. | 4468 // Create parameters for a standard navigation. |
| 4452 blink::WebFrameLoadType load_type = blink::WebFrameLoadType::Standard; | 4469 blink::WebFrameLoadType load_type = blink::WebFrameLoadType::Standard; |
| 4453 bool should_load_request = false; | 4470 bool should_load_request = false; |
| 4454 WebHistoryItem item_for_history_navigation; | 4471 WebHistoryItem item_for_history_navigation; |
| 4455 WebURLRequest request = CreateURLRequestForNavigation( | 4472 WebURLRequest request = CreateURLRequestForNavigation( |
| 4456 common_params, stream_params.Pass(), frame_->isViewSourceModeEnabled()); | 4473 common_params, stream_params.Pass(), navigation_provider_id, |
|
nasko
2015/08/07 17:51:12
Why do we need to pass this? The stream is the res
kinuko
2015/08/11 14:43:04
This is mainly to associate browser-side SW object
| |
| 4474 frame_->isViewSourceModeEnabled()); | |
| 4457 | 4475 |
| 4458 // PlzNavigate: Make sure that Blink's loader will not try to use browser side | 4476 // PlzNavigate: Make sure that Blink's loader will not try to use browser side |
| 4459 // navigation for this request (since it already went to the browser). | 4477 // navigation for this request (since it already went to the browser). |
| 4460 if (browser_side_navigation) | 4478 if (browser_side_navigation) |
| 4461 request.setCheckForBrowserSideNavigation(false); | 4479 request.setCheckForBrowserSideNavigation(false); |
| 4462 | 4480 |
| 4463 // If we are reloading, then use the history state of the current frame. | 4481 // If we are reloading, then use the history state of the current frame. |
| 4464 // Otherwise, if we have history state, then we need to navigate to it, which | 4482 // Otherwise, if we have history state, then we need to navigate to it, which |
| 4465 // corresponds to a back/forward navigation event. Update the parameters | 4483 // corresponds to a back/forward navigation event. Update the parameters |
| 4466 // depending on the navigation type. | 4484 // depending on the navigation type. |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5049 void RenderFrameImpl::RegisterMojoServices() { | 5067 void RenderFrameImpl::RegisterMojoServices() { |
| 5050 // Only main frame have ImageDownloader service. | 5068 // Only main frame have ImageDownloader service. |
| 5051 if (!frame_->parent()) { | 5069 if (!frame_->parent()) { |
| 5052 GetServiceRegistry()->AddService<image_downloader::ImageDownloader>( | 5070 GetServiceRegistry()->AddService<image_downloader::ImageDownloader>( |
| 5053 base::Bind(&ImageDownloaderImpl::CreateMojoService, | 5071 base::Bind(&ImageDownloaderImpl::CreateMojoService, |
| 5054 base::Unretained(this))); | 5072 base::Unretained(this))); |
| 5055 } | 5073 } |
| 5056 } | 5074 } |
| 5057 | 5075 |
| 5058 } // namespace content | 5076 } // namespace content |
| OLD | NEW |