forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPageClientImplMac.h
More file actions
307 lines (240 loc) · 13.4 KB
/
PageClientImplMac.h
File metadata and controls
307 lines (240 loc) · 13.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
/*
* Copyright (C) 2010, 2011, 2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#if PLATFORM(MAC)
#include "CorrectionPanel.h"
#include "PageClientImplCocoa.h"
#include "WebFullScreenManagerProxy.h"
#include <WebCore/DOMPasteAccess.h>
#include <wtf/CompletionHandler.h>
#include <wtf/Forward.h>
@class WKEditorUndoTarget;
@class WKView;
namespace WebCore {
class AlternativeTextUIController;
struct DragItem;
struct PromisedAttachmentInfo;
}
namespace WebKit {
class WebViewImpl;
class PageClientImpl final : public PageClientImplCocoa
#if ENABLE(FULLSCREEN_API)
, public WebFullScreenManagerProxyClient
#endif
{
public:
PageClientImpl(NSView *, WKWebView *);
virtual ~PageClientImpl();
// FIXME: Eventually WebViewImpl should become the PageClient.
void setImpl(WebViewImpl&);
void viewWillMoveToAnotherWindow();
private:
// PageClient
std::unique_ptr<DrawingAreaProxy> createDrawingAreaProxy(WebProcessProxy&) override;
void setViewNeedsDisplay(const WebCore::Region&) override;
void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin) override;
WebCore::FloatPoint viewScrollPosition() override;
WebCore::IntSize viewSize() override;
bool isViewWindowActive() override;
bool isViewFocused() override;
bool isViewVisible() override;
bool isViewVisibleOrOccluded() override;
bool isViewInWindow() override;
bool isVisuallyIdle() override;
LayerHostingMode viewLayerHostingMode() override;
WebCore::DestinationColorSpace colorSpace() override;
void setRemoteLayerTreeRootNode(RemoteLayerTreeNode*) override;
CALayer *acceleratedCompositingRootLayer() const override;
void processDidExit() override;
void processWillSwap() override;
void pageClosed() override;
void didRelaunchProcess() override;
void preferencesDidChange() override;
void toolTipChanged(const String& oldToolTip, const String& newToolTip) override;
void didCommitLoadForMainFrame(const String& mimeType, bool useCustomContentProvider) override;
void didFinishLoadingDataForCustomContentProvider(const String& suggestedFilename, const IPC::DataReference&) override;
void handleDownloadRequest(DownloadProxy&) override;
void didChangeContentSize(const WebCore::IntSize&) override;
void setCursor(const WebCore::Cursor&) override;
void setCursorHiddenUntilMouseMoves(bool) override;
void didChangeViewportProperties(const WebCore::ViewportAttributes&) override;
void registerEditCommand(Ref<WebEditCommandProxy>&&, UndoOrRedo) override;
void clearAllEditCommands() override;
bool canUndoRedo(UndoOrRedo) override;
void executeUndoRedo(UndoOrRedo) override;
bool executeSavedCommandBySelector(const String& selector) override;
void startDrag(const WebCore::DragItem&, const ShareableBitmap::Handle& image) override;
void setPromisedDataForImage(const String& pasteboardName, Ref<WebCore::SharedBuffer>&& imageBuffer, const String& filename, const String& extension, const String& title,
const String& url, const String& visibleURL, RefPtr<WebCore::SharedBuffer>&& archiveBuffer, const String& originIdentifier) override;
void updateSecureInputState() override;
void resetSecureInputState() override;
void notifyInputContextAboutDiscardedComposition() override;
void selectionDidChange() override;
void showSafeBrowsingWarning(const SafeBrowsingWarning&, CompletionHandler<void(Variant<WebKit::ContinueUnsafeLoad, URL>&&)>&&) override;
void clearSafeBrowsingWarning() override;
void clearSafeBrowsingWarningIfForMainFrameNavigation() override;
bool hasSafeBrowsingWarning() const override;
bool showShareSheet(const WebCore::ShareDataWithParsedURL&, WTF::CompletionHandler<void(bool)>&&) override;
WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&) override;
WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&) override;
WebCore::IntPoint screenToRootView(const WebCore::IntPoint&) override;
WebCore::IntRect rootViewToScreen(const WebCore::IntRect&) override;
#if PLATFORM(MAC)
WebCore::IntRect rootViewToWindow(const WebCore::IntRect&) override;
#endif
WebCore::IntPoint accessibilityScreenToRootView(const WebCore::IntPoint&) override;
WebCore::IntRect rootViewToAccessibilityScreen(const WebCore::IntRect&) override;
void pinnedStateWillChange() final;
void pinnedStateDidChange() final;
CGRect boundsOfLayerInLayerBackedWindowCoordinates(CALayer *) const override;
void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled) override;
#if ENABLE(IMAGE_ANALYSIS)
void requestTextRecognition(const URL& imageURL, const ShareableBitmap::Handle& imageData, CompletionHandler<void(WebCore::TextRecognitionResult&&)>&&) override;
void computeHasImageAnalysisResults(const URL&, ShareableBitmap&, ImageAnalysisType, CompletionHandler<void(bool)>&&) override;
#endif
RefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy&) override;
#if ENABLE(CONTEXT_MENUS)
Ref<WebContextMenuProxy> createContextMenuProxy(WebPageProxy&, ContextMenuContextData&&, const UserData&) override;
void didShowContextMenu() override;
void didDismissContextMenu() override;
#endif
#if ENABLE(INPUT_TYPE_COLOR)
RefPtr<WebColorPicker> createColorPicker(WebPageProxy*, const WebCore::Color& initialColor, const WebCore::IntRect&, Vector<WebCore::Color>&&) override;
#endif
#if ENABLE(DATALIST_ELEMENT)
RefPtr<WebDataListSuggestionsDropdown> createDataListSuggestionsDropdown(WebPageProxy&) override;
#endif
#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
RefPtr<WebDateTimePicker> createDateTimePicker(WebPageProxy&) override;
#endif
Ref<WebCore::ValidationBubble> createValidationBubble(const String& message, const WebCore::ValidationBubble::Settings&) final;
void setTextIndicator(Ref<WebCore::TextIndicator>, WebCore::TextIndicatorLifetime) override;
void clearTextIndicator(WebCore::TextIndicatorDismissalAnimation) override;
void setTextIndicatorAnimationProgress(float) override;
void enterAcceleratedCompositingMode(const LayerTreeContext&) override;
void exitAcceleratedCompositingMode() override;
void updateAcceleratedCompositingMode(const LayerTreeContext&) override;
void didFirstLayerFlush(const LayerTreeContext&) override;
RefPtr<ViewSnapshot> takeViewSnapshot(std::optional<WebCore::IntRect>&&) override;
void wheelEventWasNotHandledByWebCore(const NativeWebWheelEvent&) override;
#if ENABLE(MAC_GESTURE_EVENTS)
void gestureEventWasNotHandledByWebCore(const NativeWebGestureEvent&) override;
#endif
void accessibilityWebProcessTokenReceived(const IPC::DataReference&) override;
void pluginFocusOrWindowFocusChanged(uint64_t pluginComplexTextInputIdentifier, bool pluginHasFocusAndWindowHasFocus) override;
void setPluginComplexTextInputState(uint64_t pluginComplexTextInputIdentifier, PluginComplexTextInputState) override;
void makeFirstResponder() override;
void assistiveTechnologyMakeFirstResponder() override;
void setShouldSuppressFirstResponderChanges(bool shouldSuppress) override { m_shouldSuppressFirstResponderChanges = shouldSuppress; }
void didPerformDictionaryLookup(const WebCore::DictionaryPopupInfo&) override;
void showCorrectionPanel(WebCore::AlternativeTextType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings) override;
void dismissCorrectionPanel(WebCore::ReasonForDismissingAlternativeText) override;
String dismissCorrectionPanelSoon(WebCore::ReasonForDismissingAlternativeText) override;
void recordAutocorrectionResponse(WebCore::AutocorrectionResponse, const String& replacedString, const String& replacementString) override;
void recommendedScrollbarStyleDidChange(WebCore::ScrollbarStyle) override;
void intrinsicContentSizeDidChange(const WebCore::IntSize& intrinsicContentSize) override;
void showDictationAlternativeUI(const WebCore::FloatRect& boundingBoxOfDictatedText, WebCore::DictationContext) final;
void setEditableElementIsFocused(bool) override;
void registerInsertionUndoGrouping() override;
#if ENABLE(UI_PROCESS_PDF_HUD)
void createPDFHUD(PDFPluginIdentifier, const WebCore::IntRect&) override;
void updatePDFHUDLocation(PDFPluginIdentifier, const WebCore::IntRect&) override;
void removePDFHUD(PDFPluginIdentifier) override;
void removeAllPDFHUDs() override;
#endif
// Auxiliary Client Creation
#if ENABLE(FULLSCREEN_API)
WebFullScreenManagerProxyClient& fullScreenManagerProxyClient() override;
#endif
#if ENABLE(FULLSCREEN_API)
// WebFullScreenManagerProxyClient
void closeFullScreenManager() override;
bool isFullScreen() override;
void enterFullScreen() override;
void exitFullScreen() override;
void beganEnterFullScreen(const WebCore::IntRect& initialFrame, const WebCore::IntRect& finalFrame) override;
void beganExitFullScreen(const WebCore::IntRect& initialFrame, const WebCore::IntRect& finalFrame) override;
#endif
void navigationGestureDidBegin() override;
void navigationGestureWillEnd(bool willNavigate, WebBackForwardListItem&) override;
void navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem&) override;
void navigationGestureDidEnd() override;
void willRecordNavigationSnapshot(WebBackForwardListItem&) override;
void didRemoveNavigationGestureSnapshot() override;
void requestDOMPasteAccess(const WebCore::IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&) final;
void makeViewBlank(bool) final;
NSView *activeView() const;
NSWindow *activeWindow() const;
void didStartProvisionalLoadForMainFrame() override;
void didFirstVisuallyNonEmptyLayoutForMainFrame() override;
void didFinishNavigation(API::Navigation*) override;
void didFailNavigation(API::Navigation*) override;
void didSameDocumentNavigationForMainFrame(SameDocumentNavigationType) override;
void handleControlledElementIDResponse(const String&) override;
void didPerformImmediateActionHitTest(const WebHitTestResultData&, bool contentPreventsDefault, API::Object*) override;
NSObject *immediateActionAnimationControllerForHitTestResult(RefPtr<API::HitTestResult>, uint64_t, RefPtr<API::Object>) override;
void didHandleAcceptedCandidate() override;
void videoControlsManagerDidChange() override;
void showPlatformContextMenu(NSMenu *, WebCore::IntPoint) override;
void didChangeBackgroundColor() override;
void startWindowDrag() override;
NSWindow *platformWindow() override;
WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() override;
bool effectiveAppearanceIsDark() const override;
bool effectiveUserInterfaceLevelIsElevated() const override;
#if ENABLE(DRAG_SUPPORT)
void didPerformDragOperation(bool handled) final;
#endif
NSView *inspectorAttachmentView() override;
_WKRemoteObjectRegistry *remoteObjectRegistry() override;
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
WebCore::WebMediaSessionManager& mediaSessionManager() override;
#endif
void refView() override;
void derefView() override;
void pageDidScroll(const WebCore::IntPoint&) override;
void didRestoreScrollPosition() override;
bool windowIsFrontWindowUnderMouse(const NativeWebMouseEvent&) override;
void takeFocus(WebCore::FocusDirection) override;
#if HAVE(APP_ACCENT_COLORS)
WebCore::Color accentColor() override;
#endif
#if HAVE(TRANSLATION_UI_SERVICES) && ENABLE(CONTEXT_MENUS)
bool canHandleContextMenuTranslation() const override;
void handleContextMenuTranslation(const WebCore::TranslationContextMenuInfo&) override;
#endif
#if ENABLE(DATA_DETECTION)
void handleClickForDataDetectionResult(const WebCore::DataDetectorElementInfo&, const WebCore::IntPoint&) final;
#endif
void requestScrollToRect(const WebCore::FloatRect& targetRect, const WebCore::FloatPoint& origin) override;
NSView *m_view;
WeakPtr<WebViewImpl> m_impl;
#if USE(AUTOCORRECTION_PANEL)
CorrectionPanel m_correctionPanel;
#endif
bool m_shouldSuppressFirstResponderChanges { false };
};
} // namespace WebKit
#endif // PLATFORM(MAC)