Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 1427633004: Send navigation_start to the browser in DidStartProvisionalLoad IPC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@navigation_start_renderer
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2673 matching lines...) Expand 10 before | Expand all | Expand 10 after
2684 2684
2685 // Update the request time if WebKit has better knowledge of it. 2685 // Update the request time if WebKit has better knowledge of it.
2686 if (document_state->request_time().is_null() && 2686 if (document_state->request_time().is_null() &&
2687 triggering_event_time != 0.0) { 2687 triggering_event_time != 0.0) {
2688 document_state->set_request_time(Time::FromDoubleT(triggering_event_time)); 2688 document_state->set_request_time(Time::FromDoubleT(triggering_event_time));
2689 } 2689 }
2690 2690
2691 // Start time is only set after request time. 2691 // Start time is only set after request time.
2692 document_state->set_start_load_time(Time::Now()); 2692 document_state->set_start_load_time(Time::Now());
2693 2693
2694 NavigationStateImpl* navigation_state = static_cast<NavigationStateImpl*>(
2695 document_state->navigation_state());
2694 bool is_top_most = !frame->parent(); 2696 bool is_top_most = !frame->parent();
2695 if (is_top_most) { 2697 if (is_top_most) {
2696 render_view_->set_navigation_gesture( 2698 render_view_->set_navigation_gesture(
2697 WebUserGestureIndicator::isProcessingUserGesture() ? 2699 WebUserGestureIndicator::isProcessingUserGesture() ?
2698 NavigationGestureUser : NavigationGestureAuto); 2700 NavigationGestureUser : NavigationGestureAuto);
2699 } else if (ds->replacesCurrentHistoryItem()) { 2701 } else if (ds->replacesCurrentHistoryItem()) {
2700 // Subframe navigations that don't add session history items must be 2702 // Subframe navigations that don't add session history items must be
2701 // marked with AUTO_SUBFRAME. See also didFailProvisionalLoad for how we 2703 // marked with AUTO_SUBFRAME. See also didFailProvisionalLoad for how we
2702 // handle loading of error pages. 2704 // handle loading of error pages.
2703 static_cast<NavigationStateImpl*>(document_state->navigation_state()) 2705 navigation_state->set_transition_type(ui::PAGE_TRANSITION_AUTO_SUBFRAME);
2704 ->set_transition_type(ui::PAGE_TRANSITION_AUTO_SUBFRAME);
2705 } 2706 }
2706 2707
2708 base::TimeTicks navigation_start =
2709 navigation_state->common_params().navigation_start;
2710 DCHECK(!navigation_start.is_null());
2711
2707 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), 2712 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(),
2708 DidStartProvisionalLoad(frame)); 2713 DidStartProvisionalLoad(frame));
2709 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidStartProvisionalLoad()); 2714 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidStartProvisionalLoad());
2710 2715
2711 Send(new FrameHostMsg_DidStartProvisionalLoadForFrame( 2716 Send(new FrameHostMsg_DidStartProvisionalLoadForFrame(
2712 routing_id_, ds->request().url())); 2717 routing_id_, ds->request().url(), navigation_start));
2713 } 2718 }
2714 2719
2715 void RenderFrameImpl::didReceiveServerRedirectForProvisionalLoad( 2720 void RenderFrameImpl::didReceiveServerRedirectForProvisionalLoad(
2716 blink::WebLocalFrame* frame) { 2721 blink::WebLocalFrame* frame) {
2717 DCHECK(!frame_ || frame_ == frame); 2722 DCHECK(!frame_ || frame_ == frame);
2718 render_view_->history_controller()->RemoveChildrenForRedirect(this); 2723 render_view_->history_controller()->RemoveChildrenForRedirect(this);
2719 } 2724 }
2720 2725
2721 void RenderFrameImpl::didFailProvisionalLoad( 2726 void RenderFrameImpl::didFailProvisionalLoad(
2722 blink::WebLocalFrame* frame, 2727 blink::WebLocalFrame* frame,
(...skipping 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after
4310 common_params.url, request_params, &is_reload, &cache_policy); 4315 common_params.url, request_params, &is_reload, &cache_policy);
4311 4316
4312 GetContentClient()->SetActiveURL(common_params.url); 4317 GetContentClient()->SetActiveURL(common_params.url);
4313 4318
4314 pending_navigation_params_.reset(new NavigationParams( 4319 pending_navigation_params_.reset(new NavigationParams(
4315 common_params, StartNavigationParams(), request_params)); 4320 common_params, StartNavigationParams(), request_params));
4316 4321
4317 // Inform the browser of the start of the provisional load. This is needed so 4322 // Inform the browser of the start of the provisional load. This is needed so
4318 // that the load is properly tracked by the WebNavigation API. 4323 // that the load is properly tracked by the WebNavigation API.
4319 Send(new FrameHostMsg_DidStartProvisionalLoadForFrame( 4324 Send(new FrameHostMsg_DidStartProvisionalLoadForFrame(
4320 routing_id_, common_params.url)); 4325 routing_id_, common_params.url, common_params.navigation_start));
4321 4326
4322 // Send the provisional load failure. 4327 // Send the provisional load failure.
4323 blink::WebURLError error = 4328 blink::WebURLError error =
4324 CreateWebURLError(common_params.url, has_stale_copy_in_cache, error_code); 4329 CreateWebURLError(common_params.url, has_stale_copy_in_cache, error_code);
4325 WebURLRequest failed_request = CreateURLRequestForNavigation( 4330 WebURLRequest failed_request = CreateURLRequestForNavigation(
4326 common_params, scoped_ptr<StreamOverrideParameters>(), 4331 common_params, scoped_ptr<StreamOverrideParameters>(),
4327 frame_->isViewSourceModeEnabled()); 4332 frame_->isViewSourceModeEnabled());
4328 SendFailedProvisionalLoad(failed_request, error, frame_); 4333 SendFailedProvisionalLoad(failed_request, error, frame_);
4329 4334
4330 if (!ShouldDisplayErrorPageForFailedLoad(error_code, common_params.url)) { 4335 if (!ShouldDisplayErrorPageForFailedLoad(error_code, common_params.url)) {
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after
5305 mojo::ServiceProviderPtr service_provider; 5310 mojo::ServiceProviderPtr service_provider;
5306 mojo::URLRequestPtr request(mojo::URLRequest::New()); 5311 mojo::URLRequestPtr request(mojo::URLRequest::New());
5307 request->url = mojo::String::From(url); 5312 request->url = mojo::String::From(url);
5308 mojo_shell_->ConnectToApplication(request.Pass(), GetProxy(&service_provider), 5313 mojo_shell_->ConnectToApplication(request.Pass(), GetProxy(&service_provider),
5309 nullptr, nullptr, 5314 nullptr, nullptr,
5310 base::Bind(&OnGotContentHandlerID)); 5315 base::Bind(&OnGotContentHandlerID));
5311 return service_provider.Pass(); 5316 return service_provider.Pass();
5312 } 5317 }
5313 5318
5314 } // namespace content 5319 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698