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