Chromium Code Reviews| Index: content/browser/web_contents/web_contents_impl.cc |
| diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc |
| index 32eef988f7e4050f62c7b769a3908a444c000aa3..0857ae01ae518278d62d1f3981eff03c9f4c6a79 100644 |
| --- a/content/browser/web_contents/web_contents_impl.cc |
| +++ b/content/browser/web_contents/web_contents_impl.cc |
| @@ -2233,6 +2233,23 @@ void WebContentsImpl::DidCommitProvisionalLoad( |
| render_view_host)); |
| } |
| +void WebContentsImpl::DidNavigateMainFramePreCommit( |
| + const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { |
| + // Ensure fullscreen mode is exited before committing the navigation to a |
| + // different page. The next page will not start out assuming it is in |
| + // fullscreen mode. |
| + if (params.was_within_same_page) { |
| + // No document change? Then, the renderer shall decide whether to exit |
| + // fullscreen. |
| + return; |
| + } |
| + RenderViewHost* const old_render_view_host = GetRenderViewHost(); |
| + if (old_render_view_host && IsFullscreenForCurrentTab()) |
| + old_render_view_host->ExitFullscreen(); |
|
Charlie Reis
2014/04/01 23:12:38
GetRenderViewHost() will never return null in this
miu
2014/04/01 23:39:35
Done.
|
| + DCHECK(!IsFullscreenForCurrentTab()); |
| + // TODO(creis): How to handle subframes that go fullscreen? |
|
Charlie Reis
2014/04/01 23:12:38
You may know the answer to this, actually. Can su
miu
2014/04/01 23:39:35
Removed TODO. I just looked at the W3C spec, and
|
| +} |
| + |
| void WebContentsImpl::DidNavigateMainFramePostCommit( |
| const LoadCommittedDetails& details, |
| const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { |
| @@ -3048,19 +3065,8 @@ void WebContentsImpl::Close(RenderViewHost* rvh) { |
| } |
| void WebContentsImpl::SwappedOut(RenderFrameHost* rfh) { |
| - // TODO(creis): Handle subframes that go fullscreen. |
| - if (rfh->GetRenderViewHost() == GetRenderViewHost()) { |
| - // Exit fullscreen mode before the current RVH is swapped out. For numerous |
| - // cases, there is no guarantee the renderer would/could initiate an exit. |
| - // Example: http://crbug.com/347232 |
| - if (IsFullscreenForCurrentTab()) { |
| - rfh->GetRenderViewHost()->ExitFullscreen(); |
| - DCHECK(!IsFullscreenForCurrentTab()); |
| - } |
| - |
| - if (delegate_) |
| - delegate_->SwappedOut(this); |
| - } |
| + if (delegate_ && rfh->GetRenderViewHost() == GetRenderViewHost()) |
| + delegate_->SwappedOut(this); |
| } |
| void WebContentsImpl::RequestMove(const gfx::Rect& new_bounds) { |