OLD | NEW |
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 20 matching lines...) Expand all Loading... |
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/Fullscreen.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 "core/html/HTMLVideoElement.h" | 38 #include "core/html/HTMLVideoElement.h" |
39 #include "platform/LayoutTestSupport.h" | 39 #include "platform/LayoutTestSupport.h" |
40 #include "platform/RuntimeEnabledFeatures.h" | 40 #include "platform/RuntimeEnabledFeatures.h" |
41 #include "public/web/WebFrame.h" | 41 #include "public/web/WebFrameClient.h" |
42 #include "public/web/WebViewClient.h" | 42 #include "public/web/WebViewClient.h" |
| 43 #include "web/WebLocalFrameImpl.h" |
43 #include "web/WebSettingsImpl.h" | 44 #include "web/WebSettingsImpl.h" |
44 #include "web/WebViewImpl.h" | 45 #include "web/WebViewImpl.h" |
45 | 46 |
46 namespace blink { | 47 namespace blink { |
47 | 48 |
48 PassOwnPtrWillBeRawPtr<FullscreenController> FullscreenController::create(WebVie
wImpl* webViewImpl) | 49 PassOwnPtrWillBeRawPtr<FullscreenController> FullscreenController::create(WebVie
wImpl* webViewImpl) |
49 { | 50 { |
50 return adoptPtrWillBeNoop(new FullscreenController(webViewImpl)); | 51 return adoptPtrWillBeNoop(new FullscreenController(webViewImpl)); |
51 } | 52 } |
52 | 53 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 } | 140 } |
140 | 141 |
141 // We are already in fullscreen mode. | 142 // We are already in fullscreen mode. |
142 if (m_fullScreenFrame) { | 143 if (m_fullScreenFrame) { |
143 m_provisionalFullScreenElement = element; | 144 m_provisionalFullScreenElement = element; |
144 didEnterFullScreen(); | 145 didEnterFullScreen(); |
145 return; | 146 return; |
146 } | 147 } |
147 | 148 |
148 // We need to transition to fullscreen mode. | 149 // We need to transition to fullscreen mode. |
149 if (WebViewClient* client = m_webViewImpl->client()) { | 150 // FIXME: temporarily try to use WebFrameClient and WebViewClient while |
| 151 // Chromium switches from one to the other, see https://crbug.com/374854 |
| 152 WebLocalFrameImpl* frame = WebLocalFrameImpl::fromFrame(element->document().
frame()); |
| 153 if (frame && frame->client() && frame->client()->enterFullscreen()) { |
| 154 m_provisionalFullScreenElement = element; |
| 155 } else if (WebViewClient* client = m_webViewImpl->client()) { |
150 if (client->enterFullScreen()) | 156 if (client->enterFullScreen()) |
151 m_provisionalFullScreenElement = element; | 157 m_provisionalFullScreenElement = element; |
152 } | 158 } |
153 } | 159 } |
154 | 160 |
155 void FullscreenController::exitFullScreenForElement(Element* element) | 161 void FullscreenController::exitFullScreenForElement(Element* element) |
156 { | 162 { |
157 // The client is exiting full screen, so don't send a notification. | 163 // The client is exiting full screen, so don't send a notification. |
158 if (m_isCancelingFullScreen) | 164 if (m_isCancelingFullScreen) |
159 return; | 165 return; |
| 166 |
| 167 // FIXME: temporarily try to use WebFrameClient and WebViewClient while |
| 168 // Chromium switches from one to the other, see https://crbug.com/374854 |
| 169 WebLocalFrameImpl* frame = WebLocalFrameImpl::fromFrame(element->document().
frame()); |
| 170 if (frame && frame->client() && frame->client()->exitFullscreen()) |
| 171 return; |
| 172 |
160 if (WebViewClient* client = m_webViewImpl->client()) | 173 if (WebViewClient* client = m_webViewImpl->client()) |
161 client->exitFullScreen(); | 174 client->exitFullScreen(); |
162 } | 175 } |
163 | 176 |
164 void FullscreenController::updateSize() | 177 void FullscreenController::updateSize() |
165 { | 178 { |
166 if (!isFullscreen()) | 179 if (!isFullscreen()) |
167 return; | 180 return; |
168 | 181 |
169 RenderFullScreen* renderer = Fullscreen::from(*m_fullScreenFrame->document()
).fullScreenRenderer(); | 182 RenderFullScreen* renderer = Fullscreen::from(*m_fullScreenFrame->document()
).fullScreenRenderer(); |
170 if (renderer) | 183 if (renderer) |
171 renderer->updateStyle(); | 184 renderer->updateStyle(); |
172 } | 185 } |
173 | 186 |
174 void FullscreenController::trace(Visitor* visitor) | 187 void FullscreenController::trace(Visitor* visitor) |
175 { | 188 { |
176 visitor->trace(m_provisionalFullScreenElement); | 189 visitor->trace(m_provisionalFullScreenElement); |
177 visitor->trace(m_fullScreenFrame); | 190 visitor->trace(m_fullScreenFrame); |
178 } | 191 } |
179 | 192 |
180 } // namespace blink | 193 } // namespace blink |
181 | 194 |
OLD | NEW |