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 2018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2029 // Make sure any existing fullscreen widget is shut down first. | 2029 // Make sure any existing fullscreen widget is shut down first. |
2030 RenderWidgetHostView* const widget_view = GetFullscreenRenderWidgetHostView(); | 2030 RenderWidgetHostView* const widget_view = GetFullscreenRenderWidgetHostView(); |
2031 if (widget_view) { | 2031 if (widget_view) { |
2032 RenderWidgetHostImpl::From(widget_view->GetRenderWidgetHost()) | 2032 RenderWidgetHostImpl::From(widget_view->GetRenderWidgetHost()) |
2033 ->ShutdownAndDestroyWidget(true); | 2033 ->ShutdownAndDestroyWidget(true); |
2034 } | 2034 } |
2035 | 2035 |
2036 if (delegate_) | 2036 if (delegate_) |
2037 delegate_->EnterFullscreenModeForTab(this, origin); | 2037 delegate_->EnterFullscreenModeForTab(this, origin); |
2038 | 2038 |
2039 RenderWidgetHostViewBase* rwhvb = | |
boliu
2017/07/05 17:39:48
chaining these two calls through web contents does
| |
2040 static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView()); | |
2041 if (rwhvb) | |
2042 rwhvb->OnFullscreenStateChanged(); | |
2043 | |
2039 for (auto& observer : observers_) | 2044 for (auto& observer : observers_) |
2040 observer.DidToggleFullscreenModeForTab(IsFullscreenForCurrentTab(), false); | 2045 observer.DidToggleFullscreenModeForTab(IsFullscreenForCurrentTab(), false); |
2041 } | 2046 } |
2042 | 2047 |
2043 void WebContentsImpl::ExitFullscreenMode(bool will_cause_resize) { | 2048 void WebContentsImpl::ExitFullscreenMode(bool will_cause_resize) { |
2044 // This method is being called to leave renderer-initiated fullscreen mode. | 2049 // This method is being called to leave renderer-initiated fullscreen mode. |
2045 // Make sure any existing fullscreen widget is shut down first. | 2050 // Make sure any existing fullscreen widget is shut down first. |
2046 RenderWidgetHostView* const widget_view = GetFullscreenRenderWidgetHostView(); | 2051 RenderWidgetHostView* const widget_view = GetFullscreenRenderWidgetHostView(); |
2047 if (widget_view) { | 2052 if (widget_view) { |
2048 RenderWidgetHostImpl::From(widget_view->GetRenderWidgetHost()) | 2053 RenderWidgetHostImpl::From(widget_view->GetRenderWidgetHost()) |
2049 ->ShutdownAndDestroyWidget(true); | 2054 ->ShutdownAndDestroyWidget(true); |
2050 } | 2055 } |
2051 | 2056 |
2052 #if defined(OS_ANDROID) | 2057 #if defined(OS_ANDROID) |
2053 ContentVideoView* video_view = ContentVideoView::GetInstance(); | 2058 ContentVideoView* video_view = ContentVideoView::GetInstance(); |
2054 if (video_view != NULL) | 2059 if (video_view != NULL) |
2055 video_view->ExitFullscreen(); | 2060 video_view->ExitFullscreen(); |
2056 #endif | 2061 #endif |
2057 | 2062 |
2058 if (delegate_) | 2063 if (delegate_) |
2059 delegate_->ExitFullscreenModeForTab(this); | 2064 delegate_->ExitFullscreenModeForTab(this); |
2060 | 2065 |
2066 RenderWidgetHostViewBase* rwhvb = | |
2067 static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView()); | |
2068 if (rwhvb) | |
2069 rwhvb->OnFullscreenStateChanged(); | |
2070 | |
2061 // The fullscreen state is communicated to the renderer through a resize | 2071 // The fullscreen state is communicated to the renderer through a resize |
2062 // message. If the change in fullscreen state doesn't cause a view resize | 2072 // message. If the change in fullscreen state doesn't cause a view resize |
2063 // then we must ensure web contents exit the fullscreen state by explicitly | 2073 // then we must ensure web contents exit the fullscreen state by explicitly |
2064 // sending a resize message. This is required for the situation of the browser | 2074 // sending a resize message. This is required for the situation of the browser |
2065 // moving the view into a "browser fullscreen" state and then the contents | 2075 // moving the view into a "browser fullscreen" state and then the contents |
2066 // entering "tab fullscreen". Exiting the contents "tab fullscreen" then won't | 2076 // entering "tab fullscreen". Exiting the contents "tab fullscreen" then won't |
2067 // have the side effect of the view resizing, hence the explicit call here is | 2077 // have the side effect of the view resizing, hence the explicit call here is |
2068 // required. | 2078 // required. |
2069 if (!will_cause_resize) { | 2079 if (!will_cause_resize) { |
2070 if (RenderWidgetHostView* rwhv = GetRenderWidgetHostView()) { | 2080 if (RenderWidgetHostView* rwhv = GetRenderWidgetHostView()) { |
(...skipping 3731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5802 } | 5812 } |
5803 | 5813 |
5804 void WebContentsImpl::MediaMutedStatusChanged( | 5814 void WebContentsImpl::MediaMutedStatusChanged( |
5805 const WebContentsObserver::MediaPlayerId& id, | 5815 const WebContentsObserver::MediaPlayerId& id, |
5806 bool muted) { | 5816 bool muted) { |
5807 for (auto& observer : observers_) | 5817 for (auto& observer : observers_) |
5808 observer.MediaMutedStatusChanged(id, muted); | 5818 observer.MediaMutedStatusChanged(id, muted); |
5809 } | 5819 } |
5810 | 5820 |
5811 } // namespace content | 5821 } // namespace content |
OLD | NEW |