[WPE] Do not use a sync IPC message to send the host FD to the web process
[WebKit-https.git] / Source / WebKit / UIProcess / API / wpe / PageClientImpl.h
1 /*
2  * Copyright (C) 2014 Igalia S.L.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23  * THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 #pragma once
27
28 #include "PageClient.h"
29 #include "WebFullScreenManagerProxy.h"
30
31 struct wpe_view_backend;
32
33 namespace WKWPE {
34 class View;
35 }
36
37 namespace WebKit {
38
39 class ScrollGestureController;
40
41 enum class UndoOrRedo : bool;
42
43 class PageClientImpl final : public PageClient
44 #if ENABLE(FULLSCREEN_API)
45     , public WebFullScreenManagerProxyClient
46 #endif
47 {
48 public:
49     PageClientImpl(WKWPE::View&);
50     virtual ~PageClientImpl();
51
52     struct wpe_view_backend* viewBackend();
53
54 private:
55     // PageClient
56     std::unique_ptr<DrawingAreaProxy> createDrawingAreaProxy(WebProcessProxy&) override;
57     void setViewNeedsDisplay(const WebCore::Region&) override;
58     void requestScroll(const WebCore::FloatPoint&, const WebCore::IntPoint&, bool) override;
59     WebCore::FloatPoint viewScrollPosition() override;
60     WebCore::IntSize viewSize() override;
61     bool isViewWindowActive() override;
62     bool isViewFocused() override;
63     bool isViewVisible() override;
64     bool isViewInWindow() override;
65
66     void processDidExit() override;
67     void didRelaunchProcess() override;
68     void pageClosed() override;
69     void preferencesDidChange() override;
70     void toolTipChanged(const String&, const String&) override;
71
72     void didCommitLoadForMainFrame(const String&, bool) override;
73     void handleDownloadRequest(DownloadProxy*) override;
74
75     void didChangeContentSize(const WebCore::IntSize&) override;
76
77     void setCursor(const WebCore::Cursor&) override;
78     void setCursorHiddenUntilMouseMoves(bool) override;
79     void didChangeViewportProperties(const WebCore::ViewportAttributes&) override;
80
81     void registerEditCommand(Ref<WebEditCommandProxy>&&, UndoOrRedo) override;
82     void clearAllEditCommands() override;
83     bool canUndoRedo(UndoOrRedo) override;
84     void executeUndoRedo(UndoOrRedo) override;
85
86     WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&) override;
87     WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&) override;
88     WebCore::IntPoint screenToRootView(const WebCore::IntPoint&) override;
89     WebCore::IntRect rootViewToScreen(const WebCore::IntRect&) override;
90
91     void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool) override;
92 #if ENABLE(TOUCH_EVENTS)
93     void doneWithTouchEvent(const NativeWebTouchEvent&, bool) override;
94 #endif
95     void wheelEventWasNotHandledByWebCore(const NativeWebWheelEvent&) override;
96
97     RefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy&) override;
98 #if ENABLE(CONTEXT_MENUS)
99     Ref<WebContextMenuProxy> createContextMenuProxy(WebPageProxy&, ContextMenuContextData&&, const UserData&) override;
100 #endif
101
102     void enterAcceleratedCompositingMode(const LayerTreeContext&) override;
103     void exitAcceleratedCompositingMode() override;
104     void updateAcceleratedCompositingMode(const LayerTreeContext&) override;
105
106     void didFinishLoadingDataForCustomContentProvider(const String&, const IPC::DataReference&) override;
107
108     void navigationGestureDidBegin() override;
109     void navigationGestureWillEnd(bool, WebBackForwardListItem&) override;
110     void navigationGestureDidEnd(bool, WebBackForwardListItem&) override;
111     void navigationGestureDidEnd() override;
112     void willRecordNavigationSnapshot(WebBackForwardListItem&) override;
113     void didRemoveNavigationGestureSnapshot() override;
114
115     void didFirstVisuallyNonEmptyLayoutForMainFrame() override;
116     void didFinishLoadForMainFrame() override;
117     void didFailLoadForMainFrame() override;
118     void didSameDocumentNavigationForMainFrame(SameDocumentNavigationType) override;
119
120     void didChangeBackgroundColor() override;
121     void isPlayingAudioWillChange() final { }
122     void isPlayingAudioDidChange() final { }
123
124     void refView() override;
125     void derefView() override;
126
127 #if ENABLE(VIDEO) && USE(GSTREAMER)
128     bool decidePolicyForInstallMissingMediaPluginsPermissionRequest(InstallMissingMediaPluginsPermissionRequest&) override;
129 #endif
130
131     void didRestoreScrollPosition() override;
132
133 #if ENABLE(FULLSCREEN_API)
134     WebFullScreenManagerProxyClient& fullScreenManagerProxyClient() final;
135
136     void closeFullScreenManager() override;
137     bool isFullScreen() override;
138     void enterFullScreen() override;
139     void exitFullScreen() override;
140     void beganEnterFullScreen(const WebCore::IntRect& initialFrame, const WebCore::IntRect& finalFrame) override;
141     void beganExitFullScreen(const WebCore::IntRect& initialFrame, const WebCore::IntRect& finalFrame) override;
142 #endif
143
144     void didFinishProcessingAllPendingMouseEvents() final { }
145
146     IPC::Attachment hostFileDescriptor() final;
147
148     WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() override;
149
150     WKWPE::View& m_view;
151
152     std::unique_ptr<ScrollGestureController> m_scrollGestureController;
153 };
154
155 } // namespace WebKit