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 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 PickleIterator iter(msg); | 587 PickleIterator iter(msg); |
588 FrameHostMsg_DidCommitProvisionalLoad_Params validated_params; | 588 FrameHostMsg_DidCommitProvisionalLoad_Params validated_params; |
589 if (!IPC::ParamTraits<FrameHostMsg_DidCommitProvisionalLoad_Params>:: | 589 if (!IPC::ParamTraits<FrameHostMsg_DidCommitProvisionalLoad_Params>:: |
590 Read(&msg, &iter, &validated_params)) | 590 Read(&msg, &iter, &validated_params)) |
591 return; | 591 return; |
592 TRACE_EVENT1("navigation", "RenderFrameHostImpl::OnNavigate", | 592 TRACE_EVENT1("navigation", "RenderFrameHostImpl::OnNavigate", |
593 "url", validated_params.url.possibly_invalid_spec()); | 593 "url", validated_params.url.possibly_invalid_spec()); |
594 | 594 |
595 // If we're waiting for a cross-site beforeunload ack from this renderer and | 595 // If we're waiting for a cross-site beforeunload ack from this renderer and |
596 // we receive a Navigate message from the main frame, then the renderer was | 596 // we receive a Navigate message from the main frame, then the renderer was |
597 // navigating already and sent it before hearing the ViewMsg_Stop message. | 597 // navigating already and sent it before hearing the FrameMsg_Stop message. |
598 // We do not want to cancel the pending navigation in this case, since the | 598 // We do not want to cancel the pending navigation in this case, since the |
599 // old page will soon be stopped. Instead, treat this as a beforeunload ack | 599 // old page will soon be stopped. Instead, treat this as a beforeunload ack |
600 // to allow the pending navigation to continue. | 600 // to allow the pending navigation to continue. |
601 if (render_view_host_->is_waiting_for_beforeunload_ack_ && | 601 if (render_view_host_->is_waiting_for_beforeunload_ack_ && |
602 render_view_host_->unload_ack_is_for_cross_site_transition_ && | 602 render_view_host_->unload_ack_is_for_cross_site_transition_ && |
603 PageTransitionIsMainFrame(validated_params.transition)) { | 603 PageTransitionIsMainFrame(validated_params.transition)) { |
604 OnBeforeUnloadACK(true, send_before_unload_start_time_, | 604 OnBeforeUnloadACK(true, send_before_unload_start_time_, |
605 base::TimeTicks::Now()); | 605 base::TimeTicks::Now()); |
606 return; | 606 return; |
607 } | 607 } |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1113 params.pending_history_list_offset = -1; | 1113 params.pending_history_list_offset = -1; |
1114 params.current_history_list_offset = -1; | 1114 params.current_history_list_offset = -1; |
1115 params.current_history_list_length = 0; | 1115 params.current_history_list_length = 0; |
1116 params.url = url; | 1116 params.url = url; |
1117 params.transition = PAGE_TRANSITION_LINK; | 1117 params.transition = PAGE_TRANSITION_LINK; |
1118 params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 1118 params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
1119 params.browser_navigation_start = base::TimeTicks::Now(); | 1119 params.browser_navigation_start = base::TimeTicks::Now(); |
1120 Navigate(params); | 1120 Navigate(params); |
1121 } | 1121 } |
1122 | 1122 |
| 1123 void RenderFrameHostImpl::Stop() { |
| 1124 Send(new FrameMsg_Stop(routing_id_)); |
| 1125 } |
| 1126 |
1123 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_cross_site_transition) { | 1127 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_cross_site_transition) { |
1124 TRACE_EVENT_ASYNC_BEGIN0( | 1128 TRACE_EVENT_ASYNC_BEGIN0( |
1125 "navigation", "RenderFrameHostImpl::BeforeUnload", this); | 1129 "navigation", "RenderFrameHostImpl::BeforeUnload", this); |
1126 // TODO(creis): Support subframes. | 1130 // TODO(creis): Support subframes. |
1127 if (!render_view_host_->IsRenderViewLive() || GetParent()) { | 1131 if (!render_view_host_->IsRenderViewLive() || GetParent()) { |
1128 // We don't have a live renderer, so just skip running beforeunload. | 1132 // We don't have a live renderer, so just skip running beforeunload. |
1129 render_view_host_->is_waiting_for_beforeunload_ack_ = true; | 1133 render_view_host_->is_waiting_for_beforeunload_ack_ = true; |
1130 render_view_host_->unload_ack_is_for_cross_site_transition_ = | 1134 render_view_host_->unload_ack_is_for_cross_site_transition_ = |
1131 for_cross_site_transition; | 1135 for_cross_site_transition; |
1132 base::TimeTicks now = base::TimeTicks::Now(); | 1136 base::TimeTicks now = base::TimeTicks::Now(); |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1325 // Clear any state if a pending navigation is canceled or preempted. | 1329 // Clear any state if a pending navigation is canceled or preempted. |
1326 if (suspended_nav_params_) | 1330 if (suspended_nav_params_) |
1327 suspended_nav_params_.reset(); | 1331 suspended_nav_params_.reset(); |
1328 | 1332 |
1329 TRACE_EVENT_ASYNC_END0("navigation", | 1333 TRACE_EVENT_ASYNC_END0("navigation", |
1330 "RenderFrameHostImpl navigation suspended", this); | 1334 "RenderFrameHostImpl navigation suspended", this); |
1331 navigations_suspended_ = false; | 1335 navigations_suspended_ = false; |
1332 } | 1336 } |
1333 | 1337 |
1334 } // namespace content | 1338 } // namespace content |
OLD | NEW |