Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 218093002: Ensure fullscreen mode is exited for same-site navigations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 56e1ffd450cef66d2a66aa57d82aae5747b99de0..e00498e4bbb2bd2b30aaec079588038cdafe1b54 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -2237,6 +2237,21 @@ 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;
+ }
+ if (IsFullscreenForCurrentTab())
+ GetRenderViewHost()->ExitFullscreen();
+ DCHECK(!IsFullscreenForCurrentTab());
+}
+
void WebContentsImpl::DidNavigateMainFramePostCommit(
const LoadCommittedDetails& details,
const FrameHostMsg_DidCommitProvisionalLoad_Params& params) {
@@ -3052,19 +3067,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) {
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/browser/web_contents/web_contents_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698