Implement action menus for text
[WebKit-https.git] / Source / WebKit2 / WebProcess / WebPage / WebPage.h
1 /*
2  * Copyright (C) 2010, 2011, 2013 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 WebPage_h
27 #define WebPage_h
28
29 #include "APIInjectedBundleFormClient.h"
30 #include "APIInjectedBundlePageUIClient.h"
31 #include "APIObject.h"
32 #include "FindController.h"
33 #include "GeolocationPermissionRequestManager.h"
34 #include "ImageOptions.h"
35 #include "InjectedBundlePageDiagnosticLoggingClient.h"
36 #include "InjectedBundlePageEditorClient.h"
37 #include "InjectedBundlePageFullScreenClient.h"
38 #include "InjectedBundlePageLoaderClient.h"
39 #include "InjectedBundlePagePolicyClient.h"
40 #include "InjectedBundlePageResourceLoadClient.h"
41 #include "LayerTreeHost.h"
42 #include "MessageReceiver.h"
43 #include "MessageSender.h"
44 #include "Plugin.h"
45 #include "SandboxExtension.h"
46 #include "ShareableBitmap.h"
47 #include <WebCore/DictationAlternative.h>
48 #include <WebCore/DragData.h>
49 #include <WebCore/Editor.h>
50 #include <WebCore/FrameLoaderTypes.h>
51 #include <WebCore/IntRect.h>
52 #include <WebCore/IntSizeHash.h>
53 #include <WebCore/Page.h>
54 #include <WebCore/PageVisibilityState.h>
55 #include <WebCore/ScrollTypes.h>
56 #include <WebCore/TextChecking.h>
57 #include <WebCore/UserActivity.h>
58 #include <WebCore/ViewState.h>
59 #include <WebCore/ViewportConfiguration.h>
60 #include <WebCore/WebCoreKeyboardUIMode.h>
61 #include <memory>
62 #include <wtf/HashMap.h>
63 #include <wtf/PassRefPtr.h>
64 #include <wtf/RefPtr.h>
65 #include <wtf/RunLoop.h>
66 #include <wtf/text/WTFString.h>
67
68 #if HAVE(ACCESSIBILITY) && (PLATFORM(GTK) || PLATFORM(EFL))
69 #include "WebPageAccessibilityObject.h"
70 #include <wtf/gobject/GRefPtr.h>
71 #endif
72
73 #if PLATFORM(GTK)
74 #include "ArgumentCodersGtk.h"
75 #include "WebPrintOperationGtk.h"
76 #endif
77
78 #if PLATFORM(IOS)
79 #include "GestureTypes.h"
80 #import "WebPageMessages.h"
81 #endif
82
83 #if ENABLE(IOS_TOUCH_EVENTS)
84 #include <WebKitAdditions/PlatformTouchEventIOS.h>
85 #elif ENABLE(TOUCH_EVENTS)
86 #include <WebCore/PlatformTouchEvent.h>
87 #endif
88
89 #if ENABLE(CONTEXT_MENUS)
90 #include "InjectedBundlePageContextMenuClient.h"
91 #endif
92
93 #if PLATFORM(COCOA)
94 #include "ViewGestureGeometryCollector.h"
95 #include <wtf/RetainPtr.h>
96 OBJC_CLASS CALayer;
97 OBJC_CLASS NSDictionary;
98 OBJC_CLASS NSObject;
99 OBJC_CLASS WKAccessibilityWebPageObject;
100
101 #define ENABLE_PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC 1
102 #endif
103
104 namespace API {
105 class Array;
106 }
107
108 namespace IPC {
109 class ArgumentDecoder;
110 class Connection;
111 }
112
113 namespace WebCore {
114 class DocumentLoader;
115 class GraphicsContext;
116 class Frame;
117 class FrameView;
118 class HTMLPlugInElement;
119 class HTMLPlugInImageElement;
120 class IntPoint;
121 class KeyboardEvent;
122 class Page;
123 class PrintContext;
124 class Range;
125 class ResourceResponse;
126 class ResourceRequest;
127 class SharedBuffer;
128 class SubstituteData;
129 class TextCheckingRequest;
130 class URL;
131 class VisibleSelection;
132 struct Highlight;
133 struct KeypressCommand;
134 struct TextCheckingResult;
135 }
136
137 namespace WebKit {
138
139 class DrawingArea;
140 class InjectedBundleBackForwardList;
141 class NotificationPermissionRequestManager;
142 class PageBanner;
143 class PluginView;
144 class VisibleContentRectUpdateInfo;
145 class WebColorChooser;
146 class WebContextMenu;
147 class WebContextMenuItemData;
148 class WebEvent;
149 class WebFrame;
150 class WebFullScreenManager;
151 class WebImage;
152 class WebInspector;
153 class WebInspectorClient;
154 class WebInspectorUI;
155 class WebKeyboardEvent;
156 class WebMouseEvent;
157 class WebNotificationClient;
158 class WebOpenPanelResultListener;
159 class WebPageGroupProxy;
160 class WebPopupMenu;
161 class WebUndoStep;
162 class WebUserContentController;
163 class WebVideoFullscreenManager;
164 class WebWheelEvent;
165 struct AssistedNodeInformation;
166 struct AttributedString;
167 struct BackForwardListItemState;
168 struct EditingRange;
169 struct EditorState;
170 struct InteractionInformationAtPosition;
171 struct PrintInfo;
172 struct WebPageCreationParameters;
173 struct WebPreferencesStore;
174
175 #if PLATFORM(COCOA)
176 class RemoteLayerTreeTransaction;
177 #endif
178
179 #if ENABLE(TOUCH_EVENTS)
180 class WebTouchEvent;
181 #endif
182
183 class WebPage : public API::ObjectImpl<API::Object::Type::BundlePage>, public IPC::MessageReceiver, public IPC::MessageSender {
184 public:
185     static PassRefPtr<WebPage> create(uint64_t pageID, const WebPageCreationParameters&);
186     virtual ~WebPage();
187
188     void reinitializeWebPage(const WebPageCreationParameters&);
189
190     void close();
191
192     static WebPage* fromCorePage(WebCore::Page*);
193
194     WebCore::Page* corePage() const { return m_page.get(); }
195     uint64_t pageID() const { return m_pageID; }
196     WebCore::SessionID sessionID() const { return m_page->sessionID(); }
197     bool usesEphemeralSession() const { return m_page->usesEphemeralSession(); }
198
199     void setSessionID(WebCore::SessionID);
200
201     void setSize(const WebCore::IntSize&);
202     const WebCore::IntSize& size() const { return m_viewSize; }
203     WebCore::IntRect bounds() const { return WebCore::IntRect(WebCore::IntPoint(), size()); }
204     
205     InjectedBundleBackForwardList* backForwardList();
206     DrawingArea* drawingArea() const { return m_drawingArea.get(); }
207 #if ENABLE(ASYNC_SCROLLING)
208     WebCore::ScrollingCoordinator* scrollingCoordinator() const;
209 #endif
210
211     WebPageGroupProxy* pageGroup() const { return m_pageGroup.get(); }
212
213     void scrollMainFrameIfNotAtMaxScrollPosition(const WebCore::IntSize& scrollOffset);
214
215     bool scrollBy(uint32_t scrollDirection, uint32_t scrollGranularity);
216
217     void centerSelectionInVisibleArea();
218
219 #if PLATFORM(COCOA)
220     void willCommitLayerTree(RemoteLayerTreeTransaction&);
221     void didFlushLayerTreeAtTime(std::chrono::milliseconds);
222 #endif
223
224 #if ENABLE(INSPECTOR)
225     WebInspector* inspector();
226     WebInspectorUI* inspectorUI();
227     bool isInspectorPage() { return !!m_inspectorUI; }
228 #endif
229
230 #if PLATFORM(IOS)
231     WebVideoFullscreenManager* videoFullscreenManager();
232 #endif
233
234 #if ENABLE(FULLSCREEN_API)
235     WebFullScreenManager* fullScreenManager();
236 #endif
237
238     // -- Called by the DrawingArea.
239     // FIXME: We could genericize these into a DrawingArea client interface. Would that be beneficial?
240     void drawRect(WebCore::GraphicsContext&, const WebCore::IntRect&);
241     void layoutIfNeeded();
242
243     // -- Called from WebCore clients.
244     bool handleEditingKeyboardEvent(WebCore::KeyboardEvent*);
245
246     void didStartPageTransition();
247     void didCompletePageTransition();
248     void didCommitLoad(WebFrame*);
249     void didFinishDocumentLoad(WebFrame*);
250     void didFinishLoad(WebFrame*);
251     void show();
252     String userAgent(const WebCore::URL&) const;
253     String userAgent(WebFrame*, const WebCore::URL&) const;
254     String platformUserAgent(const WebCore::URL&) const;
255     WebCore::IntRect windowResizerRect() const;
256     WebCore::KeyboardUIMode keyboardUIMode();
257
258     WebUndoStep* webUndoStep(uint64_t);
259     void addWebUndoStep(uint64_t, WebUndoStep*);
260     void removeWebEditCommand(uint64_t);
261     bool isInRedo() const { return m_isInRedo; }
262
263     void setActivePopupMenu(WebPopupMenu*);
264
265 #if ENABLE(INPUT_TYPE_COLOR)
266     WebColorChooser* activeColorChooser() const { return m_activeColorChooser; }
267     void setActiveColorChooser(WebColorChooser*);
268     void didChooseColor(const WebCore::Color&);
269     void didEndColorPicker();
270 #endif
271
272     WebOpenPanelResultListener* activeOpenPanelResultListener() const { return m_activeOpenPanelResultListener.get(); }
273     void setActiveOpenPanelResultListener(PassRefPtr<WebOpenPanelResultListener>);
274
275     void didReceiveMessage(IPC::Connection*, IPC::MessageDecoder&) override;
276     void didReceiveSyncMessage(IPC::Connection*, IPC::MessageDecoder&, std::unique_ptr<IPC::MessageEncoder>&) override;
277
278     // -- InjectedBundle methods
279 #if ENABLE(CONTEXT_MENUS)
280     void initializeInjectedBundleContextMenuClient(WKBundlePageContextMenuClientBase*);
281 #endif
282     void initializeInjectedBundleEditorClient(WKBundlePageEditorClientBase*);
283     void setInjectedBundleFormClient(std::unique_ptr<API::InjectedBundle::FormClient>);
284     void initializeInjectedBundleLoaderClient(WKBundlePageLoaderClientBase*);
285     void initializeInjectedBundlePolicyClient(WKBundlePagePolicyClientBase*);
286     void initializeInjectedBundleResourceLoadClient(WKBundlePageResourceLoadClientBase*);
287     void setInjectedBundleUIClient(std::unique_ptr<API::InjectedBundle::PageUIClient>);
288 #if ENABLE(FULLSCREEN_API)
289     void initializeInjectedBundleFullScreenClient(WKBundlePageFullScreenClientBase*);
290 #endif
291     void initializeInjectedBundleDiagnosticLoggingClient(WKBundlePageDiagnosticLoggingClientBase*);
292
293 #if ENABLE(CONTEXT_MENUS)
294     InjectedBundlePageContextMenuClient& injectedBundleContextMenuClient() { return m_contextMenuClient; }
295 #endif
296     InjectedBundlePageEditorClient& injectedBundleEditorClient() { return m_editorClient; }
297     API::InjectedBundle::FormClient& injectedBundleFormClient() { return *m_formClient.get(); }
298     InjectedBundlePageLoaderClient& injectedBundleLoaderClient() { return m_loaderClient; }
299     InjectedBundlePagePolicyClient& injectedBundlePolicyClient() { return m_policyClient; }
300     InjectedBundlePageResourceLoadClient& injectedBundleResourceLoadClient() { return m_resourceLoadClient; }
301     API::InjectedBundle::PageUIClient& injectedBundleUIClient() { return *m_uiClient.get(); }
302     InjectedBundlePageDiagnosticLoggingClient& injectedBundleDiagnosticLoggingClient() { return m_logDiagnosticMessageClient; }
303 #if ENABLE(FULLSCREEN_API)
304     InjectedBundlePageFullScreenClient& injectedBundleFullScreenClient() { return m_fullScreenClient; }
305 #endif
306
307     bool findStringFromInjectedBundle(const String&, FindOptions);
308
309     WebFrame* mainWebFrame() const { return m_mainFrame.get(); }
310
311     WebCore::MainFrame* mainFrame() const; // May return 0.
312     WebCore::FrameView* mainFrameView() const; // May return 0.
313
314     PassRefPtr<WebCore::Range> currentSelectionAsRange();
315
316 #if ENABLE(NETSCAPE_PLUGIN_API)
317     PassRefPtr<Plugin> createPlugin(WebFrame*, WebCore::HTMLPlugInElement*, const Plugin::Parameters&, String& newMIMEType);
318 #endif
319
320 #if ENABLE(WEBGL)
321     WebCore::WebGLLoadPolicy webGLPolicyForURL(WebFrame*, const String&);
322     WebCore::WebGLLoadPolicy resolveWebGLPolicyForURL(WebFrame*, const String&);
323 #endif // ENABLE(WEBGL)
324     
325     EditorState editorState() const;
326
327     String renderTreeExternalRepresentation() const;
328     String renderTreeExternalRepresentationForPrinting() const;
329     uint64_t renderTreeSize() const;
330
331     void setTracksRepaints(bool);
332     bool isTrackingRepaints() const;
333     void resetTrackedRepaints();
334     PassRefPtr<API::Array> trackedRepaintRects();
335
336     void executeEditingCommand(const String& commandName, const String& argument);
337     bool isEditingCommandEnabled(const String& commandName);
338     void clearMainFrameName();
339     void sendClose();
340
341     void sendSetWindowFrame(const WebCore::FloatRect&);
342
343     double textZoomFactor() const;
344     void setTextZoomFactor(double);
345     double pageZoomFactor() const;
346     void setPageZoomFactor(double);
347     void setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor);
348     void windowScreenDidChange(uint64_t);
349
350     void scalePage(double scale, const WebCore::IntPoint& origin);
351     void scalePageInViewCoordinates(double scale, WebCore::IntPoint centerInViewCoordinates);
352     double pageScaleFactor() const;
353
354     void setUseFixedLayout(bool);
355     bool useFixedLayout() const { return m_useFixedLayout; }
356     void setFixedLayoutSize(const WebCore::IntSize&);
357
358     void listenForLayoutMilestones(uint32_t /* LayoutMilestones */);
359
360     void setSuppressScrollbarAnimations(bool);
361     
362     void setEnableVerticalRubberBanding(bool);
363     void setEnableHorizontalRubberBanding(bool);
364     
365     void setBackgroundExtendsBeyondPage(bool);
366
367     void setPaginationMode(uint32_t /* WebCore::Pagination::Mode */);
368     void setPaginationBehavesLikeColumns(bool);
369     void setPageLength(double);
370     void setGapBetweenPages(double);
371
372     void postInjectedBundleMessage(const String& messageName, IPC::MessageDecoder&);
373
374     bool drawsBackground() const { return m_drawsBackground; }
375     bool drawsTransparentBackground() const { return m_drawsTransparentBackground; }
376
377     void setUnderlayColor(const WebCore::Color& color) { m_underlayColor = color; }
378     WebCore::Color underlayColor() const { return m_underlayColor; }
379
380     void stopLoading();
381     void stopLoadingFrame(uint64_t frameID);
382     bool defersLoading() const;
383     void setDefersLoading(bool deferLoading);
384
385     void enterAcceleratedCompositingMode(WebCore::GraphicsLayer*);
386     void exitAcceleratedCompositingMode();
387
388     void addPluginView(PluginView*);
389     void removePluginView(PluginView*);
390
391     bool isVisible() const { return m_viewState & WebCore::ViewState::IsVisible; }
392     bool isVisibleOrOccluded() const { return m_viewState & WebCore::ViewState::IsVisibleOrOccluded; }
393
394     LayerHostingMode layerHostingMode() const { return m_layerHostingMode; }
395     void setLayerHostingMode(unsigned);
396
397 #if PLATFORM(COCOA)
398     void updatePluginsActiveAndFocusedState();
399     const WebCore::FloatRect& windowFrameInScreenCoordinates() const { return m_windowFrameInScreenCoordinates; }
400     const WebCore::FloatRect& windowFrameInUnflippedScreenCoordinates() const { return m_windowFrameInUnflippedScreenCoordinates; }
401     const WebCore::FloatRect& viewFrameInWindowCoordinates() const { return m_viewFrameInWindowCoordinates; }
402
403     bool hasCachedWindowFrame() const { return m_hasCachedWindowFrame; }
404
405 #if !PLATFORM(IOS)
406     void setTopOverhangImage(PassRefPtr<WebImage>);
407     void setBottomOverhangImage(PassRefPtr<WebImage>);
408 #endif // !PLATFORM(IOS)
409
410     void updateHeaderAndFooterLayersForDeviceScaleChange(float scaleFactor);
411 #endif // PLATFORM(COCOA)
412
413     bool windowIsFocused() const;
414     bool windowAndWebPageAreFocused() const;
415
416 #if !PLATFORM(IOS)
417     void setHeaderPageBanner(PassRefPtr<PageBanner>);
418     PageBanner* headerPageBanner();
419     void setFooterPageBanner(PassRefPtr<PageBanner>);
420     PageBanner* footerPageBanner();
421
422     void hidePageBanners();
423     void showPageBanners();
424     
425 #endif // !PLATFORM(IOS)
426
427     WebCore::IntPoint screenToRootView(const WebCore::IntPoint&);
428     WebCore::IntRect rootViewToScreen(const WebCore::IntRect&);
429     
430 #if PLATFORM(IOS)
431     WebCore::IntPoint accessibilityScreenToRootView(const WebCore::IntPoint&);
432     WebCore::IntRect rootViewToAccessibilityScreen(const WebCore::IntRect&);
433 #endif
434     
435     PassRefPtr<WebImage> scaledSnapshotWithOptions(const WebCore::IntRect&, double additionalScaleFactor, SnapshotOptions);
436     PassRefPtr<WebImage> snapshotAtSize(const WebCore::IntRect&, const WebCore::IntSize& bitmapSize, SnapshotOptions);
437     PassRefPtr<WebImage> snapshotNode(WebCore::Node&, SnapshotOptions, unsigned maximumPixelCount = std::numeric_limits<unsigned>::max());
438
439     static const WebEvent* currentEvent();
440
441     FindController& findController() { return m_findController; }
442
443 #if ENABLE(GEOLOCATION)
444     GeolocationPermissionRequestManager& geolocationPermissionRequestManager() { return m_geolocationPermissionRequestManager; }
445 #endif
446
447 #if PLATFORM(IOS) || PLATFORM(EFL)
448     void savePageState(WebCore::HistoryItem&);
449     void restorePageState(const WebCore::HistoryItem&);
450 #endif
451
452 #if PLATFORM(IOS)
453     WebCore::FloatSize screenSize() const;
454     WebCore::FloatSize availableScreenSize() const;
455     int32_t deviceOrientation() const { return m_deviceOrientation; }
456     void viewportPropertiesDidChange(const WebCore::ViewportArguments&);
457     void didReceiveMobileDocType(bool);
458
459     void setUseTestingViewportConfiguration(bool useTestingViewport) { m_useTestingViewportConfiguration = useTestingViewport; }
460     bool isUsingTestingViewportConfiguration() const { return m_useTestingViewportConfiguration; }
461
462     double minimumPageScaleFactor() const;
463     double maximumPageScaleFactor() const;
464     bool allowsUserScaling() const;
465     bool hasStablePageScaleFactor() const { return m_hasStablePageScaleFactor; }
466
467     void handleTap(const WebCore::IntPoint&);
468     void potentialTapAtPosition(uint64_t requestID, const WebCore::FloatPoint&);
469     void commitPotentialTap();
470     void commitPotentialTapFailed();
471     void cancelPotentialTap();
472     void tapHighlightAtPosition(uint64_t requestID, const WebCore::FloatPoint&);
473
474     void inspectorNodeSearchMovedToPosition(const WebCore::FloatPoint&);
475     void inspectorNodeSearchEndedAtPosition(const WebCore::FloatPoint&);
476
477     void blurAssistedNode();
478     void selectWithGesture(const WebCore::IntPoint&, uint32_t granularity, uint32_t gestureType, uint32_t gestureState, uint64_t callbackID);
479     void updateSelectionWithTouches(const WebCore::IntPoint& point, uint32_t touches, bool baseIsStart, uint64_t callbackID);
480     void updateBlockSelectionWithTouch(const WebCore::IntPoint&, uint32_t touch, uint32_t handlePosition);
481     void selectWithTwoTouches(const WebCore::IntPoint& from, const WebCore::IntPoint& to, uint32_t gestureType, uint32_t gestureState, uint64_t callbackID);
482     void extendSelection(uint32_t granularity);
483     void selectWordBackward();
484     void moveSelectionByOffset(int32_t offset, uint64_t callbackID);
485     void elementDidFocus(WebCore::Node*);
486     void elementDidBlur(WebCore::Node*);
487     void requestDictationContext(uint64_t callbackID);
488     void replaceDictatedText(const String& oldText, const String& newText);
489     void replaceSelectedText(const String& oldText, const String& newText);
490     void requestAutocorrectionData(const String& textForAutocorrection, uint64_t callbackID);
491     void applyAutocorrection(const String& correction, const String& originalText, uint64_t callbackID);
492     void syncApplyAutocorrection(const String& correction, const String& originalText, bool& correctionApplied);
493     void requestAutocorrectionContext(uint64_t callbackID);
494     void getAutocorrectionContext(String& beforeText, String& markedText, String& selectedText, String& afterText, uint64_t& location, uint64_t& length);
495     void getPositionInformation(const WebCore::IntPoint&, InteractionInformationAtPosition&);
496     void requestPositionInformation(const WebCore::IntPoint&);
497     void startInteractionWithElementAtPosition(const WebCore::IntPoint&);
498     void stopInteraction();
499     void performActionOnElement(uint32_t action);
500     void focusNextAssistedNode(bool isForward);
501     void setAssistedNodeValue(const String&);
502     void setAssistedNodeValueAsNumber(double);
503     void setAssistedNodeSelectedIndex(uint32_t index, bool allowMultipleSelection);
504     WebCore::IntRect rectForElementAtInteractionLocation();
505     void updateSelectionAppearance();
506
507     void dispatchAsynchronousTouchEvents(const Vector<WebTouchEvent, 1>& queue);
508     void contentSizeCategoryDidChange(const String&);
509     void executeEditCommandWithCallback(const String&, uint64_t callbackID);
510
511     std::chrono::milliseconds eventThrottlingDelay() const;
512 #if ENABLE(INSPECTOR)
513     void showInspectorHighlight(const WebCore::Highlight&);
514     void hideInspectorHighlight();
515
516     void showInspectorIndication();
517     void hideInspectorIndication();
518
519     void enableInspectorNodeSearch();
520     void disableInspectorNodeSearch();
521 #endif
522 #endif
523
524     NotificationPermissionRequestManager* notificationPermissionRequestManager();
525
526     void pageDidScroll();
527 #if USE(TILED_BACKING_STORE)
528     void pageDidRequestScroll(const WebCore::IntPoint&);
529     void setFixedVisibleContentRect(const WebCore::IntRect&);
530     void sendViewportAttributesChanged();
531 #endif
532
533 #if ENABLE(CONTEXT_MENUS)
534     WebContextMenu* contextMenu();
535     WebContextMenu* contextMenuAtPointInWindow(const WebCore::IntPoint&);
536 #endif
537     
538     bool hasLocalDataForURL(const WebCore::URL&);
539     String cachedResponseMIMETypeForURL(const WebCore::URL&);
540     String cachedSuggestedFilenameForURL(const WebCore::URL&);
541     PassRefPtr<WebCore::SharedBuffer> cachedResponseDataForURL(const WebCore::URL&);
542
543     static bool canHandleRequest(const WebCore::ResourceRequest&);
544
545     class SandboxExtensionTracker {
546     public:
547         ~SandboxExtensionTracker();
548
549         void invalidate();
550
551         void beginLoad(WebFrame*, const SandboxExtension::Handle& handle);
552         void willPerformLoadDragDestinationAction(PassRefPtr<SandboxExtension> pendingDropSandboxExtension);
553         void didStartProvisionalLoad(WebFrame*);
554         void didCommitProvisionalLoad(WebFrame*);
555         void didFailProvisionalLoad(WebFrame*);
556
557     private:
558         void setPendingProvisionalSandboxExtension(PassRefPtr<SandboxExtension>);
559
560         RefPtr<SandboxExtension> m_pendingProvisionalSandboxExtension;
561         RefPtr<SandboxExtension> m_provisionalSandboxExtension;
562         RefPtr<SandboxExtension> m_committedSandboxExtension;
563     };
564
565     SandboxExtensionTracker& sandboxExtensionTracker() { return m_sandboxExtensionTracker; }
566
567 #if PLATFORM(EFL)
568     void setThemePath(const String&);
569 #endif
570
571 #if USE(TILED_BACKING_STORE)
572     void commitPageTransitionViewport();
573 #endif
574
575 #if PLATFORM(GTK)
576     void setComposition(const String& text, const Vector<WebCore::CompositionUnderline>& underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeLength);
577     void confirmComposition(const String& text, int64_t selectionStart, int64_t selectionLength);
578     void cancelComposition();
579 #endif
580
581 #if PLATFORM (GTK) && HAVE(GTK_GESTURES)
582     void getCenterForZoomGesture(const WebCore::IntPoint& centerInViewCoordinates, WebCore::IntPoint& result);
583 #endif
584
585     void didChangeSelection();
586
587 #if PLATFORM(COCOA)
588     void registerUIProcessAccessibilityTokens(const IPC::DataReference& elemenToken, const IPC::DataReference& windowToken);
589     WKAccessibilityWebPageObject* accessibilityRemoteObject();
590     NSObject *accessibilityObjectForMainFramePlugin();
591     const WebCore::FloatPoint& accessibilityPosition() const { return m_accessibilityPosition; }
592     
593     void sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String& textInput);
594
595     void insertTextAsync(const String& text, const EditingRange& replacementRange, bool registerUndoGroup = false);
596     void getMarkedRangeAsync(uint64_t callbackID);
597     void getSelectedRangeAsync(uint64_t callbackID);
598     void characterIndexForPointAsync(const WebCore::IntPoint&, uint64_t callbackID);
599     void firstRectForCharacterRangeAsync(const EditingRange&, uint64_t callbackID);
600     void setCompositionAsync(const String& text, Vector<WebCore::CompositionUnderline> underlines, const EditingRange& selectionRange, const EditingRange& replacementRange);
601     void confirmCompositionAsync();
602
603 #if PLATFORM(MAC)
604     void insertDictatedTextAsync(const String& text, const EditingRange& replacementRange, const Vector<WebCore::DictationAlternative>& dictationAlternativeLocations, bool registerUndoGroup = false);
605     void attributedSubstringForCharacterRangeAsync(const EditingRange&, uint64_t callbackID);
606 #if !USE(ASYNC_NSTEXTINPUTCLIENT)
607     void insertText(const String& text, const EditingRange& replacementRange, bool& handled, EditorState& newState);
608     void setComposition(const String& text, Vector<WebCore::CompositionUnderline> underlines, const EditingRange& selectionRange, const EditingRange& replacementRange, EditorState& newState);
609     void confirmComposition(EditorState& newState);
610     void insertDictatedText(const String& text, const EditingRange& replacementRange, const Vector<WebCore::DictationAlternative>& dictationAlternativeLocations, bool& handled, EditorState& newState);
611     void getAttributedSubstringFromRange(const EditingRange&, AttributedString&);
612     void getMarkedRange(EditingRange&);
613     void getSelectedRange(EditingRange&);
614     void characterIndexForPoint(const WebCore::IntPoint point, uint64_t& result);
615     void firstRectForCharacterRange(const EditingRange&, WebCore::IntRect& resultRect);
616     void executeKeypressCommands(const Vector<WebCore::KeypressCommand>&, bool& handled, EditorState& newState);
617     void cancelComposition(EditorState& newState);
618 #endif
619 #endif
620
621     void readSelectionFromPasteboard(const WTF::String& pasteboardName, bool& result);
622     void getStringSelectionForPasteboard(WTF::String& stringValue);
623     void getDataSelectionForPasteboard(const WTF::String pasteboardType, SharedMemory::Handle& handle, uint64_t& size);
624     void shouldDelayWindowOrderingEvent(const WebKit::WebMouseEvent&, bool& result);
625     void acceptsFirstMouse(int eventNumber, const WebKit::WebMouseEvent&, bool& result);
626     bool performNonEditingBehaviorForSelector(const String&, WebCore::KeyboardEvent*);
627
628 #if ENABLE(SERVICE_CONTROLS)
629     void replaceSelectionWithPasteboardData(const Vector<String>& types, const IPC::DataReference&);
630 #endif
631
632 #elif PLATFORM(EFL)
633     void confirmComposition(const String& compositionString);
634     void setComposition(const WTF::String& compositionString, const WTF::Vector<WebCore::CompositionUnderline>& underlines, uint64_t cursorPosition);
635     void cancelComposition();
636 #elif PLATFORM(GTK)
637 #if USE(TEXTURE_MAPPER_GL)
638     void setAcceleratedCompositingWindowId(uint64_t nativeWindowHandle);
639 #endif
640 #endif
641
642 #if HAVE(ACCESSIBILITY) && (PLATFORM(GTK) || PLATFORM(EFL))
643     void updateAccessibilityTree();
644 #endif
645
646     void setCompositionForTesting(const String& compositionString, uint64_t from, uint64_t length);
647     bool hasCompositionForTesting();
648     void confirmCompositionForTesting(const String& compositionString);
649
650     // FIXME: This a dummy message, to avoid breaking the build for platforms that don't require
651     // any synchronous messages, and should be removed when <rdar://problem/8775115> is fixed.
652     void dummy(bool&);
653
654 #if PLATFORM(COCOA)
655     void performDictionaryLookupForSelection(WebCore::Frame*, const WebCore::VisibleSelection&);
656
657     bool isSpeaking();
658     void speak(const String&);
659     void stopSpeaking();
660
661 #endif
662
663     bool isSmartInsertDeleteEnabled();
664     void setSmartInsertDeleteEnabled(bool);
665
666     bool isSelectTrailingWhitespaceEnabled();
667     void setSelectTrailingWhitespaceEnabled(bool);
668
669     void replaceSelectionWithText(WebCore::Frame*, const String&);
670     void clearSelection();
671
672 #if ENABLE(DRAG_SUPPORT)
673 #if PLATFORM(GTK)
674     void performDragControllerAction(uint64_t action, WebCore::DragData);
675 #else
676     void performDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, const WTF::String& dragStorageName, uint32_t flags, const SandboxExtension::Handle&, const SandboxExtension::HandleArray&);
677 #endif
678     void dragEnded(WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t operation);
679
680     void willPerformLoadDragDestinationAction();
681     void mayPerformUploadDragDestinationAction();
682 #endif // ENABLE(DRAG_SUPPORT)
683
684     void beginPrinting(uint64_t frameID, const PrintInfo&);
685     void endPrinting();
686     void computePagesForPrinting(uint64_t frameID, const PrintInfo&, uint64_t callbackID);
687     void computePagesForPrintingImpl(uint64_t frameID, const PrintInfo&, Vector<WebCore::IntRect>& pageRects, double& totalScaleFactor);
688 #if PLATFORM(COCOA)
689     void drawRectToImage(uint64_t frameID, const PrintInfo&, const WebCore::IntRect&, const WebCore::IntSize&, uint64_t callbackID);
690     void drawPagesToPDF(uint64_t frameID, const PrintInfo&, uint32_t first, uint32_t count, uint64_t callbackID);
691     void drawPagesToPDFImpl(uint64_t frameID, const PrintInfo&, uint32_t first, uint32_t count, RetainPtr<CFMutableDataRef>& pdfPageData);
692 #if PLATFORM(IOS)
693     void computePagesForPrintingAndStartDrawingToPDF(uint64_t frameID, const PrintInfo&, uint32_t firstPage, PassRefPtr<Messages::WebPage::ComputePagesForPrintingAndStartDrawingToPDF::DelayedReply>);
694 #endif
695 #elif PLATFORM(GTK)
696     void drawPagesForPrinting(uint64_t frameID, const PrintInfo&, uint64_t callbackID);
697     void didFinishPrintOperation(const WebCore::ResourceError&, uint64_t callbackID);
698 #endif
699
700     void addResourceRequest(unsigned long, const WebCore::ResourceRequest&);
701     void removeResourceRequest(unsigned long);
702
703     void setMediaVolume(float);
704     void setMuted(bool);
705     void setMayStartMediaWhenInWindow(bool);
706
707     void updateMainFrameScrollOffsetPinning();
708
709     bool mainFrameHasCustomContentProvider() const;
710     void addMIMETypeWithCustomContentProvider(const String&);
711
712     void mainFrameDidLayout();
713
714     bool canRunBeforeUnloadConfirmPanel() const { return m_canRunBeforeUnloadConfirmPanel; }
715     void setCanRunBeforeUnloadConfirmPanel(bool canRunBeforeUnloadConfirmPanel) { m_canRunBeforeUnloadConfirmPanel = canRunBeforeUnloadConfirmPanel; }
716
717     bool canRunModal() const { return m_canRunModal; }
718     void setCanRunModal(bool canRunModal) { m_canRunModal = canRunModal; }
719
720     void runModal();
721
722     void setDeviceScaleFactor(float);
723     float deviceScaleFactor() const;
724
725     void forceRepaintWithoutCallback();
726
727     void unmarkAllMisspellings();
728     void unmarkAllBadGrammar();
729 #if PLATFORM(COCOA)
730     void handleAlternativeTextUIResult(const String&);
731 #endif
732
733     // For testing purpose.
734     void simulateMouseDown(int button, WebCore::IntPoint, int clickCount, WKEventModifiers, double time);
735     void simulateMouseUp(int button, WebCore::IntPoint, int clickCount, WKEventModifiers, double time);
736     void simulateMouseMotion(WebCore::IntPoint, double time);
737
738 #if ENABLE(CONTEXT_MENUS)
739     void contextMenuShowing() { m_isShowingContextMenu = true; }
740 #endif
741
742     void wheelEvent(const WebWheelEvent&);
743
744     void numWheelEventHandlersChanged(unsigned);
745     void recomputeShortCircuitHorizontalWheelEventsState();
746
747     void updateVisibilityState(bool isInitialState = false);
748
749 #if PLATFORM(IOS)
750     void setViewportConfigurationMinimumLayoutSize(const WebCore::FloatSize&);
751     void setViewportConfigurationMinimumLayoutSizeForMinimalUI(const WebCore::FloatSize&);
752     void setMaximumUnobscuredSize(const WebCore::FloatSize&);
753     void setDeviceOrientation(int32_t);
754     void dynamicViewportSizeUpdate(const WebCore::FloatSize& minimumLayoutSize, const WebCore::FloatSize& minimumLayoutSizeForMinimalUI, const WebCore::FloatSize& maximumUnobscuredSize, const WebCore::FloatRect& targetExposedContentRect, const WebCore::FloatRect& targetUnobscuredRect, const WebCore::FloatRect& targetUnobscuredRectInScrollViewCoordinates, double scale, int32_t deviceOrientation);
755     void synchronizeDynamicViewportUpdate(double& newTargetScale, WebCore::FloatPoint& newScrollPosition, uint64_t& nextValidLayerTreeTransactionID);
756     void updateVisibleContentRects(const VisibleContentRectUpdateInfo&, double oldestTimestamp);
757     bool scaleWasSetByUIProcess() const { return m_scaleWasSetByUIProcess; }
758     void willStartUserTriggeredZooming();
759     void applicationWillResignActive();
760     void applicationWillEnterForeground();
761     void applicationDidBecomeActive();
762     void zoomToRect(WebCore::FloatRect, double minimumScale, double maximumScale);
763     void dispatchTouchEvent(const WebTouchEvent&, bool& handled);
764     void completePendingSyntheticClickForContentChangeObserver();
765 #endif
766
767 #if PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL)
768     uint64_t nativeWindowHandle() { return m_nativeWindowHandle; }
769 #endif
770
771     bool shouldUseCustomContentProviderForResponse(const WebCore::ResourceResponse&);
772     bool canPluginHandleResponse(const WebCore::ResourceResponse& response);
773
774     bool asynchronousPluginInitializationEnabled() const { return m_asynchronousPluginInitializationEnabled; }
775     void setAsynchronousPluginInitializationEnabled(bool enabled) { m_asynchronousPluginInitializationEnabled = enabled; }
776     bool asynchronousPluginInitializationEnabledForAllPlugins() const { return m_asynchronousPluginInitializationEnabledForAllPlugins; }
777     void setAsynchronousPluginInitializationEnabledForAllPlugins(bool enabled) { m_asynchronousPluginInitializationEnabledForAllPlugins = enabled; }
778     bool artificialPluginInitializationDelayEnabled() const { return m_artificialPluginInitializationDelayEnabled; }
779     void setArtificialPluginInitializationDelayEnabled(bool enabled) { m_artificialPluginInitializationDelayEnabled = enabled; }
780     void setTabToLinksEnabled(bool enabled) { m_tabToLinks = enabled; }
781     bool tabToLinksEnabled() const { return m_tabToLinks; }
782
783     bool scrollingPerformanceLoggingEnabled() const { return m_scrollingPerformanceLoggingEnabled; }
784     void setScrollingPerformanceLoggingEnabled(bool);
785
786 #if PLATFORM(COCOA)
787     bool shouldUsePDFPlugin() const;
788     bool pdfPluginEnabled() const { return m_pdfPluginEnabled; }
789     void setPDFPluginEnabled(bool enabled) { m_pdfPluginEnabled = enabled; }
790 #endif
791
792     void savePDFToFileInDownloadsFolder(const String& suggestedFilename, const String& originatingURLString, const uint8_t* data, unsigned long size);
793 #if PLATFORM(COCOA)
794     void savePDFToTemporaryFolderAndOpenWithNativeApplication(const String& suggestedFilename, const String& originatingURLString, const uint8_t* data, unsigned long size, const String& pdfUUID);
795 #endif
796
797     bool mainFrameIsScrollable() const { return m_mainFrameIsScrollable; }
798
799     void setMinimumLayoutSize(const WebCore::IntSize&);
800     WebCore::IntSize minimumLayoutSize() const { return m_minimumLayoutSize; }
801
802     void setAutoSizingShouldExpandToViewHeight(bool shouldExpand);
803     bool autoSizingShouldExpandToViewHeight() { return m_autoSizingShouldExpandToViewHeight; }
804
805     bool canShowMIMEType(const String& MIMEType) const;
806
807     void addTextCheckingRequest(uint64_t requestID, PassRefPtr<WebCore::TextCheckingRequest>);
808     void didFinishCheckingText(uint64_t requestID, const Vector<WebCore::TextCheckingResult>&);
809     void didCancelCheckingText(uint64_t requestID);
810
811 #if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
812     void determinePrimarySnapshottedPlugIn();
813     void determinePrimarySnapshottedPlugInTimerFired();
814     void resetPrimarySnapshottedPlugIn();
815     bool matchesPrimaryPlugIn(const String& pageOrigin, const String& pluginOrigin, const String& mimeType) const;
816     bool plugInIntersectsSearchRect(WebCore::HTMLPlugInImageElement& pluginImageElement);
817     bool plugInIsPrimarySize(WebCore::HTMLPlugInImageElement& pluginImageElement, unsigned &pluginArea);
818 #endif
819
820     unsigned extendIncrementalRenderingSuppression();
821     void stopExtendingIncrementalRenderingSuppression(unsigned token);
822     bool shouldExtendIncrementalRenderingSuppression() { return !m_activeRenderingSuppressionTokens.isEmpty(); }
823
824     WebCore::ScrollPinningBehavior scrollPinningBehavior() { return m_scrollPinningBehavior; }
825     void setScrollPinningBehavior(uint32_t /* WebCore::ScrollPinningBehavior */ pinning);
826
827     PassRefPtr<WebCore::DocumentLoader> createDocumentLoader(WebCore::Frame&, const WebCore::ResourceRequest&, const WebCore::SubstituteData&);
828
829     void getBytecodeProfile(uint64_t callbackID);
830     
831     // Some platforms require accessibility-enabled processes to spin the run loop so that the WebProcess doesn't hang.
832     // While this is not ideal, it does not have to be applied to every platform at the moment.
833     static bool synchronousMessagesShouldSpinRunLoop();
834
835 #if ENABLE(SERVICE_CONTROLS) || ENABLE(TELEPHONE_NUMBER_DETECTION)
836     void handleTelephoneNumberClick(const String& number, const WebCore::IntPoint&);
837     void handleSelectionServiceClick(WebCore::FrameSelection&, const Vector<String>& telephoneNumbers, const WebCore::IntPoint&);
838 #endif
839
840     void didChangeScrollOffsetForFrame(WebCore::Frame*);
841
842     void willChangeCurrentHistoryItemForMainFrame();
843
844 private:
845     WebPage(uint64_t pageID, const WebPageCreationParameters&);
846
847     // IPC::MessageSender
848     virtual IPC::Connection* messageSenderConnection() override;
849     virtual uint64_t messageSenderDestinationID() override;
850
851     void platformInitialize();
852     void platformDetach();
853
854     void didReceiveWebPageMessage(IPC::Connection*, IPC::MessageDecoder&);
855     void didReceiveSyncWebPageMessage(IPC::Connection*, IPC::MessageDecoder&, std::unique_ptr<IPC::MessageEncoder>&);
856
857 #if PLATFORM(IOS)
858     void resetViewportDefaultConfiguration(WebFrame* mainFrame);
859     void viewportConfigurationChanged();
860     void updateViewportSizeForCSSViewportUnits();
861
862     static void convertSelectionRectsToRootView(WebCore::FrameView*, Vector<WebCore::SelectionRect>&);
863     PassRefPtr<WebCore::Range> rangeForWebSelectionAtPosition(const WebCore::IntPoint&, const WebCore::VisiblePosition&, SelectionFlags&);
864     PassRefPtr<WebCore::Range> rangeForBlockAtPoint(const WebCore::IntPoint&);
865     void computeExpandAndShrinkThresholdsForHandle(const WebCore::IntPoint&, SelectionHandlePosition, float& growThreshold, float& shrinkThreshold);
866     PassRefPtr<WebCore::Range> changeBlockSelection(const WebCore::IntPoint&, SelectionHandlePosition, float& growThreshold, float& shrinkThreshold, SelectionFlags&);
867     PassRefPtr<WebCore::Range> expandedRangeFromHandle(WebCore::Range*, SelectionHandlePosition);
868     PassRefPtr<WebCore::Range> contractedRangeFromHandle(WebCore::Range* currentRange, SelectionHandlePosition, SelectionFlags&);
869     void getAssistedNodeInformation(AssistedNodeInformation&);
870     void platformInitializeAccessibility();
871     void handleSyntheticClick(WebCore::Node* nodeRespondingToClick, const WebCore::FloatPoint& location);
872     void completeSyntheticClick(WebCore::Node* nodeRespondingToClick, const WebCore::FloatPoint& location);
873     void sendTapHighlightForNodeIfNecessary(uint64_t requestID, WebCore::Node*);
874     void resetTextAutosizingBeforeLayoutIfNeeded(const WebCore::FloatSize& oldSize, const WebCore::FloatSize& newSize);
875 #endif
876 #if !PLATFORM(COCOA)
877     static const char* interpretKeyEvent(const WebCore::KeyboardEvent*);
878 #endif
879     bool performDefaultBehaviorForKeyEvent(const WebKeyboardEvent&);
880
881 #if PLATFORM(MAC)
882     bool executeKeypressCommandsInternal(const Vector<WebCore::KeypressCommand>&, WebCore::KeyboardEvent*);
883 #endif
884
885     String sourceForFrame(WebFrame*);
886
887     void loadDataImpl(uint64_t navigationID, PassRefPtr<WebCore::SharedBuffer>, const String& MIMEType, const String& encodingName, const WebCore::URL& baseURL, const WebCore::URL& failingURL, IPC::MessageDecoder&);
888     void loadString(uint64_t navigationID, const String&, const String& MIMEType, const WebCore::URL& baseURL, const WebCore::URL& failingURL, IPC::MessageDecoder&);
889
890     bool platformHasLocalDataForURL(const WebCore::URL&);
891
892     // Actions
893     void tryClose();
894     void loadRequest(uint64_t navigationID, const WebCore::ResourceRequest&, const SandboxExtension::Handle&, IPC::MessageDecoder&);
895     void loadData(const IPC::DataReference&, const String& MIMEType, const String& encodingName, const String& baseURL, IPC::MessageDecoder&);
896     void loadHTMLString(uint64_t navigationID, const String& htmlString, const String& baseURL, IPC::MessageDecoder&);
897     void loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL, IPC::MessageDecoder&);
898     void loadPlainTextString(const String&, IPC::MessageDecoder&);
899     void loadWebArchiveData(const IPC::DataReference&, IPC::MessageDecoder&);
900     void navigateToURLWithSimulatedClick(const String& url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint);
901     void reload(uint64_t navigationID, bool reloadFromOrigin, const SandboxExtension::Handle&);
902     void goForward(uint64_t navigationID, uint64_t);
903     void goBack(uint64_t navigationID, uint64_t);
904     void goToBackForwardItem(uint64_t navigationID, uint64_t);
905     void tryRestoreScrollPosition();
906     void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&);
907     void setWindowResizerSize(const WebCore::IntSize&);
908     void updateIsInWindow(bool isInitialState = false);
909     void setViewState(WebCore::ViewState::Flags, bool wantsDidUpdateViewState = false);
910     void validateCommand(const String&, uint64_t);
911     void executeEditCommand(const String&);
912
913     void mouseEvent(const WebMouseEvent&);
914     void mouseEventSyncForTesting(const WebMouseEvent&, bool&);
915     void wheelEventSyncForTesting(const WebWheelEvent&, bool&);
916     void keyEvent(const WebKeyboardEvent&);
917     void keyEventSyncForTesting(const WebKeyboardEvent&, bool&);
918 #if ENABLE(IOS_TOUCH_EVENTS)
919     void touchEventSync(const WebTouchEvent&, bool& handled);
920 #elif ENABLE(TOUCH_EVENTS)
921     void touchEvent(const WebTouchEvent&);
922     void touchEventSyncForTesting(const WebTouchEvent&, bool& handled);
923 #endif
924 #if ENABLE(CONTEXT_MENUS)
925     void contextMenuHidden() { m_isShowingContextMenu = false; }
926 #endif
927
928     static bool scroll(WebCore::Page*, WebCore::ScrollDirection, WebCore::ScrollGranularity);
929     static bool logicalScroll(WebCore::Page*, WebCore::ScrollLogicalDirection, WebCore::ScrollGranularity);
930
931     void loadURLInFrame(const String&, uint64_t frameID);
932
933     void restoreSession(const Vector<BackForwardListItemState>&);
934     void didRemoveBackForwardItem(uint64_t);
935
936 #if ENABLE(REMOTE_INSPECTOR)
937     void setAllowsRemoteInspection(bool);
938 #endif
939
940     void setDrawsBackground(bool);
941     void setDrawsTransparentBackground(bool);
942
943     void setTopContentInset(float);
944
945     void viewWillStartLiveResize();
946     void viewWillEndLiveResize();
947
948     void getContentsAsString(uint64_t callbackID);
949 #if ENABLE(MHTML)
950     void getContentsAsMHTMLData(uint64_t callbackID, bool useBinaryEncoding);
951 #endif
952     void getMainResourceDataOfFrame(uint64_t frameID, uint64_t callbackID);
953     void getResourceDataFromFrame(uint64_t frameID, const String& resourceURL, uint64_t callbackID);
954     void getRenderTreeExternalRepresentation(uint64_t callbackID);
955     void getSelectionOrContentsAsString(uint64_t callbackID);
956     void getSelectionAsWebArchiveData(uint64_t callbackID);
957     void getSourceForFrame(uint64_t frameID, uint64_t callbackID);
958     void getWebArchiveOfFrame(uint64_t frameID, uint64_t callbackID);
959     void runJavaScriptInMainFrame(const String&, uint64_t callbackID);
960     void forceRepaint(uint64_t callbackID);
961     void takeSnapshot(WebCore::IntRect snapshotRect, WebCore::IntSize bitmapSize, uint32_t options, uint64_t callbackID);
962
963     void preferencesDidChange(const WebPreferencesStore&);
964     void platformPreferencesDidChange(const WebPreferencesStore&);
965     void updatePreferences(const WebPreferencesStore&);
966
967     void didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction, uint64_t navigationID, uint64_t downloadID);
968     void setUserAgent(const String&);
969     void setCustomTextEncodingName(const String&);
970     void suspendActiveDOMObjectsAndAnimations();
971     void resumeActiveDOMObjectsAndAnimations();
972
973 #if PLATFORM(COCOA)
974     void performDictionaryLookupAtLocation(const WebCore::FloatPoint&);
975     void performDictionaryLookupForRange(WebCore::Frame*, WebCore::Range&, NSDictionary *options);
976     PassRefPtr<WebCore::Range> rangeForDictionaryLookupAtHitTestResult(const WebCore::HitTestResult&, NSDictionary **);
977     void performDictionaryLookupOfCurrentSelection();
978
979     void windowAndViewFramesChanged(const WebCore::FloatRect& windowFrameInScreenCoordinates, const WebCore::FloatRect& windowFrameInUnflippedScreenCoordinates, const WebCore::FloatRect& viewFrameInWindowCoordinates, const WebCore::FloatPoint& accessibilityViewCoordinates);
980
981     RetainPtr<PDFDocument> pdfDocumentForPrintingFrame(WebCore::Frame*);
982     void computePagesForPrintingPDFDocument(uint64_t frameID, const PrintInfo&, Vector<WebCore::IntRect>& resultPageRects);
983     void drawPDFDocument(CGContextRef, PDFDocument *, const PrintInfo&, const WebCore::IntRect&);
984     void drawPagesToPDFFromPDFDocument(CGContextRef, PDFDocument *, const PrintInfo&, uint32_t first, uint32_t count);
985 #endif
986
987     void setMainFrameIsScrollable(bool);
988
989     void unapplyEditCommand(uint64_t commandID);
990     void reapplyEditCommand(uint64_t commandID);
991     void didRemoveEditCommand(uint64_t commandID);
992
993     void findString(const String&, uint32_t findOptions, uint32_t maxMatchCount);
994     void findStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount);
995     void getImageForFindMatch(uint32_t matchIndex);
996     void selectFindMatch(uint32_t matchIndex);
997     void hideFindUI();
998     void countStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount);
999
1000 #if USE(COORDINATED_GRAPHICS)
1001     void findZoomableAreaForPoint(const WebCore::IntPoint&, const WebCore::IntSize& area);
1002 #endif
1003
1004     void didChangeSelectedIndexForActivePopupMenu(int32_t newIndex);
1005     void setTextForActivePopupMenu(int32_t index);
1006
1007 #if PLATFORM(GTK)
1008     void failedToShowPopupMenu();
1009 #endif
1010
1011 #if PLATFORM(IOS)
1012     void didChooseFilesForOpenPanelWithDisplayStringAndIcon(const Vector<String>&, const String& displayString, const IPC::DataReference& iconData);
1013 #endif
1014     void didChooseFilesForOpenPanel(const Vector<String>&);
1015     void didCancelForOpenPanel();
1016 #if ENABLE(SANDBOX_EXTENSIONS)
1017     void extendSandboxForFileFromOpenPanel(const SandboxExtension::Handle&);
1018 #endif
1019
1020     void didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed);
1021
1022     void didReceiveNotificationPermissionDecision(uint64_t notificationID, bool allowed);
1023
1024     void advanceToNextMisspelling(bool startBeforeSelection);
1025     void changeSpellingToWord(const String& word);
1026 #if USE(APPKIT)
1027     void uppercaseWord();
1028     void lowercaseWord();
1029     void capitalizeWord();
1030 #endif
1031
1032 #if ENABLE(CONTEXT_MENUS)
1033     void didSelectItemFromActiveContextMenu(const WebContextMenuItemData&);
1034 #endif
1035
1036     void changeSelectedIndex(int32_t index);
1037     void setCanStartMediaTimerFired();
1038
1039     bool canHandleUserEvents() const;
1040
1041     static bool platformCanHandleRequest(const WebCore::ResourceRequest&);
1042
1043     static PluginView* focusedPluginViewForFrame(WebCore::Frame&);
1044     static PluginView* pluginViewForFrame(WebCore::Frame*);
1045
1046     static PassRefPtr<WebCore::Range> rangeFromEditingRange(WebCore::Frame&, const EditingRange&);
1047
1048     void reportUsedFeatures();
1049
1050 #if PLATFORM(MAC)
1051     void performActionMenuHitTestAtLocation(WebCore::FloatPoint);
1052     void selectLookupTextAtLocation(WebCore::FloatPoint);
1053 #endif
1054
1055     uint64_t m_pageID;
1056
1057     std::unique_ptr<WebCore::Page> m_page;
1058     RefPtr<WebFrame> m_mainFrame;
1059     RefPtr<InjectedBundleBackForwardList> m_backForwardList;
1060
1061     RefPtr<WebPageGroupProxy> m_pageGroup;
1062
1063     String m_userAgent;
1064
1065     WebCore::IntSize m_viewSize;
1066     std::unique_ptr<DrawingArea> m_drawingArea;
1067
1068     HashSet<PluginView*> m_pluginViews;
1069     bool m_hasSeenPlugin;
1070
1071     HashMap<uint64_t, RefPtr<WebCore::TextCheckingRequest>> m_pendingTextCheckingRequestMap;
1072
1073     bool m_useFixedLayout;
1074
1075     bool m_drawsBackground;
1076     bool m_drawsTransparentBackground;
1077
1078     WebCore::Color m_underlayColor;
1079
1080     bool m_isInRedo;
1081     bool m_isClosed;
1082
1083     bool m_tabToLinks;
1084     
1085     bool m_asynchronousPluginInitializationEnabled;
1086     bool m_asynchronousPluginInitializationEnabledForAllPlugins;
1087     bool m_artificialPluginInitializationDelayEnabled;
1088
1089     bool m_scrollingPerformanceLoggingEnabled;
1090
1091     bool m_mainFrameIsScrollable;
1092
1093 #if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
1094     bool m_readyToFindPrimarySnapshottedPlugin;
1095     bool m_didFindPrimarySnapshottedPlugin;
1096     unsigned m_numberOfPrimarySnapshotDetectionAttempts;
1097     String m_primaryPlugInPageOrigin;
1098     String m_primaryPlugInOrigin;
1099     String m_primaryPlugInMimeType;
1100     RunLoop::Timer<WebPage> m_determinePrimarySnapshottedPlugInTimer;
1101 #endif
1102
1103     // The layer hosting mode.
1104     LayerHostingMode m_layerHostingMode;
1105
1106 #if PLATFORM(COCOA)
1107     bool m_pdfPluginEnabled;
1108
1109     bool m_hasCachedWindowFrame;
1110
1111     // The frame of the containing window in screen coordinates.
1112     WebCore::FloatRect m_windowFrameInScreenCoordinates;
1113
1114     // The frame of the containing window in unflipped screen coordinates.
1115     WebCore::FloatRect m_windowFrameInUnflippedScreenCoordinates;
1116
1117     // The frame of the view in window coordinates.
1118     WebCore::FloatRect m_viewFrameInWindowCoordinates;
1119
1120     // The accessibility position of the view.
1121     WebCore::FloatPoint m_accessibilityPosition;
1122     
1123     RetainPtr<WKAccessibilityWebPageObject> m_mockAccessibilityElement;
1124
1125     ViewGestureGeometryCollector m_viewGestureGeometryCollector;
1126
1127 #elif HAVE(ACCESSIBILITY) && (PLATFORM(GTK) || PLATFORM(EFL))
1128     GRefPtr<WebPageAccessibilityObject> m_accessibilityObject;
1129 #endif
1130
1131 #if PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL)
1132     // Our view's window in the UI process.
1133     uint64_t m_nativeWindowHandle;
1134 #endif
1135
1136 #if !PLATFORM(IOS)
1137     RefPtr<PageBanner> m_headerBanner;
1138     RefPtr<PageBanner> m_footerBanner;
1139 #endif // !PLATFORM(IOS)
1140
1141     RunLoop::Timer<WebPage> m_setCanStartMediaTimer;
1142     bool m_mayStartMediaWhenInWindow;
1143
1144     HashMap<uint64_t, RefPtr<WebUndoStep>> m_undoStepMap;
1145
1146     WebCore::IntSize m_windowResizerSize;
1147
1148 #if ENABLE(CONTEXT_MENUS)
1149     InjectedBundlePageContextMenuClient m_contextMenuClient;
1150 #endif
1151     InjectedBundlePageEditorClient m_editorClient;
1152     std::unique_ptr<API::InjectedBundle::FormClient> m_formClient;
1153     InjectedBundlePageLoaderClient m_loaderClient;
1154     InjectedBundlePagePolicyClient m_policyClient;
1155     InjectedBundlePageResourceLoadClient m_resourceLoadClient;
1156     std::unique_ptr<API::InjectedBundle::PageUIClient> m_uiClient;
1157 #if ENABLE(FULLSCREEN_API)
1158     InjectedBundlePageFullScreenClient m_fullScreenClient;
1159 #endif
1160     InjectedBundlePageDiagnosticLoggingClient m_logDiagnosticMessageClient;
1161
1162     FindController m_findController;
1163
1164 #if ENABLE(INSPECTOR)
1165     RefPtr<WebInspector> m_inspector;
1166     RefPtr<WebInspectorUI> m_inspectorUI;
1167 #endif
1168 #if PLATFORM(IOS)
1169     RefPtr<WebVideoFullscreenManager> m_videoFullscreenManager;
1170 #endif
1171 #if ENABLE(FULLSCREEN_API)
1172     RefPtr<WebFullScreenManager> m_fullScreenManager;
1173 #endif
1174     RefPtr<WebPopupMenu> m_activePopupMenu;
1175 #if ENABLE(CONTEXT_MENUS)
1176     RefPtr<WebContextMenu> m_contextMenu;
1177 #endif
1178 #if ENABLE(INPUT_TYPE_COLOR)
1179     WebColorChooser* m_activeColorChooser;
1180 #endif
1181     RefPtr<WebOpenPanelResultListener> m_activeOpenPanelResultListener;
1182     RefPtr<NotificationPermissionRequestManager> m_notificationPermissionRequestManager;
1183
1184     RefPtr<WebUserContentController> m_userContentController;
1185
1186 #if ENABLE(GEOLOCATION)
1187     GeolocationPermissionRequestManager m_geolocationPermissionRequestManager;
1188 #endif
1189
1190     std::unique_ptr<WebCore::PrintContext> m_printContext;
1191 #if PLATFORM(GTK)
1192     RefPtr<WebPrintOperationGtk> m_printOperation;
1193 #endif
1194
1195     SandboxExtensionTracker m_sandboxExtensionTracker;
1196
1197     RefPtr<SandboxExtension> m_pendingDropSandboxExtension;
1198     Vector<RefPtr<SandboxExtension>> m_pendingDropExtensionsForFileUpload;
1199
1200     bool m_canRunBeforeUnloadConfirmPanel;
1201
1202     bool m_canRunModal;
1203     bool m_isRunningModal;
1204
1205     bool m_cachedMainFrameIsPinnedToLeftSide;
1206     bool m_cachedMainFrameIsPinnedToRightSide;
1207     bool m_cachedMainFrameIsPinnedToTopSide;
1208     bool m_cachedMainFrameIsPinnedToBottomSide;
1209     bool m_canShortCircuitHorizontalWheelEvents;
1210     unsigned m_numWheelEventHandlers;
1211
1212     unsigned m_cachedPageCount;
1213
1214     HashSet<unsigned long> m_networkResourceRequestIdentifiers;
1215
1216     WebCore::IntSize m_minimumLayoutSize;
1217     bool m_autoSizingShouldExpandToViewHeight;
1218
1219 #if ENABLE(CONTEXT_MENUS)
1220     bool m_isShowingContextMenu;
1221 #endif
1222     
1223 #if PLATFORM(IOS)
1224     RefPtr<WebCore::Node> m_assistedNode;
1225     RefPtr<WebCore::Range> m_currentWordRange;
1226     RefPtr<WebCore::Node> m_interactionNode;
1227     WebCore::IntPoint m_lastInteractionLocation;
1228
1229     RefPtr<WebCore::Node> m_potentialTapNode;
1230     WebCore::FloatPoint m_potentialTapLocation;
1231
1232     WebCore::ViewportConfiguration m_viewportConfiguration;
1233     uint64_t m_firstLayerTreeTransactionIDAfterDidCommitLoad;
1234     bool m_hasReceivedVisibleContentRectsAfterDidCommitLoad;
1235     bool m_scaleWasSetByUIProcess;
1236     bool m_userHasChangedPageScaleFactor;
1237     bool m_hasStablePageScaleFactor;
1238     bool m_userIsInteracting;
1239     bool m_hasPendingBlurNotification;
1240     bool m_useTestingViewportConfiguration;
1241     bool m_isInStableState;
1242     std::chrono::milliseconds m_oldestNonStableUpdateVisibleContentRectsTimestamp;
1243     std::chrono::milliseconds m_estimatedLatency;
1244     WebCore::FloatSize m_screenSize;
1245     WebCore::FloatSize m_availableScreenSize;
1246     RefPtr<WebCore::Range> m_currentBlockSelection;
1247     WebCore::IntSize m_blockSelectionDesiredSize;
1248     WebCore::FloatSize m_maximumUnobscuredSize;
1249     int32_t m_deviceOrientation;
1250     bool m_inDynamicSizeUpdate;
1251     HashMap<std::pair<WebCore::IntSize, double>, WebCore::IntPoint> m_dynamicSizeUpdateHistory;
1252     RefPtr<WebCore::Node> m_pendingSyntheticClickNode;
1253     WebCore::FloatPoint m_pendingSyntheticClickLocation;
1254 #endif
1255
1256     WebInspectorClient* m_inspectorClient;
1257
1258     HashSet<String, CaseFoldingHash> m_mimeTypesWithCustomContentProviders;
1259     WebCore::Color m_backgroundColor;
1260
1261     HashSet<unsigned> m_activeRenderingSuppressionTokens;
1262     unsigned m_maximumRenderingSuppressionToken;
1263     
1264     WebCore::ScrollPinningBehavior m_scrollPinningBehavior;
1265
1266     bool m_useAsyncScrolling;
1267
1268     WebCore::ViewState::Flags m_viewState;
1269
1270     UserActivity m_processSuppressionDisabledByWebPreference;
1271
1272     uint64_t m_pendingNavigationID;
1273
1274 #if ENABLE(WEBGL)
1275     WebCore::WebGLLoadPolicy m_systemWebGLPolicy;
1276 #endif
1277 };
1278
1279 } // namespace WebKit
1280
1281 #endif // WebPage_h