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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 // passed back to the browser in the DidCommitProvisionalLoad and the | 449 // passed back to the browser in the DidCommitProvisionalLoad and the |
450 // DocumentLoadComplete IPCs. | 450 // DocumentLoadComplete IPCs. |
451 base::TimeDelta ui_timestamp = common_params.ui_timestamp - base::TimeTicks(); | 451 base::TimeDelta ui_timestamp = common_params.ui_timestamp - base::TimeTicks(); |
452 request.setUiStartTime(ui_timestamp.InSecondsF()); | 452 request.setUiStartTime(ui_timestamp.InSecondsF()); |
453 request.setInputPerfMetricReportPolicy( | 453 request.setInputPerfMetricReportPolicy( |
454 static_cast<WebURLRequest::InputToLoadPerfMetricReportPolicy>( | 454 static_cast<WebURLRequest::InputToLoadPerfMetricReportPolicy>( |
455 common_params.report_type)); | 455 common_params.report_type)); |
456 return request; | 456 return request; |
457 } | 457 } |
458 | 458 |
459 void UpdateFrameNavigationTiming(WebFrame* frame, | 459 base::TimeTicks SanitizeNavigationTiming( |
460 base::TimeTicks browser_navigation_start, | 460 base::TimeTicks browser_navigation_start) { |
461 base::TimeTicks renderer_navigation_start) { | |
462 // The browser provides the navigation_start time to bootstrap the | 461 // The browser provides the navigation_start time to bootstrap the |
463 // Navigation Timing information for the browser-initiated navigations. In | 462 // Navigation Timing information for the browser-initiated navigations. In |
464 // case of cross-process navigations, this carries over the time of | 463 // case of cross-process navigations, this carries over the time of |
465 // finishing the onbeforeunload handler of the previous page. | 464 // finishing the onbeforeunload handler of the previous page. |
| 465 // |browser_navigation_start| is likely before this process existed, so we |
| 466 // can't use InterProcessTimeTicksConverter. We need at least to ensure |
| 467 // that the browser-side navigation start we set is not later than the one |
| 468 // on the renderer side. |
| 469 base::TimeTicks renderer_navigation_start = base::TimeTicks::Now(); |
466 DCHECK(!browser_navigation_start.is_null()); | 470 DCHECK(!browser_navigation_start.is_null()); |
467 if (frame->provisionalDataSource()) { | 471 base::TimeTicks navigation_start = |
468 // |browser_navigation_start| is likely before this process existed, so we | 472 std::min(browser_navigation_start, renderer_navigation_start); |
469 // can't use InterProcessTimeTicksConverter. We need at least to ensure | 473 // TODO(csharrison) UMA log: |
470 // that the browser-side navigation start we set is not later than the one | 474 // |renderer_navigation_start - browser_navigation_start| |
471 // on the renderer side. | 475 return navigation_start; |
472 base::TimeTicks navigation_start = std::min( | 476 } |
473 browser_navigation_start, renderer_navigation_start); | 477 |
| 478 // Update the navigation start based on a better value recieved from the |
| 479 // browser. This can be null if the timestamp should not be updated. |
| 480 void UpdateFrameNavigationTiming(WebFrame* frame, |
| 481 base::TimeTicks updated_navigation_start) { |
| 482 if (frame->provisionalDataSource() && !updated_navigation_start.is_null()) { |
474 double navigation_start_seconds = | 483 double navigation_start_seconds = |
475 (navigation_start - base::TimeTicks()).InSecondsF(); | 484 (updated_navigation_start - base::TimeTicks()).InSecondsF(); |
476 frame->provisionalDataSource()->setNavigationStartTime( | 485 frame->provisionalDataSource()->setNavigationStartTime( |
477 navigation_start_seconds); | 486 navigation_start_seconds); |
478 // TODO(clamy): We need to provide additional timing values for the | 487 // TODO(clamy): We need to provide additional timing values for the |
479 // Navigation Timing API to work with browser-side navigations. | 488 // Navigation Timing API to work with browser-side navigations. |
480 } | 489 } |
481 } | 490 } |
482 | 491 |
| 492 |
483 // PlzNavigate | 493 // PlzNavigate |
484 CommonNavigationParams MakeCommonNavigationParams( | 494 CommonNavigationParams MakeCommonNavigationParams( |
485 blink::WebURLRequest* request, | 495 blink::WebURLRequest* request, |
486 bool should_replace_current_entry) { | 496 bool should_replace_current_entry, |
| 497 const base::TimeTicks& navigation_start) { |
487 const RequestExtraData kEmptyData; | 498 const RequestExtraData kEmptyData; |
488 const RequestExtraData* extra_data = | 499 const RequestExtraData* extra_data = |
489 static_cast<RequestExtraData*>(request->extraData()); | 500 static_cast<RequestExtraData*>(request->extraData()); |
490 if (!extra_data) | 501 if (!extra_data) |
491 extra_data = &kEmptyData; | 502 extra_data = &kEmptyData; |
492 Referrer referrer( | 503 Referrer referrer( |
493 GURL(request->httpHeaderField(WebString::fromUTF8("Referer")).latin1()), | 504 GURL(request->httpHeaderField(WebString::fromUTF8("Referer")).latin1()), |
494 request->referrerPolicy()); | 505 request->referrerPolicy()); |
495 | 506 |
496 // Set the ui timestamp for this navigation. Currently the timestamp here is | 507 // Set the ui timestamp for this navigation. Currently the timestamp here is |
497 // only non empty when the navigation was triggered by an Android intent, or | 508 // only non empty when the navigation was triggered by an Android intent, or |
498 // by the user clicking on a link. The timestamp is converted from a double | 509 // by the user clicking on a link. The timestamp is converted from a double |
499 // version supported by blink. It will be passed back to the renderer in the | 510 // version supported by blink. It will be passed back to the renderer in the |
500 // CommitNavigation IPC, and then back to the browser again in the | 511 // CommitNavigation IPC, and then back to the browser again in the |
501 // DidCommitProvisionalLoad and the DocumentLoadComplete IPCs. | 512 // DidCommitProvisionalLoad and the DocumentLoadComplete IPCs. |
502 base::TimeTicks ui_timestamp = | 513 base::TimeTicks ui_timestamp = |
503 base::TimeTicks() + base::TimeDelta::FromSecondsD(request->uiStartTime()); | 514 base::TimeTicks() + base::TimeDelta::FromSecondsD(request->uiStartTime()); |
504 FrameMsg_UILoadMetricsReportType::Value report_type = | 515 FrameMsg_UILoadMetricsReportType::Value report_type = |
505 static_cast<FrameMsg_UILoadMetricsReportType::Value>( | 516 static_cast<FrameMsg_UILoadMetricsReportType::Value>( |
506 request->inputPerfMetricReportPolicy()); | 517 request->inputPerfMetricReportPolicy()); |
507 return CommonNavigationParams( | 518 return CommonNavigationParams( |
508 request->url(), referrer, extra_data->transition_type(), | 519 request->url(), referrer, extra_data->transition_type(), |
509 FrameMsg_Navigate_Type::NORMAL, true, should_replace_current_entry, | 520 FrameMsg_Navigate_Type::NORMAL, true, should_replace_current_entry, |
510 ui_timestamp, report_type, GURL(), GURL(), LOFI_UNSPECIFIED); | 521 ui_timestamp, report_type, GURL(), GURL(), LOFI_UNSPECIFIED, |
| 522 navigation_start); |
511 } | 523 } |
512 | 524 |
513 #if !defined(OS_ANDROID) || defined(ENABLE_MEDIA_PIPELINE_ON_ANDROID) | 525 #if !defined(OS_ANDROID) || defined(ENABLE_MEDIA_PIPELINE_ON_ANDROID) |
514 media::Context3D GetSharedMainThreadContext3D() { | 526 media::Context3D GetSharedMainThreadContext3D() { |
515 cc::ContextProvider* provider = | 527 cc::ContextProvider* provider = |
516 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); | 528 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); |
517 if (!provider) | 529 if (!provider) |
518 return media::Context3D(); | 530 return media::Context3D(); |
519 return media::Context3D(provider->ContextGL(), provider->GrContext()); | 531 return media::Context3D(provider->ContextGL(), provider->GrContext()); |
520 } | 532 } |
(...skipping 2171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2692 WebUserGestureIndicator::isProcessingUserGesture() ? | 2704 WebUserGestureIndicator::isProcessingUserGesture() ? |
2693 NavigationGestureUser : NavigationGestureAuto); | 2705 NavigationGestureUser : NavigationGestureAuto); |
2694 } else if (ds->replacesCurrentHistoryItem()) { | 2706 } else if (ds->replacesCurrentHistoryItem()) { |
2695 // Subframe navigations that don't add session history items must be | 2707 // Subframe navigations that don't add session history items must be |
2696 // marked with AUTO_SUBFRAME. See also didFailProvisionalLoad for how we | 2708 // marked with AUTO_SUBFRAME. See also didFailProvisionalLoad for how we |
2697 // handle loading of error pages. | 2709 // handle loading of error pages. |
2698 static_cast<NavigationStateImpl*>(document_state->navigation_state()) | 2710 static_cast<NavigationStateImpl*>(document_state->navigation_state()) |
2699 ->set_transition_type(ui::PAGE_TRANSITION_AUTO_SUBFRAME); | 2711 ->set_transition_type(ui::PAGE_TRANSITION_AUTO_SUBFRAME); |
2700 } | 2712 } |
2701 | 2713 |
| 2714 // Get the renderer navigation start in TimeTicks format. This will be |
| 2715 // lossy because blink converts TimeTicks internal int64 representation to a |
| 2716 // double. |
| 2717 DCHECK(ds->getNavigationStartTime()); |
| 2718 base::TimeTicks navigation_start = base::TimeTicks::FromInternalValue( |
| 2719 ds->getNavigationStartTime() * base::Time::kMicrosecondsPerSecond); |
| 2720 // See if we have a better timestamp from a browser initiated navigation. |
| 2721 // If so, override it. This will be propogated to blink after the request has |
| 2722 // been issued. |
| 2723 if (ds->request().extraData()) { |
| 2724 RequestExtraData* extra_data = |
| 2725 static_cast<RequestExtraData*>(ds->request().extraData()); |
| 2726 if (!extra_data->browser_navigation_start().is_null()) |
| 2727 navigation_start = extra_data->browser_navigation_start(); |
| 2728 } |
| 2729 |
2702 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), | 2730 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), |
2703 DidStartProvisionalLoad(frame)); | 2731 DidStartProvisionalLoad(frame)); |
2704 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidStartProvisionalLoad()); | 2732 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidStartProvisionalLoad()); |
2705 | 2733 |
2706 Send(new FrameHostMsg_DidStartProvisionalLoadForFrame( | 2734 Send(new FrameHostMsg_DidStartProvisionalLoadForFrame( |
2707 routing_id_, ds->request().url())); | 2735 routing_id_, ds->request().url(), navigation_start)); |
2708 } | 2736 } |
2709 | 2737 |
2710 void RenderFrameImpl::didReceiveServerRedirectForProvisionalLoad( | 2738 void RenderFrameImpl::didReceiveServerRedirectForProvisionalLoad( |
2711 blink::WebLocalFrame* frame) { | 2739 blink::WebLocalFrame* frame) { |
2712 DCHECK(!frame_ || frame_ == frame); | 2740 DCHECK(!frame_ || frame_ == frame); |
2713 render_view_->history_controller()->RemoveChildrenForRedirect(this); | 2741 render_view_->history_controller()->RemoveChildrenForRedirect(this); |
2714 } | 2742 } |
2715 | 2743 |
2716 void RenderFrameImpl::didFailProvisionalLoad( | 2744 void RenderFrameImpl::didFailProvisionalLoad( |
2717 blink::WebLocalFrame* frame, | 2745 blink::WebLocalFrame* frame, |
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3345 | 3373 |
3346 // The request's extra data may indicate that we should set a custom user | 3374 // The request's extra data may indicate that we should set a custom user |
3347 // agent. This needs to be done here, after WebKit is through with setting the | 3375 // agent. This needs to be done here, after WebKit is through with setting the |
3348 // user agent on its own. Similarly, it may indicate that we should set an | 3376 // user agent on its own. Similarly, it may indicate that we should set an |
3349 // X-Requested-With header. This must be done here to avoid breaking CORS | 3377 // X-Requested-With header. This must be done here to avoid breaking CORS |
3350 // checks. | 3378 // checks. |
3351 // PlzNavigate: there may also be a stream url associated with the request. | 3379 // PlzNavigate: there may also be a stream url associated with the request. |
3352 WebString custom_user_agent; | 3380 WebString custom_user_agent; |
3353 WebString requested_with; | 3381 WebString requested_with; |
3354 scoped_ptr<StreamOverrideParameters> stream_override; | 3382 scoped_ptr<StreamOverrideParameters> stream_override; |
| 3383 base::TimeTicks navigation_start; |
3355 if (request.extraData()) { | 3384 if (request.extraData()) { |
3356 RequestExtraData* old_extra_data = | 3385 RequestExtraData* old_extra_data = |
3357 static_cast<RequestExtraData*>(request.extraData()); | 3386 static_cast<RequestExtraData*>(request.extraData()); |
3358 | 3387 |
| 3388 navigation_start = old_extra_data->browser_navigation_start(); |
3359 custom_user_agent = old_extra_data->custom_user_agent(); | 3389 custom_user_agent = old_extra_data->custom_user_agent(); |
3360 if (!custom_user_agent.isNull()) { | 3390 if (!custom_user_agent.isNull()) { |
3361 if (custom_user_agent.isEmpty()) | 3391 if (custom_user_agent.isEmpty()) |
3362 request.clearHTTPHeaderField("User-Agent"); | 3392 request.clearHTTPHeaderField("User-Agent"); |
3363 else | 3393 else |
3364 request.setHTTPHeaderField("User-Agent", custom_user_agent); | 3394 request.setHTTPHeaderField("User-Agent", custom_user_agent); |
3365 } | 3395 } |
3366 | 3396 |
3367 requested_with = old_extra_data->requested_with(); | 3397 requested_with = old_extra_data->requested_with(); |
3368 if (!requested_with.isNull()) { | 3398 if (!requested_with.isNull()) { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3443 extra_data->set_allow_download( | 3473 extra_data->set_allow_download( |
3444 navigation_state->common_params().allow_download); | 3474 navigation_state->common_params().allow_download); |
3445 extra_data->set_transition_type(transition_type); | 3475 extra_data->set_transition_type(transition_type); |
3446 extra_data->set_should_replace_current_entry(should_replace_current_entry); | 3476 extra_data->set_should_replace_current_entry(should_replace_current_entry); |
3447 extra_data->set_transferred_request_child_id( | 3477 extra_data->set_transferred_request_child_id( |
3448 navigation_state->start_params().transferred_request_child_id); | 3478 navigation_state->start_params().transferred_request_child_id); |
3449 extra_data->set_transferred_request_request_id( | 3479 extra_data->set_transferred_request_request_id( |
3450 navigation_state->start_params().transferred_request_request_id); | 3480 navigation_state->start_params().transferred_request_request_id); |
3451 extra_data->set_service_worker_provider_id(provider_id); | 3481 extra_data->set_service_worker_provider_id(provider_id); |
3452 extra_data->set_stream_override(stream_override.Pass()); | 3482 extra_data->set_stream_override(stream_override.Pass()); |
| 3483 extra_data->set_browser_navigation_start(navigation_start); |
3453 if (request.loFiState() != WebURLRequest::LoFiUnspecified) | 3484 if (request.loFiState() != WebURLRequest::LoFiUnspecified) |
3454 extra_data->set_lofi_state(static_cast<LoFiState>(request.loFiState())); | 3485 extra_data->set_lofi_state(static_cast<LoFiState>(request.loFiState())); |
3455 else if (is_main_frame_ && !navigation_state->request_committed()) | 3486 else if (is_main_frame_ && !navigation_state->request_committed()) |
3456 extra_data->set_lofi_state(navigation_state->common_params().lofi_state); | 3487 extra_data->set_lofi_state(navigation_state->common_params().lofi_state); |
3457 else | 3488 else |
3458 extra_data->set_lofi_state(is_using_lofi_ ? LOFI_ON : LOFI_OFF); | 3489 extra_data->set_lofi_state(is_using_lofi_ ? LOFI_ON : LOFI_OFF); |
3459 request.setExtraData(extra_data); | 3490 request.setExtraData(extra_data); |
3460 | 3491 |
3461 // TODO(creis): Update prefetching to work with out-of-process iframes. | 3492 // TODO(creis): Update prefetching to work with out-of-process iframes. |
3462 WebFrame* top_frame = frame->top(); | 3493 WebFrame* top_frame = frame->top(); |
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4297 WebURLRequest::CachePolicy cache_policy = | 4328 WebURLRequest::CachePolicy cache_policy = |
4298 WebURLRequest::UseProtocolCachePolicy; | 4329 WebURLRequest::UseProtocolCachePolicy; |
4299 RenderFrameImpl::PrepareRenderViewForNavigation( | 4330 RenderFrameImpl::PrepareRenderViewForNavigation( |
4300 common_params.url, request_params, &is_reload, &cache_policy); | 4331 common_params.url, request_params, &is_reload, &cache_policy); |
4301 | 4332 |
4302 GetContentClient()->SetActiveURL(common_params.url); | 4333 GetContentClient()->SetActiveURL(common_params.url); |
4303 | 4334 |
4304 pending_navigation_params_.reset(new NavigationParams( | 4335 pending_navigation_params_.reset(new NavigationParams( |
4305 common_params, StartNavigationParams(), request_params)); | 4336 common_params, StartNavigationParams(), request_params)); |
4306 | 4337 |
4307 // Inform the browser of the start of the provisional load. This is needed so | |
4308 // that the load is properly tracked by the WebNavigation API. | |
4309 Send(new FrameHostMsg_DidStartProvisionalLoadForFrame( | 4338 Send(new FrameHostMsg_DidStartProvisionalLoadForFrame( |
4310 routing_id_, common_params.url)); | 4339 routing_id_, common_params.url, common_params.navigation_start)); |
4311 | 4340 |
4312 // Send the provisional load failure. | 4341 // Send the provisional load failure. |
4313 blink::WebURLError error = | 4342 blink::WebURLError error = |
4314 CreateWebURLError(common_params.url, has_stale_copy_in_cache, error_code); | 4343 CreateWebURLError(common_params.url, has_stale_copy_in_cache, error_code); |
4315 WebURLRequest failed_request = CreateURLRequestForNavigation( | 4344 WebURLRequest failed_request = CreateURLRequestForNavigation( |
4316 common_params, scoped_ptr<StreamOverrideParameters>(), | 4345 common_params, scoped_ptr<StreamOverrideParameters>(), |
4317 frame_->isViewSourceModeEnabled()); | 4346 frame_->isViewSourceModeEnabled()); |
4318 SendFailedProvisionalLoad(failed_request, error, frame_); | 4347 SendFailedProvisionalLoad(failed_request, error, frame_); |
4319 | 4348 |
4320 if (!ShouldDisplayErrorPageForFailedLoad(error_code, common_params.url)) { | 4349 if (!ShouldDisplayErrorPageForFailedLoad(error_code, common_params.url)) { |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4642 } | 4671 } |
4643 | 4672 |
4644 pending_navigation_params_.reset( | 4673 pending_navigation_params_.reset( |
4645 new NavigationParams(common_params, start_params, request_params)); | 4674 new NavigationParams(common_params, start_params, request_params)); |
4646 | 4675 |
4647 // Create parameters for a standard navigation. | 4676 // Create parameters for a standard navigation. |
4648 blink::WebFrameLoadType load_type = blink::WebFrameLoadType::Standard; | 4677 blink::WebFrameLoadType load_type = blink::WebFrameLoadType::Standard; |
4649 bool should_load_request = false; | 4678 bool should_load_request = false; |
4650 WebHistoryItem item_for_history_navigation; | 4679 WebHistoryItem item_for_history_navigation; |
4651 WebURLRequest request = CreateURLRequestForNavigation( | 4680 WebURLRequest request = CreateURLRequestForNavigation( |
4652 common_params, stream_params.Pass(), frame_->isViewSourceModeEnabled()); | 4681 common_params, stream_params.Pass(), |
| 4682 frame_->isViewSourceModeEnabled()); |
4653 #if defined(OS_ANDROID) | 4683 #if defined(OS_ANDROID) |
4654 request.setHasUserGesture(start_params.has_user_gesture); | 4684 request.setHasUserGesture(start_params.has_user_gesture); |
4655 #endif | 4685 #endif |
4656 | 4686 |
4657 // PlzNavigate: Make sure that Blink's loader will not try to use browser side | 4687 // PlzNavigate: Make sure that Blink's loader will not try to use browser side |
4658 // navigation for this request (since it already went to the browser). | 4688 // navigation for this request (since it already went to the browser). |
4659 if (browser_side_navigation) | 4689 if (browser_side_navigation) |
4660 request.setCheckForBrowserSideNavigation(false); | 4690 request.setCheckForBrowserSideNavigation(false); |
4661 | 4691 |
4662 // If we are reloading, then use the history state of the current frame. | 4692 // If we are reloading, then use the history state of the current frame. |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4767 request.setHTTPBody(http_body); | 4797 request.setHTTPBody(http_body); |
4768 } | 4798 } |
4769 | 4799 |
4770 // A session history navigation should have been accompanied by state. | 4800 // A session history navigation should have been accompanied by state. |
4771 CHECK_EQ(request_params.page_id, -1); | 4801 CHECK_EQ(request_params.page_id, -1); |
4772 | 4802 |
4773 should_load_request = true; | 4803 should_load_request = true; |
4774 } | 4804 } |
4775 | 4805 |
4776 if (should_load_request) { | 4806 if (should_load_request) { |
4777 // Record this before starting the load. We need a lower bound of this | 4807 base::TimeTicks updated_navigation_start; |
4778 // time to sanitize the navigationStart override set below. | 4808 if (load_type == blink::WebFrameLoadType::Standard) { |
4779 base::TimeTicks renderer_navigation_start = base::TimeTicks::Now(); | 4809 updated_navigation_start = |
| 4810 SanitizeNavigationTiming(common_params.navigation_start); |
| 4811 static_cast<RequestExtraData*>(request.extraData()) |
| 4812 ->set_browser_navigation_start(updated_navigation_start); |
| 4813 } |
4780 | 4814 |
4781 // Perform a navigation to a data url if needed. | 4815 // Perform a navigation to a data url if needed. |
4782 if (!common_params.base_url_for_data_url.is_empty() || | 4816 if (!common_params.base_url_for_data_url.is_empty() || |
4783 (browser_side_navigation && | 4817 (browser_side_navigation && |
4784 common_params.url.SchemeIs(url::kDataScheme))) { | 4818 common_params.url.SchemeIs(url::kDataScheme))) { |
4785 LoadDataURL(common_params, frame_); | 4819 LoadDataURL(common_params, frame_); |
4786 } else { | 4820 } else { |
4787 // Load the request. | 4821 // Load the request. |
4788 frame_->toWebLocalFrame()->load(request, load_type, | 4822 frame_->toWebLocalFrame()->load(request, load_type, |
4789 item_for_history_navigation); | 4823 item_for_history_navigation); |
4790 } | 4824 } |
4791 | 4825 // Update the navigationStart value after the request has been made. |
4792 if (load_type == blink::WebFrameLoadType::Standard) { | 4826 UpdateFrameNavigationTiming(frame_, updated_navigation_start); |
4793 UpdateFrameNavigationTiming(frame_, | |
4794 request_params.browser_navigation_start, | |
4795 renderer_navigation_start); | |
4796 } | |
4797 } | 4827 } |
4798 | 4828 |
4799 // In case LoadRequest failed before didCreateDataSource was called. | 4829 // In case LoadRequest failed before didCreateDataSource was called. |
4800 pending_navigation_params_.reset(); | 4830 pending_navigation_params_.reset(); |
4801 } | 4831 } |
4802 | 4832 |
4803 void RenderFrameImpl::UpdateEncoding(WebFrame* frame, | 4833 void RenderFrameImpl::UpdateEncoding(WebFrame* frame, |
4804 const std::string& encoding_name) { | 4834 const std::string& encoding_name) { |
4805 // Only update main frame's encoding_name. | 4835 // Only update main frame's encoding_name. |
4806 if (!frame->parent()) | 4836 if (!frame->parent()) |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4977 // Note: At this stage, the goal is to apply all the modifications the | 5007 // Note: At this stage, the goal is to apply all the modifications the |
4978 // renderer wants to make to the request, and then send it to the browser, so | 5008 // renderer wants to make to the request, and then send it to the browser, so |
4979 // that the actual network request can be started. Ideally, all such | 5009 // that the actual network request can be started. Ideally, all such |
4980 // modifications should take place in willSendRequest, and in the | 5010 // modifications should take place in willSendRequest, and in the |
4981 // implementation of willSendRequest for the various InspectorAgents | 5011 // implementation of willSendRequest for the various InspectorAgents |
4982 // (devtools). | 5012 // (devtools). |
4983 // | 5013 // |
4984 // TODO(clamy): Apply devtools override. | 5014 // TODO(clamy): Apply devtools override. |
4985 // TODO(clamy): Make sure that navigation requests are not modified somewhere | 5015 // TODO(clamy): Make sure that navigation requests are not modified somewhere |
4986 // else in blink. | 5016 // else in blink. |
| 5017 |
| 5018 base::TimeTicks navigation_start = base::TimeTicks::Now(); |
| 5019 |
4987 willSendRequest(frame_, 0, *request, blink::WebURLResponse()); | 5020 willSendRequest(frame_, 0, *request, blink::WebURLResponse()); |
4988 | 5021 |
4989 // TODO(clamy): Same-document navigations should not be sent back to the | 5022 // TODO(clamy): Same-document navigations should not be sent back to the |
4990 // browser. | 5023 // browser. |
4991 // TODO(clamy): Data urls should not be sent back to the browser either. | 5024 // TODO(clamy): Data urls should not be sent back to the browser either. |
4992 bool should_replace_current_entry = false; | 5025 bool should_replace_current_entry = false; |
4993 WebDataSource* provisional_data_source = frame_->provisionalDataSource(); | 5026 WebDataSource* provisional_data_source = frame_->provisionalDataSource(); |
4994 WebDataSource* current_data_source = frame_->dataSource(); | 5027 WebDataSource* current_data_source = frame_->dataSource(); |
4995 WebDataSource* data_source = | 5028 WebDataSource* data_source = |
4996 provisional_data_source ? provisional_data_source : current_data_source; | 5029 provisional_data_source ? provisional_data_source : current_data_source; |
(...skipping 13 matching lines...) Expand all Loading... |
5010 DCHECK(GetFetchRedirectModeForWebURLRequest(*request) == | 5043 DCHECK(GetFetchRedirectModeForWebURLRequest(*request) == |
5011 FetchRedirectMode::MANUAL_MODE); | 5044 FetchRedirectMode::MANUAL_MODE); |
5012 DCHECK(frame_->parent() || | 5045 DCHECK(frame_->parent() || |
5013 GetRequestContextFrameTypeForWebURLRequest(*request) == | 5046 GetRequestContextFrameTypeForWebURLRequest(*request) == |
5014 REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL); | 5047 REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL); |
5015 DCHECK(!frame_->parent() || | 5048 DCHECK(!frame_->parent() || |
5016 GetRequestContextFrameTypeForWebURLRequest(*request) == | 5049 GetRequestContextFrameTypeForWebURLRequest(*request) == |
5017 REQUEST_CONTEXT_FRAME_TYPE_NESTED); | 5050 REQUEST_CONTEXT_FRAME_TYPE_NESTED); |
5018 | 5051 |
5019 Send(new FrameHostMsg_BeginNavigation( | 5052 Send(new FrameHostMsg_BeginNavigation( |
5020 routing_id_, | 5053 routing_id_, MakeCommonNavigationParams( |
5021 MakeCommonNavigationParams(request, should_replace_current_entry), | 5054 request, should_replace_current_entry, navigation_start), |
5022 BeginNavigationParams( | 5055 BeginNavigationParams( |
5023 request->httpMethod().latin1(), GetWebURLRequestHeaders(*request), | 5056 request->httpMethod().latin1(), GetWebURLRequestHeaders(*request), |
5024 GetLoadFlagsForWebURLRequest(*request), request->hasUserGesture(), | 5057 GetLoadFlagsForWebURLRequest(*request), request->hasUserGesture(), |
5025 request->skipServiceWorker(), | 5058 request->skipServiceWorker(), |
5026 GetRequestContextTypeForWebURLRequest(*request)), | 5059 GetRequestContextTypeForWebURLRequest(*request)), |
5027 GetRequestBodyForWebURLRequest(*request))); | 5060 GetRequestBodyForWebURLRequest(*request))); |
5028 } | 5061 } |
5029 | 5062 |
5030 void RenderFrameImpl::LoadDataURL(const CommonNavigationParams& params, | 5063 void RenderFrameImpl::LoadDataURL(const CommonNavigationParams& params, |
5031 WebFrame* frame) { | 5064 WebFrame* frame) { |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5284 mojo::ServiceProviderPtr service_provider; | 5317 mojo::ServiceProviderPtr service_provider; |
5285 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 5318 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
5286 request->url = mojo::String::From(url); | 5319 request->url = mojo::String::From(url); |
5287 mojo_shell_->ConnectToApplication(request.Pass(), GetProxy(&service_provider), | 5320 mojo_shell_->ConnectToApplication(request.Pass(), GetProxy(&service_provider), |
5288 nullptr, nullptr, | 5321 nullptr, nullptr, |
5289 base::Bind(&OnGotContentHandlerID)); | 5322 base::Bind(&OnGotContentHandlerID)); |
5290 return service_provider.Pass(); | 5323 return service_provider.Pass(); |
5291 } | 5324 } |
5292 | 5325 |
5293 } // namespace content | 5326 } // namespace content |
OLD | NEW |