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 2690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2701 | 2701 |
2702 // Update the request time if WebKit has better knowledge of it. | 2702 // Update the request time if WebKit has better knowledge of it. |
2703 if (document_state->request_time().is_null() && | 2703 if (document_state->request_time().is_null() && |
2704 triggering_event_time != 0.0) { | 2704 triggering_event_time != 0.0) { |
2705 document_state->set_request_time(Time::FromDoubleT(triggering_event_time)); | 2705 document_state->set_request_time(Time::FromDoubleT(triggering_event_time)); |
2706 } | 2706 } |
2707 | 2707 |
2708 // Start time is only set after request time. | 2708 // Start time is only set after request time. |
2709 document_state->set_start_load_time(Time::Now()); | 2709 document_state->set_start_load_time(Time::Now()); |
2710 | 2710 |
| 2711 NavigationStateImpl* navigation_state = static_cast<NavigationStateImpl*>( |
| 2712 document_state->navigation_state()); |
2711 bool is_top_most = !frame->parent(); | 2713 bool is_top_most = !frame->parent(); |
2712 if (is_top_most) { | 2714 if (is_top_most) { |
2713 render_view_->set_navigation_gesture( | 2715 render_view_->set_navigation_gesture( |
2714 WebUserGestureIndicator::isProcessingUserGesture() ? | 2716 WebUserGestureIndicator::isProcessingUserGesture() ? |
2715 NavigationGestureUser : NavigationGestureAuto); | 2717 NavigationGestureUser : NavigationGestureAuto); |
2716 } else if (ds->replacesCurrentHistoryItem()) { | 2718 } else if (ds->replacesCurrentHistoryItem()) { |
2717 // Subframe navigations that don't add session history items must be | 2719 // Subframe navigations that don't add session history items must be |
2718 // marked with AUTO_SUBFRAME. See also didFailProvisionalLoad for how we | 2720 // marked with AUTO_SUBFRAME. See also didFailProvisionalLoad for how we |
2719 // handle loading of error pages. | 2721 // handle loading of error pages. |
2720 static_cast<NavigationStateImpl*>(document_state->navigation_state()) | 2722 navigation_state->set_transition_type(ui::PAGE_TRANSITION_AUTO_SUBFRAME); |
2721 ->set_transition_type(ui::PAGE_TRANSITION_AUTO_SUBFRAME); | |
2722 } | 2723 } |
2723 | 2724 |
| 2725 base::TimeTicks navigation_start = |
| 2726 navigation_state->common_params().navigation_start; |
| 2727 DCHECK(!navigation_start.is_null()); |
| 2728 |
2724 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), | 2729 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), |
2725 DidStartProvisionalLoad(frame)); | 2730 DidStartProvisionalLoad(frame)); |
2726 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidStartProvisionalLoad()); | 2731 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidStartProvisionalLoad()); |
2727 | 2732 |
2728 Send(new FrameHostMsg_DidStartProvisionalLoadForFrame( | 2733 Send(new FrameHostMsg_DidStartProvisionalLoadForFrame( |
2729 routing_id_, ds->request().url())); | 2734 routing_id_, ds->request().url(), navigation_start)); |
2730 } | 2735 } |
2731 | 2736 |
2732 void RenderFrameImpl::didReceiveServerRedirectForProvisionalLoad( | 2737 void RenderFrameImpl::didReceiveServerRedirectForProvisionalLoad( |
2733 blink::WebLocalFrame* frame) { | 2738 blink::WebLocalFrame* frame) { |
2734 DCHECK(!frame_ || frame_ == frame); | 2739 DCHECK(!frame_ || frame_ == frame); |
2735 | 2740 |
2736 // We don't use HistoryController in OOPIF enabled modes. | 2741 // We don't use HistoryController in OOPIF enabled modes. |
2737 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) | 2742 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) |
2738 return; | 2743 return; |
2739 | 2744 |
(...skipping 1606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4346 common_params.url, request_params, &is_reload, &cache_policy); | 4351 common_params.url, request_params, &is_reload, &cache_policy); |
4347 | 4352 |
4348 GetContentClient()->SetActiveURL(common_params.url); | 4353 GetContentClient()->SetActiveURL(common_params.url); |
4349 | 4354 |
4350 pending_navigation_params_.reset(new NavigationParams( | 4355 pending_navigation_params_.reset(new NavigationParams( |
4351 common_params, StartNavigationParams(), request_params)); | 4356 common_params, StartNavigationParams(), request_params)); |
4352 | 4357 |
4353 // Inform the browser of the start of the provisional load. This is needed so | 4358 // Inform the browser of the start of the provisional load. This is needed so |
4354 // that the load is properly tracked by the WebNavigation API. | 4359 // that the load is properly tracked by the WebNavigation API. |
4355 Send(new FrameHostMsg_DidStartProvisionalLoadForFrame( | 4360 Send(new FrameHostMsg_DidStartProvisionalLoadForFrame( |
4356 routing_id_, common_params.url)); | 4361 routing_id_, common_params.url, common_params.navigation_start)); |
4357 | 4362 |
4358 // Send the provisional load failure. | 4363 // Send the provisional load failure. |
4359 blink::WebURLError error = | 4364 blink::WebURLError error = |
4360 CreateWebURLError(common_params.url, has_stale_copy_in_cache, error_code); | 4365 CreateWebURLError(common_params.url, has_stale_copy_in_cache, error_code); |
4361 WebURLRequest failed_request = CreateURLRequestForNavigation( | 4366 WebURLRequest failed_request = CreateURLRequestForNavigation( |
4362 common_params, scoped_ptr<StreamOverrideParameters>(), | 4367 common_params, scoped_ptr<StreamOverrideParameters>(), |
4363 frame_->isViewSourceModeEnabled()); | 4368 frame_->isViewSourceModeEnabled()); |
4364 SendFailedProvisionalLoad(failed_request, error, frame_); | 4369 SendFailedProvisionalLoad(failed_request, error, frame_); |
4365 | 4370 |
4366 if (!ShouldDisplayErrorPageForFailedLoad(error_code, common_params.url)) { | 4371 if (!ShouldDisplayErrorPageForFailedLoad(error_code, common_params.url)) { |
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5352 mojo::ServiceProviderPtr service_provider; | 5357 mojo::ServiceProviderPtr service_provider; |
5353 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 5358 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
5354 request->url = mojo::String::From(url); | 5359 request->url = mojo::String::From(url); |
5355 mojo_shell_->ConnectToApplication(request.Pass(), GetProxy(&service_provider), | 5360 mojo_shell_->ConnectToApplication(request.Pass(), GetProxy(&service_provider), |
5356 nullptr, nullptr, | 5361 nullptr, nullptr, |
5357 base::Bind(&OnGotContentHandlerID)); | 5362 base::Bind(&OnGotContentHandlerID)); |
5358 return service_provider.Pass(); | 5363 return service_provider.Pass(); |
5359 } | 5364 } |
5360 | 5365 |
5361 } // namespace content | 5366 } // namespace content |
OLD | NEW |