| 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 #if defined(OS_ANDROID) |
| 2036 RenderWidgetHostViewAndroid* rwhva = |
| 2037 static_cast<RenderWidgetHostViewAndroid*>(GetRenderWidgetHostView()); |
| 2038 if (rwhva) |
| 2039 rwhva->OnFullscreenStateChanged(true); |
| 2040 #endif |
| 2041 |
| 2035 for (auto& observer : observers_) | 2042 for (auto& observer : observers_) |
| 2036 observer.DidToggleFullscreenModeForTab(IsFullscreenForCurrentTab(), false); | 2043 observer.DidToggleFullscreenModeForTab(IsFullscreenForCurrentTab(), false); |
| 2037 } | 2044 } |
| 2038 | 2045 |
| 2039 void WebContentsImpl::ExitFullscreenMode(bool will_cause_resize) { | 2046 void WebContentsImpl::ExitFullscreenMode(bool will_cause_resize) { |
| 2040 // This method is being called to leave renderer-initiated fullscreen mode. | 2047 // This method is being called to leave renderer-initiated fullscreen mode. |
| 2041 // Make sure any existing fullscreen widget is shut down first. | 2048 // Make sure any existing fullscreen widget is shut down first. |
| 2042 RenderWidgetHostView* const widget_view = GetFullscreenRenderWidgetHostView(); | 2049 RenderWidgetHostView* const widget_view = GetFullscreenRenderWidgetHostView(); |
| 2043 if (widget_view) { | 2050 if (widget_view) { |
| 2044 RenderWidgetHostImpl::From(widget_view->GetRenderWidgetHost()) | 2051 RenderWidgetHostImpl::From(widget_view->GetRenderWidgetHost()) |
| 2045 ->ShutdownAndDestroyWidget(true); | 2052 ->ShutdownAndDestroyWidget(true); |
| 2046 } | 2053 } |
| 2047 | 2054 |
| 2048 #if defined(OS_ANDROID) | 2055 #if defined(OS_ANDROID) |
| 2049 ContentVideoView* video_view = ContentVideoView::GetInstance(); | 2056 ContentVideoView* video_view = ContentVideoView::GetInstance(); |
| 2050 if (video_view != NULL) | 2057 if (video_view != NULL) |
| 2051 video_view->ExitFullscreen(); | 2058 video_view->ExitFullscreen(); |
| 2059 |
| 2060 RenderWidgetHostViewAndroid* rwhva = |
| 2061 static_cast<RenderWidgetHostViewAndroid*>(GetRenderWidgetHostView()); |
| 2062 if (rwhva) |
| 2063 rwhva->OnFullscreenStateChanged(false); |
| 2052 #endif | 2064 #endif |
| 2053 | 2065 |
| 2054 if (delegate_) | 2066 if (delegate_) |
| 2055 delegate_->ExitFullscreenModeForTab(this); | 2067 delegate_->ExitFullscreenModeForTab(this); |
| 2056 | 2068 |
| 2057 // The fullscreen state is communicated to the renderer through a resize | 2069 // 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 | 2070 // 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 | 2071 // 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 | 2072 // 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 | 2073 // moving the view into a "browser fullscreen" state and then the contents |
| (...skipping 3683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5745 new_root->SetOriginalOpener(opener->frame_tree()->root()); | 5757 new_root->SetOriginalOpener(opener->frame_tree()->root()); |
| 5746 | 5758 |
| 5747 if (!opener_suppressed) { | 5759 if (!opener_suppressed) { |
| 5748 new_root->SetOpener(opener); | 5760 new_root->SetOpener(opener); |
| 5749 created_with_opener_ = true; | 5761 created_with_opener_ = true; |
| 5750 } | 5762 } |
| 5751 } | 5763 } |
| 5752 } | 5764 } |
| 5753 | 5765 |
| 5754 } // namespace content | 5766 } // namespace content |
| OLD | NEW |