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