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

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

Issue 476763004: Rename FullscreenElementStack to just Fullscreen (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 6 years, 4 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 | « Source/web/FrameLoaderClientImpl.cpp ('k') | Source/web/WebDocument.cpp » ('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 14 matching lines...) Expand all
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
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/Fullscreen.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/WebSettingsImpl.h"
43 #include "web/WebViewImpl.h" 43 #include "web/WebViewImpl.h"
44 44
45 namespace blink { 45 namespace blink {
(...skipping 11 matching lines...) Expand all
57 } 57 }
58 58
59 void FullscreenController::willEnterFullScreen() 59 void FullscreenController::willEnterFullScreen()
60 { 60 {
61 if (!m_provisionalFullScreenElement) 61 if (!m_provisionalFullScreenElement)
62 return; 62 return;
63 63
64 // Ensure that this element's document is still attached. 64 // Ensure that this element's document is still attached.
65 Document& doc = m_provisionalFullScreenElement->document(); 65 Document& doc = m_provisionalFullScreenElement->document();
66 if (doc.frame()) { 66 if (doc.frame()) {
67 FullscreenElementStack::from(doc).willEnterFullScreenForElement(m_provis ionalFullScreenElement.get()); 67 Fullscreen::from(doc).willEnterFullScreenForElement(m_provisionalFullScr eenElement.get());
68 m_fullScreenFrame = doc.frame(); 68 m_fullScreenFrame = doc.frame();
69 } 69 }
70 m_provisionalFullScreenElement.clear(); 70 m_provisionalFullScreenElement.clear();
71 } 71 }
72 72
73 void FullscreenController::didEnterFullScreen() 73 void FullscreenController::didEnterFullScreen()
74 { 74 {
75 if (!m_fullScreenFrame) 75 if (!m_fullScreenFrame)
76 return; 76 return;
77 77
78 if (Document* doc = m_fullScreenFrame->document()) { 78 if (Document* doc = m_fullScreenFrame->document()) {
79 if (FullscreenElementStack::isFullScreen(*doc)) { 79 if (Fullscreen::isFullScreen(*doc)) {
80 if (!m_exitFullscreenPageScaleFactor) { 80 if (!m_exitFullscreenPageScaleFactor) {
81 m_exitFullscreenPageScaleFactor = m_webViewImpl->pageScaleFactor (); 81 m_exitFullscreenPageScaleFactor = m_webViewImpl->pageScaleFactor ();
82 m_exitFullscreenScrollOffset = m_webViewImpl->mainFrame()->scrol lOffset(); 82 m_exitFullscreenScrollOffset = m_webViewImpl->mainFrame()->scrol lOffset();
83 m_exitFullscreenPinchViewportOffset = m_webViewImpl->pinchViewpo rtOffset(); 83 m_exitFullscreenPinchViewportOffset = m_webViewImpl->pinchViewpo rtOffset();
84 m_webViewImpl->setPageScaleFactor(1.0f); 84 m_webViewImpl->setPageScaleFactor(1.0f);
85 m_webViewImpl->setMainFrameScrollOffset(IntPoint()); 85 m_webViewImpl->setMainFrameScrollOffset(IntPoint());
86 m_webViewImpl->setPinchViewportOffset(FloatPoint()); 86 m_webViewImpl->setPinchViewportOffset(FloatPoint());
87 } 87 }
88 88
89 FullscreenElementStack::from(*doc).didEnterFullScreenForElement(0); 89 Fullscreen::from(*doc).didEnterFullScreenForElement(0);
90 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled()) { 90 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled()) {
91 Element* element = FullscreenElementStack::currentFullScreenElem entFrom(*doc); 91 Element* element = Fullscreen::currentFullScreenElementFrom(*doc );
92 ASSERT(element); 92 ASSERT(element);
93 if (isHTMLMediaElement(*element)) { 93 if (isHTMLMediaElement(*element)) {
94 HTMLMediaElement* mediaElement = toHTMLMediaElement(element) ; 94 HTMLMediaElement* mediaElement = toHTMLMediaElement(element) ;
95 if (mediaElement->webMediaPlayer() && mediaElement->webMedia Player()->canEnterFullscreen() 95 if (mediaElement->webMediaPlayer() && mediaElement->webMedia Player()->canEnterFullscreen()
96 // FIXME: There is no embedder-side handling in layout t est mode. 96 // FIXME: There is no embedder-side handling in layout t est mode.
97 && !LayoutTestSupport::isRunningLayoutTest()) { 97 && !LayoutTestSupport::isRunningLayoutTest()) {
98 mediaElement->webMediaPlayer()->enterFullscreen(); 98 mediaElement->webMediaPlayer()->enterFullscreen();
99 } 99 }
100 if (m_webViewImpl->layerTreeView()) 100 if (m_webViewImpl->layerTreeView())
101 m_webViewImpl->layerTreeView()->setHasTransparentBackgro und(true); 101 m_webViewImpl->layerTreeView()->setHasTransparentBackgro und(true);
102 } 102 }
103 } 103 }
104 } 104 }
105 } 105 }
106 } 106 }
107 107
108 void FullscreenController::willExitFullScreen() 108 void FullscreenController::willExitFullScreen()
109 { 109 {
110 if (!m_fullScreenFrame) 110 if (!m_fullScreenFrame)
111 return; 111 return;
112 112
113 if (Document* doc = m_fullScreenFrame->document()) { 113 if (Document* doc = m_fullScreenFrame->document()) {
114 FullscreenElementStack* fullscreen = FullscreenElementStack::fromIfExist s(*doc); 114 Fullscreen* fullscreen = Fullscreen::fromIfExists(*doc);
115 if (!fullscreen) 115 if (!fullscreen)
116 return; 116 return;
117 if (fullscreen->isFullScreen(*doc)) { 117 if (fullscreen->isFullScreen(*doc)) {
118 // When the client exits from full screen we have to call fullyExitF ullscreen to notify 118 // When the client exits from full screen we have to call fullyExitF ullscreen to notify
119 // the document. While doing that, suppress notifications back to th e client. 119 // the document. While doing that, suppress notifications back to th e client.
120 m_isCancelingFullScreen = true; 120 m_isCancelingFullScreen = true;
121 fullscreen->fullyExitFullscreen(); 121 fullscreen->fullyExitFullscreen();
122 m_isCancelingFullScreen = false; 122 m_isCancelingFullScreen = false;
123 fullscreen->willExitFullScreenForElement(0); 123 fullscreen->willExitFullScreenForElement(0);
124 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && m_web ViewImpl->layerTreeView()) 124 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && m_web ViewImpl->layerTreeView())
125 m_webViewImpl->layerTreeView()->setHasTransparentBackground(m_we bViewImpl->isTransparent()); 125 m_webViewImpl->layerTreeView()->setHasTransparentBackground(m_we bViewImpl->isTransparent());
126 } 126 }
127 } 127 }
128 } 128 }
129 129
130 void FullscreenController::didExitFullScreen() 130 void FullscreenController::didExitFullScreen()
131 { 131 {
132 if (!m_fullScreenFrame) 132 if (!m_fullScreenFrame)
133 return; 133 return;
134 134
135 if (Document* doc = m_fullScreenFrame->document()) { 135 if (Document* doc = m_fullScreenFrame->document()) {
136 if (FullscreenElementStack* fullscreen = FullscreenElementStack::fromIfE xists(*doc)) { 136 if (Fullscreen* fullscreen = Fullscreen::fromIfExists(*doc)) {
137 if (fullscreen->webkitIsFullScreen()) { 137 if (fullscreen->webkitIsFullScreen()) {
138 if (m_exitFullscreenPageScaleFactor) { 138 if (m_exitFullscreenPageScaleFactor) {
139 m_webViewImpl->setPageScaleFactor(m_exitFullscreenPageScaleF actor); 139 m_webViewImpl->setPageScaleFactor(m_exitFullscreenPageScaleF actor);
140 m_webViewImpl->setMainFrameScrollOffset(IntPoint(m_exitFulls creenScrollOffset)); 140 m_webViewImpl->setMainFrameScrollOffset(IntPoint(m_exitFulls creenScrollOffset));
141 m_webViewImpl->setPinchViewportOffset(m_exitFullscreenPinchV iewportOffset); 141 m_webViewImpl->setPinchViewportOffset(m_exitFullscreenPinchV iewportOffset);
142 m_exitFullscreenPageScaleFactor = 0; 142 m_exitFullscreenPageScaleFactor = 0;
143 m_exitFullscreenScrollOffset = IntSize(); 143 m_exitFullscreenScrollOffset = IntSize();
144 } 144 }
145 145
146 fullscreen->didExitFullScreenForElement(0); 146 fullscreen->didExitFullScreenForElement(0);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 { 178 {
179 // The client is exiting full screen, so don't send a notification. 179 // The client is exiting full screen, so don't send a notification.
180 if (m_isCancelingFullScreen) 180 if (m_isCancelingFullScreen)
181 return; 181 return;
182 if (WebViewClient* client = m_webViewImpl->client()) 182 if (WebViewClient* client = m_webViewImpl->client())
183 client->exitFullScreen(); 183 client->exitFullScreen();
184 } 184 }
185 185
186 } // namespace blink 186 } // namespace blink
187 187
OLDNEW
« no previous file with comments | « Source/web/FrameLoaderClientImpl.cpp ('k') | Source/web/WebDocument.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698