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

Side by Side Diff: Source/web/FullscreenController.cpp

Issue 290643005: Don't show video fullscreen until DidEnterFullscreen() is called, and disable fullscreen for non-me… (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 6 years, 5 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/web/WebSettingsImpl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 21 matching lines...) Expand all
32 #include "web/FullscreenController.h" 32 #include "web/FullscreenController.h"
33 33
34 #include "core/dom/Document.h" 34 #include "core/dom/Document.h"
35 #include "core/dom/FullscreenElementStack.h" 35 #include "core/dom/FullscreenElementStack.h"
36 #include "core/frame/LocalFrame.h" 36 #include "core/frame/LocalFrame.h"
37 #include "core/html/HTMLMediaElement.h" 37 #include "core/html/HTMLMediaElement.h"
38 #include "platform/LayoutTestSupport.h" 38 #include "platform/LayoutTestSupport.h"
39 #include "platform/RuntimeEnabledFeatures.h" 39 #include "platform/RuntimeEnabledFeatures.h"
40 #include "public/web/WebFrame.h" 40 #include "public/web/WebFrame.h"
41 #include "public/web/WebViewClient.h" 41 #include "public/web/WebViewClient.h"
42 #include "web/WebSettingsImpl.h"
42 #include "web/WebViewImpl.h" 43 #include "web/WebViewImpl.h"
43 44
44 using namespace WebCore; 45 using namespace WebCore;
45 46
46 namespace blink { 47 namespace blink {
47 48
48 PassOwnPtr<FullscreenController> FullscreenController::create(WebViewImpl* webVi ewImpl) 49 PassOwnPtr<FullscreenController> FullscreenController::create(WebViewImpl* webVi ewImpl)
49 { 50 {
50 return adoptPtr(new FullscreenController(webViewImpl)); 51 return adoptPtr(new FullscreenController(webViewImpl));
51 } 52 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 m_exitFullscreenPinchViewportOffset = m_webViewImpl->pinchViewpo rtOffset(); 85 m_exitFullscreenPinchViewportOffset = m_webViewImpl->pinchViewpo rtOffset();
85 m_webViewImpl->setPageScaleFactor(1.0f); 86 m_webViewImpl->setPageScaleFactor(1.0f);
86 m_webViewImpl->setMainFrameScrollOffset(IntPoint()); 87 m_webViewImpl->setMainFrameScrollOffset(IntPoint());
87 m_webViewImpl->setPinchViewportOffset(FloatPoint()); 88 m_webViewImpl->setPinchViewportOffset(FloatPoint());
88 } 89 }
89 90
90 FullscreenElementStack::from(*doc).webkitDidEnterFullScreenForElemen t(0); 91 FullscreenElementStack::from(*doc).webkitDidEnterFullScreenForElemen t(0);
91 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled()) { 92 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled()) {
92 Element* element = FullscreenElementStack::currentFullScreenElem entFrom(*doc); 93 Element* element = FullscreenElementStack::currentFullScreenElem entFrom(*doc);
93 ASSERT(element); 94 ASSERT(element);
94 if (isHTMLMediaElement(*element) && m_webViewImpl->layerTreeView ()) 95 if (isHTMLMediaElement(*element)) {
95 m_webViewImpl->layerTreeView()->setHasTransparentBackground( true); 96 HTMLMediaElement* mediaElement = toHTMLMediaElement(element) ;
97 if (mediaElement->webMediaPlayer() && mediaElement->webMedia Player()->canEnterFullscreen()
98 // FIXME: There is no embedder-side handling in layout t est mode.
99 && !isRunningLayoutTest()) {
100 mediaElement->webMediaPlayer()->enterFullscreen();
101 }
102 if (m_webViewImpl->layerTreeView())
103 m_webViewImpl->layerTreeView()->setHasTransparentBackgro und(true);
104 }
96 } 105 }
97 } 106 }
98 } 107 }
99 } 108 }
100 109
101 void FullscreenController::willExitFullScreen() 110 void FullscreenController::willExitFullScreen()
102 { 111 {
103 if (!m_fullScreenFrame) 112 if (!m_fullScreenFrame)
104 return; 113 return;
105 114
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 fullscreen->webkitDidExitFullScreenForElement(0); 148 fullscreen->webkitDidExitFullScreenForElement(0);
140 } 149 }
141 } 150 }
142 } 151 }
143 152
144 m_fullScreenFrame.clear(); 153 m_fullScreenFrame.clear();
145 } 154 }
146 155
147 void FullscreenController::enterFullScreenForElement(WebCore::Element* element) 156 void FullscreenController::enterFullScreenForElement(WebCore::Element* element)
148 { 157 {
158 if (m_webViewImpl->settingsImpl()->disallowFullscreenForNonMediaElements() & & !isHTMLMediaElement(element))
159 return;
160
149 // We are already transitioning to fullscreen for a different element. 161 // We are already transitioning to fullscreen for a different element.
150 if (m_provisionalFullScreenElement) { 162 if (m_provisionalFullScreenElement) {
151 m_provisionalFullScreenElement = element; 163 m_provisionalFullScreenElement = element;
152 return; 164 return;
153 } 165 }
154 166
155 // We are already in fullscreen mode. 167 // We are already in fullscreen mode.
156 if (m_fullScreenFrame) { 168 if (m_fullScreenFrame) {
157 m_provisionalFullScreenElement = element; 169 m_provisionalFullScreenElement = element;
158 willEnterFullScreen(); 170 willEnterFullScreen();
159 didEnterFullScreen(); 171 didEnterFullScreen();
160 return; 172 return;
161 } 173 }
162 174
163 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled()
164 && isHTMLMediaElement(element)
165 // FIXME: There is no embedder-side handling in layout test mode.
166 && !isRunningLayoutTest()) {
167 HTMLMediaElement* mediaElement = toHTMLMediaElement(element);
168 if (mediaElement->webMediaPlayer() && mediaElement->webMediaPlayer()->ca nEnterFullscreen()) {
169 mediaElement->webMediaPlayer()->enterFullscreen();
170 m_provisionalFullScreenElement = element;
171 return;
172 }
173 }
174
175 // We need to transition to fullscreen mode. 175 // We need to transition to fullscreen mode.
176 if (WebViewClient* client = m_webViewImpl->client()) { 176 if (WebViewClient* client = m_webViewImpl->client()) {
177 if (client->enterFullScreen()) 177 if (client->enterFullScreen())
178 m_provisionalFullScreenElement = element; 178 m_provisionalFullScreenElement = element;
179 } 179 }
180 } 180 }
181 181
182 void FullscreenController::exitFullScreenForElement(WebCore::Element* element) 182 void FullscreenController::exitFullScreenForElement(WebCore::Element* element)
183 { 183 {
184 // The client is exiting full screen, so don't send a notification. 184 // The client is exiting full screen, so don't send a notification.
185 if (m_isCancelingFullScreen) 185 if (m_isCancelingFullScreen)
186 return; 186 return;
187 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled()
188 && isHTMLMediaElement(element)
189 // FIXME: There is no embedder-side handling in layout test mode.
190 && !isRunningLayoutTest()) {
191 HTMLMediaElement* mediaElement = toHTMLMediaElement(element);
192 if (mediaElement->webMediaPlayer())
193 mediaElement->webMediaPlayer()->exitFullscreen();
194 return;
195 }
196 if (WebViewClient* client = m_webViewImpl->client()) 187 if (WebViewClient* client = m_webViewImpl->client())
197 client->exitFullScreen(); 188 client->exitFullScreen();
198 } 189 }
199 190
200 } 191 }
201 192
OLDNEW
« no previous file with comments | « no previous file | Source/web/WebSettingsImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698