Reduce PassRefPtr in WebKit2 - 3
[WebKit-https.git] / Source / WebKit2 / UIProcess / WebPageProxy.h
1 /*
2  * Copyright (C) 2010, 2011, 2014-2015 Apple Inc. All rights reserved.
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 #ifndef WebPageProxy_h
27 #define WebPageProxy_h
28
29 #include "APIObject.h"
30 #include "APISession.h"
31 #include "AssistedNodeInformation.h"
32 #include "AutoCorrectionCallback.h"
33 #include "Connection.h"
34 #include "ContextMenuContextData.h"
35 #include "DragControllerAction.h"
36 #include "DrawingAreaProxy.h"
37 #include "EditingRange.h"
38 #include "EditorState.h"
39 #include "GeolocationPermissionRequestManagerProxy.h"
40 #include "InteractionInformationAtPosition.h"
41 #include "LayerTreeContext.h"
42 #include "MessageSender.h"
43 #include "NotificationPermissionRequestManagerProxy.h"
44 #include "PageLoadState.h"
45 #include "PlatformProcessIdentifier.h"
46 #include "ProcessThrottler.h"
47 #include "SandboxExtension.h"
48 #include "ShareableBitmap.h"
49 #include "UserMediaPermissionRequestManagerProxy.h"
50 #include "VisibleContentRectUpdateInfo.h"
51 #include "WKBase.h"
52 #include "WKPagePrivate.h"
53 #include "WebColorPicker.h"
54 #include "WebContextMenuItemData.h"
55 #include "WebCoreArgumentCoders.h"
56 #include "WebFindClient.h"
57 #include "WebFrameProxy.h"
58 #include "WebPageCreationParameters.h"
59 #include "WebPageDiagnosticLoggingClient.h"
60 #include "WebPageInjectedBundleClient.h"
61 #include "WebPreferences.h"
62 #include <WebCore/AlternativeTextClient.h> // FIXME: Needed by WebPageProxyMessages.h for DICTATION_ALTERNATIVES.
63 #include "WebPageProxyMessages.h"
64 #include "WebPopupMenuProxy.h"
65 #include "WebProcessLifetimeTracker.h"
66 #include <WebCore/Color.h>
67 #include <WebCore/DragActions.h>
68 #include <WebCore/FrameLoaderTypes.h>
69 #include <WebCore/HitTestResult.h>
70 #include <WebCore/MediaProducer.h>
71 #include <WebCore/Page.h>
72 #include <WebCore/PlatformScreen.h>
73 #include <WebCore/ScrollTypes.h>
74 #include <WebCore/TextChecking.h>
75 #include <WebCore/TextGranularity.h>
76 #include <WebCore/ViewState.h>
77 #include <WebCore/VisibleSelection.h>
78 #include <memory>
79 #include <wtf/HashMap.h>
80 #include <wtf/HashSet.h>
81 #include <wtf/PassRefPtr.h>
82 #include <wtf/Ref.h>
83 #include <wtf/RefPtr.h>
84 #include <wtf/Vector.h>
85 #include <wtf/text/WTFString.h>
86
87 #if ENABLE(DRAG_SUPPORT)
88 #include <WebCore/DragActions.h>
89 #endif
90
91 #if ENABLE(TOUCH_EVENTS)
92 #include "NativeWebTouchEvent.h"
93 #endif
94
95 #if PLATFORM(EFL)
96 #include "WKPageEfl.h"
97 #include "WebUIPopupMenuClient.h"
98 #include <Evas.h>
99 #endif
100
101 #if PLATFORM(COCOA)
102 #include "LayerRepresentation.h"
103 #endif
104
105 #if PLATFORM(MAC)
106 #include "AttributedString.h"
107 #endif
108
109 #if PLATFORM(IOS)
110 #include "ProcessThrottler.h"
111 #endif
112
113 #if PLATFORM(GTK)
114 #include "ArgumentCodersGtk.h"
115 #endif
116
117 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
118 #include <WebCore/MediaPlaybackTargetPicker.h>
119 #include <WebCore/WebMediaSessionManagerClient.h>
120 #endif
121
122 #if ENABLE(MEDIA_SESSION)
123 namespace WebCore {
124 struct MediaSessionMetadata;
125 }
126 #endif
127
128 namespace API {
129 class ContextMenuClient;
130 class FindClient;
131 class FormClient;
132 class HistoryClient;
133 class LoaderClient;
134 class Navigation;
135 class NavigationClient;
136 class PolicyClient;
137 class UIClient;
138 class URLRequest;
139 }
140
141 namespace IPC {
142 class ArgumentDecoder;
143 class Connection;
144 }
145
146 namespace WebCore {
147 class AuthenticationChallenge;
148 class Cursor;
149 class DragData;
150 class FloatRect;
151 class GraphicsLayer;
152 class IntSize;
153 class MediaConstraintsImpl;
154 class ProtectionSpace;
155 class RunLoopObserver;
156 class SharedBuffer;
157 class TextIndicator;
158 struct FileChooserSettings;
159 struct TextAlternativeWithRange;
160 struct TextCheckingResult;
161 struct ViewportAttributes;
162 struct WindowFeatures;
163 }
164
165 #if USE(APPKIT)
166 OBJC_CLASS WKView;
167 #endif
168
169 #if PLATFORM(GTK)
170 typedef GtkWidget* PlatformWidget;
171 #endif
172
173 namespace WebKit {
174
175 class CertificateInfo;
176 class NativeWebKeyboardEvent;
177 class NativeWebMouseEvent;
178 class NativeWebWheelEvent;
179 class PageClient;
180 class RemoteLayerTreeScrollingPerformanceData;
181 class RemoteLayerTreeTransaction;
182 class RemoteScrollingCoordinatorProxy;
183 class StringPairVector;
184 class UserData;
185 class ViewSnapshot;
186 class VisitedLinkProvider;
187 class WebBackForwardList;
188 class WebBackForwardListItem;
189 class WebContextMenuProxy;
190 class WebEditCommandProxy;
191 class WebFullScreenManagerProxy;
192 class WebNavigationState;
193 class WebVideoFullscreenManagerProxy;
194 class WebKeyboardEvent;
195 class WebMouseEvent;
196 class WebOpenPanelResultListenerProxy;
197 class WebPageGroup;
198 class WebProcessProxy;
199 class WebUserContentControllerProxy;
200 class WebWheelEvent;
201 class WebsiteDataStore;
202 struct AttributedString;
203 struct ColorSpaceData;
204 struct DictionaryPopupInfo;
205 struct EditingRange;
206 struct EditorState;
207 struct PlatformPopupMenuData;
208 struct PrintInfo;
209 struct SecurityOriginData;
210 struct WebPopupItem;
211
212 #if ENABLE(VIBRATION)
213 class WebVibrationProxy;
214 #endif
215
216 #if USE(QUICK_LOOK)
217 class QuickLookDocumentData;
218 #endif
219
220 typedef GenericCallback<uint64_t> UnsignedCallback;
221 typedef GenericCallback<EditingRange> EditingRangeCallback;
222 typedef GenericCallback<const String&> StringCallback;
223 typedef GenericCallback<API::SerializedScriptValue*, bool> ScriptValueCallback;
224
225 #if PLATFORM(GTK)
226 typedef GenericCallback<API::Error*> PrintFinishedCallback;
227 #endif
228
229 #if ENABLE(TOUCH_EVENTS)
230 struct QueuedTouchEvents {
231     QueuedTouchEvents(const NativeWebTouchEvent& event)
232         : forwardedEvent(event)
233     {
234     }
235     NativeWebTouchEvent forwardedEvent;
236     Vector<NativeWebTouchEvent> deferredTouchEvents;
237 };
238 #endif
239
240 typedef GenericCallback<const String&, bool, int32_t> ValidateCommandCallback;
241 typedef GenericCallback<const WebCore::IntRect&, const EditingRange&> RectForCharacterRangeCallback;
242
243 #if PLATFORM(MAC)
244 typedef GenericCallback<const AttributedString&, const EditingRange&> AttributedStringForCharacterRangeCallback;
245 typedef GenericCallback<const String&, double, bool> FontAtSelectionCallback;
246 #endif
247
248 #if PLATFORM(IOS)
249 typedef GenericCallback<const WebCore::IntPoint&, uint32_t, uint32_t, uint32_t> GestureCallback;
250 typedef GenericCallback<const WebCore::IntPoint&, uint32_t> TouchesCallback;
251 #endif
252
253 #if PLATFORM(COCOA)
254 typedef GenericCallback<const WebCore::MachSendRight&> MachSendRightCallback;
255 #endif
256
257 struct WebPageConfiguration {
258     WebPageGroup* pageGroup = nullptr;
259     WebPreferences* preferences = nullptr;
260     WebUserContentControllerProxy* userContentController = nullptr;
261     VisitedLinkProvider* visitedLinkProvider = nullptr;
262
263     WebsiteDataStore* websiteDataStore = nullptr;
264     // FIXME: We currently have to pass the session ID separately here to support the legacy private browsing session.
265     // Once we get rid of it we should get rid of this configuration parameter as well.
266     WebCore::SessionID sessionID;
267
268     WebPageProxy* relatedPage = nullptr;
269
270     bool treatsSHA1SignedCertificatesAsInsecure = false;
271
272 #if PLATFORM(IOS)
273     bool alwaysRunsAtForegroundPriority = false;
274 #endif
275
276     WebPreferencesStore::ValueMap preferenceValues;
277 };
278
279 class WebPageProxy : public API::ObjectImpl<API::Object::Type::Page>
280 #if ENABLE(INPUT_TYPE_COLOR)
281     , public WebColorPicker::Client
282 #endif
283 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
284     , public WebCore::WebMediaSessionManagerClient
285 #endif
286     , public WebPopupMenuProxy::Client
287     , public IPC::MessageReceiver
288     , public IPC::MessageSender {
289 public:
290     static Ref<WebPageProxy> create(PageClient&, WebProcessProxy&, uint64_t pageID, const WebPageConfiguration&);
291     virtual ~WebPageProxy();
292
293     uint64_t pageID() const { return m_pageID; }
294     WebCore::SessionID sessionID() const { return m_sessionID; }
295     void setSessionID(WebCore::SessionID);
296
297     WebFrameProxy* mainFrame() const { return m_mainFrame.get(); }
298     WebFrameProxy* focusedFrame() const { return m_focusedFrame.get(); }
299     WebFrameProxy* frameSetLargestFrame() const { return m_frameSetLargestFrame.get(); }
300
301     DrawingAreaProxy* drawingArea() const { return m_drawingArea.get(); }
302
303     WebNavigationState& navigationState() { return *m_navigationState.get(); }
304
305     WebsiteDataStore& websiteDataStore() { return m_websiteDataStore; }
306
307 #if ENABLE(ASYNC_SCROLLING)
308     RemoteScrollingCoordinatorProxy* scrollingCoordinatorProxy() const { return m_scrollingCoordinatorProxy.get(); }
309 #endif
310
311     WebBackForwardList& backForwardList() { return m_backForwardList; }
312
313     bool addsVisitedLinks() const { return m_addsVisitedLinks; }
314     void setAddsVisitedLinks(bool addsVisitedLinks) { m_addsVisitedLinks = addsVisitedLinks; }
315
316     void fullscreenMayReturnToInline();
317     void didEnterFullscreen();
318     void didExitFullscreen();
319
320     WebInspectorProxy* inspector();
321
322 #if ENABLE(REMOTE_INSPECTOR)
323     bool allowsRemoteInspection() const { return m_allowsRemoteInspection; }
324     void setAllowsRemoteInspection(bool);
325 #endif
326
327 #if ENABLE(VIBRATION)
328     WebVibrationProxy* vibration() { return m_vibration.get(); }
329 #endif
330
331 #if ENABLE(FULLSCREEN_API)
332     WebFullScreenManagerProxy* fullScreenManager();
333 #endif
334 #if PLATFORM(IOS)
335     RefPtr<WebVideoFullscreenManagerProxy> videoFullscreenManager();
336 #endif
337
338 #if ENABLE(CONTEXT_MENUS)
339     void setContextMenuClient(std::unique_ptr<API::ContextMenuClient>);
340 #endif
341     API::FindClient& findClient() { return *m_findClient; }
342     void setFindClient(std::unique_ptr<API::FindClient>);
343     API::DiagnosticLoggingClient& diagnosticLoggingClient() { return *m_diagnosticLoggingClient; }
344     void setDiagnosticLoggingClient(std::unique_ptr<API::DiagnosticLoggingClient>);
345     void initializeFindMatchesClient(const WKPageFindMatchesClientBase*);
346     void setFormClient(std::unique_ptr<API::FormClient>);
347     void setNavigationClient(std::unique_ptr<API::NavigationClient>);
348     void setHistoryClient(std::unique_ptr<API::HistoryClient>);
349     void setLoaderClient(std::unique_ptr<API::LoaderClient>);
350     void setPolicyClient(std::unique_ptr<API::PolicyClient>);
351     void setInjectedBundleClient(const WKPageInjectedBundleClientBase*);
352     WebPageInjectedBundleClient* injectedBundleClient() { return m_injectedBundleClient.get(); }
353
354     API::UIClient& uiClient() { return *m_uiClient; }
355     void setUIClient(std::unique_ptr<API::UIClient>);
356 #if PLATFORM(EFL)
357     void initializeUIPopupMenuClient(const WKPageUIPopupMenuClientBase*);
358 #endif
359
360     void initializeWebPage();
361
362     void close();
363     bool tryClose();
364     bool isClosed() const { return m_isClosed; }
365
366     RefPtr<API::Navigation> loadRequest(const WebCore::ResourceRequest&, WebCore::ShouldOpenExternalURLsPolicy = WebCore::ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemes, API::Object* userData = nullptr);
367     RefPtr<API::Navigation> loadFile(const String& fileURL, const String& resourceDirectoryURL, API::Object* userData = nullptr);
368     RefPtr<API::Navigation> loadData(API::Data*, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData = nullptr);
369     RefPtr<API::Navigation> loadHTMLString(const String& htmlString, const String& baseURL, API::Object* userData = nullptr);
370     void loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL, API::Object* userData = nullptr);
371     void loadPlainTextString(const String&, API::Object* userData = nullptr);
372     void loadWebArchiveData(API::Data*, API::Object* userData = nullptr);
373     void navigateToPDFLinkWithSimulatedClick(const String& url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint);
374
375     void stopLoading();
376     RefPtr<API::Navigation> reload(bool reloadFromOrigin);
377
378     RefPtr<API::Navigation> goForward();
379     RefPtr<API::Navigation> goBack();
380
381     RefPtr<API::Navigation> goToBackForwardItem(WebBackForwardListItem*);
382     void tryRestoreScrollPosition();
383     void didChangeBackForwardList(WebBackForwardListItem* addedItem, Vector<RefPtr<WebBackForwardListItem>> removed);
384     void willGoToBackForwardListItem(uint64_t itemID, const UserData&);
385
386     bool shouldKeepCurrentBackForwardListItemInList(WebBackForwardListItem*);
387
388     bool willHandleHorizontalScrollEvents() const;
389
390     bool canShowMIMEType(const String& mimeType);
391
392     bool drawsBackground() const { return m_drawsBackground; }
393     void setDrawsBackground(bool);
394
395     bool drawsTransparentBackground() const { return m_drawsTransparentBackground; }
396     void setDrawsTransparentBackground(bool);
397
398     float topContentInset() const { return m_topContentInset; }
399     void setTopContentInset(float);
400
401     WebCore::Color underlayColor() const { return m_underlayColor; }
402     void setUnderlayColor(const WebCore::Color&);
403
404     // At this time, m_pageExtendedBackgroundColor can be set via pageExtendedBackgroundColorDidChange() which is a message
405     // from the UIProcess, or by didCommitLayerTree(). When PLATFORM(MAC) adopts UI side compositing, we should get rid of
406     // the message entirely.
407     WebCore::Color pageExtendedBackgroundColor() const { return m_pageExtendedBackgroundColor; }
408
409     void viewWillStartLiveResize();
410     void viewWillEndLiveResize();
411
412     void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&, std::function<void (CallbackBase::Error)>);
413     
414     void clearSelection();
415     void restoreSelectionInFocusedEditableElement();
416
417     void setViewNeedsDisplay(const WebCore::IntRect&);
418     void displayView();
419     bool canScrollView();
420     void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset); // FIXME: CoordinatedGraphics should use requestScroll().
421     void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, bool isProgrammaticScroll);
422     
423     void setDelegatesScrolling(bool delegatesScrolling) { m_delegatesScrolling = delegatesScrolling; }
424     bool delegatesScrolling() const { return m_delegatesScrolling; }
425
426     enum class ViewStateChangeDispatchMode { Deferrable, Immediate };
427     void viewStateDidChange(WebCore::ViewState::Flags mayHaveChanged, bool wantsSynchronousReply = false, ViewStateChangeDispatchMode = ViewStateChangeDispatchMode::Deferrable);
428     bool isInWindow() const { return m_viewState & WebCore::ViewState::IsInWindow; }
429     void waitForDidUpdateViewState();
430     void didUpdateViewState() { m_waitingForDidUpdateViewState = false; }
431
432     void layerHostingModeDidChange();
433
434     WebCore::IntSize viewSize() const;
435     bool isViewVisible() const { return m_viewState & WebCore::ViewState::IsVisible; }
436     bool isViewWindowActive() const;
437
438     void addMIMETypeWithCustomContentProvider(const String& mimeType);
439
440     void executeEditCommand(const String& commandName);
441     void validateCommand(const String& commandName, std::function<void (const String&, bool, int32_t, CallbackBase::Error)>);
442
443     const EditorState& editorState() const { return m_editorState; }
444     bool canDelete() const { return hasSelectedRange() && isContentEditable(); }
445     bool hasSelectedRange() const { return m_editorState.selectionIsRange; }
446     bool isContentEditable() const { return m_editorState.isContentEditable; }
447     
448     bool maintainsInactiveSelection() const { return m_maintainsInactiveSelection; }
449     void setMaintainsInactiveSelection(bool);
450     void setEditable(bool);
451     bool isEditable() const { return m_isEditable; }
452
453 #if PLATFORM(IOS)
454     void executeEditCommand(const String& commandName, std::function<void (CallbackBase::Error)>);
455     double displayedContentScale() const { return m_lastVisibleContentRectUpdate.scale(); }
456     const WebCore::FloatRect& exposedContentRect() const { return m_lastVisibleContentRectUpdate.exposedRect(); }
457     const WebCore::FloatRect& unobscuredContentRect() const { return m_lastVisibleContentRectUpdate.unobscuredRect(); }
458
459     void updateVisibleContentRects(const WebCore::FloatRect& exposedRect, const WebCore::FloatRect& unobscuredRect, const WebCore::FloatRect& unobscuredRectInScrollViewCoordinates, const WebCore::FloatRect& customFixedPositionRect, double scale, bool inStableState, bool isChangingObscuredInsetsInteractively, double timestamp, double horizontalVelocity, double verticalVelocity, double scaleChangeRate);
460     void resendLastVisibleContentRects();
461
462     enum class UnobscuredRectConstraint { ConstrainedToDocumentRect, Unconstrained };
463     WebCore::FloatRect computeCustomFixedPositionRect(const WebCore::FloatRect& unobscuredContentRect, double displayedContentScale, UnobscuredRectConstraint = UnobscuredRectConstraint::Unconstrained) const;
464     void overflowScrollViewWillStartPanGesture();
465     void overflowScrollViewDidScroll();
466     void overflowScrollWillStartScroll();
467     void overflowScrollDidEndScroll();
468
469     void dynamicViewportSizeUpdate(const WebCore::FloatSize& minimumLayoutSize, const WebCore::FloatSize& maximumUnobscuredSize, const WebCore::FloatRect& targetExposedContentRect, const WebCore::FloatRect& targetUnobscuredRect, const WebCore::FloatRect& targetUnobscuredRectInScrollViewCoordinates, double targetScale, int32_t deviceOrientation);
470     void synchronizeDynamicViewportUpdate();
471
472     void setViewportConfigurationMinimumLayoutSize(const WebCore::FloatSize&);
473     void setMaximumUnobscuredSize(const WebCore::FloatSize&);
474     void setDeviceOrientation(int32_t);
475     int32_t deviceOrientation() const { return m_deviceOrientation; }
476     void willCommitLayerTree(uint64_t transactionID);
477
478     void selectWithGesture(const WebCore::IntPoint, WebCore::TextGranularity, uint32_t gestureType, uint32_t gestureState, std::function<void (const WebCore::IntPoint&, uint32_t, uint32_t, uint32_t, CallbackBase::Error)>);
479     void updateSelectionWithTouches(const WebCore::IntPoint, uint32_t touches, bool baseIsStart, std::function<void (const WebCore::IntPoint&, uint32_t, CallbackBase::Error)>);
480     void selectWithTwoTouches(const WebCore::IntPoint from, const WebCore::IntPoint to, uint32_t gestureType, uint32_t gestureState, std::function<void (const WebCore::IntPoint&, uint32_t, uint32_t, uint32_t, CallbackBase::Error)>);
481     void updateBlockSelectionWithTouch(const WebCore::IntPoint, uint32_t touch, uint32_t handlePosition);
482     void extendSelection(WebCore::TextGranularity);
483     void selectWordBackward();
484     void moveSelectionByOffset(int32_t offset, std::function<void (CallbackBase::Error)>);
485     void selectTextWithGranularityAtPoint(const WebCore::IntPoint, WebCore::TextGranularity, std::function<void (CallbackBase::Error)>);
486     void selectPositionAtPoint(const WebCore::IntPoint, std::function<void (CallbackBase::Error)>);
487     void selectPositionAtBoundaryWithDirection(const WebCore::IntPoint, WebCore::TextGranularity, WebCore::SelectionDirection, std::function<void (CallbackBase::Error)>);
488     void moveSelectionAtBoundaryWithDirection(WebCore::TextGranularity, WebCore::SelectionDirection, std::function<void(CallbackBase::Error)>);
489     void beginSelectionInDirection(WebCore::SelectionDirection, std::function<void (uint64_t, CallbackBase::Error)>);
490     void updateSelectionWithExtentPoint(const WebCore::IntPoint, std::function<void (uint64_t, CallbackBase::Error)>);
491     void updateSelectionWithExtentPointAndBoundary(const WebCore::IntPoint, WebCore::TextGranularity, std::function<void(uint64_t, CallbackBase::Error)>);
492     void requestAutocorrectionData(const String& textForAutocorrection, std::function<void (const Vector<WebCore::FloatRect>&, const String&, double, uint64_t, CallbackBase::Error)>);
493     void applyAutocorrection(const String& correction, const String& originalText, std::function<void (const String&, CallbackBase::Error)>);
494     bool applyAutocorrection(const String& correction, const String& originalText);
495     void requestAutocorrectionContext(std::function<void (const String&, const String&, const String&, const String&, uint64_t, uint64_t, CallbackBase::Error)>);
496     void getAutocorrectionContext(String& contextBefore, String& markedText, String& selectedText, String& contextAfter, uint64_t& location, uint64_t& length);
497     void requestDictationContext(std::function<void (const String&, const String&, const String&, CallbackBase::Error)>);
498     void replaceDictatedText(const String& oldText, const String& newText);
499     void replaceSelectedText(const String& oldText, const String& newText);
500     void didReceivePositionInformation(const InteractionInformationAtPosition&);
501     void getPositionInformation(const WebCore::IntPoint&, InteractionInformationAtPosition&);
502     void requestPositionInformation(const WebCore::IntPoint&);
503     void startInteractionWithElementAtPosition(const WebCore::IntPoint&);
504     void stopInteraction();
505     void performActionOnElement(uint32_t action);
506     void saveImageToLibrary(const SharedMemory::Handle& imageHandle, uint64_t imageSize);
507     void didUpdateBlockSelectionWithTouch(uint32_t touch, uint32_t flags, float growThreshold, float shrinkThreshold);
508     void focusNextAssistedNode(bool isForward, std::function<void (CallbackBase::Error)>);
509     void setAssistedNodeValue(const String&);
510     void setAssistedNodeValueAsNumber(double);
511     void setAssistedNodeSelectedIndex(uint32_t index, bool allowMultipleSelection = false);
512     void applicationDidEnterBackground();
513     void applicationWillEnterForeground();
514     void applicationWillResignActive();
515     void applicationDidBecomeActive();
516     void zoomToRect(WebCore::FloatRect, double minimumScale, double maximumScale);
517     void commitPotentialTapFailed();
518     void didNotHandleTapAsClick(const WebCore::IntPoint&);
519     void viewportMetaTagWidthDidChange(float width);
520     void didFinishDrawingPagesToPDF(const IPC::DataReference&);
521     void contentSizeCategoryDidChange(const String& contentSizeCategory);
522     void getLookupContextAtPoint(const WebCore::IntPoint&, std::function<void(const String&, CallbackBase::Error)>);
523 #endif
524
525     void didCommitLayerTree(const WebKit::RemoteLayerTreeTransaction&);
526
527 #if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
528     void didRenderFrame(const WebCore::IntSize& contentsSize, const WebCore::IntRect& coveredRect);
529 #endif
530 #if PLATFORM(EFL)
531     void setThemePath(const String&);
532 #endif
533
534 #if PLATFORM(GTK)
535     void setComposition(const String& text, Vector<WebCore::CompositionUnderline> underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeEnd);
536     void confirmComposition(const String& compositionString, int64_t selectionStart, int64_t selectionLength);
537     void cancelComposition();
538 #endif
539
540 #if PLATFORM(GTK)
541     void setInputMethodState(bool enabled);
542 #endif
543
544 #if PLATFORM (GTK) && HAVE(GTK_GESTURES)
545     void getCenterForZoomGesture(const WebCore::IntPoint& centerInViewCoordinates, WebCore::IntPoint& center);
546 #endif
547
548 #if PLATFORM(COCOA)
549     void windowAndViewFramesChanged(const WebCore::FloatRect& viewFrameInWindowCoordinates, const WebCore::FloatPoint& accessibilityViewCoordinates);
550     void setMainFrameIsScrollable(bool);
551
552     void sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String& textInput);
553     bool shouldDelayWindowOrderingForEvent(const WebMouseEvent&);
554     bool acceptsFirstMouse(int eventNumber, const WebMouseEvent&);
555
556     void setAcceleratedCompositingRootLayer(LayerOrView*);
557     LayerOrView* acceleratedCompositingRootLayer() const;
558
559     void insertTextAsync(const String& text, const EditingRange& replacementRange, bool registerUndoGroup = false);
560     void getMarkedRangeAsync(std::function<void (EditingRange, CallbackBase::Error)>);
561     void getSelectedRangeAsync(std::function<void (EditingRange, CallbackBase::Error)>);
562     void characterIndexForPointAsync(const WebCore::IntPoint&, std::function<void (uint64_t, CallbackBase::Error)>);
563     void firstRectForCharacterRangeAsync(const EditingRange&, std::function<void (const WebCore::IntRect&, const EditingRange&, CallbackBase::Error)>);
564     void setCompositionAsync(const String& text, Vector<WebCore::CompositionUnderline> underlines, const EditingRange& selectionRange, const EditingRange& replacementRange);
565     void confirmCompositionAsync();
566
567     void setScrollPerformanceDataCollectionEnabled(bool);
568     bool scrollPerformanceDataCollectionEnabled() const { return m_scrollPerformanceDataCollectionEnabled; }
569     RemoteLayerTreeScrollingPerformanceData* scrollingPerformanceData() { return m_scrollingPerformanceData.get(); }
570 #endif // PLATFORM(COCOA)
571
572 #if PLATFORM(MAC)
573     void insertDictatedTextAsync(const String& text, const EditingRange& replacementRange, const Vector<WebCore::TextAlternativeWithRange>& dictationAlternatives, bool registerUndoGroup);
574     void attributedSubstringForCharacterRangeAsync(const EditingRange&, std::function<void (const AttributedString&, const EditingRange&, CallbackBase::Error)>);
575     void setFont(const String& fontFamily, double fontSize, uint64_t fontTraits);
576     void fontAtSelection(std::function<void (const String&, double, bool, CallbackBase::Error)>);
577
578 #if !USE(ASYNC_NSTEXTINPUTCLIENT)
579     bool insertText(const String& text, const EditingRange& replacementRange);
580     void setComposition(const String& text, Vector<WebCore::CompositionUnderline> underlines, const EditingRange& selectionRange, const EditingRange& replacementRange);
581     void confirmComposition();
582     bool insertDictatedText(const String& text, const EditingRange& replacementRange, const Vector<WebCore::TextAlternativeWithRange>& dictationAlternatives);
583     void getAttributedSubstringFromRange(const EditingRange&, AttributedString&);
584     void getMarkedRange(EditingRange&);
585     void getSelectedRange(EditingRange&);
586     uint64_t characterIndexForPoint(const WebCore::IntPoint);
587     WebCore::IntRect firstRectForCharacterRange(const EditingRange&);
588     bool executeKeypressCommands(const Vector<WebCore::KeypressCommand>&);
589     void cancelComposition();
590 #endif // !USE(ASYNC_NSTEXTINPUTCLIENT)
591
592     WKView* wkView() const;
593     void intrinsicContentSizeDidChange(const WebCore::IntSize& intrinsicContentSize);
594     CGRect boundsOfLayerInLayerBackedWindowCoordinates(CALayer *) const;
595 #endif // PLATFORM(MAC)
596
597 #if PLATFORM(EFL)
598     void handleInputMethodKeydown(bool& handled);
599     void confirmComposition(const String&);
600     void setComposition(const String&, Vector<WebCore::CompositionUnderline>&, int);
601     void cancelComposition();
602 #endif
603
604 #if PLATFORM(GTK)
605     PlatformWidget viewWidget();
606     const WebCore::Color& backgroundColor() const { return m_backgroundColor; }
607     void setBackgroundColor(const WebCore::Color& color) { m_backgroundColor = color; }
608 #endif
609
610 #if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
611     void commitPageTransitionViewport();
612 #endif
613
614     void handleMouseEvent(const NativeWebMouseEvent&);
615     void handleWheelEvent(const NativeWebWheelEvent&);
616     void handleKeyboardEvent(const NativeWebKeyboardEvent&);
617
618 #if ENABLE(IOS_TOUCH_EVENTS)
619     void handleTouchEventSynchronously(const NativeWebTouchEvent&);
620     void handleTouchEventAsynchronously(const NativeWebTouchEvent&);
621
622 #elif ENABLE(TOUCH_EVENTS)
623     void handleTouchEvent(const NativeWebTouchEvent&);
624 #endif
625
626     void scrollBy(WebCore::ScrollDirection, WebCore::ScrollGranularity);
627     void centerSelectionInVisibleArea();
628
629     const String& toolTip() const { return m_toolTip; }
630
631     const String& userAgent() const { return m_userAgent; }
632     void setApplicationNameForUserAgent(const String&);
633     const String& applicationNameForUserAgent() const { return m_applicationNameForUserAgent; }
634     void setCustomUserAgent(const String&);
635     const String& customUserAgent() const { return m_customUserAgent; }
636     static String standardUserAgent(const String& applicationName = String());
637
638     bool supportsTextEncoding() const;
639     void setCustomTextEncodingName(const String&);
640     String customTextEncodingName() const { return m_customTextEncodingName; }
641
642     bool areActiveDOMObjectsAndAnimationsSuspended() const { return m_isPageSuspended; }
643     void resumeActiveDOMObjectsAndAnimations();
644     void suspendActiveDOMObjectsAndAnimations();
645
646     double estimatedProgress() const;
647
648     void terminateProcess();
649
650     SessionState sessionState(const std::function<bool (WebBackForwardListItem&)>& = nullptr) const;
651     RefPtr<API::Navigation> restoreFromSessionState(SessionState, bool navigate);
652
653     bool supportsTextZoom() const;
654     double textZoomFactor() const { return m_textZoomFactor; }
655     void setTextZoomFactor(double);
656     double pageZoomFactor() const;
657     void setPageZoomFactor(double);
658     void setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor);
659
660     void scalePage(double scale, const WebCore::IntPoint& origin);
661     void scalePageInViewCoordinates(double scale, const WebCore::IntPoint& centerInViewCoordinates);
662     double pageScaleFactor() const;
663     double viewScaleFactor() const { return m_viewScaleFactor; }
664     void scaleView(double scale);
665 #if PLATFORM(COCOA)
666     void scaleViewAndUpdateGeometryFenced(double scale, WebCore::IntSize viewSize, std::function<void (const WebCore::MachSendRight&, CallbackBase::Error)>);
667 #endif
668     void setShouldScaleViewToFitDocument(bool);
669     
670     bool userContentExtensionsEnabled() { return m_userContentExtensionsEnabled; }
671     void setUserContentExtensionsEnabled(bool);
672
673     float deviceScaleFactor() const;
674     void setIntrinsicDeviceScaleFactor(float);
675     void setCustomDeviceScaleFactor(float);
676     void windowScreenDidChange(PlatformDisplayID);
677
678     void setUseFixedLayout(bool);
679     void setFixedLayoutSize(const WebCore::IntSize&);
680     bool useFixedLayout() const { return m_useFixedLayout; };
681     const WebCore::IntSize& fixedLayoutSize() const { return m_fixedLayoutSize; };
682
683     void listenForLayoutMilestones(WebCore::LayoutMilestones);
684
685     bool hasHorizontalScrollbar() const { return m_mainFrameHasHorizontalScrollbar; }
686     bool hasVerticalScrollbar() const { return m_mainFrameHasVerticalScrollbar; }
687
688     void setSuppressScrollbarAnimations(bool);
689     bool areScrollbarAnimationsSuppressed() const { return m_suppressScrollbarAnimations; }
690
691     bool isPinnedToLeftSide() const { return m_mainFrameIsPinnedToLeftSide; }
692     bool isPinnedToRightSide() const { return m_mainFrameIsPinnedToRightSide; }
693     bool isPinnedToTopSide() const { return m_mainFrameIsPinnedToTopSide; }
694     bool isPinnedToBottomSide() const { return m_mainFrameIsPinnedToBottomSide; }
695
696     bool rubberBandsAtLeft() const;
697     void setRubberBandsAtLeft(bool);
698     bool rubberBandsAtRight() const;
699     void setRubberBandsAtRight(bool);
700     bool rubberBandsAtTop() const;
701     void setRubberBandsAtTop(bool);
702     bool rubberBandsAtBottom() const;
703     void setRubberBandsAtBottom(bool);
704
705     void setShouldUseImplicitRubberBandControl(bool shouldUseImplicitRubberBandControl) { m_shouldUseImplicitRubberBandControl = shouldUseImplicitRubberBandControl; }
706     bool shouldUseImplicitRubberBandControl() const { return m_shouldUseImplicitRubberBandControl; }
707         
708     void setEnableVerticalRubberBanding(bool);
709     bool verticalRubberBandingIsEnabled() const;
710     void setEnableHorizontalRubberBanding(bool);
711     bool horizontalRubberBandingIsEnabled() const;
712         
713     void setBackgroundExtendsBeyondPage(bool);
714     bool backgroundExtendsBeyondPage() const;
715
716     void setPaginationMode(WebCore::Pagination::Mode);
717     WebCore::Pagination::Mode paginationMode() const { return m_paginationMode; }
718     void setPaginationBehavesLikeColumns(bool);
719     bool paginationBehavesLikeColumns() const { return m_paginationBehavesLikeColumns; }
720     void setPageLength(double);
721     double pageLength() const { return m_pageLength; }
722     void setGapBetweenPages(double);
723     double gapBetweenPages() const { return m_gapBetweenPages; }
724     unsigned pageCount() const { return m_pageCount; }
725
726 #if PLATFORM(COCOA)
727     // Called by the web process through a message.
728     void registerWebProcessAccessibilityToken(const IPC::DataReference&);
729     // Called by the UI process when it is ready to send its tokens to the web process.
730     void registerUIProcessAccessibilityTokens(const IPC::DataReference& elemenToken, const IPC::DataReference& windowToken);
731     bool readSelectionFromPasteboard(const String& pasteboardName);
732     String stringSelectionForPasteboard();
733     RefPtr<WebCore::SharedBuffer> dataSelectionForPasteboard(const String& pasteboardType);
734     void makeFirstResponder();
735
736     ColorSpaceData colorSpace();
737 #endif
738
739 #if ENABLE(SERVICE_CONTROLS)
740     void replaceSelectionWithPasteboardData(const Vector<String>& types, const IPC::DataReference&);
741 #endif
742
743     void pageScaleFactorDidChange(double);
744     void pluginScaleFactorDidChange(double);
745     void pluginZoomFactorDidChange(double);
746
747     // Find.
748     void findString(const String&, FindOptions, unsigned maxMatchCount);
749     void findStringMatches(const String&, FindOptions, unsigned maxMatchCount);
750     void getImageForFindMatch(int32_t matchIndex);
751     void selectFindMatch(int32_t matchIndex);
752     void didGetImageForFindMatch(const ShareableBitmap::Handle& contentImageHandle, uint32_t matchIndex);
753     void hideFindUI();
754     void countStringMatches(const String&, FindOptions, unsigned maxMatchCount);
755     void didCountStringMatches(const String&, uint32_t matchCount);
756     void setTextIndicator(const WebCore::TextIndicatorData&, uint64_t /* WebCore::TextIndicatorLifetime */ lifetime = (uint64_t)WebCore::TextIndicatorLifetime::Permanent);
757     void setTextIndicatorAnimationProgress(float);
758     void clearTextIndicator();
759     void didFindString(const String&, uint32_t matchCount, int32_t matchIndex);
760     void didFailToFindString(const String&);
761     void didFindStringMatches(const String&, const Vector<Vector<WebCore::IntRect>>& matchRects, int32_t firstIndexAfterSelection);
762
763     void getContentsAsString(std::function<void (const String&, CallbackBase::Error)>);
764     void getBytecodeProfile(std::function<void (const String&, CallbackBase::Error)>);
765
766 #if ENABLE(MHTML)
767     void getContentsAsMHTMLData(std::function<void (API::Data*, CallbackBase::Error)>, bool useBinaryEncoding);
768 #endif
769     void getMainResourceDataOfFrame(WebFrameProxy*, std::function<void (API::Data*, CallbackBase::Error)>);
770     void getResourceDataFromFrame(WebFrameProxy*, API::URL*, std::function<void (API::Data*, CallbackBase::Error)>);
771     void getRenderTreeExternalRepresentation(std::function<void (const String&, CallbackBase::Error)>);
772     void getSelectionOrContentsAsString(std::function<void (const String&, CallbackBase::Error)>);
773     void getSelectionAsWebArchiveData(std::function<void (API::Data*, CallbackBase::Error)>);
774     void getSourceForFrame(WebFrameProxy*, std::function<void (const String&, CallbackBase::Error)>);
775     void getWebArchiveOfFrame(WebFrameProxy*, std::function<void (API::Data*, CallbackBase::Error)>);
776     void runJavaScriptInMainFrame(const String&, std::function<void (API::SerializedScriptValue*, bool hadException, CallbackBase::Error)> callbackFunction);
777     void forceRepaint(PassRefPtr<VoidCallback>);
778
779     float headerHeight(WebFrameProxy*);
780     float footerHeight(WebFrameProxy*);
781     void drawHeader(WebFrameProxy*, const WebCore::FloatRect&);
782     void drawFooter(WebFrameProxy*, const WebCore::FloatRect&);
783
784 #if PLATFORM(COCOA)
785     // Dictionary.
786     void performDictionaryLookupAtLocation(const WebCore::FloatPoint&);
787     void performDictionaryLookupOfCurrentSelection();
788 #endif
789
790     void receivedPolicyDecision(WebCore::PolicyAction, WebFrameProxy*, uint64_t listenerID, API::Navigation* navigationID);
791
792     void backForwardRemovedItem(uint64_t itemID);
793
794 #if ENABLE(DRAG_SUPPORT)    
795     // Drag and drop support.
796     void dragEntered(WebCore::DragData&, const String& dragStorageName = String());
797     void dragUpdated(WebCore::DragData&, const String& dragStorageName = String());
798     void dragExited(WebCore::DragData&, const String& dragStorageName = String());
799     void performDragOperation(WebCore::DragData&, const String& dragStorageName, const SandboxExtension::Handle&, const SandboxExtension::HandleArray&);
800
801     void didPerformDragControllerAction(uint64_t dragOperation, bool mouseIsOverFileInput, unsigned numberOfItemsToBeAccepted);
802     void dragEnded(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition, uint64_t operation);
803 #if PLATFORM(COCOA)
804     void setDragImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& dragImageHandle, bool isLinkDrag);
805     void setPromisedDataForImage(const String& pasteboardName, const SharedMemory::Handle& imageHandle, uint64_t imageSize, const String& filename, const String& extension,
806                          const String& title, const String& url, const String& visibleURL, const SharedMemory::Handle& archiveHandle, uint64_t archiveSize);
807 #if ENABLE(ATTACHMENT_ELEMENT)
808     void setPromisedDataForAttachment(const String& pasteboardName, const String& filename, const String& extension, const String& title, const String& url, const String& visibleURL);
809 #endif
810 #endif
811 #if PLATFORM(GTK)
812     void startDrag(const WebCore::DragData&, const ShareableBitmap::Handle& dragImage);
813 #endif
814 #endif
815
816     void processDidBecomeUnresponsive();
817     void interactionOccurredWhileProcessUnresponsive();
818     void processDidBecomeResponsive();
819     void processDidCrash();
820 #if PLATFORM(IOS)
821     void processWillBecomeSuspended();
822     void processWillBecomeForeground();
823 #endif
824
825     virtual void enterAcceleratedCompositingMode(const LayerTreeContext&);
826     virtual void exitAcceleratedCompositingMode();
827     virtual void updateAcceleratedCompositingMode(const LayerTreeContext&);
828     
829     void didDraw();
830
831     enum UndoOrRedo { Undo, Redo };
832     void addEditCommand(WebEditCommandProxy*);
833     void removeEditCommand(WebEditCommandProxy*);
834     bool isValidEditCommand(WebEditCommandProxy*);
835     void registerEditCommand(PassRefPtr<WebEditCommandProxy>, UndoOrRedo);
836
837 #if PLATFORM(COCOA)
838     void registerKeypressCommandName(const String& name) { m_knownKeypressCommandNames.add(name); }
839     bool isValidKeypressCommandName(const String& name) const { return m_knownKeypressCommandNames.contains(name); }
840 #endif
841
842     WebProcessProxy& process() { return m_process; }
843     PlatformProcessIdentifier processIdentifier() const;
844
845     WebPreferences& preferences() { return m_preferences; }
846     void setPreferences(WebPreferences&);
847
848     WebPageGroup& pageGroup() { return m_pageGroup; }
849
850     bool isValid() const;
851
852 #if ENABLE(DRAG_SUPPORT)
853     WebCore::DragOperation currentDragOperation() const { return m_currentDragOperation; }
854     bool currentDragIsOverFileInput() const { return m_currentDragIsOverFileInput; }
855     unsigned currentDragNumberOfFilesToBeAccepted() const { return m_currentDragNumberOfFilesToBeAccepted; }
856     void resetCurrentDragInformation()
857     {
858         m_currentDragOperation = WebCore::DragOperationNone;
859         m_currentDragIsOverFileInput = false;
860         m_currentDragNumberOfFilesToBeAccepted = 0;
861     }
862 #endif
863
864     void preferencesDidChange();
865
866 #if ENABLE(CONTEXT_MENUS)
867     // Called by the WebContextMenuProxy.
868     void contextMenuItemSelected(const WebContextMenuItemData&);
869 #endif
870
871     // Called by the WebOpenPanelResultListenerProxy.
872 #if PLATFORM(IOS)
873     void didChooseFilesForOpenPanelWithDisplayStringAndIcon(const Vector<String>&, const String& displayString, const API::Data* iconData);
874 #endif
875     void didChooseFilesForOpenPanel(const Vector<String>&);
876     void didCancelForOpenPanel();
877
878     WebPageCreationParameters creationParameters();
879
880 #if USE(COORDINATED_GRAPHICS)
881     void findZoomableAreaForPoint(const WebCore::IntPoint&, const WebCore::IntSize&);
882 #endif
883
884     void handleDownloadRequest(DownloadProxy*);
885
886     void advanceToNextMisspelling(bool startBeforeSelection);
887     void changeSpellingToWord(const String& word);
888 #if USE(APPKIT)
889     void uppercaseWord();
890     void lowercaseWord();
891     void capitalizeWord();
892 #endif
893
894 #if PLATFORM(COCOA)
895     bool isSmartInsertDeleteEnabled() const { return m_isSmartInsertDeleteEnabled; }
896     void setSmartInsertDeleteEnabled(bool);
897 #endif
898
899 #if PLATFORM(GTK)
900     String accessibilityPlugID() const { return m_accessibilityPlugID; }
901 #endif
902
903     void setCanRunModal(bool);
904     bool canRunModal();
905
906     void beginPrinting(WebFrameProxy*, const PrintInfo&);
907     void endPrinting();
908     void computePagesForPrinting(WebFrameProxy*, const PrintInfo&, PassRefPtr<ComputedPagesCallback>);
909 #if PLATFORM(COCOA)
910     void drawRectToImage(WebFrameProxy*, const PrintInfo&, const WebCore::IntRect&, const WebCore::IntSize&, PassRefPtr<ImageCallback>);
911     void drawPagesToPDF(WebFrameProxy*, const PrintInfo&, uint32_t first, uint32_t count, PassRefPtr<DataCallback>);
912 #elif PLATFORM(GTK)
913     void drawPagesForPrinting(WebFrameProxy*, const PrintInfo&, PassRefPtr<PrintFinishedCallback>);
914 #endif
915
916     PageLoadState& pageLoadState() { return m_pageLoadState; }
917
918 #if PLATFORM(COCOA)
919     void handleAlternativeTextUIResult(const String& result);
920 #endif
921
922     void saveDataToFileInDownloadsFolder(const String& suggestedFilename, const String& mimeType, const String& originatingURLString, API::Data*);
923     void savePDFToFileInDownloadsFolder(const String& suggestedFilename, const String& originatingURLString, const IPC::DataReference&);
924 #if PLATFORM(COCOA)
925     void savePDFToTemporaryFolderAndOpenWithNativeApplicationRaw(const String& suggestedFilename, const String& originatingURLString, const uint8_t* data, unsigned long size, const String& pdfUUID);
926     void savePDFToTemporaryFolderAndOpenWithNativeApplication(const String& suggestedFilename, const String& originatingURLString, const IPC::DataReference&, const String& pdfUUID);
927     void openPDFFromTemporaryFolderWithNativeApplication(const String& pdfUUID);
928 #endif
929
930     WebCore::IntRect visibleScrollerThumbRect() const { return m_visibleScrollerThumbRect; }
931
932     uint64_t renderTreeSize() const { return m_renderTreeSize; }
933
934     void setShouldSendEventsSynchronously(bool sync) { m_shouldSendEventsSynchronously = sync; };
935
936     void printMainFrame();
937     
938     void setMediaVolume(float);
939     void setMuted(bool);
940     void setMayStartMediaWhenInWindow(bool);
941     bool mayStartMediaWhenInWindow() const { return m_mayStartMediaWhenInWindow; }
942         
943 #if ENABLE(MEDIA_SESSION)
944     bool hasMediaSessionWithActiveMediaElements() const { return m_hasMediaSessionWithActiveMediaElements; }
945     void handleMediaEvent(WebCore::MediaEventType);
946 #endif
947
948     // WebPopupMenuProxy::Client
949     virtual NativeWebMouseEvent* currentlyProcessedMouseDownEvent() override;
950
951     void setSuppressVisibilityUpdates(bool flag);
952     bool suppressVisibilityUpdates() { return m_suppressVisibilityUpdates; }
953
954 #if PLATFORM(IOS)
955     void willStartUserTriggeredZooming();
956
957     void potentialTapAtPosition(const WebCore::FloatPoint&, uint64_t& requestID);
958     void commitPotentialTap();
959     void cancelPotentialTap();
960     void tapHighlightAtPosition(const WebCore::FloatPoint&, uint64_t& requestID);
961     void handleTap(const WebCore::FloatPoint&);
962
963     void inspectorNodeSearchMovedToPosition(const WebCore::FloatPoint&);
964     void inspectorNodeSearchEndedAtPosition(const WebCore::FloatPoint&);
965
966     void blurAssistedNode();
967 #endif
968
969     void postMessageToInjectedBundle(const String& messageName, API::Object* messageBody);
970
971 #if ENABLE(INPUT_TYPE_COLOR)
972     void setColorPickerColor(const WebCore::Color&);
973     void endColorPicker();
974 #endif
975
976     WebCore::IntSize minimumLayoutSize() const { return m_minimumLayoutSize; }
977     void setMinimumLayoutSize(const WebCore::IntSize&);
978
979     bool autoSizingShouldExpandToViewHeight() const { return m_autoSizingShouldExpandToViewHeight; }
980     void setAutoSizingShouldExpandToViewHeight(bool);
981
982     void didReceiveAuthenticationChallengeProxy(uint64_t frameID, PassRefPtr<AuthenticationChallengeProxy>);
983
984     int64_t spellDocumentTag();
985     void didFinishCheckingText(uint64_t requestID, const Vector<WebCore::TextCheckingResult>&);
986     void didCancelCheckingText(uint64_t requestID);
987
988     void connectionWillOpen(IPC::Connection&);
989     void webProcessWillShutDown();
990
991     void processDidFinishLaunching();
992
993     void didSaveToPageCache();
994         
995     void setScrollPinningBehavior(WebCore::ScrollPinningBehavior);
996     WebCore::ScrollPinningBehavior scrollPinningBehavior() { return m_scrollPinningBehavior; }
997
998     void setOverlayScrollbarStyle(WTF::Optional<WebCore::ScrollbarOverlayStyle>);
999     WTF::Optional<WebCore::ScrollbarOverlayStyle> overlayScrollbarStyle() { return m_scrollbarOverlayStyle; }
1000
1001     bool shouldRecordNavigationSnapshots() const { return m_shouldRecordNavigationSnapshots; }
1002     void setShouldRecordNavigationSnapshots(bool shouldRecordSnapshots) { m_shouldRecordNavigationSnapshots = shouldRecordSnapshots; }
1003     void recordNavigationSnapshot();
1004     void recordNavigationSnapshot(WebBackForwardListItem&);
1005
1006 #if PLATFORM(COCOA)
1007     PassRefPtr<ViewSnapshot> takeViewSnapshot();
1008 #endif
1009
1010 #if ENABLE(SUBTLE_CRYPTO)
1011     void wrapCryptoKey(const Vector<uint8_t>&, bool& succeeded, Vector<uint8_t>&);
1012     void unwrapCryptoKey(const Vector<uint8_t>&, bool& succeeded, Vector<uint8_t>&);
1013 #endif
1014
1015     void takeSnapshot(WebCore::IntRect, WebCore::IntSize bitmapSize, SnapshotOptions, std::function<void (const ShareableBitmap::Handle&, CallbackBase::Error)>);
1016
1017     void navigationGestureDidBegin();
1018     void navigationGestureWillEnd(bool willNavigate, WebBackForwardListItem&);
1019     void navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem&);
1020     void navigationGestureDidEnd();
1021     void navigationGestureSnapshotWasRemoved();
1022     void willRecordNavigationSnapshot(WebBackForwardListItem&);
1023
1024     bool isShowingNavigationGestureSnapshot() const { return m_isShowingNavigationGestureSnapshot; }
1025
1026     bool isPlayingAudio() const { return !!(m_mediaState & WebCore::MediaProducer::IsPlayingAudio); }
1027     void isPlayingMediaDidChange(WebCore::MediaProducer::MediaStateFlags);
1028
1029 #if ENABLE(MEDIA_SESSION)
1030     void hasMediaSessionWithActiveMediaElementsDidChange(bool);
1031     void mediaSessionMetadataDidChange(const WebCore::MediaSessionMetadata&);
1032 #endif
1033
1034 #if PLATFORM(MAC)
1035     void removeNavigationGestureSnapshot();
1036
1037     WebHitTestResult* lastMouseMoveHitTestResult() const { return m_lastMouseMoveHitTestResult.get(); }
1038     void performImmediateActionHitTestAtLocation(WebCore::FloatPoint);
1039
1040     void immediateActionDidUpdate();
1041     void immediateActionDidCancel();
1042     void immediateActionDidComplete();
1043
1044     void installViewStateChangeCompletionHandler(void(^completionHandler)());
1045 #endif
1046
1047 #if PLATFORM(EFL) && HAVE(ACCESSIBILITY) && defined(HAVE_ECORE_X)
1048     bool accessibilityObjectReadByPoint(const WebCore::IntPoint&);
1049     bool accessibilityObjectReadPrevious();
1050     bool accessibilityObjectReadNext();
1051 #endif
1052
1053 #if USE(UNIFIED_TEXT_CHECKING)
1054     void checkTextOfParagraph(const String& text, uint64_t checkingTypes, Vector<WebCore::TextCheckingResult>& results);
1055 #endif
1056     void getGuessesForWord(const String& word, const String& context, Vector<String>& guesses);
1057
1058     void setShouldDispatchFakeMouseMoveEvents(bool);
1059
1060     // Diagnostic messages logging.
1061     void logDiagnosticMessage(const String& message, const String& description, bool shouldSample);
1062     void logDiagnosticMessageWithResult(const String& message, const String& description, uint32_t result, bool shouldSample);
1063     void logDiagnosticMessageWithValue(const String& message, const String& description, const String& value, bool shouldSample);
1064     void logSampledDiagnosticMessage(const String& message, const String& description);
1065     void logSampledDiagnosticMessageWithResult(const String& message, const String& description, uint32_t result);
1066     void logSampledDiagnosticMessageWithValue(const String& message, const String& description, const String& value);
1067
1068 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
1069     void addPlaybackTargetPickerClient(uint64_t);
1070     void removePlaybackTargetPickerClient(uint64_t);
1071     void showPlaybackTargetPicker(uint64_t, const WebCore::FloatRect&, bool hasVideo);
1072     void playbackTargetPickerClientStateDidChange(uint64_t, WebCore::MediaProducer::MediaStateFlags);
1073
1074     // WebMediaSessionManagerClient
1075     virtual void setPlaybackTarget(uint64_t, Ref<WebCore::MediaPlaybackTarget>&&) override;
1076     virtual void externalOutputDeviceAvailableDidChange(uint64_t, bool) override;
1077     virtual void setShouldPlayToPlaybackTarget(uint64_t, bool) override;
1078 #endif
1079
1080     void didChangeBackgroundColor();
1081     void didLayoutForCustomContentProvider();
1082
1083     void clearWheelEventTestTrigger();
1084
1085 private:
1086     WebPageProxy(PageClient&, WebProcessProxy&, uint64_t pageID, const WebPageConfiguration&);
1087     void platformInitialize();
1088
1089     void updateViewState(WebCore::ViewState::Flags flagsToUpdate = WebCore::ViewState::AllFlags);
1090     void updateActivityToken();
1091     void updateProccessSuppressionState();
1092
1093     enum class ResetStateReason {
1094         PageInvalidated,
1095         WebProcessExited,
1096     };
1097     void resetState(ResetStateReason);
1098     void resetStateAfterProcessExited();
1099
1100     void setUserAgent(const String&);
1101
1102     // IPC::MessageReceiver
1103     // Implemented in generated WebPageProxyMessageReceiver.cpp
1104     virtual void didReceiveMessage(IPC::Connection&, IPC::MessageDecoder&) override;
1105     virtual void didReceiveSyncMessage(IPC::Connection&, IPC::MessageDecoder&, std::unique_ptr<IPC::MessageEncoder>&) override;
1106
1107     // IPC::MessageSender
1108     virtual bool sendMessage(std::unique_ptr<IPC::MessageEncoder>, unsigned messageSendFlags) override;
1109     virtual IPC::Connection* messageSenderConnection() override;
1110     virtual uint64_t messageSenderDestinationID() override;
1111
1112     // WebPopupMenuProxy::Client
1113     virtual void valueChangedForPopupMenu(WebPopupMenuProxy*, int32_t newSelectedIndex) override;
1114     virtual void setTextFromItemForPopupMenu(WebPopupMenuProxy*, int32_t index) override;
1115 #if PLATFORM(GTK)
1116     virtual void failedToShowPopupMenu() override;
1117 #endif
1118
1119     void didCreateMainFrame(uint64_t frameID);
1120     void didCreateSubframe(uint64_t frameID);
1121
1122     void didStartProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, const String& url, const String& unreachableURL, const UserData&);
1123     void didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, const String&, const UserData&);
1124     void didChangeProvisionalURLForFrame(uint64_t frameID, uint64_t navigationID, const String& url);
1125     void didFailProvisionalLoadForFrame(uint64_t frameID, const SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, const String& provisionalURL, const WebCore::ResourceError&, const UserData&);
1126     void didCommitLoadForFrame(uint64_t frameID, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t frameLoadType, const WebCore::CertificateInfo&, const UserData&);
1127     void didFinishDocumentLoadForFrame(uint64_t frameID, uint64_t navigationID, const UserData&);
1128     void didFinishLoadForFrame(uint64_t frameID, uint64_t navigationID, const UserData&);
1129     void didFailLoadForFrame(uint64_t frameID, uint64_t navigationID, const WebCore::ResourceError&, const UserData&);
1130     void didSameDocumentNavigationForFrame(uint64_t frameID, uint64_t navigationID, uint32_t sameDocumentNavigationType, const String&, const UserData&);
1131     void didReceiveTitleForFrame(uint64_t frameID, const String&, const UserData&);
1132     void didFirstLayoutForFrame(uint64_t frameID, const UserData&);
1133     void didFirstVisuallyNonEmptyLayoutForFrame(uint64_t frameID, const UserData&);
1134     void didLayout(uint32_t layoutMilestones, const UserData&);
1135     void didRemoveFrameFromHierarchy(uint64_t frameID, const UserData&);
1136     void didDisplayInsecureContentForFrame(uint64_t frameID, const UserData&);
1137     void didRunInsecureContentForFrame(uint64_t frameID, const UserData&);
1138     void didDetectXSSForFrame(uint64_t frameID, const UserData&);
1139     void frameDidBecomeFrameSet(uint64_t frameID, bool);
1140     void didStartProgress();
1141     void didChangeProgress(double);
1142     void didFinishProgress();
1143     void setNetworkRequestsInProgress(bool);
1144
1145     void didDestroyNavigation(uint64_t navigationID);
1146
1147     void decidePolicyForNavigationAction(uint64_t frameID, const SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, const NavigationActionData&, uint64_t originatingFrameID, const SecurityOriginData& originatingFrameSecurityOrigin, const WebCore::ResourceRequest& originalRequest, const WebCore::ResourceRequest&, uint64_t listenerID, const UserData&, bool& receivedPolicyAction, uint64_t& newNavigationID, uint64_t& policyAction, uint64_t& downloadID);
1148     void decidePolicyForNewWindowAction(uint64_t frameID, const SecurityOriginData& frameSecurityOrigin, const NavigationActionData&, const WebCore::ResourceRequest&, const String& frameName, uint64_t listenerID, const UserData&);
1149     void decidePolicyForResponse(uint64_t frameID, const SecurityOriginData& frameSecurityOrigin, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, bool canShowMIMEType, uint64_t listenerID, const UserData&);
1150     void decidePolicyForResponseSync(uint64_t frameID, const SecurityOriginData& frameSecurityOrigin, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, bool canShowMIMEType, uint64_t listenerID, const UserData&, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID);
1151     void unableToImplementPolicy(uint64_t frameID, const WebCore::ResourceError&, const UserData&);
1152
1153     void willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const Vector<std::pair<String, String>>& textFieldValues, uint64_t listenerID, const UserData&);
1154
1155     // History client
1156     void didNavigateWithNavigationData(const WebNavigationDataStore&, uint64_t frameID);
1157     void didPerformClientRedirect(const String& sourceURLString, const String& destinationURLString, uint64_t frameID);
1158     void didPerformServerRedirect(const String& sourceURLString, const String& destinationURLString, uint64_t frameID);
1159     void didUpdateHistoryTitle(const String& title, const String& url, uint64_t frameID);
1160
1161     // UI client
1162     void createNewPage(uint64_t frameID, const SecurityOriginData&, const WebCore::ResourceRequest&, const WebCore::WindowFeatures&, const NavigationActionData&, uint64_t& newPageID, WebPageCreationParameters&);
1163     void showPage();
1164     void closePage(bool stopResponsivenessTimer);
1165     void runJavaScriptAlert(uint64_t frameID, const SecurityOriginData&, const String&, RefPtr<Messages::WebPageProxy::RunJavaScriptAlert::DelayedReply>);
1166     void runJavaScriptConfirm(uint64_t frameID, const SecurityOriginData&, const String&, RefPtr<Messages::WebPageProxy::RunJavaScriptConfirm::DelayedReply>);
1167     void runJavaScriptPrompt(uint64_t frameID, const SecurityOriginData&, const String&, const String&, RefPtr<Messages::WebPageProxy::RunJavaScriptPrompt::DelayedReply>);
1168     void setStatusText(const String&);
1169     void mouseDidMoveOverElement(const WebHitTestResult::Data& hitTestResultData, uint32_t modifiers, const UserData&);
1170
1171     void didBeginTrackingPotentialLongMousePress(const WebCore::IntPoint& mouseDownPosition, const WebHitTestResult::Data& hitTestResultData, const UserData&);
1172     void didRecognizeLongMousePress(const UserData&);
1173     void didCancelTrackingPotentialLongMousePress(const UserData&);
1174
1175 #if ENABLE(NETSCAPE_PLUGIN_API)
1176     void unavailablePluginButtonClicked(uint32_t opaquePluginUnavailabilityReason, const String& mimeType, const String& pluginURLString, const String& pluginsPageURLString, const String& frameURLString, const String& pageURLString);
1177 #endif // ENABLE(NETSCAPE_PLUGIN_API)
1178 #if ENABLE(WEBGL)
1179     void webGLPolicyForURL(const String& url, uint32_t& loadPolicy);
1180     void resolveWebGLPolicyForURL(const String& url, uint32_t& loadPolicy);
1181 #endif // ENABLE(WEBGL)
1182     void setToolbarsAreVisible(bool toolbarsAreVisible);
1183     void getToolbarsAreVisible(bool& toolbarsAreVisible);
1184     void setMenuBarIsVisible(bool menuBarIsVisible);
1185     void getMenuBarIsVisible(bool& menuBarIsVisible);
1186     void setStatusBarIsVisible(bool statusBarIsVisible);
1187     void getStatusBarIsVisible(bool& statusBarIsVisible);
1188     void setIsResizable(bool isResizable);
1189     void getIsResizable(bool& isResizable);
1190     void setWindowFrame(const WebCore::FloatRect&);
1191     void getWindowFrame(WebCore::FloatRect&);
1192     void screenToRootView(const WebCore::IntPoint& screenPoint, WebCore::IntPoint& windowPoint);
1193     void rootViewToScreen(const WebCore::IntRect& viewRect, WebCore::IntRect& result);
1194 #if PLATFORM(IOS)
1195     void accessibilityScreenToRootView(const WebCore::IntPoint& screenPoint, WebCore::IntPoint& windowPoint);
1196     void rootViewToAccessibilityScreen(const WebCore::IntRect& viewRect, WebCore::IntRect& result);
1197 #endif
1198     void runBeforeUnloadConfirmPanel(const String& message, uint64_t frameID, bool& shouldClose);
1199     void didChangeViewportProperties(const WebCore::ViewportAttributes&);
1200     void pageDidScroll();
1201     void runOpenPanel(uint64_t frameID, const WebCore::FileChooserSettings&);
1202     void printFrame(uint64_t frameID);
1203     void exceededDatabaseQuota(uint64_t frameID, const String& originIdentifier, const String& databaseName, const String& displayName, uint64_t currentQuota, uint64_t currentOriginUsage, uint64_t currentDatabaseUsage, uint64_t expectedUsage, PassRefPtr<Messages::WebPageProxy::ExceededDatabaseQuota::DelayedReply>);
1204     void reachedApplicationCacheOriginQuota(const String& originIdentifier, uint64_t currentQuota, uint64_t totalBytesNeeded, PassRefPtr<Messages::WebPageProxy::ReachedApplicationCacheOriginQuota::DelayedReply>);
1205     void requestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, String originIdentifier);
1206
1207     void requestUserMediaPermissionForFrame(uint64_t userMediaID, uint64_t frameID, String originIdentifier, bool audio, bool video);
1208
1209     void runModal();
1210     void notifyScrollerThumbIsVisibleInRect(const WebCore::IntRect&);
1211     void recommendedScrollbarStyleDidChange(int32_t newStyle);
1212     void didChangeScrollbarsForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar);
1213     void didChangeScrollOffsetPinningForMainFrame(bool pinnedToLeftSide, bool pinnedToRightSide, bool pinnedToTopSide, bool pinnedToBottomSide);
1214     void didChangePageCount(unsigned);
1215     void pageExtendedBackgroundColorDidChange(const WebCore::Color&);
1216 #if ENABLE(NETSCAPE_PLUGIN_API)
1217     void didFailToInitializePlugin(const String& mimeType, const String& frameURLString, const String& pageURLString);
1218     void didBlockInsecurePluginVersion(const String& mimeType, const String& pluginURLString, const String& frameURLString, const String& pageURLString, bool replacementObscured);
1219 #endif // ENABLE(NETSCAPE_PLUGIN_API)
1220     void setCanShortCircuitHorizontalWheelEvents(bool canShortCircuitHorizontalWheelEvents) { m_canShortCircuitHorizontalWheelEvents = canShortCircuitHorizontalWheelEvents; }
1221
1222     void reattachToWebProcess();
1223     RefPtr<API::Navigation> reattachToWebProcessForReload();
1224     RefPtr<API::Navigation> reattachToWebProcessWithItem(WebBackForwardListItem*);
1225
1226     void requestNotificationPermission(uint64_t notificationID, const String& originString);
1227     void showNotification(const String& title, const String& body, const String& iconURL, const String& tag, const String& lang, const String& dir, const String& originString, uint64_t notificationID);
1228     void cancelNotification(uint64_t notificationID);
1229     void clearNotifications(const Vector<uint64_t>& notificationIDs);
1230     void didDestroyNotification(uint64_t notificationID);
1231
1232 #if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
1233     void pageDidRequestScroll(const WebCore::IntPoint&);
1234     void pageTransitionViewportReady();
1235     void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&);
1236 #endif
1237
1238     void didChangeContentSize(const WebCore::IntSize&);
1239
1240 #if ENABLE(INPUT_TYPE_COLOR)
1241     void showColorPicker(const WebCore::Color& initialColor, const WebCore::IntRect&);
1242     virtual void didChooseColor(const WebCore::Color&) override;
1243     virtual void didEndColorPicker() override;
1244 #endif
1245
1246     void editorStateChanged(const EditorState&);
1247     void compositionWasCanceled(const EditorState&);
1248
1249     // Back/Forward list management
1250     void backForwardAddItem(uint64_t itemID);
1251     void backForwardGoToItem(uint64_t itemID, SandboxExtension::Handle&);
1252     void backForwardItemAtIndex(int32_t index, uint64_t& itemID);
1253     void backForwardBackListCount(int32_t& count);
1254     void backForwardForwardListCount(int32_t& count);
1255     void backForwardClear();
1256
1257     // Undo management
1258     void registerEditCommandForUndo(uint64_t commandID, uint32_t editAction);
1259     void registerInsertionUndoGrouping();
1260     void clearAllEditCommands();
1261     void canUndoRedo(uint32_t action, bool& result);
1262     void executeUndoRedo(uint32_t action, bool& result);
1263
1264     // Keyboard handling
1265 #if PLATFORM(COCOA)
1266     void executeSavedCommandBySelector(const String& selector, bool& handled);
1267 #endif
1268
1269 #if PLATFORM(GTK)
1270     void getEditorCommandsForKeyEvent(const AtomicString&, Vector<String>&);
1271     void bindAccessibilityTree(const String&);
1272 #endif
1273 #if PLATFORM(EFL)
1274     void getEditorCommandsForKeyEvent(Vector<String>&);
1275 #endif
1276
1277     // Popup Menu.
1278     void showPopupMenu(const WebCore::IntRect& rect, uint64_t textDirection, const Vector<WebPopupItem>& items, int32_t selectedIndex, const PlatformPopupMenuData&);
1279     void hidePopupMenu();
1280
1281 #if ENABLE(CONTEXT_MENUS)
1282     enum class ContextMenuClientEligibility {
1283         EligibleForClient,
1284         NotEligibleForClient
1285     };
1286     void showContextMenu(const WebCore::IntPoint& menuLocation, const ContextMenuContextData&, const Vector<WebContextMenuItemData>&, const UserData&);
1287     void internalShowContextMenu(const WebCore::IntPoint& menuLocation, const ContextMenuContextData&, const Vector<WebContextMenuItemData>&, ContextMenuClientEligibility, const UserData&);
1288
1289     void platformInitializeShareMenuItem(WebCore::ContextMenuItem&);
1290 #endif
1291
1292 #if ENABLE(TELEPHONE_NUMBER_DETECTION)
1293 #if PLATFORM(MAC)
1294     void showTelephoneNumberMenu(const String& telephoneNumber, const WebCore::IntPoint&);
1295 #endif
1296 #endif
1297
1298 #if ENABLE(SERVICE_CONTROLS)
1299     void showSelectionServiceMenu(const IPC::DataReference& selectionAsRTFD, const Vector<String>& telephoneNumbers, bool isEditable, const WebCore::IntPoint&);
1300 #endif
1301
1302     // Search popup results
1303     void saveRecentSearches(const String&, const Vector<String>&);
1304     void loadRecentSearches(const String&, Vector<String>&);
1305
1306 #if PLATFORM(COCOA)
1307     // Speech.
1308     void getIsSpeaking(bool&);
1309     void speak(const String&);
1310     void stopSpeaking();
1311
1312     // Spotlight.
1313     void searchWithSpotlight(const String&);
1314         
1315     void searchTheWeb(const String&);
1316
1317     // Dictionary.
1318     void didPerformDictionaryLookup(const DictionaryPopupInfo&);
1319 #endif
1320
1321 #if PLATFORM(MAC)
1322     bool appleMailPaginationQuirkEnabled();
1323 #endif
1324
1325     // Spelling and grammar.
1326     void checkSpellingOfString(const String& text, int32_t& misspellingLocation, int32_t& misspellingLength);
1327     void checkGrammarOfString(const String& text, Vector<WebCore::GrammarDetail>&, int32_t& badGrammarLocation, int32_t& badGrammarLength);
1328     void spellingUIIsShowing(bool&);
1329     void updateSpellingUIWithMisspelledWord(const String& misspelledWord);
1330     void updateSpellingUIWithGrammarString(const String& badGrammarPhrase, const WebCore::GrammarDetail&);
1331     void learnWord(const String& word);
1332     void ignoreWord(const String& word);
1333     void requestCheckingOfString(uint64_t requestID, const WebCore::TextCheckingRequestData&);
1334
1335     void setFocus(bool focused);
1336     void takeFocus(uint32_t direction);
1337     void setToolTip(const String&);
1338     void setCursor(const WebCore::Cursor&);
1339     void setCursorHiddenUntilMouseMoves(bool);
1340
1341     void didReceiveEvent(uint32_t opaqueType, bool handled);
1342     void stopResponsivenessTimer();
1343
1344     void voidCallback(uint64_t);
1345     void dataCallback(const IPC::DataReference&, uint64_t);
1346     void imageCallback(const ShareableBitmap::Handle&, uint64_t);
1347     void stringCallback(const String&, uint64_t);
1348     void scriptValueCallback(const IPC::DataReference&, bool hadException, uint64_t);
1349     void computedPagesCallback(const Vector<WebCore::IntRect>&, double totalScaleFactorForPrinting, uint64_t);
1350     void validateCommandCallback(const String&, bool, int, uint64_t);
1351     void unsignedCallback(uint64_t, uint64_t);
1352     void editingRangeCallback(const EditingRange&, uint64_t);
1353 #if PLATFORM(COCOA)
1354     void machSendRightCallback(const WebCore::MachSendRight&, uint64_t);
1355 #endif
1356     void rectForCharacterRangeCallback(const WebCore::IntRect&, const EditingRange&, uint64_t);
1357 #if PLATFORM(MAC)
1358     void attributedStringForCharacterRangeCallback(const AttributedString&, const EditingRange&, uint64_t);
1359     void fontAtSelectionCallback(const String&, double, bool, uint64_t);
1360 #endif
1361 #if PLATFORM(IOS)
1362     void gestureCallback(const WebCore::IntPoint&, uint32_t, uint32_t, uint32_t, uint64_t);
1363     void touchesCallback(const WebCore::IntPoint&, uint32_t, uint64_t);
1364     void autocorrectionDataCallback(const Vector<WebCore::FloatRect>&, const String&, float, uint64_t, uint64_t);
1365     void autocorrectionContextCallback(const String&, const String&, const String&, const String&, uint64_t, uint64_t, uint64_t);
1366     void dictationContextCallback(const String&, const String&, const String&, uint64_t);
1367     void interpretKeyEvent(const EditorState&, bool isCharEvent, bool& handled);
1368     void showPlaybackTargetPicker(bool hasVideo, const WebCore::IntRect& elementRect);
1369 #endif
1370 #if PLATFORM(GTK)
1371     void printFinishedCallback(const WebCore::ResourceError&, uint64_t);
1372 #endif
1373
1374     void focusedFrameChanged(uint64_t frameID);
1375     void frameSetLargestFrameChanged(uint64_t frameID);
1376
1377     void canAuthenticateAgainstProtectionSpaceInFrame(uint64_t frameID, const WebCore::ProtectionSpace&, bool& canAuthenticate);
1378     void didReceiveAuthenticationChallenge(uint64_t frameID, const WebCore::AuthenticationChallenge&, uint64_t challengeID);
1379
1380     void didFinishLoadingDataForCustomContentProvider(const String& suggestedFilename, const IPC::DataReference&);
1381
1382 #if PLATFORM(COCOA)
1383     void pluginFocusOrWindowFocusChanged(uint64_t pluginComplexTextInputIdentifier, bool pluginHasFocusAndWindowHasFocus);
1384     void setPluginComplexTextInputState(uint64_t pluginComplexTextInputIdentifier, uint64_t complexTextInputState);
1385 #endif
1386
1387     bool maybeInitializeSandboxExtensionHandle(const WebCore::URL&, SandboxExtension::Handle&);
1388
1389 #if PLATFORM(MAC)
1390     void substitutionsPanelIsShowing(bool&);
1391     void showCorrectionPanel(int32_t panelType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings);
1392     void dismissCorrectionPanel(int32_t reason);
1393     void dismissCorrectionPanelSoon(int32_t reason, String& result);
1394     void recordAutocorrectionResponse(int32_t responseType, const String& replacedString, const String& replacementString);
1395
1396 #if USE(DICTATION_ALTERNATIVES)
1397     void showDictationAlternativeUI(const WebCore::FloatRect& boundingBoxOfDictatedText, uint64_t dictationContext);
1398     void removeDictationAlternatives(uint64_t dictationContext);
1399     void dictationAlternatives(uint64_t dictationContext, Vector<String>& result);
1400 #endif
1401 #endif // PLATFORM(MAC)
1402
1403 #if PLATFORM(IOS)
1404     WebCore::FloatSize screenSize();
1405     WebCore::FloatSize availableScreenSize();
1406     float textAutosizingWidth();
1407
1408     void dynamicViewportUpdateChangedTarget(double newTargetScale, const WebCore::FloatPoint& newScrollPosition, uint64_t dynamicViewportSizeUpdateID);
1409     void couldNotRestorePageState();
1410     void restorePageState(const WebCore::FloatRect&, double scale);
1411     void restorePageCenterAndScale(const WebCore::FloatPoint&, double scale);
1412
1413     void didGetTapHighlightGeometries(uint64_t requestID, const WebCore::Color& color, const Vector<WebCore::FloatQuad>& geometries, const WebCore::IntSize& topLeftRadius, const WebCore::IntSize& topRightRadius, const WebCore::IntSize& bottomLeftRadius, const WebCore::IntSize& bottomRightRadius);
1414
1415     void startAssistingNode(const AssistedNodeInformation&, bool userIsInteracting, bool blurPreviousNode, const UserData&);
1416     void stopAssistingNode();
1417
1418     void showInspectorHighlight(const WebCore::Highlight&);
1419     void hideInspectorHighlight();
1420
1421     void showInspectorIndication();
1422     void hideInspectorIndication();
1423
1424     void enableInspectorNodeSearch();
1425     void disableInspectorNodeSearch();
1426 #endif // PLATFORM(IOS)
1427
1428     void clearLoadDependentCallbacks();
1429
1430     void performDragControllerAction(DragControllerAction, WebCore::DragData&, const String& dragStorageName, const SandboxExtension::Handle&, const SandboxExtension::HandleArray&);
1431
1432     void updateBackingStoreDiscardableState();
1433
1434     void setRenderTreeSize(uint64_t treeSize) { m_renderTreeSize = treeSize; }
1435
1436 #if PLUGIN_ARCHITECTURE(X11)
1437     void createPluginContainer(uint64_t& windowID);
1438     void windowedPluginGeometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect, uint64_t windowID);
1439     void windowedPluginVisibilityDidChange(bool isVisible, uint64_t windowID);
1440 #endif
1441
1442     void processNextQueuedWheelEvent();
1443     void sendWheelEvent(const WebWheelEvent&);
1444
1445 #if ENABLE(TOUCH_EVENTS)
1446     bool shouldStartTrackingTouchEvents(const WebTouchEvent&) const;
1447 #endif
1448
1449 #if ENABLE(NETSCAPE_PLUGIN_API)
1450     void findPlugin(const String& mimeType, uint32_t processType, const String& urlString, const String& frameURLString, const String& pageURLString, bool allowOnlyApplicationPlugins, uint64_t& pluginProcessToken, String& newMIMEType, uint32_t& pluginLoadPolicy, String& unavailabilityDescription);
1451 #endif
1452
1453 #if USE(QUICK_LOOK)
1454     void didStartLoadForQuickLookDocumentInMainFrame(const String& fileName, const String& uti);
1455     void didFinishLoadForQuickLookDocumentInMainFrame(const QuickLookDocumentData&);
1456 #endif
1457
1458 #if ENABLE(CONTENT_FILTERING)
1459     void contentFilterDidBlockLoadForFrame(const WebCore::ContentFilterUnblockHandler&, uint64_t frameID);
1460 #endif
1461
1462     uint64_t generateNavigationID();
1463
1464     WebPreferencesStore preferencesStore() const;
1465
1466     void dispatchViewStateChange();
1467     void viewDidLeaveWindow();
1468     void viewDidEnterWindow();
1469
1470 #if PLATFORM(MAC)
1471     void didPerformImmediateActionHitTest(const WebHitTestResult::Data&, bool contentPreventsDefault, const UserData&);
1472 #endif
1473
1474     void useFixedLayoutDidChange(bool useFixedLayout) { m_useFixedLayout = useFixedLayout; }
1475     void fixedLayoutSizeDidChange(WebCore::IntSize fixedLayoutSize) { m_fixedLayoutSize = fixedLayoutSize; }
1476
1477     void handleAutoFillButtonClick(const UserData&);
1478
1479     void handleMessage(IPC::Connection&, const String& messageName, const UserData& messageBody);
1480     void handleSynchronousMessage(IPC::Connection&, const String& messageName, const UserData& messageBody, UserData& returnUserData);
1481
1482     PageClient& m_pageClient;
1483     std::unique_ptr<API::LoaderClient> m_loaderClient;
1484     std::unique_ptr<API::PolicyClient> m_policyClient;
1485     std::unique_ptr<API::NavigationClient> m_navigationClient;
1486     std::unique_ptr<API::HistoryClient> m_historyClient;
1487     std::unique_ptr<API::FormClient> m_formClient;
1488     std::unique_ptr<API::UIClient> m_uiClient;
1489 #if PLATFORM(EFL)
1490     WebUIPopupMenuClient m_uiPopupMenuClient;
1491 #endif
1492     std::unique_ptr<API::FindClient> m_findClient;
1493     WebFindMatchesClient m_findMatchesClient;
1494     std::unique_ptr<API::DiagnosticLoggingClient> m_diagnosticLoggingClient;
1495 #if ENABLE(CONTEXT_MENUS)
1496     std::unique_ptr<API::ContextMenuClient> m_contextMenuClient;
1497 #endif
1498     std::unique_ptr<WebPageInjectedBundleClient> m_injectedBundleClient;
1499
1500     std::unique_ptr<WebNavigationState> m_navigationState;
1501     String m_failingProvisionalLoadURL;
1502
1503     std::unique_ptr<DrawingAreaProxy> m_drawingArea;
1504 #if ENABLE(ASYNC_SCROLLING)
1505     std::unique_ptr<RemoteScrollingCoordinatorProxy> m_scrollingCoordinatorProxy;
1506 #endif
1507
1508     Ref<WebProcessProxy> m_process;
1509     Ref<WebPageGroup> m_pageGroup;
1510     Ref<WebPreferences> m_preferences;
1511
1512     WebProcessLifetimeTracker m_webProcessLifetimeTracker { *this };
1513
1514     const RefPtr<WebUserContentControllerProxy> m_userContentController;
1515     Ref<VisitedLinkProvider> m_visitedLinkProvider;
1516     Ref<WebsiteDataStore> m_websiteDataStore;
1517
1518     RefPtr<WebFrameProxy> m_mainFrame;
1519     RefPtr<WebFrameProxy> m_focusedFrame;
1520     RefPtr<WebFrameProxy> m_frameSetLargestFrame;
1521
1522     String m_userAgent;
1523     String m_applicationNameForUserAgent;
1524     String m_customUserAgent;
1525     String m_customTextEncodingName;
1526
1527     bool m_treatsSHA1CertificatesAsInsecure;
1528
1529     RefPtr<WebInspectorProxy> m_inspector;
1530
1531 #if ENABLE(FULLSCREEN_API)
1532     RefPtr<WebFullScreenManagerProxy> m_fullScreenManager;
1533 #endif
1534 #if PLATFORM(IOS)
1535     RefPtr<WebVideoFullscreenManagerProxy> m_videoFullscreenManager;
1536     VisibleContentRectUpdateInfo m_lastVisibleContentRectUpdate;
1537     bool m_hasReceivedLayerTreeTransactionAfterDidCommitLoad;
1538     uint64_t m_firstLayerTreeTransactionIdAfterDidCommitLoad;
1539     int32_t m_deviceOrientation;
1540     bool m_dynamicViewportSizeUpdateWaitingForTarget;
1541     bool m_dynamicViewportSizeUpdateWaitingForLayerTreeCommit;
1542     uint64_t m_dynamicViewportSizeUpdateLayerTreeTransactionID;
1543     uint64_t m_layerTreeTransactionIdAtLastTouchStart;
1544     uint64_t m_currentDynamicViewportSizeUpdateID { 0 };
1545     bool m_hasNetworkRequestsOnSuspended;
1546 #endif
1547
1548 #if ENABLE(VIBRATION)
1549     RefPtr<WebVibrationProxy> m_vibration;
1550 #endif
1551
1552     CallbackMap m_callbacks;
1553     HashSet<uint64_t> m_loadDependentStringCallbackIDs;
1554
1555     HashSet<WebEditCommandProxy*> m_editCommandSet;
1556
1557 #if PLATFORM(COCOA)
1558     HashSet<String> m_knownKeypressCommandNames;
1559 #endif
1560
1561     RefPtr<WebPopupMenuProxy> m_activePopupMenu;
1562 #if ENABLE(CONTEXT_MENUS)
1563     RefPtr<WebContextMenuProxy> m_activeContextMenu;
1564     ContextMenuContextData m_activeContextMenuContextData;
1565 #endif
1566     RefPtr<WebHitTestResult> m_lastMouseMoveHitTestResult;
1567
1568     RefPtr<WebOpenPanelResultListenerProxy> m_openPanelResultListener;
1569     GeolocationPermissionRequestManagerProxy m_geolocationPermissionRequestManager;
1570     NotificationPermissionRequestManagerProxy m_notificationPermissionRequestManager;
1571
1572     UserMediaPermissionRequestManagerProxy m_userMediaPermissionRequestManager;
1573
1574     WebCore::ViewState::Flags m_viewState;
1575     bool m_viewWasEverInWindow;
1576 #if PLATFORM(IOS)
1577     bool m_alwaysRunsAtForegroundPriority;
1578     ProcessThrottler::ForegroundActivityToken m_activityToken;
1579 #endif
1580         
1581     Ref<WebBackForwardList> m_backForwardList;
1582         
1583     bool m_maintainsInactiveSelection;
1584
1585     String m_toolTip;
1586
1587     EditorState m_editorState;
1588     bool m_isEditable;
1589 #if PLATFORM(MAC) && !USE(ASYNC_NSTEXTINPUTCLIENT)
1590     bool m_temporarilyClosedComposition; // Editor state changed from hasComposition to !hasComposition, but that was only with shouldIgnoreCompositionSelectionChange yet.
1591 #endif
1592
1593     double m_textZoomFactor;
1594     double m_pageZoomFactor;
1595     double m_pageScaleFactor;
1596     double m_pluginZoomFactor;
1597     double m_pluginScaleFactor;
1598     double m_viewScaleFactor { 1 };
1599     float m_intrinsicDeviceScaleFactor;
1600     float m_customDeviceScaleFactor;
1601     float m_topContentInset;
1602
1603     LayerHostingMode m_layerHostingMode;
1604
1605     bool m_drawsBackground;
1606     bool m_drawsTransparentBackground;
1607
1608     WebCore::Color m_underlayColor;
1609     WebCore::Color m_pageExtendedBackgroundColor;
1610
1611     bool m_useFixedLayout;
1612     WebCore::IntSize m_fixedLayoutSize;
1613
1614     bool m_suppressScrollbarAnimations;
1615
1616     WebCore::Pagination::Mode m_paginationMode;
1617     bool m_paginationBehavesLikeColumns;
1618     double m_pageLength;
1619     double m_gapBetweenPages;
1620
1621     // If the process backing the web page is alive and kicking.
1622     bool m_isValid;
1623
1624     // Whether WebPageProxy::close() has been called on this page.
1625     bool m_isClosed;
1626
1627     // Whether it can run modal child web pages.
1628     bool m_canRunModal;
1629
1630     bool m_isInPrintingMode;
1631     bool m_isPerformingDOMPrintOperation;
1632
1633     bool m_inDecidePolicyForResponseSync;
1634     const WebCore::ResourceRequest* m_decidePolicyForResponseRequest;
1635     bool m_syncMimeTypePolicyActionIsValid;
1636     WebCore::PolicyAction m_syncMimeTypePolicyAction;
1637     uint64_t m_syncMimeTypePolicyDownloadID;
1638
1639     bool m_inDecidePolicyForNavigationAction;
1640     bool m_syncNavigationActionPolicyActionIsValid;
1641     WebCore::PolicyAction m_syncNavigationActionPolicyAction;
1642     uint64_t m_syncNavigationActionPolicyDownloadID;
1643     bool m_shouldSuppressAppLinksInNextNavigationPolicyDecision { false };
1644
1645     Deque<NativeWebKeyboardEvent> m_keyEventQueue;
1646     Deque<NativeWebWheelEvent> m_wheelEventQueue;
1647     Deque<std::unique_ptr<Vector<NativeWebWheelEvent>>> m_currentlyProcessedWheelEvents;
1648
1649     bool m_processingMouseMoveEvent;
1650     std::unique_ptr<NativeWebMouseEvent> m_nextMouseMoveEvent;
1651     std::unique_ptr<NativeWebMouseEvent> m_currentlyProcessedMouseDownEvent;
1652
1653 #if ENABLE(TOUCH_EVENTS)
1654     bool m_isTrackingTouchEvents;
1655 #endif
1656 #if ENABLE(TOUCH_EVENTS) && !ENABLE(IOS_TOUCH_EVENTS)
1657     Deque<QueuedTouchEvents> m_touchEventQueue;
1658 #endif
1659
1660 #if ENABLE(INPUT_TYPE_COLOR)
1661     RefPtr<WebColorPicker> m_colorPicker;
1662 #endif
1663
1664     const uint64_t m_pageID;
1665     WebCore::SessionID m_sessionID;
1666
1667     bool m_isPageSuspended;
1668     bool m_addsVisitedLinks;
1669
1670 #if ENABLE(REMOTE_INSPECTOR)
1671     bool m_allowsRemoteInspection;
1672 #endif
1673
1674 #if PLATFORM(COCOA)
1675     bool m_isSmartInsertDeleteEnabled;
1676 #endif
1677
1678 #if PLATFORM(GTK)
1679     String m_accessibilityPlugID;
1680     WebCore::Color m_backgroundColor;
1681 #endif
1682
1683     int64_t m_spellDocumentTag;
1684     bool m_hasSpellDocumentTag;
1685     unsigned m_pendingLearnOrIgnoreWordMessageCount;
1686
1687     bool m_mainFrameHasCustomContentProvider;
1688
1689 #if ENABLE(DRAG_SUPPORT)
1690     // Current drag destination details are delivered as an asynchronous response,
1691     // so we preserve them to be used when the next dragging delegate call is made.
1692     WebCore::DragOperation m_currentDragOperation;
1693     bool m_currentDragIsOverFileInput;
1694     unsigned m_currentDragNumberOfFilesToBeAccepted;
1695 #endif
1696
1697     PageLoadState m_pageLoadState;
1698     
1699     bool m_delegatesScrolling;
1700
1701     bool m_mainFrameHasHorizontalScrollbar;
1702     bool m_mainFrameHasVerticalScrollbar;
1703
1704     // Whether horizontal wheel events can be handled directly for swiping purposes.
1705     bool m_canShortCircuitHorizontalWheelEvents;
1706
1707     bool m_mainFrameIsPinnedToLeftSide;
1708     bool m_mainFrameIsPinnedToRightSide;
1709     bool m_mainFrameIsPinnedToTopSide;
1710     bool m_mainFrameIsPinnedToBottomSide;
1711
1712     bool m_shouldUseImplicitRubberBandControl;
1713     bool m_rubberBandsAtLeft;
1714     bool m_rubberBandsAtRight;
1715     bool m_rubberBandsAtTop;
1716     bool m_rubberBandsAtBottom;
1717         
1718     bool m_enableVerticalRubberBanding;
1719     bool m_enableHorizontalRubberBanding;
1720
1721     bool m_backgroundExtendsBeyondPage;
1722
1723     bool m_shouldRecordNavigationSnapshots;
1724     bool m_isShowingNavigationGestureSnapshot;
1725
1726     unsigned m_pageCount;
1727
1728     WebCore::IntRect m_visibleScrollerThumbRect;
1729
1730     uint64_t m_renderTreeSize;
1731     uint64_t m_sessionRestorationRenderTreeSize;
1732     bool m_wantsSessionRestorationRenderTreeSizeThresholdEvent;
1733     bool m_hitRenderTreeSizeThreshold;
1734
1735     bool m_shouldSendEventsSynchronously;
1736
1737     bool m_suppressVisibilityUpdates;
1738     bool m_autoSizingShouldExpandToViewHeight;
1739     WebCore::IntSize m_minimumLayoutSize;
1740
1741     float m_mediaVolume;
1742     bool m_muted;
1743     bool m_mayStartMediaWhenInWindow;
1744
1745     bool m_waitingForDidUpdateViewState;
1746
1747     bool m_shouldScaleViewToFitDocument { false };
1748     bool m_suppressNavigationSnapshotting { false };
1749
1750 #if PLATFORM(COCOA)
1751     HashMap<String, String> m_temporaryPDFFiles;
1752     std::unique_ptr<WebCore::RunLoopObserver> m_viewStateChangeDispatcher;
1753
1754     std::unique_ptr<RemoteLayerTreeScrollingPerformanceData> m_scrollingPerformanceData;
1755     bool m_scrollPerformanceDataCollectionEnabled;
1756 #endif
1757     UserObservablePageToken m_pageIsUserObservableCount;
1758     ProcessSuppressionDisabledToken m_preventProcessSuppressionCount;
1759         
1760     WebCore::ScrollPinningBehavior m_scrollPinningBehavior;
1761     WTF::Optional<WebCore::ScrollbarOverlayStyle> m_scrollbarOverlayStyle;
1762
1763     uint64_t m_navigationID;
1764
1765     WebPreferencesStore::ValueMap m_configurationPreferenceValues;
1766     WebCore::ViewState::Flags m_potentiallyChangedViewStateFlags;
1767     bool m_viewStateChangeWantsSynchronousReply;
1768     Vector<uint64_t> m_nextViewStateChangeCallbacks;
1769
1770     WebCore::MediaProducer::MediaStateFlags m_mediaState { WebCore::MediaProducer::IsNotPlaying };
1771
1772 #if ENABLE(MEDIA_SESSION)
1773     bool m_hasMediaSessionWithActiveMediaElements { false };
1774 #endif
1775
1776 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
1777     bool m_requiresTargetMonitoring { false };
1778 #endif
1779
1780     bool m_userContentExtensionsEnabled { true };
1781 };
1782
1783 } // namespace WebKit
1784
1785 #endif // WebPageProxy_h