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