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 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 // Read the parameters out of the IPC message directly to avoid making another | 577 // Read the parameters out of the IPC message directly to avoid making another |
578 // copy when we filter the URLs. | 578 // copy when we filter the URLs. |
579 PickleIterator iter(msg); | 579 PickleIterator iter(msg); |
580 FrameHostMsg_DidCommitProvisionalLoad_Params validated_params; | 580 FrameHostMsg_DidCommitProvisionalLoad_Params validated_params; |
581 if (!IPC::ParamTraits<FrameHostMsg_DidCommitProvisionalLoad_Params>:: | 581 if (!IPC::ParamTraits<FrameHostMsg_DidCommitProvisionalLoad_Params>:: |
582 Read(&msg, &iter, &validated_params)) | 582 Read(&msg, &iter, &validated_params)) |
583 return; | 583 return; |
584 | 584 |
585 // If we're waiting for a cross-site beforeunload ack from this renderer and | 585 // If we're waiting for a cross-site beforeunload ack from this renderer and |
586 // we receive a Navigate message from the main frame, then the renderer was | 586 // we receive a Navigate message from the main frame, then the renderer was |
587 // navigating already and sent it before hearing the ViewMsg_Stop message. | 587 // navigating already and sent it before hearing the FrameMsg_Stop message. |
588 // We do not want to cancel the pending navigation in this case, since the | 588 // We do not want to cancel the pending navigation in this case, since the |
589 // old page will soon be stopped. Instead, treat this as a beforeunload ack | 589 // old page will soon be stopped. Instead, treat this as a beforeunload ack |
590 // to allow the pending navigation to continue. | 590 // to allow the pending navigation to continue. |
591 if (render_view_host_->is_waiting_for_beforeunload_ack_ && | 591 if (render_view_host_->is_waiting_for_beforeunload_ack_ && |
592 render_view_host_->unload_ack_is_for_cross_site_transition_ && | 592 render_view_host_->unload_ack_is_for_cross_site_transition_ && |
593 PageTransitionIsMainFrame(validated_params.transition)) { | 593 PageTransitionIsMainFrame(validated_params.transition)) { |
594 OnBeforeUnloadACK(true, send_before_unload_start_time_, | 594 OnBeforeUnloadACK(true, send_before_unload_start_time_, |
595 base::TimeTicks::Now()); | 595 base::TimeTicks::Now()); |
596 return; | 596 return; |
597 } | 597 } |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1073 params.pending_history_list_offset = -1; | 1073 params.pending_history_list_offset = -1; |
1074 params.current_history_list_offset = -1; | 1074 params.current_history_list_offset = -1; |
1075 params.current_history_list_length = 0; | 1075 params.current_history_list_length = 0; |
1076 params.url = url; | 1076 params.url = url; |
1077 params.transition = PAGE_TRANSITION_LINK; | 1077 params.transition = PAGE_TRANSITION_LINK; |
1078 params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 1078 params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
1079 params.browser_navigation_start = base::TimeTicks::Now(); | 1079 params.browser_navigation_start = base::TimeTicks::Now(); |
1080 Navigate(params); | 1080 Navigate(params); |
1081 } | 1081 } |
1082 | 1082 |
| 1083 void RenderFrameHostImpl::Stop() { |
| 1084 Send(new FrameMsg_Stop(routing_id_)); |
| 1085 } |
| 1086 |
1083 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_cross_site_transition) { | 1087 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_cross_site_transition) { |
1084 // TODO(creis): Support subframes. | 1088 // TODO(creis): Support subframes. |
1085 if (!render_view_host_->IsRenderViewLive() || GetParent()) { | 1089 if (!render_view_host_->IsRenderViewLive() || GetParent()) { |
1086 // We don't have a live renderer, so just skip running beforeunload. | 1090 // We don't have a live renderer, so just skip running beforeunload. |
1087 render_view_host_->is_waiting_for_beforeunload_ack_ = true; | 1091 render_view_host_->is_waiting_for_beforeunload_ack_ = true; |
1088 render_view_host_->unload_ack_is_for_cross_site_transition_ = | 1092 render_view_host_->unload_ack_is_for_cross_site_transition_ = |
1089 for_cross_site_transition; | 1093 for_cross_site_transition; |
1090 base::TimeTicks now = base::TimeTicks::Now(); | 1094 base::TimeTicks now = base::TimeTicks::Now(); |
1091 OnBeforeUnloadACK(true, now, now); | 1095 OnBeforeUnloadACK(true, now, now); |
1092 return; | 1096 return; |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1255 } | 1259 } |
1256 | 1260 |
1257 void RenderFrameHostImpl::CancelSuspendedNavigations() { | 1261 void RenderFrameHostImpl::CancelSuspendedNavigations() { |
1258 // Clear any state if a pending navigation is canceled or preempted. | 1262 // Clear any state if a pending navigation is canceled or preempted. |
1259 if (suspended_nav_params_) | 1263 if (suspended_nav_params_) |
1260 suspended_nav_params_.reset(); | 1264 suspended_nav_params_.reset(); |
1261 navigations_suspended_ = false; | 1265 navigations_suspended_ = false; |
1262 } | 1266 } |
1263 | 1267 |
1264 } // namespace content | 1268 } // namespace content |
OLD | NEW |