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