| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be found | 2 // Use of this source code is governed by a BSD-style license that can be found |
| 3 // in the LICENSE file. | 3 // in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef WebViewFrameWidget_h | 5 #ifndef WebViewFrameWidget_h |
| 6 #define WebViewFrameWidget_h | 6 #define WebViewFrameWidget_h |
| 7 | 7 |
| 8 #include "platform/heap/Handle.h" |
| 8 #include "public/web/WebFrameWidget.h" | 9 #include "public/web/WebFrameWidget.h" |
| 9 #include "wtf/Noncopyable.h" | 10 #include "wtf/Noncopyable.h" |
| 11 #include "wtf/RefPtr.h" |
| 10 | 12 |
| 11 namespace blink { | 13 namespace blink { |
| 12 | 14 |
| 15 class WebLocalFrameImpl; |
| 13 class WebViewImpl; | 16 class WebViewImpl; |
| 17 class WebWidgetClient; |
| 14 | 18 |
| 15 // Shim class to help normalize the widget interfaces in the Blink public API. | 19 // Shim class to help normalize the widget interfaces in the Blink public API. |
| 16 // For OOPI, subframes have WebFrameWidgets for input and rendering. | 20 // For OOPI, subframes have WebFrameWidgets for input and rendering. |
| 17 // Unfortunately, the main frame still uses WebView's WebWidget for input and | 21 // Unfortunately, the main frame still uses WebView's WebWidget for input and |
| 18 // rendering. This results in complex code, since there are two different | 22 // rendering. This results in complex code, since there are two different |
| 19 // implementations of WebWidget and code needs to have branches to handle both | 23 // implementations of WebWidget and code needs to have branches to handle both |
| 20 // cases. | 24 // cases. |
| 21 // This class allows a Blink embedder to create a WebFrameWidget that can be | 25 // This class allows a Blink embedder to create a WebFrameWidget that can be |
| 22 // used for the main frame. Internally, it currently wraps WebView's WebWidget | 26 // used for the main frame. Internally, it currently wraps WebView's WebWidget |
| 23 // and just forwards almost everything to it. | 27 // and just forwards almost everything to it. |
| 24 // After the embedder starts using a WebFrameWidget for the main frame, | 28 // After the embedder starts using a WebFrameWidget for the main frame, |
| 25 // WebView will be updated to no longer inherit WebWidget. The eventual goal is | 29 // WebView will be updated to no longer inherit WebWidget. The eventual goal is |
| 26 // to unfork the widget code duplicated in WebFrameWidgetImpl and WebViewImpl | 30 // to unfork the widget code duplicated in WebFrameWidgetImpl and WebViewImpl |
| 27 // into one class. | 31 // into one class. |
| 28 // A more detailed writeup of this transition can be read at | 32 // A more detailed writeup of this transition can be read at |
| 29 // https://goo.gl/7yVrnb. | 33 // https://goo.gl/7yVrnb. |
| 30 class WebViewFrameWidget : public WebFrameWidget { | 34 class WebViewFrameWidget : public WebFrameWidget { |
| 31 WTF_MAKE_NONCOPYABLE(WebViewFrameWidget); | 35 WTF_MAKE_NONCOPYABLE(WebViewFrameWidget); |
| 32 public: | 36 public: |
| 33 explicit WebViewFrameWidget(WebViewImpl&); | 37 explicit WebViewFrameWidget(WebWidgetClient*, WebViewImpl&, WebLocalFrameImp
l&); |
| 34 virtual ~WebViewFrameWidget(); | 38 virtual ~WebViewFrameWidget(); |
| 35 | 39 |
| 36 // WebFrameWidget overrides: | 40 // WebFrameWidget overrides: |
| 37 void close() override; | 41 void close() override; |
| 38 WebSize size() override; | 42 WebSize size() override; |
| 39 void willStartLiveResize() override; | 43 void willStartLiveResize() override; |
| 40 void resize(const WebSize&) override; | 44 void resize(const WebSize&) override; |
| 41 void resizePinchViewport(const WebSize&) override; | 45 void resizePinchViewport(const WebSize&) override; |
| 42 void willEndLiveResize() override; | 46 void willEndLiveResize() override; |
| 43 void didEnterFullScreen() override; | 47 void didEnterFullScreen() override; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 void didLosePointerLock() override; | 89 void didLosePointerLock() override; |
| 86 void didChangeWindowResizerRect() override; | 90 void didChangeWindowResizerRect() override; |
| 87 WebColor backgroundColor() const override; | 91 WebColor backgroundColor() const override; |
| 88 WebPagePopup* pagePopup() const override; | 92 WebPagePopup* pagePopup() const override; |
| 89 void setTopControlsHeight(float height, bool topControlsShrinkLayoutSize) ov
erride; | 93 void setTopControlsHeight(float height, bool topControlsShrinkLayoutSize) ov
erride; |
| 90 void updateTopControlsState(WebTopControlsState constraints, WebTopControlsS
tate current, bool animate) override; | 94 void updateTopControlsState(WebTopControlsState constraints, WebTopControlsS
tate current, bool animate) override; |
| 91 void setVisibilityState(WebPageVisibilityState, bool isInitialState) overrid
e; | 95 void setVisibilityState(WebPageVisibilityState, bool isInitialState) overrid
e; |
| 92 bool forSubframe() const { return false; } | 96 bool forSubframe() const { return false; } |
| 93 | 97 |
| 94 private: | 98 private: |
| 95 WebViewImpl* m_webView; | 99 WebWidgetClient* m_client; |
| 100 RefPtr<WebViewImpl> m_webView; |
| 101 RefPtrWillBePersistent<WebLocalFrameImpl> m_mainFrame; |
| 96 }; | 102 }; |
| 97 | 103 |
| 98 } // namespace blink | 104 } // namespace blink |
| 99 | 105 |
| 100 #endif // WebViewFrameWidget_h | 106 #endif // WebViewFrameWidget_h |
| OLD | NEW |