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 2700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2711 | 2711 |
2712 // Update the request time if WebKit has better knowledge of it. | 2712 // Update the request time if WebKit has better knowledge of it. |
2713 if (document_state->request_time().is_null() && | 2713 if (document_state->request_time().is_null() && |
2714 triggering_event_time != 0.0) { | 2714 triggering_event_time != 0.0) { |
2715 document_state->set_request_time(Time::FromDoubleT(triggering_event_time)); | 2715 document_state->set_request_time(Time::FromDoubleT(triggering_event_time)); |
2716 } | 2716 } |
2717 | 2717 |
2718 // Start time is only set after request time. | 2718 // Start time is only set after request time. |
2719 document_state->set_start_load_time(Time::Now()); | 2719 document_state->set_start_load_time(Time::Now()); |
2720 | 2720 |
| 2721 NavigationStateImpl* navigation_state = static_cast<NavigationStateImpl*>( |
| 2722 document_state->navigation_state()); |
2721 bool is_top_most = !frame->parent(); | 2723 bool is_top_most = !frame->parent(); |
2722 if (is_top_most) { | 2724 if (is_top_most) { |
2723 render_view_->set_navigation_gesture( | 2725 render_view_->set_navigation_gesture( |
2724 WebUserGestureIndicator::isProcessingUserGesture() ? | 2726 WebUserGestureIndicator::isProcessingUserGesture() ? |
2725 NavigationGestureUser : NavigationGestureAuto); | 2727 NavigationGestureUser : NavigationGestureAuto); |
2726 } else if (ds->replacesCurrentHistoryItem()) { | 2728 } else if (ds->replacesCurrentHistoryItem()) { |
2727 // Subframe navigations that don't add session history items must be | 2729 // Subframe navigations that don't add session history items must be |
2728 // marked with AUTO_SUBFRAME. See also didFailProvisionalLoad for how we | 2730 // marked with AUTO_SUBFRAME. See also didFailProvisionalLoad for how we |
2729 // handle loading of error pages. | 2731 // handle loading of error pages. |
2730 static_cast<NavigationStateImpl*>(document_state->navigation_state()) | 2732 navigation_state->set_transition_type(ui::PAGE_TRANSITION_AUTO_SUBFRAME); |
2731 ->set_transition_type(ui::PAGE_TRANSITION_AUTO_SUBFRAME); | |
2732 } | 2733 } |
2733 | 2734 |
| 2735 base::TimeTicks navigation_start = |
| 2736 navigation_state->common_params().navigation_start; |
| 2737 DCHECK(!navigation_start.is_null()); |
| 2738 |
2734 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), | 2739 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), |
2735 DidStartProvisionalLoad(frame)); | 2740 DidStartProvisionalLoad(frame)); |
2736 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidStartProvisionalLoad()); | 2741 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidStartProvisionalLoad()); |
2737 | 2742 |
2738 Send(new FrameHostMsg_DidStartProvisionalLoadForFrame( | 2743 Send(new FrameHostMsg_DidStartProvisionalLoadForFrame( |
2739 routing_id_, ds->request().url())); | 2744 routing_id_, ds->request().url(), navigation_start)); |
2740 } | 2745 } |
2741 | 2746 |
2742 void RenderFrameImpl::didReceiveServerRedirectForProvisionalLoad( | 2747 void RenderFrameImpl::didReceiveServerRedirectForProvisionalLoad( |
2743 blink::WebLocalFrame* frame) { | 2748 blink::WebLocalFrame* frame) { |
2744 DCHECK(!frame_ || frame_ == frame); | 2749 DCHECK(!frame_ || frame_ == frame); |
2745 render_view_->history_controller()->RemoveChildrenForRedirect(this); | 2750 render_view_->history_controller()->RemoveChildrenForRedirect(this); |
2746 } | 2751 } |
2747 | 2752 |
2748 void RenderFrameImpl::didFailProvisionalLoad( | 2753 void RenderFrameImpl::didFailProvisionalLoad( |
2749 blink::WebLocalFrame* frame, | 2754 blink::WebLocalFrame* frame, |
(...skipping 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4336 common_params.url, request_params, &is_reload, &cache_policy); | 4341 common_params.url, request_params, &is_reload, &cache_policy); |
4337 | 4342 |
4338 GetContentClient()->SetActiveURL(common_params.url); | 4343 GetContentClient()->SetActiveURL(common_params.url); |
4339 | 4344 |
4340 pending_navigation_params_.reset(new NavigationParams( | 4345 pending_navigation_params_.reset(new NavigationParams( |
4341 common_params, StartNavigationParams(), request_params)); | 4346 common_params, StartNavigationParams(), request_params)); |
4342 | 4347 |
4343 // Inform the browser of the start of the provisional load. This is needed so | 4348 // Inform the browser of the start of the provisional load. This is needed so |
4344 // that the load is properly tracked by the WebNavigation API. | 4349 // that the load is properly tracked by the WebNavigation API. |
4345 Send(new FrameHostMsg_DidStartProvisionalLoadForFrame( | 4350 Send(new FrameHostMsg_DidStartProvisionalLoadForFrame( |
4346 routing_id_, common_params.url)); | 4351 routing_id_, common_params.url, common_params.navigation_start)); |
4347 | 4352 |
4348 // Send the provisional load failure. | 4353 // Send the provisional load failure. |
4349 blink::WebURLError error = | 4354 blink::WebURLError error = |
4350 CreateWebURLError(common_params.url, has_stale_copy_in_cache, error_code); | 4355 CreateWebURLError(common_params.url, has_stale_copy_in_cache, error_code); |
4351 WebURLRequest failed_request = CreateURLRequestForNavigation( | 4356 WebURLRequest failed_request = CreateURLRequestForNavigation( |
4352 common_params, scoped_ptr<StreamOverrideParameters>(), | 4357 common_params, scoped_ptr<StreamOverrideParameters>(), |
4353 frame_->isViewSourceModeEnabled()); | 4358 frame_->isViewSourceModeEnabled()); |
4354 SendFailedProvisionalLoad(failed_request, error, frame_); | 4359 SendFailedProvisionalLoad(failed_request, error, frame_); |
4355 | 4360 |
4356 if (!ShouldDisplayErrorPageForFailedLoad(error_code, common_params.url)) { | 4361 if (!ShouldDisplayErrorPageForFailedLoad(error_code, common_params.url)) { |
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5344 mojo::ServiceProviderPtr service_provider; | 5349 mojo::ServiceProviderPtr service_provider; |
5345 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 5350 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
5346 request->url = mojo::String::From(url); | 5351 request->url = mojo::String::From(url); |
5347 mojo_shell_->ConnectToApplication(request.Pass(), GetProxy(&service_provider), | 5352 mojo_shell_->ConnectToApplication(request.Pass(), GetProxy(&service_provider), |
5348 nullptr, nullptr, | 5353 nullptr, nullptr, |
5349 base::Bind(&OnGotContentHandlerID)); | 5354 base::Bind(&OnGotContentHandlerID)); |
5350 return service_provider.Pass(); | 5355 return service_provider.Pass(); |
5351 } | 5356 } |
5352 | 5357 |
5353 } // namespace content | 5358 } // namespace content |
OLD | NEW |