1/*
2 * Copyright (C) 2010, 2011 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 "Connection.h"
31#include "DragControllerAction.h"
32#include "DrawingAreaProxy.h"
33#include "EditorState.h"
34#include "GeolocationPermissionRequestManagerProxy.h"
35#include "LayerTreeContext.h"
36#include "NotificationPermissionRequestManagerProxy.h"
37#include "PlatformProcessIdentifier.h"
38#include "SandboxExtension.h"
39#include "ShareableBitmap.h"
40#include "WKBase.h"
41#include "WKPagePrivate.h"
42#include "WebColorChooserProxy.h"
43#include "WebContextMenuItemData.h"
44#include "WebCoreArgumentCoders.h"
45#include "WebFindClient.h"
46#include "WebFormClient.h"
47#include "WebFrameProxy.h"
48#include "WebHistoryClient.h"
49#include "WebHitTestResult.h"
50#include "WebLoaderClient.h"
51#include "WebPageContextMenuClient.h"
52#include <WebCore/AlternativeTextClient.h> // FIXME: Needed by WebPageProxyMessages.h for DICTATION_ALTERNATIVES.
53#include "WebPageProxyMessages.h"
54#include "WebPolicyClient.h"
55#include "WebPopupMenuProxy.h"
56#include "WebUIClient.h"
57#include <WebCore/Color.h>
58#include <WebCore/DragActions.h>
59#include <WebCore/DragSession.h>
60#include <WebCore/HitTestResult.h>
61#include <WebCore/Page.h>
62#include <WebCore/PlatformScreen.h>
63#include <WebCore/ScrollTypes.h>
64#include <WebCore/TextChecking.h>
65#include <wtf/HashMap.h>
66#include <wtf/HashSet.h>
67#include <wtf/OwnPtr.h>
68#include <wtf/PassOwnPtr.h>
69#include <wtf/PassRefPtr.h>
70#include <wtf/RefPtr.h>
71#include <wtf/Vector.h>
72#include <wtf/text/WTFString.h>
73
74#if ENABLE(DRAG_SUPPORT)
75#include <WebCore/DragActions.h>
76#include <WebCore/DragSession.h>
77#endif
78
79#if ENABLE(TOUCH_EVENTS)
80#include "NativeWebTouchEvent.h"
81#endif
82
83#if PLATFORM(EFL)
84#include "WKPageEfl.h"
85#include "WebUIPopupMenuClient.h"
86#include <Evas.h>
87#endif
88
89#if PLATFORM(QT)
90#include "QtNetworkRequestData.h"
91#endif
92
93namespace CoreIPC {
94    class ArgumentDecoder;
95    class Connection;
96}
97
98namespace WebCore {
99    class AuthenticationChallenge;
100    class Cursor;
101    class DragData;
102    class FloatRect;
103    class GraphicsLayer;
104    class IntSize;
105    class ProtectionSpace;
106    class SharedBuffer;
107    struct FileChooserSettings;
108    struct TextAlternativeWithRange;
109    struct TextCheckingResult;
110    struct ViewportAttributes;
111    struct WindowFeatures;
112}
113
114#if PLATFORM(QT)
115class QQuickNetworkReply;
116#endif
117
118#if USE(APPKIT)
119#ifdef __OBJC__
120@class WKView;
121#else
122class WKView;
123#endif
124#endif
125
126#if PLATFORM(GTK)
127typedef GtkWidget* PlatformWidget;
128#endif
129
130namespace WebKit {
131
132class NativeWebKeyboardEvent;
133class NativeWebMouseEvent;
134class NativeWebWheelEvent;
135class PageClient;
136class PlatformCertificateInfo;
137class StringPairVector;
138class WebBackForwardList;
139class WebBackForwardListItem;
140class WebColorPickerResultListenerProxy;
141class WebContextMenuProxy;
142class WebData;
143class WebEditCommandProxy;
144class WebFullScreenManagerProxy;
145class WebKeyboardEvent;
146class WebMouseEvent;
147class WebOpenPanelResultListenerProxy;
148class WebPageGroup;
149class WebProcessProxy;
150class WebURLRequest;
151class WebWheelEvent;
152struct AttributedString;
153struct ColorSpaceData;
154struct DictionaryPopupInfo;
155struct EditorState;
156struct PlatformPopupMenuData;
157struct PrintInfo;
158struct WebPageCreationParameters;
159struct WebPopupItem;
160
161#if ENABLE(GESTURE_EVENTS)
162class WebGestureEvent;
163#endif
164
165#if ENABLE(VIBRATION)
166class WebVibrationProxy;
167#endif
168
169typedef GenericCallback<WKStringRef, StringImpl*> StringCallback;
170typedef GenericCallback<WKSerializedScriptValueRef, WebSerializedScriptValue*> ScriptValueCallback;
171
172#if PLATFORM(GTK)
173typedef GenericCallback<WKErrorRef> PrintFinishedCallback;
174#endif
175
176#if ENABLE(TOUCH_EVENTS)
177struct QueuedTouchEvents {
178    QueuedTouchEvents(const NativeWebTouchEvent& event)
179        : forwardedEvent(event)
180    {
181    }
182    NativeWebTouchEvent forwardedEvent;
183    Vector<NativeWebTouchEvent> deferredTouchEvents;
184};
185#endif
186
187// FIXME: Make a version of CallbackBase with three arguments, and define ValidateCommandCallback as a specialization.
188class ValidateCommandCallback : public CallbackBase {
189public:
190    typedef void (*CallbackFunction)(WKStringRef, bool, int32_t, WKErrorRef, void*);
191
192    static PassRefPtr<ValidateCommandCallback> create(void* context, CallbackFunction callback)
193    {
194        return adoptRef(new ValidateCommandCallback(context, callback));
195    }
196
197    virtual ~ValidateCommandCallback()
198    {
199        ASSERT(!m_callback);
200    }
201
202    void performCallbackWithReturnValue(StringImpl* returnValue1, bool returnValue2, int returnValue3)
203    {
204        ASSERT(m_callback);
205
206        m_callback(toAPI(returnValue1), returnValue2, returnValue3, 0, context());
207
208        m_callback = 0;
209    }
210
211    void invalidate()
212    {
213        ASSERT(m_callback);
214
215        RefPtr<WebError> error = WebError::create();
216        m_callback(0, 0, 0, toAPI(error.get()), context());
217
218        m_callback = 0;
219    }
220
221private:
222
223    ValidateCommandCallback(void* context, CallbackFunction callback)
224        : CallbackBase(context)
225        , m_callback(callback)
226    {
227    }
228
229    CallbackFunction m_callback;
230};
231
232class WebPageProxy
233    : public TypedAPIObject<APIObject::TypePage>
234#if ENABLE(INPUT_TYPE_COLOR)
235    , public WebColorChooserProxy::Client
236#endif
237    , public WebPopupMenuProxy::Client
238    , public CoreIPC::MessageReceiver {
239public:
240
241    static PassRefPtr<WebPageProxy> create(PageClient*, PassRefPtr<WebProcessProxy>, WebPageGroup*, uint64_t pageID);
242    virtual ~WebPageProxy();
243
244    uint64_t pageID() const { return m_pageID; }
245
246    WebFrameProxy* mainFrame() const { return m_mainFrame.get(); }
247    WebFrameProxy* focusedFrame() const { return m_focusedFrame.get(); }
248    WebFrameProxy* frameSetLargestFrame() const { return m_frameSetLargestFrame.get(); }
249
250    DrawingAreaProxy* drawingArea() const { return m_drawingArea.get(); }
251
252    WebBackForwardList* backForwardList() const { return m_backForwardList.get(); }
253
254#if ENABLE(INSPECTOR)
255    WebInspectorProxy* inspector();
256#endif
257
258#if ENABLE(VIBRATION)
259    WebVibrationProxy* vibration() { return m_vibration.get(); }
260#endif
261
262#if ENABLE(FULLSCREEN_API)
263    WebFullScreenManagerProxy* fullScreenManager();
264#endif
265
266#if ENABLE(CONTEXT_MENUS)
267    void initializeContextMenuClient(const WKPageContextMenuClient*);
268#endif
269    void initializeFindClient(const WKPageFindClient*);
270    void initializeFindMatchesClient(const WKPageFindMatchesClient*);
271    void initializeFormClient(const WKPageFormClient*);
272    void initializeLoaderClient(const WKPageLoaderClient*);
273    void initializePolicyClient(const WKPagePolicyClient*);
274    void initializeUIClient(const WKPageUIClient*);
275#if PLATFORM(EFL)
276    void initializeUIPopupMenuClient(const WKPageUIPopupMenuClient*);
277#endif
278
279    void initializeWebPage();
280
281    void close();
282    bool tryClose();
283    bool isClosed() const { return m_isClosed; }
284
285    void loadURL(const String&, APIObject* userData = 0);
286    void loadURLRequest(WebURLRequest*, APIObject* userData = 0);
287    void loadFile(const String& fileURL, const String& resourceDirectoryURL, APIObject* userData = 0);
288    void loadData(WebData*, const String& MIMEType, const String& encoding, const String& baseURL, APIObject* userData = 0);
289    void loadHTMLString(const String& htmlString, const String& baseURL, APIObject* userData = 0);
290    void loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL, APIObject* userData = 0);
291    void loadPlainTextString(const String& string, APIObject* userData = 0);
292    void loadWebArchiveData(const WebData*, APIObject* userData = 0);
293
294    void stopLoading();
295    void reload(bool reloadFromOrigin);
296
297    void goForward();
298    bool canGoForward() const;
299    void goBack();
300    bool canGoBack() const;
301
302    void goToBackForwardItem(WebBackForwardListItem*);
303    void tryRestoreScrollPosition();
304    void didChangeBackForwardList(WebBackForwardListItem* addedItem, Vector<RefPtr<APIObject>>* removedItems);
305    void shouldGoToBackForwardListItem(uint64_t itemID, bool& shouldGoToBackForwardListItem);
306    void willGoToBackForwardListItem(uint64_t itemID, CoreIPC::MessageDecoder&);
307
308    String activeURL() const;
309    String provisionalURL() const;
310    String committedURL() const;
311
312    bool willHandleHorizontalScrollEvents() const;
313
314    bool canShowMIMEType(const String& mimeType) const;
315
316    bool drawsBackground() const { return m_drawsBackground; }
317    void setDrawsBackground(bool);
318
319    bool drawsTransparentBackground() const { return m_drawsTransparentBackground; }
320    void setDrawsTransparentBackground(bool);
321
322    WebCore::Color underlayColor() const { return m_underlayColor; }
323    void setUnderlayColor(const WebCore::Color&);
324
325    void viewWillStartLiveResize();
326    void viewWillEndLiveResize();
327
328    void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&);
329    void setWindowResizerSize(const WebCore::IntSize&);
330
331    void clearSelection();
332
333    void setViewNeedsDisplay(const WebCore::IntRect&);
334    void displayView();
335    bool canScrollView();
336    void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
337
338    enum {
339        ViewWindowIsActive = 1 << 0,
340        ViewIsFocused = 1 << 1,
341        ViewIsVisible = 1 << 2,
342        ViewIsInWindow = 1 << 3,
343    };
344    typedef unsigned ViewStateFlags;
345    void viewStateDidChange(ViewStateFlags flags);
346    enum class WantsReplyOrNot { DoesNotWantReply, DoesWantReply };
347    void viewInWindowStateDidChange(WantsReplyOrNot = WantsReplyOrNot::DoesNotWantReply);
348    bool isInWindow() const { return m_isInWindow; }
349    void waitForDidUpdateInWindowState();
350
351    WebCore::IntSize viewSize() const;
352    bool isViewVisible() const { return m_isVisible; }
353    bool isViewWindowActive() const;
354
355    void executeEditCommand(const String& commandName);
356    void validateCommand(const String& commandName, PassRefPtr<ValidateCommandCallback>);
357
358    const EditorState& editorState() const { return m_editorState; }
359    bool canDelete() const { return hasSelectedRange() && isContentEditable(); }
360    bool hasSelectedRange() const { return m_editorState.selectionIsRange; }
361    bool isContentEditable() const { return m_editorState.isContentEditable; }
362
363    bool maintainsInactiveSelection() const { return m_maintainsInactiveSelection; }
364    void setMaintainsInactiveSelection(bool);
365#if USE(TILED_BACKING_STORE)
366    void didRenderFrame(const WebCore::IntSize& contentsSize, const WebCore::IntRect& coveredRect);
367#endif
368#if PLATFORM(QT)
369    void registerApplicationScheme(const String& scheme);
370    void resolveApplicationSchemeRequest(QtNetworkRequestData);
371    void sendApplicationSchemeReply(const QQuickNetworkReply*);
372    void authenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password);
373    void certificateVerificationRequest(const String& hostname, bool& ignoreErrors);
374    void proxyAuthenticationRequiredRequest(const String& hostname, uint16_t port, const String& prefilledUsername, String& username, String& password);
375#endif // PLATFORM(QT).
376#if PLATFORM(EFL)
377    void setThemePath(const String&);
378#endif
379
380#if PLATFORM(QT) || PLATFORM(GTK)
381    void setComposition(const String& text, Vector<WebCore::CompositionUnderline> underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeEnd);
382    void confirmComposition(const String& compositionString, int64_t selectionStart, int64_t selectionLength);
383    void cancelComposition();
384#endif
385
386#if PLATFORM(GTK)
387    void setInputMethodState(bool enabled);
388#endif
389
390#if PLATFORM(MAC)
391    void updateWindowIsVisible(bool windowIsVisible);
392    void windowAndViewFramesChanged(const WebCore::FloatRect& viewFrameInWindowCoordinates, const WebCore::FloatPoint& accessibilityViewCoordinates);
393    void viewExposedRectChanged(const WebCore::FloatRect& exposedRect, bool);
394    void exposedRectChangedTimerFired(WebCore::Timer<WebPageProxy>*);
395    void setMainFrameIsScrollable(bool);
396
397    void setComposition(const String& text, Vector<WebCore::CompositionUnderline> underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeEnd);
398    void confirmComposition();
399    void cancelComposition();
400    bool insertText(const String& text, uint64_t replacementRangeStart, uint64_t replacementRangeEnd);
401    bool insertDictatedText(const String& text, uint64_t replacementRangeStart, uint64_t replacementRangeEnd, const Vector<WebCore::TextAlternativeWithRange>& dictationAlternatives);
402    void getMarkedRange(uint64_t& location, uint64_t& length);
403    void getSelectedRange(uint64_t& location, uint64_t& length);
404    void getAttributedSubstringFromRange(uint64_t location, uint64_t length, AttributedString&);
405    uint64_t characterIndexForPoint(const WebCore::IntPoint);
406    WebCore::IntRect firstRectForCharacterRange(uint64_t, uint64_t);
407    bool executeKeypressCommands(const Vector<WebCore::KeypressCommand>&);
408
409    void sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String& textInput);
410    CGContextRef containingWindowGraphicsContext();
411    bool shouldDelayWindowOrderingForEvent(const WebMouseEvent&);
412    bool acceptsFirstMouse(int eventNumber, const WebMouseEvent&);
413
414    void setAcceleratedCompositingRootLayer(const WebCore::GraphicsLayer*);
415
416#if USE(APPKIT)
417    WKView* wkView() const;
418    void intrinsicContentSizeDidChange(const WebCore::IntSize& intrinsicContentSize);
419#endif
420#endif
421#if PLATFORM(EFL)
422    void handleInputMethodKeydown(bool& handled);
423    void confirmComposition(const String&);
424    void setComposition(const String&, Vector<WebCore::CompositionUnderline>&, int);
425    void cancelComposition();
426#endif
427#if PLATFORM(GTK)
428    PlatformWidget viewWidget();
429#endif
430#if USE(TILED_BACKING_STORE)
431    void commitPageTransitionViewport();
432#endif
433
434    void handleMouseEvent(const NativeWebMouseEvent&);
435    void handleWheelEvent(const NativeWebWheelEvent&);
436    void handleKeyboardEvent(const NativeWebKeyboardEvent&);
437#if ENABLE(GESTURE_EVENTS)
438    void handleGestureEvent(const WebGestureEvent&);
439#endif
440#if ENABLE(TOUCH_EVENTS)
441    void handleTouchEvent(const NativeWebTouchEvent&);
442#if PLATFORM(QT)
443    void handlePotentialActivation(const WebCore::IntPoint& touchPoint, const WebCore::IntSize& touchArea);
444#endif
445#endif
446
447    void scrollBy(WebCore::ScrollDirection, WebCore::ScrollGranularity);
448    void centerSelectionInVisibleArea();
449
450    String pageTitle() const;
451    const String& toolTip() const { return m_toolTip; }
452
453    void setUserAgent(const String&);
454    const String& userAgent() const { return m_userAgent; }
455    void setApplicationNameForUserAgent(const String&);
456    const String& applicationNameForUserAgent() const { return m_applicationNameForUserAgent; }
457    void setCustomUserAgent(const String&);
458    const String& customUserAgent() const { return m_customUserAgent; }
459    static String standardUserAgent(const String& applicationName = String());
460
461    bool supportsTextEncoding() const;
462    void setCustomTextEncodingName(const String&);
463    String customTextEncodingName() const { return m_customTextEncodingName; }
464
465    bool areActiveDOMObjectsAndAnimationsSuspended() const { return m_isPageSuspended; }
466    void resumeActiveDOMObjectsAndAnimations();
467    void suspendActiveDOMObjectsAndAnimations();
468
469    double estimatedProgress() const;
470
471    void terminateProcess();
472
473    typedef bool (*WebPageProxySessionStateFilterCallback)(WKPageRef, WKStringRef type, WKTypeRef object, void* context);
474    PassRefPtr<WebData> sessionStateData(WebPageProxySessionStateFilterCallback, void* context) const;
475    void restoreFromSessionStateData(WebData*);
476
477    bool supportsTextZoom() const;
478    double textZoomFactor() const { return m_mainFrameHasCustomRepresentation ? 1 : m_textZoomFactor; }
479    void setTextZoomFactor(double);
480    double pageZoomFactor() const;
481    void setPageZoomFactor(double);
482    void setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor);
483
484    void scalePage(double scale, const WebCore::IntPoint& origin);
485    double pageScaleFactor() const { return m_pageScaleFactor; }
486
487    float deviceScaleFactor() const;
488    void setIntrinsicDeviceScaleFactor(float);
489    void setCustomDeviceScaleFactor(float);
490    void windowScreenDidChange(PlatformDisplayID);
491
492    LayerHostingMode layerHostingMode() const { return m_layerHostingMode; }
493
494    void setUseFixedLayout(bool);
495    void setFixedLayoutSize(const WebCore::IntSize&);
496    bool useFixedLayout() const { return m_useFixedLayout; };
497    const WebCore::IntSize& fixedLayoutSize() const { return m_fixedLayoutSize; };
498
499    void listenForLayoutMilestones(WebCore::LayoutMilestones);
500
501    void setVisibilityState(WebCore::PageVisibilityState, bool isInitialState);
502    void didUpdateInWindowState() { m_waitingForDidUpdateInWindowState = false; }
503
504    bool hasHorizontalScrollbar() const { return m_mainFrameHasHorizontalScrollbar; }
505    bool hasVerticalScrollbar() const { return m_mainFrameHasVerticalScrollbar; }
506
507    void setSuppressScrollbarAnimations(bool);
508    bool areScrollbarAnimationsSuppressed() const { return m_suppressScrollbarAnimations; }
509
510    bool isPinnedToLeftSide() const { return m_mainFrameIsPinnedToLeftSide; }
511    bool isPinnedToRightSide() const { return m_mainFrameIsPinnedToRightSide; }
512    bool isPinnedToTopSide() const { return m_mainFrameIsPinnedToTopSide; }
513    bool isPinnedToBottomSide() const { return m_mainFrameIsPinnedToBottomSide; }
514
515    bool rubberBandsAtBottom() const { return m_rubberBandsAtBottom; }
516    void setRubberBandsAtBottom(bool);
517    bool rubberBandsAtTop() const { return m_rubberBandsAtTop; }
518    void setRubberBandsAtTop(bool);
519
520    void setPaginationMode(WebCore::Pagination::Mode);
521    WebCore::Pagination::Mode paginationMode() const { return m_paginationMode; }
522    void setPaginationBehavesLikeColumns(bool);
523    bool paginationBehavesLikeColumns() const { return m_paginationBehavesLikeColumns; }
524    void setPageLength(double);
525    double pageLength() const { return m_pageLength; }
526    void setGapBetweenPages(double);
527    double gapBetweenPages() const { return m_gapBetweenPages; }
528    unsigned pageCount() const { return m_pageCount; }
529
530#if PLATFORM(MAC)
531    // Called by the web process through a message.
532    void registerWebProcessAccessibilityToken(const CoreIPC::DataReference&);
533    // Called by the UI process when it is ready to send its tokens to the web process.
534    void registerUIProcessAccessibilityTokens(const CoreIPC::DataReference& elemenToken, const CoreIPC::DataReference& windowToken);
535    bool readSelectionFromPasteboard(const String& pasteboardName);
536    String stringSelectionForPasteboard();
537    PassRefPtr<WebCore::SharedBuffer> dataSelectionForPasteboard(const String& pasteboardType);
538    void makeFirstResponder();
539
540    ColorSpaceData colorSpace();
541#endif
542
543    void pageScaleFactorDidChange(double);
544    void pageZoomFactorDidChange(double);
545
546    void setMemoryCacheClientCallsEnabled(bool);
547
548    // Find.
549    void findString(const String&, FindOptions, unsigned maxMatchCount);
550    void findStringMatches(const String&, FindOptions, unsigned maxMatchCount);
551    void getImageForFindMatch(int32_t matchIndex);
552    void selectFindMatch(int32_t matchIndex);
553    void didGetImageForFindMatch(const ShareableBitmap::Handle& contentImageHandle, uint32_t matchIndex);
554    void hideFindUI();
555    void countStringMatches(const String&, FindOptions, unsigned maxMatchCount);
556    void didCountStringMatches(const String&, uint32_t matchCount);
557    void setFindIndicator(const WebCore::FloatRect& selectionRectInWindowCoordinates, const Vector<WebCore::FloatRect>& textRectsInSelectionRectCoordinates, float contentImageScaleFactor, const ShareableBitmap::Handle& contentImageHandle, bool fadeOut, bool animate);
558    void didFindString(const String&, uint32_t matchCount);
559    void didFailToFindString(const String&);
560    void didFindStringMatches(const String&, Vector<Vector<WebCore::IntRect>> matchRects, int32_t firstIndexAfterSelection);
561
562    void getContentsAsString(PassRefPtr<StringCallback>);
563#if ENABLE(MHTML)
564    void getContentsAsMHTMLData(PassRefPtr<DataCallback>, bool useBinaryEncoding);
565#endif
566    void getMainResourceDataOfFrame(WebFrameProxy*, PassRefPtr<DataCallback>);
567    void getResourceDataFromFrame(WebFrameProxy*, WebURL*, PassRefPtr<DataCallback>);
568    void getRenderTreeExternalRepresentation(PassRefPtr<StringCallback>);
569    void getSelectionOrContentsAsString(PassRefPtr<StringCallback>);
570    void getSelectionAsWebArchiveData(PassRefPtr<DataCallback>);
571    void getSourceForFrame(WebFrameProxy*, PassRefPtr<StringCallback>);
572    void getWebArchiveOfFrame(WebFrameProxy*, PassRefPtr<DataCallback>);
573    void runJavaScriptInMainFrame(const String&, PassRefPtr<ScriptValueCallback>);
574    void forceRepaint(PassRefPtr<VoidCallback>);
575
576    float headerHeight(WebFrameProxy*);
577    float footerHeight(WebFrameProxy*);
578    void drawHeader(WebFrameProxy*, const WebCore::FloatRect&);
579    void drawFooter(WebFrameProxy*, const WebCore::FloatRect&);
580
581#if PLATFORM(MAC)
582    // Dictionary.
583    void performDictionaryLookupAtLocation(const WebCore::FloatPoint&);
584#endif
585
586    void receivedPolicyDecision(WebCore::PolicyAction, WebFrameProxy*, uint64_t listenerID);
587
588    void backForwardRemovedItem(uint64_t itemID);
589
590#if ENABLE(DRAG_SUPPORT)
591    // Drag and drop support.
592    void dragEntered(WebCore::DragData*, const String& dragStorageName = String());
593    void dragUpdated(WebCore::DragData*, const String& dragStorageName = String());
594    void dragExited(WebCore::DragData*, const String& dragStorageName = String());
595    void performDrag(WebCore::DragData*, const String& dragStorageName, const SandboxExtension::Handle&, const SandboxExtension::HandleArray&);
596
597    void didPerformDragControllerAction(WebCore::DragSession);
598    void dragEnded(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition, uint64_t operation);
599#if PLATFORM(MAC)
600    void setDragImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& dragImageHandle, bool isLinkDrag);
601    void setPromisedData(const String& pasteboardName, const SharedMemory::Handle& imageHandle, uint64_t imageSize, const String& filename, const String& extension,
602                         const String& title, const String& url, const String& visibleURL, const SharedMemory::Handle& archiveHandle, uint64_t archiveSize);
603#endif
604#if PLATFORM(QT) || PLATFORM(GTK)
605    void startDrag(const WebCore::DragData&, const ShareableBitmap::Handle& dragImage);
606#endif
607#endif
608
609    void processDidBecomeUnresponsive();
610    void interactionOccurredWhileProcessUnresponsive();
611    void processDidBecomeResponsive();
612    void processDidCrash();
613
614#if USE(ACCELERATED_COMPOSITING)
615    virtual void enterAcceleratedCompositingMode(const LayerTreeContext&);
616    virtual void exitAcceleratedCompositingMode();
617    virtual void updateAcceleratedCompositingMode(const LayerTreeContext&);
618#endif
619
620    void didDraw();
621
622    enum UndoOrRedo { Undo, Redo };
623    void addEditCommand(WebEditCommandProxy*);
624    void removeEditCommand(WebEditCommandProxy*);
625    bool isValidEditCommand(WebEditCommandProxy*);
626    void registerEditCommand(PassRefPtr<WebEditCommandProxy>, UndoOrRedo);
627
628#if PLATFORM(MAC)
629    void registerKeypressCommandName(const String& name) { m_knownKeypressCommandNames.add(name); }
630    bool isValidKeypressCommandName(const String& name) const { return m_knownKeypressCommandNames.contains(name); }
631#endif
632
633    WebProcessProxy* process() const;
634    PlatformProcessIdentifier processIdentifier() const;
635
636    WebPageGroup* pageGroup() const { return m_pageGroup.get(); }
637
638    bool isValid() const;
639
640    PassRefPtr<ImmutableArray> relatedPages() const;
641
642    const String& urlAtProcessExit() const { return m_urlAtProcessExit; }
643    WebFrameProxy::LoadState loadStateAtProcessExit() const { return m_loadStateAtProcessExit; }
644
645#if ENABLE(DRAG_SUPPORT)
646    WebCore::DragSession dragSession() const { return m_currentDragSession; }
647    void resetDragOperation() { m_currentDragSession = WebCore::DragSession(); }
648#endif
649
650    void preferencesDidChange();
651
652#if ENABLE(CONTEXT_MENUS)
653    // Called by the WebContextMenuProxy.
654    void contextMenuItemSelected(const WebContextMenuItemData&);
655#endif
656
657    // Called by the WebOpenPanelResultListenerProxy.
658    void didChooseFilesForOpenPanel(const Vector<String>&);
659    void didCancelForOpenPanel();
660
661    WebPageCreationParameters creationParameters() const;
662
663#if PLATFORM(QT)
664    void findZoomableAreaForPoint(const WebCore::IntPoint&, const WebCore::IntSize&);
665#endif
666
667#if PLATFORM(QT) || PLATFORM(EFL) || PLATFORM(GTK)
668    void handleDownloadRequest(DownloadProxy*);
669#endif
670
671    void advanceToNextMisspelling(bool startBeforeSelection) const;
672    void changeSpellingToWord(const String& word) const;
673#if USE(APPKIT)
674    void uppercaseWord();
675    void lowercaseWord();
676    void capitalizeWord();
677#endif
678
679#if PLATFORM(MAC)
680    bool isSmartInsertDeleteEnabled() const { return m_isSmartInsertDeleteEnabled; }
681    void setSmartInsertDeleteEnabled(bool);
682#endif
683
684#if PLATFORM(GTK)
685    String accessibilityPlugID() const { return m_accessibilityPlugID; }
686#endif
687
688    void setCanRunModal(bool);
689    bool canRunModal();
690
691    void beginPrinting(WebFrameProxy*, const PrintInfo&);
692    void endPrinting();
693    void computePagesForPrinting(WebFrameProxy*, const PrintInfo&, PassRefPtr<ComputedPagesCallback>);
694#if PLATFORM(MAC)
695    void drawRectToImage(WebFrameProxy*, const PrintInfo&, const WebCore::IntRect&, const WebCore::IntSize&, PassRefPtr<ImageCallback>);
696    void drawPagesToPDF(WebFrameProxy*, const PrintInfo&, uint32_t first, uint32_t count, PassRefPtr<DataCallback>);
697#elif PLATFORM(GTK)
698    void drawPagesForPrinting(WebFrameProxy*, const PrintInfo&, PassRefPtr<PrintFinishedCallback>);
699#endif
700
701    const String& pendingAPIRequestURL() const { return m_pendingAPIRequestURL; }
702
703    void flashBackingStoreUpdates(const Vector<WebCore::IntRect>& updateRects);
704
705#if PLATFORM(MAC)
706    void handleAlternativeTextUIResult(const String& result);
707#endif
708
709    static void setDebugPaintFlags(WKPageDebugPaintFlags flags) { s_debugPaintFlags = flags; }
710    static WKPageDebugPaintFlags debugPaintFlags() { return s_debugPaintFlags; }
711
712    // Color to be used with kWKDebugFlashViewUpdates.
713    static WebCore::Color viewUpdatesFlashColor();
714
715    // Color to be used with kWKDebugFlashBackingStoreUpdates.
716    static WebCore::Color backingStoreUpdatesFlashColor();
717
718    void saveDataToFileInDownloadsFolder(const String& suggestedFilename, const String& mimeType, const String& originatingURLString, WebData*);
719    void savePDFToFileInDownloadsFolder(const String& suggestedFilename, const String& originatingURLString, const CoreIPC::DataReference&);
720#if PLATFORM(MAC)
721    void savePDFToTemporaryFolderAndOpenWithNativeApplicationRaw(const String& suggestedFilename, const String& originatingURLString, const uint8_t* data, unsigned long size, const String& pdfUUID);
722    void savePDFToTemporaryFolderAndOpenWithNativeApplication(const String& suggestedFilename, const String& originatingURLString, const CoreIPC::DataReference&, const String& pdfUUID);
723    void openPDFFromTemporaryFolderWithNativeApplication(const String& pdfUUID);
724#endif
725
726    void linkClicked(const String&, const WebMouseEvent&);
727
728    WebCore::IntRect visibleScrollerThumbRect() const { return m_visibleScrollerThumbRect; }
729
730    uint64_t renderTreeSize() const { return m_renderTreeSize; }
731
732    void setShouldSendEventsSynchronously(bool sync) { m_shouldSendEventsSynchronously = sync; };
733
734    void printMainFrame();
735
736    void setMediaVolume(float);
737    void setMayStartMediaWhenInWindow(bool);
738
739    // WebPopupMenuProxy::Client
740    virtual NativeWebMouseEvent* currentlyProcessedMouseDownEvent();
741
742#if PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL)
743    void setAcceleratedCompositingWindowId(uint64_t nativeWindowId);
744#endif
745
746    void setSuppressVisibilityUpdates(bool flag) { m_suppressVisibilityUpdates = flag; }
747    bool suppressVisibilityUpdates() { return m_suppressVisibilityUpdates; }
748
749    void postMessageToInjectedBundle(const String& messageName, APIObject* messageBody);
750
751#if ENABLE(INPUT_TYPE_COLOR)
752    void setColorChooserColor(const WebCore::Color&);
753    void endColorChooser();
754#endif
755
756    const WebLoaderClient& loaderClient() { return m_loaderClient; }
757
758    WebCore::IntSize minimumLayoutSize() const { return m_minimumLayoutSize; }
759    void setMinimumLayoutSize(const WebCore::IntSize&);
760
761    bool autoSizingShouldExpandToViewHeight() const { return m_autoSizingShouldExpandToViewHeight; }
762    void setAutoSizingShouldExpandToViewHeight(bool);
763
764    bool mainFrameInViewSourceMode() const { return m_mainFrameInViewSourceMode; }
765    void setMainFrameInViewSourceMode(bool);
766
767    void didReceiveAuthenticationChallengeProxy(uint64_t frameID, PassRefPtr<AuthenticationChallengeProxy>);
768
769    int64_t spellDocumentTag();
770    void didFinishCheckingText(uint64_t requestID, const Vector<WebCore::TextCheckingResult>&) const;
771    void didCancelCheckingText(uint64_t requestID) const;
772
773    void connectionWillOpen(CoreIPC::Connection*);
774    void connectionWillClose(CoreIPC::Connection*);
775
776    void didSaveToPageCache();
777
778    void setScrollPinningBehavior(WebCore::ScrollPinningBehavior);
779    WebCore::ScrollPinningBehavior scrollPinningBehavior() { return m_scrollPinningBehavior; }
780
781private:
782    WebPageProxy(PageClient*, PassRefPtr<WebProcessProxy>, WebPageGroup*, uint64_t pageID);
783
784    void resetStateAfterProcessExited();
785
786    // CoreIPC::MessageReceiver
787    virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&) OVERRIDE;
788    virtual void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&, OwnPtr<CoreIPC::MessageEncoder>&) OVERRIDE;
789
790    // WebPopupMenuProxy::Client
791    virtual void valueChangedForPopupMenu(WebPopupMenuProxy*, int32_t newSelectedIndex);
792    virtual void setTextFromItemForPopupMenu(WebPopupMenuProxy*, int32_t index);
793#if PLATFORM(GTK)
794    virtual void failedToShowPopupMenu();
795#endif
796#if PLATFORM(QT)
797    virtual void changeSelectedIndex(int32_t newSelectedIndex);
798    virtual void closePopupMenu();
799#endif
800
801    // Implemented in generated WebPageProxyMessageReceiver.cpp
802    void didReceiveWebPageProxyMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&);
803    void didReceiveSyncWebPageProxyMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&, OwnPtr<CoreIPC::MessageEncoder>&);
804
805    void didCreateMainFrame(uint64_t frameID);
806    void didCreateSubframe(uint64_t frameID);
807
808    void didStartProvisionalLoadForFrame(uint64_t frameID, const String& url, const String& unreachableURL, CoreIPC::MessageDecoder&);
809    void didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, const String&, CoreIPC::MessageDecoder&);
810    void didFailProvisionalLoadForFrame(uint64_t frameID, const WebCore::ResourceError&, CoreIPC::MessageDecoder&);
811    void didCommitLoadForFrame(uint64_t frameID, const String& mimeType, bool frameHasCustomRepresentation, uint32_t frameLoadType, const PlatformCertificateInfo&, CoreIPC::MessageDecoder&);
812    void didFinishDocumentLoadForFrame(uint64_t frameID, CoreIPC::MessageDecoder&);
813    void didFinishLoadForFrame(uint64_t frameID, CoreIPC::MessageDecoder&);
814    void didFailLoadForFrame(uint64_t frameID, const WebCore::ResourceError&, CoreIPC::MessageDecoder&);
815    void didSameDocumentNavigationForFrame(uint64_t frameID, uint32_t sameDocumentNavigationType, const String&, CoreIPC::MessageDecoder&);
816    void didReceiveTitleForFrame(uint64_t frameID, const String&, CoreIPC::MessageDecoder&);
817    void didFirstLayoutForFrame(uint64_t frameID, CoreIPC::MessageDecoder&);
818    void didFirstVisuallyNonEmptyLayoutForFrame(uint64_t frameID, CoreIPC::MessageDecoder&);
819    void didNewFirstVisuallyNonEmptyLayout(CoreIPC::MessageDecoder&);
820    void didLayout(uint32_t layoutMilestones, CoreIPC::MessageDecoder&);
821    void didRemoveFrameFromHierarchy(uint64_t frameID, CoreIPC::MessageDecoder&);
822    void didDisplayInsecureContentForFrame(uint64_t frameID, CoreIPC::MessageDecoder&);
823    void didRunInsecureContentForFrame(uint64_t frameID, CoreIPC::MessageDecoder&);
824    void didDetectXSSForFrame(uint64_t frameID, CoreIPC::MessageDecoder&);
825    void frameDidBecomeFrameSet(uint64_t frameID, bool);
826    void didStartProgress();
827    void didChangeProgress(double);
828    void didFinishProgress();
829
830    void decidePolicyForNavigationAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, const WebCore::ResourceRequest&, uint64_t listenerID, CoreIPC::MessageDecoder&, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID);
831    void decidePolicyForNewWindowAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, const WebCore::ResourceRequest&, const String& frameName, uint64_t listenerID, CoreIPC::MessageDecoder&);
832    void decidePolicyForResponse(uint64_t frameID, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, uint64_t listenerID, CoreIPC::MessageDecoder&);
833    void decidePolicyForResponseSync(uint64_t frameID, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, uint64_t listenerID, CoreIPC::MessageDecoder&, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID);
834    void unableToImplementPolicy(uint64_t frameID, const WebCore::ResourceError&, CoreIPC::MessageDecoder&);
835
836    void willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const Vector<std::pair<String, String>>& textFieldValues, uint64_t listenerID, CoreIPC::MessageDecoder&);
837
838    // UI client
839    void createNewPage(const WebCore::ResourceRequest&, const WebCore::WindowFeatures&, uint32_t modifiers, int32_t mouseButton, uint64_t& newPageID, WebPageCreationParameters&);
840    void showPage();
841    void closePage(bool stopResponsivenessTimer);
842    void runJavaScriptAlert(uint64_t frameID, const String&);
843    void runJavaScriptConfirm(uint64_t frameID, const String&, bool& result);
844    void runJavaScriptPrompt(uint64_t frameID, const String&, const String&, String& result);
845    void shouldInterruptJavaScript(bool& result);
846    void setStatusText(const String&);
847    void mouseDidMoveOverElement(const WebHitTestResult::Data& hitTestResultData, uint32_t modifiers, CoreIPC::MessageDecoder&);
848    void unavailablePluginButtonClicked(uint32_t opaquePluginUnavailabilityReason, const String& mimeType, const String& pluginURLString, const String& pluginsPageURLString, const String& frameURLString, const String& pageURLString);
849    void setToolbarsAreVisible(bool toolbarsAreVisible);
850    void getToolbarsAreVisible(bool& toolbarsAreVisible);
851    void setMenuBarIsVisible(bool menuBarIsVisible);
852    void getMenuBarIsVisible(bool& menuBarIsVisible);
853    void setStatusBarIsVisible(bool statusBarIsVisible);
854    void getStatusBarIsVisible(bool& statusBarIsVisible);
855    void setIsResizable(bool isResizable);
856    void getIsResizable(bool& isResizable);
857    void setWindowFrame(const WebCore::FloatRect&);
858    void getWindowFrame(WebCore::FloatRect&);
859    void screenToWindow(const WebCore::IntPoint& screenPoint, WebCore::IntPoint& windowPoint);
860    void windowToScreen(const WebCore::IntRect& viewRect, WebCore::IntRect& result);
861    void runBeforeUnloadConfirmPanel(const String& message, uint64_t frameID, bool& shouldClose);
862    void didChangeViewportProperties(const WebCore::ViewportAttributes&);
863    void pageDidScroll();
864    void runOpenPanel(uint64_t frameID, const WebCore::FileChooserSettings&);
865    void printFrame(uint64_t frameID);
866    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>);
867    void requestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, String originIdentifier);
868    void runModal();
869    void notifyScrollerThumbIsVisibleInRect(const WebCore::IntRect&);
870    void recommendedScrollbarStyleDidChange(int32_t newStyle);
871    void didChangeScrollbarsForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar);
872    void didChangeScrollOffsetPinningForMainFrame(bool pinnedToLeftSide, bool pinnedToRightSide, bool pinnedToTopSide, bool pinnedToBottomSide);
873    void didChangePageCount(unsigned);
874    void didFailToInitializePlugin(const String& mimeType, const String& frameURLString, const String& pageURLString);
875    void didBlockInsecurePluginVersion(const String& mimeType, const String& pluginURLString, const String& frameURLString, const String& pageURLString, bool replacementObscured);
876    void setCanShortCircuitHorizontalWheelEvents(bool canShortCircuitHorizontalWheelEvents) { m_canShortCircuitHorizontalWheelEvents = canShortCircuitHorizontalWheelEvents; }
877
878    void reattachToWebProcess();
879    void reattachToWebProcessWithItem(WebBackForwardListItem*);
880
881    void requestNotificationPermission(uint64_t notificationID, const String& originString);
882    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);
883    void cancelNotification(uint64_t notificationID);
884    void clearNotifications(const Vector<uint64_t>& notificationIDs);
885    void didDestroyNotification(uint64_t notificationID);
886
887#if USE(TILED_BACKING_STORE)
888    void pageDidRequestScroll(const WebCore::IntPoint&);
889    void pageTransitionViewportReady();
890#endif
891#if PLATFORM(QT)
892    void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&);
893#endif
894
895#if PLATFORM(QT) || PLATFORM(EFL)
896    void didChangeContentsSize(const WebCore::IntSize&);
897#endif
898
899#if ENABLE(TOUCH_EVENTS)
900    void needTouchEvents(bool);
901#endif
902
903#if ENABLE(INPUT_TYPE_COLOR)
904    void showColorChooser(const WebCore::Color& initialColor, const WebCore::IntRect&);
905    void didChooseColor(const WebCore::Color&);
906    void didEndColorChooser();
907#endif
908
909    void editorStateChanged(const EditorState&);
910#if PLATFORM(QT)
911    void willSetInputMethodState();
912#endif
913
914    // Back/Forward list management
915    void backForwardAddItem(uint64_t itemID);
916    void backForwardGoToItem(uint64_t itemID, SandboxExtension::Handle&);
917    void backForwardItemAtIndex(int32_t index, uint64_t& itemID);
918    void backForwardBackListCount(int32_t& count);
919    void backForwardForwardListCount(int32_t& count);
920    void backForwardClear();
921
922    // Undo management
923    void registerEditCommandForUndo(uint64_t commandID, uint32_t editAction);
924    void clearAllEditCommands();
925    void canUndoRedo(uint32_t action, bool& result);
926    void executeUndoRedo(uint32_t action, bool& result);
927
928    // Keyboard handling
929#if PLATFORM(MAC)
930    void interpretQueuedKeyEvent(const EditorState&, bool& handled, Vector<WebCore::KeypressCommand>&);
931    void executeSavedCommandBySelector(const String& selector, bool& handled);
932#endif
933
934#if PLATFORM(GTK)
935    void getEditorCommandsForKeyEvent(const AtomicString&, Vector<String>&);
936    void bindAccessibilityTree(const String&);
937#endif
938#if PLATFORM(EFL)
939    void getEditorCommandsForKeyEvent(Vector<String>&);
940#endif
941
942    // Popup Menu.
943    void showPopupMenu(const WebCore::IntRect& rect, uint64_t textDirection, const Vector<WebPopupItem>& items, int32_t selectedIndex, const PlatformPopupMenuData&);
944    void hidePopupMenu();
945
946#if ENABLE(CONTEXT_MENUS)
947    // Context Menu.
948    void showContextMenu(const WebCore::IntPoint& menuLocation, const WebHitTestResult::Data&, const Vector<WebContextMenuItemData>&, CoreIPC::MessageDecoder&);
949    void internalShowContextMenu(const WebCore::IntPoint& menuLocation, const WebHitTestResult::Data&, const Vector<WebContextMenuItemData>&, CoreIPC::MessageDecoder&);
950#endif
951
952    // Search popup results
953    void saveRecentSearches(const String&, const Vector<String>&);
954    void loadRecentSearches(const String&, Vector<String>&);
955
956#if PLATFORM(MAC)
957    // Speech.
958    void getIsSpeaking(bool&);
959    void speak(const String&);
960    void stopSpeaking();
961
962    // Spotlight.
963    void searchWithSpotlight(const String&);
964
965    void searchTheWeb(const String&);
966
967    // Dictionary.
968    void didPerformDictionaryLookup(const AttributedString&, const DictionaryPopupInfo&);
969#endif
970
971    // Spelling and grammar.
972#if USE(UNIFIED_TEXT_CHECKING)
973    void checkTextOfParagraph(const String& text, uint64_t checkingTypes, Vector<WebCore::TextCheckingResult>& results);
974#endif
975    void checkSpellingOfString(const String& text, int32_t& misspellingLocation, int32_t& misspellingLength);
976    void checkGrammarOfString(const String& text, Vector<WebCore::GrammarDetail>&, int32_t& badGrammarLocation, int32_t& badGrammarLength);
977    void spellingUIIsShowing(bool&);
978    void updateSpellingUIWithMisspelledWord(const String& misspelledWord);
979    void updateSpellingUIWithGrammarString(const String& badGrammarPhrase, const WebCore::GrammarDetail&);
980    void getGuessesForWord(const String& word, const String& context, Vector<String>& guesses);
981    void learnWord(const String& word);
982    void ignoreWord(const String& word);
983    void requestCheckingOfString(uint64_t requestID, const WebCore::TextCheckingRequestData&);
984
985    void setFocus(bool focused);
986    void takeFocus(uint32_t direction);
987    void setToolTip(const String&);
988    void setCursor(const WebCore::Cursor&);
989    void setCursorHiddenUntilMouseMoves(bool);
990
991    void didReceiveEvent(uint32_t opaqueType, bool handled);
992    void stopResponsivenessTimer();
993
994    void voidCallback(uint64_t);
995    void dataCallback(const CoreIPC::DataReference&, uint64_t);
996    void imageCallback(const ShareableBitmap::Handle&, uint64_t);
997    void stringCallback(const String&, uint64_t);
998    void scriptValueCallback(const CoreIPC::DataReference&, uint64_t);
999    void computedPagesCallback(const Vector<WebCore::IntRect>&, double totalScaleFactorForPrinting, uint64_t);
1000    void validateCommandCallback(const String&, bool, int, uint64_t);
1001#if PLATFORM(GTK)
1002    void printFinishedCallback(const WebCore::ResourceError&, uint64_t);
1003#endif
1004
1005    void focusedFrameChanged(uint64_t frameID);
1006    void frameSetLargestFrameChanged(uint64_t frameID);
1007
1008    void canAuthenticateAgainstProtectionSpaceInFrame(uint64_t frameID, const WebCore::ProtectionSpace&, bool& canAuthenticate);
1009    void didReceiveAuthenticationChallenge(uint64_t frameID, const WebCore::AuthenticationChallenge&, uint64_t challengeID);
1010
1011    void didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference&);
1012
1013#if PLATFORM(MAC)
1014    void pluginFocusOrWindowFocusChanged(uint64_t pluginComplexTextInputIdentifier, bool pluginHasFocusAndWindowHasFocus);
1015    void setPluginComplexTextInputState(uint64_t pluginComplexTextInputIdentifier, uint64_t complexTextInputState);
1016#endif
1017
1018    void clearPendingAPIRequestURL() { m_pendingAPIRequestURL = String(); }
1019    void setPendingAPIRequestURL(const String& pendingAPIRequestURL) { m_pendingAPIRequestURL = pendingAPIRequestURL; }
1020
1021    bool maybeInitializeSandboxExtensionHandle(const WebCore::KURL&, SandboxExtension::Handle&);
1022
1023#if PLATFORM(MAC)
1024    void substitutionsPanelIsShowing(bool&);
1025    void showCorrectionPanel(int32_t panelType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings);
1026    void dismissCorrectionPanel(int32_t reason);
1027    void dismissCorrectionPanelSoon(int32_t reason, String& result);
1028    void recordAutocorrectionResponse(int32_t responseType, const String& replacedString, const String& replacementString);
1029
1030#if USE(DICTATION_ALTERNATIVES)
1031    void showDictationAlternativeUI(const WebCore::FloatRect& boundingBoxOfDictatedText, uint64_t dictationContext);
1032    void removeDictationAlternatives(uint64_t dictationContext);
1033    void dictationAlternatives(uint64_t dictationContext, Vector<String>& result);
1034#endif
1035#endif // PLATFORM(MAC)
1036
1037#if USE(SOUP)
1038    void didReceiveURIRequest(String uriString, uint64_t requestID);
1039#endif
1040
1041    void clearLoadDependentCallbacks();
1042
1043    void performDragControllerAction(DragControllerAction, WebCore::DragData*, const String& dragStorageName, const SandboxExtension::Handle&, const SandboxExtension::HandleArray&);
1044
1045    void updateBackingStoreDiscardableState();
1046
1047    void setRenderTreeSize(uint64_t treeSize) { m_renderTreeSize = treeSize; }
1048
1049#if PLUGIN_ARCHITECTURE(X11)
1050    void createPluginContainer(uint64_t& windowID);
1051    void windowedPluginGeometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect, uint64_t windowID);
1052#endif
1053
1054    void processNextQueuedWheelEvent();
1055    void sendWheelEvent(const WebWheelEvent&);
1056
1057#if ENABLE(NETSCAPE_PLUGIN_API)
1058    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);
1059#endif
1060
1061    PageClient* m_pageClient;
1062    WebLoaderClient m_loaderClient;
1063    WebPolicyClient m_policyClient;
1064    WebFormClient m_formClient;
1065    WebUIClient m_uiClient;
1066#if PLATFORM(EFL)
1067    WebUIPopupMenuClient m_uiPopupMenuClient;
1068#endif
1069    WebFindClient m_findClient;
1070    WebFindMatchesClient m_findMatchesClient;
1071#if ENABLE(CONTEXT_MENUS)
1072    WebPageContextMenuClient m_contextMenuClient;
1073#endif
1074
1075    OwnPtr<DrawingAreaProxy> m_drawingArea;
1076    RefPtr<WebProcessProxy> m_process;
1077    RefPtr<WebPageGroup> m_pageGroup;
1078    RefPtr<WebFrameProxy> m_mainFrame;
1079    RefPtr<WebFrameProxy> m_focusedFrame;
1080    RefPtr<WebFrameProxy> m_frameSetLargestFrame;
1081
1082    String m_userAgent;
1083    String m_applicationNameForUserAgent;
1084    String m_customUserAgent;
1085    String m_customTextEncodingName;
1086
1087#if ENABLE(INSPECTOR)
1088    RefPtr<WebInspectorProxy> m_inspector;
1089#endif
1090
1091#if ENABLE(FULLSCREEN_API)
1092    RefPtr<WebFullScreenManagerProxy> m_fullScreenManager;
1093#endif
1094
1095#if ENABLE(VIBRATION)
1096    RefPtr<WebVibrationProxy> m_vibration;
1097#endif
1098
1099    HashMap<uint64_t, RefPtr<VoidCallback>> m_voidCallbacks;
1100    HashMap<uint64_t, RefPtr<DataCallback>> m_dataCallbacks;
1101    HashMap<uint64_t, RefPtr<ImageCallback>> m_imageCallbacks;
1102    HashMap<uint64_t, RefPtr<StringCallback>> m_stringCallbacks;
1103    HashSet<uint64_t> m_loadDependentStringCallbackIDs;
1104    HashMap<uint64_t, RefPtr<ScriptValueCallback>> m_scriptValueCallbacks;
1105    HashMap<uint64_t, RefPtr<ComputedPagesCallback>> m_computedPagesCallbacks;
1106    HashMap<uint64_t, RefPtr<ValidateCommandCallback>> m_validateCommandCallbacks;
1107#if PLATFORM(GTK)
1108    HashMap<uint64_t, RefPtr<PrintFinishedCallback>> m_printFinishedCallbacks;
1109#endif
1110
1111    HashSet<WebEditCommandProxy*> m_editCommandSet;
1112
1113#if PLATFORM(MAC)
1114    HashSet<String> m_knownKeypressCommandNames;
1115#endif
1116
1117    RefPtr<WebPopupMenuProxy> m_activePopupMenu;
1118    RefPtr<WebContextMenuProxy> m_activeContextMenu;
1119    WebHitTestResult::Data m_activeContextMenuHitTestResultData;
1120    RefPtr<WebOpenPanelResultListenerProxy> m_openPanelResultListener;
1121    GeolocationPermissionRequestManagerProxy m_geolocationPermissionRequestManager;
1122    NotificationPermissionRequestManagerProxy m_notificationPermissionRequestManager;
1123
1124    double m_estimatedProgress;
1125
1126    // Whether the web page is contained in a top-level window.
1127    bool m_isInWindow;
1128
1129    // Whether the page is visible; if the backing view is visible and inserted into a window.
1130    bool m_isVisible;
1131
1132    bool m_canGoBack;
1133    bool m_canGoForward;
1134    RefPtr<WebBackForwardList> m_backForwardList;
1135
1136    bool m_maintainsInactiveSelection;
1137
1138    String m_toolTip;
1139
1140    String m_urlAtProcessExit;
1141    WebFrameProxy::LoadState m_loadStateAtProcessExit;
1142
1143    EditorState m_editorState;
1144    bool m_temporarilyClosedComposition; // Editor state changed from hasComposition to !hasComposition, but that was only with shouldIgnoreCompositionSelectionChange yet.
1145
1146    double m_textZoomFactor;
1147    double m_pageZoomFactor;
1148    double m_pageScaleFactor;
1149    float m_intrinsicDeviceScaleFactor;
1150    float m_customDeviceScaleFactor;
1151
1152    LayerHostingMode m_layerHostingMode;
1153
1154    bool m_drawsBackground;
1155    bool m_drawsTransparentBackground;
1156
1157    WebCore::Color m_underlayColor;
1158
1159    bool m_areMemoryCacheClientCallsEnabled;
1160
1161    bool m_useFixedLayout;
1162    WebCore::IntSize m_fixedLayoutSize;
1163
1164    bool m_suppressScrollbarAnimations;
1165
1166    WebCore::Pagination::Mode m_paginationMode;
1167    bool m_paginationBehavesLikeColumns;
1168    double m_pageLength;
1169    double m_gapBetweenPages;
1170
1171    // If the process backing the web page is alive and kicking.
1172    bool m_isValid;
1173
1174    // Whether WebPageProxy::close() has been called on this page.
1175    bool m_isClosed;
1176
1177    // Whether it can run modal child web pages.
1178    bool m_canRunModal;
1179
1180    bool m_isInPrintingMode;
1181    bool m_isPerformingDOMPrintOperation;
1182
1183    bool m_inDecidePolicyForResponseSync;
1184    const WebCore::ResourceRequest* m_decidePolicyForResponseRequest;
1185    bool m_syncMimeTypePolicyActionIsValid;
1186    WebCore::PolicyAction m_syncMimeTypePolicyAction;
1187    uint64_t m_syncMimeTypePolicyDownloadID;
1188
1189    bool m_inDecidePolicyForNavigationAction;
1190    bool m_syncNavigationActionPolicyActionIsValid;
1191    WebCore::PolicyAction m_syncNavigationActionPolicyAction;
1192    uint64_t m_syncNavigationActionPolicyDownloadID;
1193
1194#if ENABLE(GESTURE_EVENTS)
1195    Deque<WebGestureEvent> m_gestureEventQueue;
1196#endif
1197    Deque<NativeWebKeyboardEvent> m_keyEventQueue;
1198    Deque<NativeWebWheelEvent> m_wheelEventQueue;
1199    Deque<OwnPtr<Vector<NativeWebWheelEvent>>> m_currentlyProcessedWheelEvents;
1200
1201    bool m_processingMouseMoveEvent;
1202    OwnPtr<NativeWebMouseEvent> m_nextMouseMoveEvent;
1203    OwnPtr<NativeWebMouseEvent> m_currentlyProcessedMouseDownEvent;
1204
1205#if ENABLE(TOUCH_EVENTS)
1206    bool m_needTouchEvents;
1207    Deque<QueuedTouchEvents> m_touchEventQueue;
1208#endif
1209#if ENABLE(INPUT_TYPE_COLOR)
1210    RefPtr<WebColorChooserProxy> m_colorChooser;
1211    RefPtr<WebColorPickerResultListenerProxy> m_colorPickerResultListener;
1212#endif
1213
1214    uint64_t m_pageID;
1215
1216    bool m_isPageSuspended;
1217
1218#if PLATFORM(MAC)
1219    bool m_isSmartInsertDeleteEnabled;
1220#endif
1221
1222#if PLATFORM(GTK)
1223    String m_accessibilityPlugID;
1224#endif
1225
1226    int64_t m_spellDocumentTag;
1227    bool m_hasSpellDocumentTag;
1228    unsigned m_pendingLearnOrIgnoreWordMessageCount;
1229
1230    bool m_mainFrameHasCustomRepresentation;
1231
1232#if ENABLE(DRAG_SUPPORT)
1233    WebCore::DragSession m_currentDragSession;
1234#endif
1235
1236    String m_pendingAPIRequestURL;
1237
1238    bool m_mainFrameHasHorizontalScrollbar;
1239    bool m_mainFrameHasVerticalScrollbar;
1240
1241    // Whether horizontal wheel events can be handled directly for swiping purposes.
1242    bool m_canShortCircuitHorizontalWheelEvents;
1243
1244    bool m_mainFrameIsPinnedToLeftSide;
1245    bool m_mainFrameIsPinnedToRightSide;
1246    bool m_mainFrameIsPinnedToTopSide;
1247    bool m_mainFrameIsPinnedToBottomSide;
1248
1249    bool m_rubberBandsAtBottom;
1250    bool m_rubberBandsAtTop;
1251
1252    bool m_mainFrameInViewSourceMode;
1253
1254    unsigned m_pageCount;
1255
1256    WebCore::IntRect m_visibleScrollerThumbRect;
1257
1258    uint64_t m_renderTreeSize;
1259
1260    static WKPageDebugPaintFlags s_debugPaintFlags;
1261
1262    bool m_shouldSendEventsSynchronously;
1263
1264    bool m_suppressVisibilityUpdates;
1265    bool m_autoSizingShouldExpandToViewHeight;
1266    WebCore::IntSize m_minimumLayoutSize;
1267
1268    float m_mediaVolume;
1269    bool m_mayStartMediaWhenInWindow;
1270
1271    bool m_waitingForDidUpdateInWindowState;
1272
1273#if PLATFORM(MAC)
1274    WebCore::Timer<WebPageProxy> m_exposedRectChangedTimer;
1275    WebCore::FloatRect m_exposedRect;
1276    WebCore::FloatRect m_lastSentExposedRect;
1277    bool m_clipsToExposedRect;
1278    bool m_lastSentClipsToExposedRect;
1279#endif
1280
1281#if PLATFORM(QT)
1282    WTF::HashSet<RefPtr<QtRefCountedNetworkRequestData>> m_applicationSchemeRequests;
1283#endif
1284
1285#if ENABLE(PAGE_VISIBILITY_API)
1286    WebCore::PageVisibilityState m_visibilityState;
1287#endif
1288
1289#if PLATFORM(MAC)
1290    HashMap<String, String> m_temporaryPDFFiles;
1291#endif
1292
1293    WebCore::ScrollPinningBehavior m_scrollPinningBehavior;
1294};
1295
1296} // namespace WebKit
1297
1298#endif // WebPageProxy_h
1299