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 1663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1674 params.user_gesture); | 1674 params.user_gesture); |
1675 } | 1675 } |
1676 | 1676 |
1677 void RenderFrameHostImpl::Stop() { | 1677 void RenderFrameHostImpl::Stop() { |
1678 Send(new FrameMsg_Stop(routing_id_)); | 1678 Send(new FrameMsg_Stop(routing_id_)); |
1679 } | 1679 } |
1680 | 1680 |
1681 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_navigation) { | 1681 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_navigation) { |
1682 // TODO(creis): Support beforeunload on subframes. For now just pretend that | 1682 // TODO(creis): Support beforeunload on subframes. For now just pretend that |
1683 // the handler ran and allowed the navigation to proceed. | 1683 // the handler ran and allowed the navigation to proceed. |
1684 if (GetParent() || !IsRenderFrameLive()) { | 1684 if (!ShouldDispatchBeforeUnload()) { |
1685 // We don't have a live renderer, so just skip running beforeunload. | 1685 // We don't have a live renderer or are on a subframe, so just skip running |
clamy
2015/06/09 16:01:30
If changing the comment, rephrase so that it does
carlosk
2015/06/10 11:53:09
Done.
| |
1686 // beforeunload. | |
1686 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 1687 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
clamy
2015/06/09 16:07:44
Now that I think about it, we should never end up
carlosk
2015/06/10 11:53:09
Done.
| |
1687 switches::kEnableBrowserSideNavigation)) { | 1688 switches::kEnableBrowserSideNavigation)) { |
1688 frame_tree_node_->navigator()->OnBeforeUnloadACK( | 1689 frame_tree_node_->navigator()->OnBeforeUnloadACK( |
1689 frame_tree_node_, true); | 1690 frame_tree_node_, true); |
1690 } else { | 1691 } else { |
1691 frame_tree_node_->render_manager()->OnBeforeUnloadACK( | 1692 frame_tree_node_->render_manager()->OnBeforeUnloadACK( |
1692 for_navigation, true, base::TimeTicks::Now()); | 1693 for_navigation, true, base::TimeTicks::Now()); |
1693 } | 1694 } |
1694 return; | 1695 return; |
1695 } | 1696 } |
1696 TRACE_EVENT_ASYNC_BEGIN0( | 1697 TRACE_EVENT_ASYNC_BEGIN0( |
(...skipping 19 matching lines...) Expand all Loading... | |
1716 // Increment the in-flight event count, to ensure that input events won't | 1717 // Increment the in-flight event count, to ensure that input events won't |
1717 // cancel the timeout timer. | 1718 // cancel the timeout timer. |
1718 render_view_host_->increment_in_flight_event_count(); | 1719 render_view_host_->increment_in_flight_event_count(); |
1719 render_view_host_->StartHangMonitorTimeout( | 1720 render_view_host_->StartHangMonitorTimeout( |
1720 TimeDelta::FromMilliseconds(RenderViewHostImpl::kUnloadTimeoutMS)); | 1721 TimeDelta::FromMilliseconds(RenderViewHostImpl::kUnloadTimeoutMS)); |
1721 send_before_unload_start_time_ = base::TimeTicks::Now(); | 1722 send_before_unload_start_time_ = base::TimeTicks::Now(); |
1722 Send(new FrameMsg_BeforeUnload(routing_id_)); | 1723 Send(new FrameMsg_BeforeUnload(routing_id_)); |
1723 } | 1724 } |
1724 } | 1725 } |
1725 | 1726 |
1727 bool RenderFrameHostImpl::ShouldDispatchBeforeUnload() { | |
clamy
2015/06/09 16:01:30
I think you may copy the TODO(creis): Support befo
carlosk
2015/06/10 11:53:09
Done.
| |
1728 return !GetParent() && IsRenderFrameLive(); | |
1729 } | |
1730 | |
1726 void RenderFrameHostImpl::DisownOpener() { | 1731 void RenderFrameHostImpl::DisownOpener() { |
1727 Send(new FrameMsg_DisownOpener(GetRoutingID())); | 1732 Send(new FrameMsg_DisownOpener(GetRoutingID())); |
1728 } | 1733 } |
1729 | 1734 |
1730 void RenderFrameHostImpl::ExtendSelectionAndDelete(size_t before, | 1735 void RenderFrameHostImpl::ExtendSelectionAndDelete(size_t before, |
1731 size_t after) { | 1736 size_t after) { |
1732 Send(new InputMsg_ExtendSelectionAndDelete(routing_id_, before, after)); | 1737 Send(new InputMsg_ExtendSelectionAndDelete(routing_id_, before, after)); |
1733 } | 1738 } |
1734 | 1739 |
1735 void RenderFrameHostImpl::JavaScriptDialogClosed( | 1740 void RenderFrameHostImpl::JavaScriptDialogClosed( |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2071 // We may be returning to an existing NavigationEntry that had been granted | 2076 // We may be returning to an existing NavigationEntry that had been granted |
2072 // file access. If this is a different process, we will need to grant the | 2077 // file access. If this is a different process, we will need to grant the |
2073 // access again. The files listed in the page state are validated when they | 2078 // access again. The files listed in the page state are validated when they |
2074 // are received from the renderer to prevent abuse. | 2079 // are received from the renderer to prevent abuse. |
2075 if (request_params.page_state.IsValid()) { | 2080 if (request_params.page_state.IsValid()) { |
2076 render_view_host_->GrantFileAccessFromPageState(request_params.page_state); | 2081 render_view_host_->GrantFileAccessFromPageState(request_params.page_state); |
2077 } | 2082 } |
2078 } | 2083 } |
2079 | 2084 |
2080 } // namespace content | 2085 } // namespace content |
OLD | NEW |