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 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 // Read the parameters out of the IPC message directly to avoid making another | 573 // Read the parameters out of the IPC message directly to avoid making another |
574 // copy when we filter the URLs. | 574 // copy when we filter the URLs. |
575 PickleIterator iter(msg); | 575 PickleIterator iter(msg); |
576 FrameHostMsg_DidCommitProvisionalLoad_Params validated_params; | 576 FrameHostMsg_DidCommitProvisionalLoad_Params validated_params; |
577 if (!IPC::ParamTraits<FrameHostMsg_DidCommitProvisionalLoad_Params>:: | 577 if (!IPC::ParamTraits<FrameHostMsg_DidCommitProvisionalLoad_Params>:: |
578 Read(&msg, &iter, &validated_params)) | 578 Read(&msg, &iter, &validated_params)) |
579 return; | 579 return; |
580 | 580 |
581 // If we're waiting for a cross-site beforeunload ack from this renderer and | 581 // If we're waiting for a cross-site beforeunload ack from this renderer and |
582 // we receive a Navigate message from the main frame, then the renderer was | 582 // we receive a Navigate message from the main frame, then the renderer was |
583 // navigating already and sent it before hearing the ViewMsg_Stop message. | 583 // navigating already and sent it before hearing the FrameMsg_Stop message. |
584 // We do not want to cancel the pending navigation in this case, since the | 584 // We do not want to cancel the pending navigation in this case, since the |
585 // old page will soon be stopped. Instead, treat this as a beforeunload ack | 585 // old page will soon be stopped. Instead, treat this as a beforeunload ack |
586 // to allow the pending navigation to continue. | 586 // to allow the pending navigation to continue. |
587 if (render_view_host_->is_waiting_for_beforeunload_ack_ && | 587 if (render_view_host_->is_waiting_for_beforeunload_ack_ && |
588 render_view_host_->unload_ack_is_for_cross_site_transition_ && | 588 render_view_host_->unload_ack_is_for_cross_site_transition_ && |
589 PageTransitionIsMainFrame(validated_params.transition)) { | 589 PageTransitionIsMainFrame(validated_params.transition)) { |
590 OnBeforeUnloadACK(true, send_before_unload_start_time_, | 590 OnBeforeUnloadACK(true, send_before_unload_start_time_, |
591 base::TimeTicks::Now()); | 591 base::TimeTicks::Now()); |
592 return; | 592 return; |
593 } | 593 } |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1065 params.pending_history_list_offset = -1; | 1065 params.pending_history_list_offset = -1; |
1066 params.current_history_list_offset = -1; | 1066 params.current_history_list_offset = -1; |
1067 params.current_history_list_length = 0; | 1067 params.current_history_list_length = 0; |
1068 params.url = url; | 1068 params.url = url; |
1069 params.transition = PAGE_TRANSITION_LINK; | 1069 params.transition = PAGE_TRANSITION_LINK; |
1070 params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 1070 params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
1071 params.browser_navigation_start = base::TimeTicks::Now(); | 1071 params.browser_navigation_start = base::TimeTicks::Now(); |
1072 Navigate(params); | 1072 Navigate(params); |
1073 } | 1073 } |
1074 | 1074 |
| 1075 void RenderFrameHostImpl::Stop() { |
| 1076 Send(new FrameMsg_Stop(routing_id_)); |
| 1077 } |
| 1078 |
1075 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_cross_site_transition) { | 1079 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_cross_site_transition) { |
1076 // TODO(creis): Support subframes. | 1080 // TODO(creis): Support subframes. |
1077 if (!render_view_host_->IsRenderViewLive() || GetParent()) { | 1081 if (!render_view_host_->IsRenderViewLive() || GetParent()) { |
1078 // We don't have a live renderer, so just skip running beforeunload. | 1082 // We don't have a live renderer, so just skip running beforeunload. |
1079 render_view_host_->is_waiting_for_beforeunload_ack_ = true; | 1083 render_view_host_->is_waiting_for_beforeunload_ack_ = true; |
1080 render_view_host_->unload_ack_is_for_cross_site_transition_ = | 1084 render_view_host_->unload_ack_is_for_cross_site_transition_ = |
1081 for_cross_site_transition; | 1085 for_cross_site_transition; |
1082 base::TimeTicks now = base::TimeTicks::Now(); | 1086 base::TimeTicks now = base::TimeTicks::Now(); |
1083 OnBeforeUnloadACK(true, now, now); | 1087 OnBeforeUnloadACK(true, now, now); |
1084 return; | 1088 return; |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1236 } | 1240 } |
1237 | 1241 |
1238 void RenderFrameHostImpl::CancelSuspendedNavigations() { | 1242 void RenderFrameHostImpl::CancelSuspendedNavigations() { |
1239 // Clear any state if a pending navigation is canceled or preempted. | 1243 // Clear any state if a pending navigation is canceled or preempted. |
1240 if (suspended_nav_params_) | 1244 if (suspended_nav_params_) |
1241 suspended_nav_params_.reset(); | 1245 suspended_nav_params_.reset(); |
1242 navigations_suspended_ = false; | 1246 navigations_suspended_ = false; |
1243 } | 1247 } |
1244 | 1248 |
1245 } // namespace content | 1249 } // namespace content |
OLD | NEW |