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