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