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

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

Issue 789533002: Fullscreen: make fullscreen requests come from RenderFrame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update webcontentsdelegateandroid Created 6 years 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 ca9112af81bc56e40d79e9f6ff6dc120c11d0977..d066909e572efd410a9689279112dfa73cf4f8d9 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -1289,7 +1289,7 @@ void WebContentsImpl::RenderWidgetDeleted(
if (render_widget_host &&
render_widget_host->GetRoutingID() == fullscreen_widget_routing_id_) {
if (delegate_ && delegate_->EmbedsFullscreenWidget())
- delegate_->ToggleFullscreenModeForTab(this, false);
+ delegate_->ExitFullscreenModeForTab(this);
FOR_EACH_OBSERVER(WebContentsObserver,
observers_,
DidDestroyFullscreenWidget(
@@ -1417,7 +1417,30 @@ void WebContentsImpl::HandleGestureEnd() {
delegate_->HandleGestureEnd();
}
-void WebContentsImpl::ToggleFullscreenMode(bool enter_fullscreen) {
+void WebContentsImpl::ExitFullscreen() {
scheib 2014/12/10 21:36:30 declaration & definition order should match: http:
mlamouri (slow - plz ping) 2014/12/11 16:03:19 Done.
+ // The callers of this method seem to call it when they expect |WebContents|
Charlie Reis 2014/12/10 19:22:57 This seems a bit hand-wavy. Let's just say "Clean
mlamouri (slow - plz ping) 2014/12/11 16:03:20 Done.
+ // to clean-up or to actually initiate the exit. This will do both.
+ GetRenderViewHostImpl()->RejectMouseLockOrUnlockIfNecessary();
+ ExitFullscreenMode();
+}
+
+void WebContentsImpl::EnterFullscreenMode(const GURL& origin) {
+ // This method is being called to enter or leave renderer-initiated fullscreen
Charlie Reis 2014/12/10 19:22:57 nit: Remove "or leave"
mlamouri (slow - plz ping) 2014/12/11 16:03:19 Done. Updated the comment for both ::EnterFullscre
+ // mode. Either way, make sure any existing fullscreen widget is shut down
+ // first.
+ RenderWidgetHostView* const widget_view = GetFullscreenRenderWidgetHostView();
+ if (widget_view)
+ RenderWidgetHostImpl::From(widget_view->GetRenderWidgetHost())->Shutdown();
+
+ if (delegate_)
+ delegate_->EnterFullscreenModeForTab(this, origin);
+
+ FOR_EACH_OBSERVER(WebContentsObserver,
+ observers_,
+ DidToggleFullscreenModeForTab(IsFullscreenForCurrentTab()));
+}
+
+void WebContentsImpl::ExitFullscreenMode() {
// This method is being called to enter or leave renderer-initiated fullscreen
// mode. Either way, make sure any existing fullscreen widget is shut down
// first.
@@ -1426,7 +1449,7 @@ void WebContentsImpl::ToggleFullscreenMode(bool enter_fullscreen) {
RenderWidgetHostImpl::From(widget_view->GetRenderWidgetHost())->Shutdown();
if (delegate_)
- delegate_->ToggleFullscreenModeForTab(this, enter_fullscreen);
+ delegate_->ExitFullscreenModeForTab(this);
FOR_EACH_OBSERVER(WebContentsObserver,
observers_,
@@ -1689,7 +1712,7 @@ void WebContentsImpl::ShowCreatedWidget(int route_id,
fullscreen_widget_routing_id_ = route_id;
if (delegate_ && delegate_->EmbedsFullscreenWidget()) {
widget_host_view->InitAsChild(GetRenderWidgetHostView()->GetNativeView());
- delegate_->ToggleFullscreenModeForTab(this, true);
+ delegate_->EnterFullscreenModeForTab(this, GURL());
} else {
widget_host_view->InitAsFullscreen(view);
}
@@ -2563,7 +2586,7 @@ void WebContentsImpl::DidNavigateMainFramePreCommit(
return;
}
if (IsFullscreenForCurrentTab())
- GetRenderViewHost()->ExitFullscreen();
+ ExitFullscreen();
DCHECK(!IsFullscreenForCurrentTab());
}
@@ -3574,7 +3597,7 @@ void WebContentsImpl::RenderViewTerminated(RenderViewHost* rvh,
// Ensure fullscreen mode is exited in the |delegate_| since a crashed
// renderer may not have made a clean exit.
if (IsFullscreenForCurrentTab())
- ToggleFullscreenMode(false);
+ ExitFullscreenMode();
// Cancel any visible dialogs so they are not left dangling over the sad tab.
if (dialog_manager_)

Powered by Google App Engine
This is Rietveld 408576698