1 | |
2 | /* |
3 | * Copyright (C) 2010 Apple Inc. All rights reserved. |
4 | * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. |
5 | * Copyright (C) 2011 Igalia S.L. |
6 | * |
7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions |
9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. |
15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' |
17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
18 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS |
20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
26 | * THE POSSIBILITY OF SUCH DAMAGE. |
27 | */ |
28 | |
29 | #pragma once |
30 | |
31 | #include "DefaultUndoController.h" |
32 | #include "PageClient.h" |
33 | #include "WebFullScreenManagerProxy.h" |
34 | #include "WebPageProxy.h" |
35 | #include <WebCore/IntSize.h> |
36 | #include <gtk/gtk.h> |
37 | #include <memory> |
38 | |
39 | namespace WebCore { |
40 | enum class DOMPasteAccessPolicy : uint8_t; |
41 | } |
42 | |
43 | namespace WebKit { |
44 | |
45 | class DrawingAreaProxy; |
46 | class WebPageNamespace; |
47 | |
48 | enum class UndoOrRedo : bool; |
49 | |
50 | class PageClientImpl : public PageClient |
51 | #if ENABLE(FULLSCREEN_API) |
52 | , public WebFullScreenManagerProxyClient |
53 | #endif |
54 | { |
55 | WTF_MAKE_FAST_ALLOCATED; |
56 | public: |
57 | explicit PageClientImpl(GtkWidget*); |
58 | |
59 | GtkWidget* viewWidget() { return m_viewWidget; } |
60 | |
61 | private: |
62 | // PageClient |
63 | std::unique_ptr<DrawingAreaProxy> createDrawingAreaProxy(WebProcessProxy&) override; |
64 | void setViewNeedsDisplay(const WebCore::Region&) override; |
65 | void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin) override; |
66 | WebCore::FloatPoint viewScrollPosition() override; |
67 | WebCore::IntSize viewSize() override; |
68 | bool isViewWindowActive() override; |
69 | bool isViewFocused() override; |
70 | bool isViewVisible() override; |
71 | bool isViewInWindow() override; |
72 | void processDidExit() override; |
73 | void didRelaunchProcess() override; |
74 | void pageClosed() override; |
75 | void preferencesDidChange() override; |
76 | void toolTipChanged(const WTF::String&, const WTF::String&) override; |
77 | void setCursor(const WebCore::Cursor&) override; |
78 | void setCursorHiddenUntilMouseMoves(bool) override; |
79 | void didChangeViewportProperties(const WebCore::ViewportAttributes&) override; |
80 | void registerEditCommand(Ref<WebEditCommandProxy>&&, UndoOrRedo) override; |
81 | void clearAllEditCommands() override; |
82 | bool canUndoRedo(UndoOrRedo) override; |
83 | void executeUndoRedo(UndoOrRedo) override; |
84 | WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&) override; |
85 | WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&) override; |
86 | WebCore::IntPoint screenToRootView(const WebCore::IntPoint&) override; |
87 | WebCore::IntRect rootViewToScreen(const WebCore::IntRect&) override; |
88 | WebCore::IntPoint accessibilityScreenToRootView(const WebCore::IntPoint&) override; |
89 | WebCore::IntRect rootViewToAccessibilityScreen(const WebCore::IntRect&) override; |
90 | void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled) override; |
91 | RefPtr<WebPopupMenuProxy> (WebPageProxy&) override; |
92 | Ref<WebContextMenuProxy> (WebPageProxy&, ContextMenuContextData&&, const UserData&) override; |
93 | #if ENABLE(INPUT_TYPE_COLOR) |
94 | RefPtr<WebColorPicker> createColorPicker(WebPageProxy*, const WebCore::Color& initialColor, const WebCore::IntRect&, Vector<WebCore::Color>&&) override; |
95 | #endif |
96 | void selectionDidChange() override; |
97 | RefPtr<ViewSnapshot> takeViewSnapshot() override; |
98 | #if ENABLE(DRAG_SUPPORT) |
99 | void startDrag(Ref<WebCore::SelectionData>&&, WebCore::DragOperation, RefPtr<ShareableBitmap>&& dragImage) override; |
100 | #endif |
101 | |
102 | void enterAcceleratedCompositingMode(const LayerTreeContext&) override; |
103 | void exitAcceleratedCompositingMode() override; |
104 | void updateAcceleratedCompositingMode(const LayerTreeContext&) override; |
105 | |
106 | void handleDownloadRequest(DownloadProxy&) override; |
107 | void didChangeContentSize(const WebCore::IntSize&) override; |
108 | void didCommitLoadForMainFrame(const String& mimeType, bool useCustomContentProvider) override; |
109 | void didFailLoadForMainFrame() override; |
110 | |
111 | // Auxiliary Client Creation |
112 | #if ENABLE(FULLSCREEN_API) |
113 | WebFullScreenManagerProxyClient& fullScreenManagerProxyClient() final; |
114 | #endif |
115 | |
116 | #if ENABLE(FULLSCREEN_API) |
117 | // WebFullScreenManagerProxyClient |
118 | void closeFullScreenManager() override; |
119 | bool isFullScreen() override; |
120 | void enterFullScreen() override; |
121 | void exitFullScreen() override; |
122 | void beganEnterFullScreen(const WebCore::IntRect& initialFrame, const WebCore::IntRect& finalFrame) override; |
123 | void beganExitFullScreen(const WebCore::IntRect& initialFrame, const WebCore::IntRect& finalFrame) override; |
124 | #endif |
125 | |
126 | void didFinishLoadingDataForCustomContentProvider(const String& suggestedFilename, const IPC::DataReference&) override; |
127 | |
128 | void navigationGestureDidBegin() override; |
129 | void navigationGestureWillEnd(bool, WebBackForwardListItem&) override; |
130 | void navigationGestureDidEnd(bool, WebBackForwardListItem&) override; |
131 | void navigationGestureDidEnd() override; |
132 | void willRecordNavigationSnapshot(WebBackForwardListItem&) override; |
133 | void didRemoveNavigationGestureSnapshot() override; |
134 | |
135 | void didStartProvisionalLoadForMainFrame() override; |
136 | void didFirstVisuallyNonEmptyLayoutForMainFrame() override; |
137 | void didFinishLoadForMainFrame() override; |
138 | void didSameDocumentNavigationForMainFrame(SameDocumentNavigationType) override; |
139 | |
140 | #if ENABLE(TOUCH_EVENTS) |
141 | void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled) override; |
142 | #endif |
143 | |
144 | void wheelEventWasNotHandledByWebCore(const NativeWebWheelEvent&) override; |
145 | |
146 | void didChangeBackgroundColor() override; |
147 | |
148 | void refView() override; |
149 | void derefView() override; |
150 | |
151 | void didRestoreScrollPosition() override; |
152 | void isPlayingAudioWillChange() final { } |
153 | void isPlayingAudioDidChange() final { } |
154 | |
155 | void didFinishProcessingAllPendingMouseEvents() final { } |
156 | |
157 | void requestDOMPasteAccess(const WebCore::IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&) final; |
158 | |
159 | #if ENABLE(VIDEO) && USE(GSTREAMER) |
160 | bool decidePolicyForInstallMissingMediaPluginsPermissionRequest(InstallMissingMediaPluginsPermissionRequest&) override; |
161 | #endif |
162 | |
163 | WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() override { return WebCore::UserInterfaceLayoutDirection::LTR; } |
164 | |
165 | bool effectiveAppearanceIsDark() const override; |
166 | |
167 | #if USE(WPE_RENDERER) |
168 | IPC::Attachment hostFileDescriptor() override; |
169 | #endif |
170 | |
171 | // Members of PageClientImpl class |
172 | GtkWidget* m_viewWidget; |
173 | DefaultUndoController m_undoController; |
174 | }; |
175 | |
176 | } // namespace WebKit |
177 | |