Chromium Code Reviews| 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 15 matching lines...) Expand all Loading... | |
| 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 #ifndef FullscreenController_h | 31 #ifndef FullscreenController_h |
| 32 #define FullscreenController_h | 32 #define FullscreenController_h |
| 33 | 33 |
| 34 #include "platform/geometry/FloatPoint.h" | 34 #include "platform/geometry/FloatPoint.h" |
| 35 #include "platform/geometry/IntSize.h" | 35 #include "platform/geometry/IntSize.h" |
| 36 #include "platform/heap/Handle.h" | 36 #include <memory> |
| 37 #include "wtf/RefPtr.h" | |
| 38 | 37 |
| 39 namespace blink { | 38 namespace blink { |
| 40 | 39 |
| 41 class Element; | 40 class Element; |
| 42 class LocalFrame; | 41 class LocalFrame; |
| 43 class WebViewImpl; | 42 class WebViewImpl; |
| 44 | 43 |
| 45 class FullscreenController final | 44 class FullscreenController { |
| 46 : public GarbageCollected<FullscreenController> { | |
| 47 public: | 45 public: |
| 48 static FullscreenController* create(WebViewImpl*); | 46 static std::unique_ptr<FullscreenController> create(WebViewImpl*); |
| 49 | 47 |
| 50 // Called by Fullscreen (via ChromeClient) to request entering or exiting | 48 // Called by Fullscreen (via ChromeClient) to request entering or exiting |
| 51 // fullscreen. | 49 // fullscreen. |
| 52 void enterFullscreenForElement(Element*); | 50 void enterFullscreen(LocalFrame&); |
| 53 void exitFullscreen(LocalFrame*); | 51 void exitFullscreen(LocalFrame&); |
| 54 | 52 |
| 55 // Called by content::RenderWidget (via WebWidget) to notify that we've | 53 // Called by content::RenderWidget (via WebWidget) to notify that we've |
| 56 // entered or exited fullscreen. This can be because we requested it, or it | 54 // entered or exited fullscreen. This can be because we requested it, or it |
| 57 // can be initiated by the browser directly. | 55 // can be initiated by the browser directly. |
| 58 void didEnterFullscreen(); | 56 void didEnterFullscreen(); |
| 59 void didExitFullscreen(); | 57 void didExitFullscreen(); |
| 60 | 58 |
| 61 // Called by Fullscreen (via ChromeClient) to notify that the fullscreen | 59 // Called by Fullscreen (via ChromeClient) to notify that the fullscreen |
| 62 // element has changed. | 60 // element has changed. |
| 63 void fullscreenElementChanged(Element*, Element*); | 61 void fullscreenElementChanged(Element*, Element*); |
| 64 | 62 |
| 65 bool isFullscreen() { return m_fullscreenFrame; } | 63 bool isFullscreen() { return m_state == State::Fullscreen; } |
| 66 | 64 |
| 67 void updateSize(); | 65 void updateSize(); |
| 68 | 66 |
| 69 void didUpdateLayout(); | 67 void didUpdateLayout(); |
| 70 | 68 |
| 71 DECLARE_TRACE(); | |
| 72 | |
| 73 protected: | 69 protected: |
| 74 explicit FullscreenController(WebViewImpl*); | 70 explicit FullscreenController(WebViewImpl*); |
| 75 | 71 |
| 76 private: | 72 private: |
| 77 void updatePageScaleConstraints(bool removeConstraints); | 73 void updatePageScaleConstraints(bool removeConstraints); |
| 78 | 74 |
| 79 WebViewImpl* m_webViewImpl; | 75 WebViewImpl* m_webViewImpl; |
| 80 | 76 |
| 81 bool m_haveEnteredFullscreen; | 77 enum class State { |
| 82 float m_exitFullscreenPageScaleFactor; | 78 Initial, |
|
mlamouri (slow - plz ping)
2016/12/05 13:54:54
Is `Initial` used after exiting fullscreen scroll
foolip
2016/12/06 11:31:39
I have added a documentation block, can you take a
| |
| 83 IntSize m_exitFullscreenScrollOffset; | 79 EnteringFullscreen, |
| 84 FloatPoint m_exitFullscreenVisualViewportOffset; | 80 Fullscreen, |
| 85 bool m_needsScrollAndScaleRestore; | 81 ExitingFullscreen, |
| 82 NeedsScrollAndScaleRestore | |
|
mlamouri (slow - plz ping)
2016/12/05 13:54:54
Add a comment explaining what that means?
| |
| 83 }; | |
| 84 State m_state = State::Initial; | |
| 86 | 85 |
| 87 // If set, the WebView is transitioning to fullscreen for this element. | 86 float m_initialPageScaleFactor = 0.0f; |
| 88 Member<Element> m_provisionalFullscreenElement; | 87 IntSize m_initialScrollOffset; |
| 89 | 88 FloatPoint m_initialVisualViewportOffset; |
| 90 // If set, the WebView is in fullscreen mode for an element in this frame. | |
| 91 Member<LocalFrame> m_fullscreenFrame; | |
| 92 | |
| 93 bool m_isCancelingFullscreen; | |
| 94 }; | 89 }; |
| 95 | 90 |
| 96 } // namespace blink | 91 } // namespace blink |
| 97 | 92 |
| 98 #endif | 93 #endif |
| OLD | NEW |