| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 2066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2077 frame_tree_node_->navigator()->RequestOpenURL( | 2077 frame_tree_node_->navigator()->RequestOpenURL( |
| 2078 this, validated_url, source_site_instance, params.referrer, | 2078 this, validated_url, source_site_instance, params.referrer, |
| 2079 params.disposition, params.should_replace_current_entry, | 2079 params.disposition, params.should_replace_current_entry, |
| 2080 params.user_gesture); | 2080 params.user_gesture); |
| 2081 } | 2081 } |
| 2082 | 2082 |
| 2083 void RenderFrameHostImpl::Stop() { | 2083 void RenderFrameHostImpl::Stop() { |
| 2084 Send(new FrameMsg_Stop(routing_id_)); | 2084 Send(new FrameMsg_Stop(routing_id_)); |
| 2085 } | 2085 } |
| 2086 | 2086 |
| 2087 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_navigation) { | 2087 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_navigation, |
| 2088 bool is_reload) { |
| 2089 DCHECK(for_navigation || !is_reload); |
| 2090 |
| 2088 // TODO(creis): Support beforeunload on subframes. For now just pretend that | 2091 // TODO(creis): Support beforeunload on subframes. For now just pretend that |
| 2089 // the handler ran and allowed the navigation to proceed. | 2092 // the handler ran and allowed the navigation to proceed. |
| 2090 if (!ShouldDispatchBeforeUnload()) { | 2093 if (!ShouldDispatchBeforeUnload()) { |
| 2091 DCHECK(!(IsBrowserSideNavigationEnabled() && for_navigation)); | 2094 DCHECK(!(IsBrowserSideNavigationEnabled() && for_navigation)); |
| 2092 frame_tree_node_->render_manager()->OnBeforeUnloadACK( | 2095 frame_tree_node_->render_manager()->OnBeforeUnloadACK( |
| 2093 for_navigation, true, base::TimeTicks::Now()); | 2096 for_navigation, true, base::TimeTicks::Now()); |
| 2094 return; | 2097 return; |
| 2095 } | 2098 } |
| 2096 TRACE_EVENT_ASYNC_BEGIN1("navigation", "RenderFrameHostImpl BeforeUnload", | 2099 TRACE_EVENT_ASYNC_BEGIN1("navigation", "RenderFrameHostImpl BeforeUnload", |
| 2097 this, "&RenderFrameHostImpl", (void*)this); | 2100 this, "&RenderFrameHostImpl", (void*)this); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2112 // Start the hang monitor in case the renderer hangs in the beforeunload | 2115 // Start the hang monitor in case the renderer hangs in the beforeunload |
| 2113 // handler. | 2116 // handler. |
| 2114 is_waiting_for_beforeunload_ack_ = true; | 2117 is_waiting_for_beforeunload_ack_ = true; |
| 2115 unload_ack_is_for_navigation_ = for_navigation; | 2118 unload_ack_is_for_navigation_ = for_navigation; |
| 2116 // Increment the in-flight event count, to ensure that input events won't | 2119 // Increment the in-flight event count, to ensure that input events won't |
| 2117 // cancel the timeout timer. | 2120 // cancel the timeout timer. |
| 2118 render_view_host_->GetWidget()->increment_in_flight_event_count(); | 2121 render_view_host_->GetWidget()->increment_in_flight_event_count(); |
| 2119 render_view_host_->GetWidget()->StartHangMonitorTimeout( | 2122 render_view_host_->GetWidget()->StartHangMonitorTimeout( |
| 2120 TimeDelta::FromMilliseconds(RenderViewHostImpl::kUnloadTimeoutMS)); | 2123 TimeDelta::FromMilliseconds(RenderViewHostImpl::kUnloadTimeoutMS)); |
| 2121 send_before_unload_start_time_ = base::TimeTicks::Now(); | 2124 send_before_unload_start_time_ = base::TimeTicks::Now(); |
| 2122 Send(new FrameMsg_BeforeUnload(routing_id_)); | 2125 Send(new FrameMsg_BeforeUnload(routing_id_, is_reload)); |
| 2123 } | 2126 } |
| 2124 } | 2127 } |
| 2125 | 2128 |
| 2126 bool RenderFrameHostImpl::ShouldDispatchBeforeUnload() { | 2129 bool RenderFrameHostImpl::ShouldDispatchBeforeUnload() { |
| 2127 // TODO(creis): Support beforeunload on subframes. | 2130 // TODO(creis): Support beforeunload on subframes. |
| 2128 return !GetParent() && IsRenderFrameLive(); | 2131 return !GetParent() && IsRenderFrameLive(); |
| 2129 } | 2132 } |
| 2130 | 2133 |
| 2131 void RenderFrameHostImpl::UpdateOpener() { | 2134 void RenderFrameHostImpl::UpdateOpener() { |
| 2132 // This frame (the frame whose opener is being updated) might not have had | 2135 // This frame (the frame whose opener is being updated) might not have had |
| (...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2763 // handler after it's destroyed so it can't run after the RFHI is destroyed. | 2766 // handler after it's destroyed so it can't run after the RFHI is destroyed. |
| 2764 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( | 2767 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( |
| 2765 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); | 2768 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); |
| 2766 } | 2769 } |
| 2767 | 2770 |
| 2768 void RenderFrameHostImpl::DeleteWebBluetoothService() { | 2771 void RenderFrameHostImpl::DeleteWebBluetoothService() { |
| 2769 web_bluetooth_service_.reset(); | 2772 web_bluetooth_service_.reset(); |
| 2770 } | 2773 } |
| 2771 | 2774 |
| 2772 } // namespace content | 2775 } // namespace content |
| OLD | NEW |