Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 2014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2025 // Make sure any existing fullscreen widget is shut down first. | 2025 // Make sure any existing fullscreen widget is shut down first. |
| 2026 RenderWidgetHostView* const widget_view = GetFullscreenRenderWidgetHostView(); | 2026 RenderWidgetHostView* const widget_view = GetFullscreenRenderWidgetHostView(); |
| 2027 if (widget_view) { | 2027 if (widget_view) { |
| 2028 RenderWidgetHostImpl::From(widget_view->GetRenderWidgetHost()) | 2028 RenderWidgetHostImpl::From(widget_view->GetRenderWidgetHost()) |
| 2029 ->ShutdownAndDestroyWidget(true); | 2029 ->ShutdownAndDestroyWidget(true); |
| 2030 } | 2030 } |
| 2031 | 2031 |
| 2032 if (delegate_) | 2032 if (delegate_) |
| 2033 delegate_->EnterFullscreenModeForTab(this, origin); | 2033 delegate_->EnterFullscreenModeForTab(this, origin); |
| 2034 | 2034 |
| 2035 RenderWidgetHostViewBase* rwhvb = | |
| 2036 static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView()); | |
| 2037 if (rwhvb) | |
| 2038 rwhvb->OnFullscreenStateChanged(IsFullscreenForCurrentTab()); | |
| 2039 | |
| 2035 for (auto& observer : observers_) | 2040 for (auto& observer : observers_) |
| 2036 observer.DidToggleFullscreenModeForTab(IsFullscreenForCurrentTab(), false); | 2041 observer.DidToggleFullscreenModeForTab(IsFullscreenForCurrentTab(), false); |
| 2037 } | 2042 } |
| 2038 | 2043 |
| 2039 void WebContentsImpl::ExitFullscreenMode(bool will_cause_resize) { | 2044 void WebContentsImpl::ExitFullscreenMode(bool will_cause_resize) { |
| 2040 // This method is being called to leave renderer-initiated fullscreen mode. | 2045 // This method is being called to leave renderer-initiated fullscreen mode. |
| 2041 // Make sure any existing fullscreen widget is shut down first. | 2046 // Make sure any existing fullscreen widget is shut down first. |
| 2042 RenderWidgetHostView* const widget_view = GetFullscreenRenderWidgetHostView(); | 2047 RenderWidgetHostView* const widget_view = GetFullscreenRenderWidgetHostView(); |
| 2043 if (widget_view) { | 2048 if (widget_view) { |
| 2044 RenderWidgetHostImpl::From(widget_view->GetRenderWidgetHost()) | 2049 RenderWidgetHostImpl::From(widget_view->GetRenderWidgetHost()) |
| 2045 ->ShutdownAndDestroyWidget(true); | 2050 ->ShutdownAndDestroyWidget(true); |
| 2046 } | 2051 } |
| 2047 | 2052 |
| 2048 #if defined(OS_ANDROID) | 2053 #if defined(OS_ANDROID) |
| 2049 ContentVideoView* video_view = ContentVideoView::GetInstance(); | 2054 ContentVideoView* video_view = ContentVideoView::GetInstance(); |
| 2050 if (video_view != NULL) | 2055 if (video_view != NULL) |
| 2051 video_view->ExitFullscreen(); | 2056 video_view->ExitFullscreen(); |
| 2052 #endif | 2057 #endif |
| 2053 | 2058 |
| 2059 RenderWidgetHostViewBase* rwhvb = | |
|
Khushal
2017/06/15 18:42:56
Don't we need to call this after delegate_->ExitFu
steimel
2017/06/15 21:46:39
Done.
| |
| 2060 static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView()); | |
| 2061 if (rwhvb) | |
| 2062 rwhvb->OnFullscreenStateChanged(IsFullscreenForCurrentTab()); | |
| 2063 | |
| 2054 if (delegate_) | 2064 if (delegate_) |
| 2055 delegate_->ExitFullscreenModeForTab(this); | 2065 delegate_->ExitFullscreenModeForTab(this); |
| 2056 | 2066 |
| 2057 // The fullscreen state is communicated to the renderer through a resize | 2067 // The fullscreen state is communicated to the renderer through a resize |
| 2058 // message. If the change in fullscreen state doesn't cause a view resize | 2068 // message. If the change in fullscreen state doesn't cause a view resize |
| 2059 // then we must ensure web contents exit the fullscreen state by explicitly | 2069 // then we must ensure web contents exit the fullscreen state by explicitly |
| 2060 // sending a resize message. This is required for the situation of the browser | 2070 // sending a resize message. This is required for the situation of the browser |
| 2061 // moving the view into a "browser fullscreen" state and then the contents | 2071 // moving the view into a "browser fullscreen" state and then the contents |
| 2062 // entering "tab fullscreen". Exiting the contents "tab fullscreen" then won't | 2072 // entering "tab fullscreen". Exiting the contents "tab fullscreen" then won't |
| 2063 // have the side effect of the view resizing, hence the explicit call here is | 2073 // have the side effect of the view resizing, hence the explicit call here is |
| (...skipping 3681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5745 new_root->SetOriginalOpener(opener->frame_tree()->root()); | 5755 new_root->SetOriginalOpener(opener->frame_tree()->root()); |
| 5746 | 5756 |
| 5747 if (!opener_suppressed) { | 5757 if (!opener_suppressed) { |
| 5748 new_root->SetOpener(opener); | 5758 new_root->SetOpener(opener); |
| 5749 created_with_opener_ = true; | 5759 created_with_opener_ = true; |
| 5750 } | 5760 } |
| 5751 } | 5761 } |
| 5752 } | 5762 } |
| 5753 | 5763 |
| 5754 } // namespace content | 5764 } // namespace content |
| OLD | NEW |