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