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