diff options
Diffstat (limited to 'chromium/content/browser/web_contents/web_contents_impl.cc')
-rw-r--r-- | chromium/content/browser/web_contents/web_contents_impl.cc | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/chromium/content/browser/web_contents/web_contents_impl.cc b/chromium/content/browser/web_contents/web_contents_impl.cc index f985ea2bcea..3ae6216917a 100644 --- a/chromium/content/browser/web_contents/web_contents_impl.cc +++ b/chromium/content/browser/web_contents/web_contents_impl.cc @@ -2036,6 +2036,26 @@ RenderWidgetHostInputEventRouter* WebContentsImpl::GetInputEventRouter() { return rwh_input_event_router_.get(); } +void WebContentsImpl::NotifyFullscreenChanged(bool will_cause_resize) { + // The fullscreen state is communicated to the renderer through a resize + // message. If the change in fullscreen state doesn't cause a view resize + // then we must ensure web contents exit the fullscreen state by explicitly + // sending a resize message. This is required for the situation of the browser + // moving the view into a "browser fullscreen" state and then the contents + // entering "tab fullscreen". Exiting the contents "tab fullscreen" then won't + // have the side effect of the view resizing, hence the explicit call here is + // required. + if (!will_cause_resize) { + if (RenderWidgetHostView* rwh_view = GetRenderWidgetHostView()) { + if (RenderWidgetHost* render_widget_host = rwh_view->GetRenderWidgetHost()) + render_widget_host->WasResized(); + } + } + + for (auto& observer : observers_) + observer.DidToggleFullscreenModeForTab(IsFullscreenForCurrentTab(), will_cause_resize); +} + void WebContentsImpl::ReplicatePageFocus(bool is_focused) { // Focus loss may occur while this WebContents is being destroyed. Don't // send the message in this case, as the main frame's RenderFrameHost and @@ -2118,8 +2138,8 @@ void WebContentsImpl::EnterFullscreenMode(const GURL& origin) { if (delegate_) delegate_->EnterFullscreenModeForTab(this, origin); - for (auto& observer : observers_) - observer.DidToggleFullscreenModeForTab(IsFullscreenForCurrentTab(), false); + if (IsFullscreenForCurrentTab()) + NotifyFullscreenChanged(false); } void WebContentsImpl::ExitFullscreenMode(bool will_cause_resize) { @@ -2140,25 +2160,8 @@ void WebContentsImpl::ExitFullscreenMode(bool will_cause_resize) { if (delegate_) delegate_->ExitFullscreenModeForTab(this); - // The fullscreen state is communicated to the renderer through a resize - // message. If the change in fullscreen state doesn't cause a view resize - // then we must ensure web contents exit the fullscreen state by explicitly - // sending a resize message. This is required for the situation of the browser - // moving the view into a "browser fullscreen" state and then the contents - // entering "tab fullscreen". Exiting the contents "tab fullscreen" then won't - // have the side effect of the view resizing, hence the explicit call here is - // required. - if (!will_cause_resize) { - if (RenderWidgetHostView* rwhv = GetRenderWidgetHostView()) { - if (RenderWidgetHost* render_widget_host = rwhv->GetRenderWidgetHost()) - render_widget_host->WasResized(); - } - } - - for (auto& observer : observers_) { - observer.DidToggleFullscreenModeForTab(IsFullscreenForCurrentTab(), - will_cause_resize); - } + if (!IsFullscreenForCurrentTab()) + NotifyFullscreenChanged(will_cause_resize); } bool WebContentsImpl::IsFullscreenForCurrentTab() const { @@ -2492,7 +2495,7 @@ void WebContentsImpl::CreateNewWidget(int32_t render_process_id, pending_widget_views_[std::make_pair(render_process_id, route_id)] = widget_view; -#if defined(OS_MACOSX) +#if defined(OS_MACOSX) && !defined(TOOLKIT_QT) // A RenderWidgetHostViewMac has lifetime scoped to the view. We'll retain it // to allow it to survive the trip without being hosted. base::mac::NSObjectRetain(widget_view->GetNativeView()); @@ -2582,7 +2585,7 @@ void WebContentsImpl::ShowCreatedWidget(int process_id, // used to implement Pepper Flash fullscreen. render_widget_host_impl->set_allow_privileged_mouse_lock(is_fullscreen); -#if defined(OS_MACOSX) +#if defined(OS_MACOSX) && !defined(TOOLKIT_QT) // A RenderWidgetHostViewMac has lifetime scoped to the view. Now that it's // properly embedded (or purposefully ignored) we can release the retain we // took in CreateNewWidget(). |