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/browser/frame_host/render_frame_host_impl.h" | 5 #include "content/browser/frame_host/render_frame_host_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 "url", validated_params.url.possibly_invalid_spec()); | 673 "url", validated_params.url.possibly_invalid_spec()); |
674 | 674 |
675 // If we're waiting for a cross-site beforeunload ack from this renderer and | 675 // If we're waiting for a cross-site beforeunload ack from this renderer and |
676 // we receive a Navigate message from the main frame, then the renderer was | 676 // we receive a Navigate message from the main frame, then the renderer was |
677 // navigating already and sent it before hearing the FrameMsg_Stop message. | 677 // navigating already and sent it before hearing the FrameMsg_Stop message. |
678 // We do not want to cancel the pending navigation in this case, since the | 678 // We do not want to cancel the pending navigation in this case, since the |
679 // old page will soon be stopped. Instead, treat this as a beforeunload ack | 679 // old page will soon be stopped. Instead, treat this as a beforeunload ack |
680 // to allow the pending navigation to continue. | 680 // to allow the pending navigation to continue. |
681 if (render_view_host_->is_waiting_for_beforeunload_ack_ && | 681 if (render_view_host_->is_waiting_for_beforeunload_ack_ && |
682 render_view_host_->unload_ack_is_for_cross_site_transition_ && | 682 render_view_host_->unload_ack_is_for_cross_site_transition_ && |
683 PageTransitionIsMainFrame(validated_params.transition)) { | 683 ui::PageTransitionIsMainFrame(validated_params.transition)) { |
684 OnBeforeUnloadACK(true, send_before_unload_start_time_, | 684 OnBeforeUnloadACK(true, send_before_unload_start_time_, |
685 base::TimeTicks::Now()); | 685 base::TimeTicks::Now()); |
686 return; | 686 return; |
687 } | 687 } |
688 | 688 |
689 // If we're waiting for an unload ack from this renderer and we receive a | 689 // If we're waiting for an unload ack from this renderer and we receive a |
690 // Navigate message, then the renderer was navigating before it received the | 690 // Navigate message, then the renderer was navigating before it received the |
691 // unload request. It will either respond to the unload request soon or our | 691 // unload request. It will either respond to the unload request soon or our |
692 // timer will expire. Either way, we should ignore this message, because we | 692 // timer will expire. Either way, we should ignore this message, because we |
693 // have already committed to closing this renderer. | 693 // have already committed to closing this renderer. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 | 739 |
740 int RenderFrameHostImpl::GetEnabledBindings() { | 740 int RenderFrameHostImpl::GetEnabledBindings() { |
741 return render_view_host_->GetEnabledBindings(); | 741 return render_view_host_->GetEnabledBindings(); |
742 } | 742 } |
743 | 743 |
744 void RenderFrameHostImpl::OnCrossSiteResponse( | 744 void RenderFrameHostImpl::OnCrossSiteResponse( |
745 const GlobalRequestID& global_request_id, | 745 const GlobalRequestID& global_request_id, |
746 scoped_ptr<CrossSiteTransferringRequest> cross_site_transferring_request, | 746 scoped_ptr<CrossSiteTransferringRequest> cross_site_transferring_request, |
747 const std::vector<GURL>& transfer_url_chain, | 747 const std::vector<GURL>& transfer_url_chain, |
748 const Referrer& referrer, | 748 const Referrer& referrer, |
749 PageTransition page_transition, | 749 ui::PageTransition page_transition, |
750 bool should_replace_current_entry) { | 750 bool should_replace_current_entry) { |
751 frame_tree_node_->render_manager()->OnCrossSiteResponse( | 751 frame_tree_node_->render_manager()->OnCrossSiteResponse( |
752 this, global_request_id, cross_site_transferring_request.Pass(), | 752 this, global_request_id, cross_site_transferring_request.Pass(), |
753 transfer_url_chain, referrer, page_transition, | 753 transfer_url_chain, referrer, page_transition, |
754 should_replace_current_entry); | 754 should_replace_current_entry); |
755 } | 755 } |
756 | 756 |
757 void RenderFrameHostImpl::OnDeferredAfterResponseStarted( | 757 void RenderFrameHostImpl::OnDeferredAfterResponseStarted( |
758 const GlobalRequestID& global_request_id, | 758 const GlobalRequestID& global_request_id, |
759 const TransitionLayerData& transition_data) { | 759 const TransitionLayerData& transition_data) { |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1215 delegate_->DidStartLoading(this, true); | 1215 delegate_->DidStartLoading(this, true); |
1216 } | 1216 } |
1217 | 1217 |
1218 void RenderFrameHostImpl::NavigateToURL(const GURL& url) { | 1218 void RenderFrameHostImpl::NavigateToURL(const GURL& url) { |
1219 FrameMsg_Navigate_Params params; | 1219 FrameMsg_Navigate_Params params; |
1220 params.page_id = -1; | 1220 params.page_id = -1; |
1221 params.pending_history_list_offset = -1; | 1221 params.pending_history_list_offset = -1; |
1222 params.current_history_list_offset = -1; | 1222 params.current_history_list_offset = -1; |
1223 params.current_history_list_length = 0; | 1223 params.current_history_list_length = 0; |
1224 params.url = url; | 1224 params.url = url; |
1225 params.transition = PAGE_TRANSITION_LINK; | 1225 params.transition = ui::PAGE_TRANSITION_LINK; |
1226 params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 1226 params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
1227 params.browser_navigation_start = base::TimeTicks::Now(); | 1227 params.browser_navigation_start = base::TimeTicks::Now(); |
1228 Navigate(params); | 1228 Navigate(params); |
1229 } | 1229 } |
1230 | 1230 |
1231 void RenderFrameHostImpl::Stop() { | 1231 void RenderFrameHostImpl::Stop() { |
1232 Send(new FrameMsg_Stop(routing_id_)); | 1232 Send(new FrameMsg_Stop(routing_id_)); |
1233 } | 1233 } |
1234 | 1234 |
1235 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_cross_site_transition) { | 1235 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_cross_site_transition) { |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1473 // Clear any state if a pending navigation is canceled or preempted. | 1473 // Clear any state if a pending navigation is canceled or preempted. |
1474 if (suspended_nav_params_) | 1474 if (suspended_nav_params_) |
1475 suspended_nav_params_.reset(); | 1475 suspended_nav_params_.reset(); |
1476 | 1476 |
1477 TRACE_EVENT_ASYNC_END0("navigation", | 1477 TRACE_EVENT_ASYNC_END0("navigation", |
1478 "RenderFrameHostImpl navigation suspended", this); | 1478 "RenderFrameHostImpl navigation suspended", this); |
1479 navigations_suspended_ = false; | 1479 navigations_suspended_ = false; |
1480 } | 1480 } |
1481 | 1481 |
1482 } // namespace content | 1482 } // namespace content |
OLD | NEW |