https://bugs.webkit.org/show_bug.cgi?id=77383
[WebKit-https.git] / Source / WebKit2 / WebProcess / WebPage / WebPage.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 WebPage_h
27 #define WebPage_h
28
29 #include "APIObject.h"
30 #include "DrawingArea.h"
31 #include "FindController.h"
32 #include "GeolocationPermissionRequestManager.h"
33 #include "ImageOptions.h"
34 #include "ImmutableArray.h"
35 #include "InjectedBundlePageContextMenuClient.h"
36 #include "InjectedBundlePageEditorClient.h"
37 #include "InjectedBundlePageFormClient.h"
38 #include "InjectedBundlePageFullScreenClient.h"
39 #include "InjectedBundlePageLoaderClient.h"
40 #include "InjectedBundlePagePolicyClient.h"
41 #include "InjectedBundlePageResourceLoadClient.h"
42 #include "InjectedBundlePageUIClient.h"
43 #include "MessageSender.h"
44 #include "TapHighlightController.h"
45 #include "Plugin.h"
46 #include "SandboxExtension.h"
47 #include "ShareableBitmap.h"
48 #include "WebUndoStep.h"
49 #include <WebCore/DragData.h>
50 #include <WebCore/Editor.h>
51 #include <WebCore/FrameLoaderTypes.h>
52 #include <WebCore/IntRect.h>
53 #include <WebCore/PlatformScreen.h>
54 #include <WebCore/ScrollTypes.h>
55 #include <WebCore/WebCoreKeyboardUIMode.h>
56 #include <wtf/HashMap.h>
57 #include <wtf/OwnPtr.h>
58 #include <wtf/PassRefPtr.h>
59 #include <wtf/RefPtr.h>
60 #include <wtf/text/WTFString.h>
61
62 #if PLATFORM(QT)
63 #include "ArgumentCodersQt.h"
64 #include "QtNetworkAccessManager.h"
65 #include "QtNetworkReply.h"
66 #include "QtNetworkReplyData.h"
67 #include "QtNetworkRequestData.h"
68 #include <QNetworkReply>
69 #include <QNetworkRequest>
70 #endif
71
72 #if PLATFORM(GTK)
73 #include "ArgumentCodersGtk.h"
74 #include "WebPageAccessibilityObject.h"
75 #include "WebPrintOperationGtk.h"
76 #endif
77
78 #if ENABLE(TOUCH_EVENTS)
79 #include <WebCore/PlatformTouchEvent.h>
80 #endif
81
82 #if PLATFORM(MAC)
83 #include "DictionaryPopupInfo.h"
84 #include <wtf/RetainPtr.h>
85 OBJC_CLASS NSDictionary;
86 OBJC_CLASS NSObject;
87 OBJC_CLASS WKAccessibilityWebPageObject;
88 #endif
89
90 namespace CoreIPC {
91     class ArgumentDecoder;
92     class Connection;
93     class MessageID;
94 }
95
96 namespace WebCore {
97     class GraphicsContext;
98     class Frame;
99     class FrameView;
100     class KeyboardEvent;
101     class Page;
102     class PrintContext;
103     class Range;
104     class ResourceRequest;
105     class SharedBuffer;
106     class VisibleSelection;
107     struct KeypressCommand;
108 }
109
110 namespace WebKit {
111
112 class DrawingArea;
113 class InjectedBundleBackForwardList;
114 class NotificationPermissionRequestManager;
115 class PageOverlay;
116 class PluginView;
117 class SessionState;
118 class WebContextMenu;
119 class WebContextMenuItemData;
120 class WebEvent;
121 class WebFrame;
122 class WebFullScreenManager;
123 class WebImage;
124 class WebInspector;
125 class WebKeyboardEvent;
126 class WebMouseEvent;
127 class WebNotificationClient;
128 class WebOpenPanelResultListener;
129 class WebPageGroupProxy;
130 class WebPopupMenu;
131 class WebWheelEvent;
132 struct AttributedString;
133 struct EditorState;
134 struct PrintInfo;
135 struct WebPageCreationParameters;
136 struct WebPreferencesStore;
137
138 #if ENABLE(GESTURE_EVENTS)
139 class WebGestureEvent;
140 #endif
141
142 #if ENABLE(TOUCH_EVENTS)
143 class WebTouchEvent;
144 #endif
145
146 class WebPage : public APIObject, public CoreIPC::MessageSender<WebPage> {
147 public:
148     static const Type APIType = TypeBundlePage;
149
150     static PassRefPtr<WebPage> create(uint64_t pageID, const WebPageCreationParameters&);
151     virtual ~WebPage();
152
153     // Used by MessageSender.
154     CoreIPC::Connection* connection() const;
155     uint64_t destinationID() const { return pageID(); }
156
157     void close();
158
159     WebCore::Page* corePage() const { return m_page.get(); }
160     uint64_t pageID() const { return m_pageID; }
161
162     void setSize(const WebCore::IntSize&);
163     const WebCore::IntSize& size() const { return m_viewSize; }
164     WebCore::IntRect bounds() const { return WebCore::IntRect(WebCore::IntPoint(), size()); }
165     
166     InjectedBundleBackForwardList* backForwardList();
167     DrawingArea* drawingArea() const { return m_drawingArea.get(); }
168
169     WebPageGroupProxy* pageGroup() const { return m_pageGroup.get(); }
170
171     void scrollMainFrameIfNotAtMaxScrollPosition(const WebCore::IntSize& scrollOffset);
172
173     void scrollBy(uint32_t scrollDirection, uint32_t scrollGranularity);
174
175     void centerSelectionInVisibleArea();
176
177 #if ENABLE(INSPECTOR)
178     WebInspector* inspector();
179 #endif
180
181 #if ENABLE(FULLSCREEN_API)
182     WebFullScreenManager* fullScreenManager();
183 #endif
184
185     // -- Called by the DrawingArea.
186     // FIXME: We could genericize these into a DrawingArea client interface. Would that be beneficial?
187     void drawRect(WebCore::GraphicsContext&, const WebCore::IntRect&);
188     void drawPageOverlay(WebCore::GraphicsContext&, const WebCore::IntRect&);
189     void layoutIfNeeded();
190
191     // -- Called from WebCore clients.
192 #if PLATFORM(MAC)
193     bool handleEditingKeyboardEvent(WebCore::KeyboardEvent*, bool saveCommands);
194 #elif !PLATFORM(GTK)
195     bool handleEditingKeyboardEvent(WebCore::KeyboardEvent*);
196 #endif
197
198     void show();
199     String userAgent() const { return m_userAgent; }
200     WebCore::IntRect windowResizerRect() const;
201     WebCore::KeyboardUIMode keyboardUIMode();
202
203     WebUndoStep* webUndoStep(uint64_t);
204     void addWebUndoStep(uint64_t, WebUndoStep*);
205     void removeWebEditCommand(uint64_t);
206     bool isInRedo() const { return m_isInRedo; }
207
208     void setActivePopupMenu(WebPopupMenu*);
209     
210     WebOpenPanelResultListener* activeOpenPanelResultListener() const { return m_activeOpenPanelResultListener.get(); }
211     void setActiveOpenPanelResultListener(PassRefPtr<WebOpenPanelResultListener>);
212
213     // -- Called from WebProcess.
214     void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
215     void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&);
216
217     // -- InjectedBundle methods
218     void initializeInjectedBundleContextMenuClient(WKBundlePageContextMenuClient*);
219     void initializeInjectedBundleEditorClient(WKBundlePageEditorClient*);
220     void initializeInjectedBundleFormClient(WKBundlePageFormClient*);
221     void initializeInjectedBundleLoaderClient(WKBundlePageLoaderClient*);
222     void initializeInjectedBundlePolicyClient(WKBundlePagePolicyClient*);
223     void initializeInjectedBundleResourceLoadClient(WKBundlePageResourceLoadClient*);
224     void initializeInjectedBundleUIClient(WKBundlePageUIClient*);
225 #if ENABLE(FULLSCREEN_API)
226     void initializeInjectedBundleFullScreenClient(WKBundlePageFullScreenClient*);
227 #endif
228
229     InjectedBundlePageContextMenuClient& injectedBundleContextMenuClient() { return m_contextMenuClient; }
230     InjectedBundlePageEditorClient& injectedBundleEditorClient() { return m_editorClient; }
231     InjectedBundlePageFormClient& injectedBundleFormClient() { return m_formClient; }
232     InjectedBundlePageLoaderClient& injectedBundleLoaderClient() { return m_loaderClient; }
233     InjectedBundlePagePolicyClient& injectedBundlePolicyClient() { return m_policyClient; }
234     InjectedBundlePageResourceLoadClient& injectedBundleResourceLoadClient() { return m_resourceLoadClient; }
235     InjectedBundlePageUIClient& injectedBundleUIClient() { return m_uiClient; }
236 #if ENABLE(FULLSCREEN_API)
237     InjectedBundlePageFullScreenClient& injectedBundleFullScreenClient() { return m_fullScreenClient; }
238 #endif
239
240     void setUnderlayPage(PassRefPtr<WebPage> underlayPage) { m_underlayPage = underlayPage; }
241
242     bool findStringFromInjectedBundle(const String&, FindOptions);
243
244     WebFrame* mainWebFrame() const { return m_mainFrame.get(); }
245
246     WebCore::Frame* mainFrame() const; // May return 0.
247     WebCore::FrameView* mainFrameView() const; // May return 0.
248
249     PassRefPtr<Plugin> createPlugin(WebFrame*, const Plugin::Parameters&);
250
251     EditorState editorState() const;
252
253     String renderTreeExternalRepresentation() const;
254     uint64_t renderTreeSize() const;
255     void setPaintedObjectsCounterThreshold(uint64_t);
256
257     void setTracksRepaints(bool);
258     bool isTrackingRepaints() const;
259     void resetTrackedRepaints();
260     PassRefPtr<ImmutableArray> trackedRepaintRects();
261
262     void executeEditingCommand(const String& commandName, const String& argument);
263     bool isEditingCommandEnabled(const String& commandName);
264     void clearMainFrameName();
265     void sendClose();
266
267     double textZoomFactor() const;
268     void setTextZoomFactor(double);
269     double pageZoomFactor() const;
270     void setPageZoomFactor(double);
271     void setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor);
272     void windowScreenDidChange(uint64_t);
273
274     void scalePage(double scale, const WebCore::IntPoint& origin);
275     double pageScaleFactor() const;
276
277     void setUseFixedLayout(bool);
278     bool useFixedLayout() const { return m_useFixedLayout; }
279     void setFixedLayoutSize(const WebCore::IntSize&);
280
281     void setPaginationMode(uint32_t /* WebCore::Page::Pagination::Mode */);
282     void setPageLength(double);
283     void setGapBetweenPages(double);
284
285     bool drawsBackground() const { return m_drawsBackground; }
286     bool drawsTransparentBackground() const { return m_drawsTransparentBackground; }
287
288     void stopLoading();
289     void stopLoadingFrame(uint64_t frameID);
290     void setDefersLoading(bool deferLoading);
291
292 #if USE(ACCELERATED_COMPOSITING)
293     void enterAcceleratedCompositingMode(WebCore::GraphicsLayer*);
294     void exitAcceleratedCompositingMode();
295 #endif
296
297 #if PLATFORM(MAC)
298     void addPluginView(PluginView*);
299     void removePluginView(PluginView*);
300
301     bool windowIsVisible() const { return m_windowIsVisible; }
302     const WebCore::IntRect& windowFrameInScreenCoordinates() const { return m_windowFrameInScreenCoordinates; }
303     const WebCore::IntRect& viewFrameInWindowCoordinates() const { return m_viewFrameInWindowCoordinates; }
304 #elif PLATFORM(WIN)
305     HWND nativeWindow() const { return m_nativeWindow; }
306 #endif
307
308     bool windowIsFocused() const;
309     void installPageOverlay(PassRefPtr<PageOverlay>);
310     void uninstallPageOverlay(PageOverlay*, bool fadeOut);
311     bool hasPageOverlay() const { return m_pageOverlay; }
312     WebCore::IntPoint screenToWindow(const WebCore::IntPoint&);
313     WebCore::IntRect windowToScreen(const WebCore::IntRect&);
314
315     PassRefPtr<WebImage> snapshotInViewCoordinates(const WebCore::IntRect&, ImageOptions);
316     PassRefPtr<WebImage> snapshotInDocumentCoordinates(const WebCore::IntRect&, ImageOptions);
317     PassRefPtr<WebImage> scaledSnapshotInDocumentCoordinates(const WebCore::IntRect&, double scaleFactor, ImageOptions);
318
319     static const WebEvent* currentEvent();
320
321     FindController& findController() { return m_findController; }
322 #if PLATFORM(QT)
323     TapHighlightController& tapHighlightController() { return m_tapHighlightController; }
324 #endif
325
326     GeolocationPermissionRequestManager& geolocationPermissionRequestManager() { return m_geolocationPermissionRequestManager; }
327     NotificationPermissionRequestManager* notificationPermissionRequestManager();
328
329     void pageDidScroll();
330 #if USE(TILED_BACKING_STORE)
331     void pageDidRequestScroll(const WebCore::IntPoint&);
332     void setFixedVisibleContentRect(const WebCore::IntRect&);
333     void setResizesToContentsUsingLayoutSize(const WebCore::IntSize&);
334     void resizeToContentsIfNeeded();
335     void setViewportSize(const WebCore::IntSize&);
336     WebCore::IntSize viewportSize() const { return m_viewportSize; }
337 #endif
338
339     WebContextMenu* contextMenu();
340     
341     bool hasLocalDataForURL(const WebCore::KURL&);
342     String cachedResponseMIMETypeForURL(const WebCore::KURL&);
343     String cachedSuggestedFilenameForURL(const WebCore::KURL&);
344     PassRefPtr<WebCore::SharedBuffer> cachedResponseDataForURL(const WebCore::KURL&);
345
346     static bool canHandleRequest(const WebCore::ResourceRequest&);
347
348     class SandboxExtensionTracker {
349     public:
350         ~SandboxExtensionTracker();
351
352         void invalidate();
353
354         void beginLoad(WebFrame*, const SandboxExtension::Handle& handle);
355         void willPerformLoadDragDestinationAction(PassRefPtr<SandboxExtension> pendingDropSandboxExtension);
356         void didStartProvisionalLoad(WebFrame*);
357         void didCommitProvisionalLoad(WebFrame*);
358         void didFailProvisionalLoad(WebFrame*);
359
360     private:
361         void setPendingProvisionalSandboxExtension(PassRefPtr<SandboxExtension>);
362
363         RefPtr<SandboxExtension> m_pendingProvisionalSandboxExtension;
364         RefPtr<SandboxExtension> m_provisionalSandboxExtension;
365         RefPtr<SandboxExtension> m_committedSandboxExtension;
366     };
367
368     SandboxExtensionTracker& sandboxExtensionTracker() { return m_sandboxExtensionTracker; }
369
370 #if PLATFORM(QT)
371     void setComposition(const String& text, Vector<WebCore::CompositionUnderline> underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeEnd);
372     void confirmComposition(const String& text, int64_t selectionStart, int64_t selectionLength);
373     void cancelComposition();
374 #endif
375
376 #if PLATFORM(MAC)
377     void registerUIProcessAccessibilityTokens(const CoreIPC::DataReference& elemenToken, const CoreIPC::DataReference& windowToken);
378     WKAccessibilityWebPageObject* accessibilityRemoteObject();
379     WebCore::IntPoint accessibilityPosition() const { return m_accessibilityPosition; }    
380     
381     void sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String& textInput);
382
383     void setComposition(const String& text, Vector<WebCore::CompositionUnderline> underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeEnd, EditorState& newState);
384     void confirmComposition(EditorState& newState);
385     void cancelComposition(EditorState& newState);
386     void insertText(const String& text, uint64_t replacementRangeStart, uint64_t replacementRangeEnd, bool& handled, EditorState& newState);
387     void getMarkedRange(uint64_t& location, uint64_t& length);
388     void getSelectedRange(uint64_t& location, uint64_t& length);
389     void getAttributedSubstringFromRange(uint64_t location, uint64_t length, AttributedString&);
390     void characterIndexForPoint(const WebCore::IntPoint point, uint64_t& result);
391     void firstRectForCharacterRange(uint64_t location, uint64_t length, WebCore::IntRect& resultRect);
392     void executeKeypressCommands(const Vector<WebCore::KeypressCommand>&, bool& handled, EditorState& newState);
393     void writeSelectionToPasteboard(const WTF::String& pasteboardName, const WTF::Vector<WTF::String>& pasteboardTypes, bool& result);
394     void readSelectionFromPasteboard(const WTF::String& pasteboardName, bool& result);
395     void shouldDelayWindowOrderingEvent(const WebKit::WebMouseEvent&, bool& result);
396     void acceptsFirstMouse(int eventNumber, const WebKit::WebMouseEvent&, bool& result);
397     bool performNonEditingBehaviorForSelector(const String&);
398
399 #elif PLATFORM(WIN)
400     void confirmComposition(const String& compositionString);
401     void setComposition(const WTF::String& compositionString, const WTF::Vector<WebCore::CompositionUnderline>& underlines, uint64_t cursorPosition);
402     void firstRectForCharacterInSelectedRange(const uint64_t characterPosition, WebCore::IntRect& resultRect);
403     void getSelectedText(WTF::String&);
404
405     void gestureWillBegin(const WebCore::IntPoint&, bool& canBeginPanning);
406     void gestureDidScroll(const WebCore::IntSize&);
407     void gestureDidEnd();
408
409 #elif PLATFORM(GTK)
410     void updateAccessibilityTree();
411 #endif
412
413     void setCompositionForTesting(const String& compositionString, uint64_t from, uint64_t length);
414     bool hasCompositionForTesting();
415     void confirmCompositionForTesting(const String& compositionString);
416
417     // FIXME: This a dummy message, to avoid breaking the build for platforms that don't require
418     // any synchronous messages, and should be removed when <rdar://problem/8775115> is fixed.
419     void dummy(bool&);
420
421 #if PLATFORM(MAC)
422     void performDictionaryLookupForSelection(DictionaryPopupInfo::Type, WebCore::Frame*, const WebCore::VisibleSelection&);
423
424     bool isSpeaking();
425     void speak(const String&);
426     void stopSpeaking();
427
428     bool isSmartInsertDeleteEnabled() const { return m_isSmartInsertDeleteEnabled; }
429 #endif
430
431     void replaceSelectionWithText(WebCore::Frame*, const String&);
432     void clearSelection();
433 #if PLATFORM(WIN)
434     void performDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, const WebCore::DragDataMap&, uint32_t flags);
435 #elif PLATFORM(QT) || PLATFORM(GTK)
436     void performDragControllerAction(uint64_t action, WebCore::DragData);
437 #else
438     void performDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, const WTF::String& dragStorageName, uint32_t flags, const SandboxExtension::Handle&);
439 #endif
440     void dragEnded(WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t operation);
441
442     void willPerformLoadDragDestinationAction();
443
444     void beginPrinting(uint64_t frameID, const PrintInfo&);
445     void endPrinting();
446     void computePagesForPrinting(uint64_t frameID, const PrintInfo&, uint64_t callbackID);
447 #if PLATFORM(MAC) || PLATFORM(WIN)
448     void drawRectToPDF(uint64_t frameID, const PrintInfo&, const WebCore::IntRect&, uint64_t callbackID);
449     void drawPagesToPDF(uint64_t frameID, const PrintInfo&, uint32_t first, uint32_t count, uint64_t callbackID);
450 #elif PLATFORM(GTK)
451     void drawPagesForPrinting(uint64_t frameID, const PrintInfo&, uint64_t callbackID);
452 #endif
453
454     void setMediaVolume(float);
455
456     bool mainFrameHasCustomRepresentation() const;
457
458     void didChangeScrollOffsetForMainFrame();
459
460     void mainFrameDidLayout();
461
462     bool canRunBeforeUnloadConfirmPanel() const { return m_canRunBeforeUnloadConfirmPanel; }
463     void setCanRunBeforeUnloadConfirmPanel(bool canRunBeforeUnloadConfirmPanel) { m_canRunBeforeUnloadConfirmPanel = canRunBeforeUnloadConfirmPanel; }
464
465     bool canRunModal() const { return m_canRunModal; }
466     void setCanRunModal(bool canRunModal) { m_canRunModal = canRunModal; }
467
468     void runModal();
469
470     void setDeviceScaleFactor(float);
471     float deviceScaleFactor() const;
472
473     void setMemoryCacheMessagesEnabled(bool);
474
475     void forceRepaintWithoutCallback();
476
477     void unmarkAllMisspellings();
478     void unmarkAllBadGrammar();
479
480 #if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD)
481     void handleCorrectionPanelResult(const String&);
482 #endif
483
484     // For testing purpose.
485     void simulateMouseDown(int button, WebCore::IntPoint, int clickCount, WKEventModifiers, double time);
486     void simulateMouseUp(int button, WebCore::IntPoint, int clickCount, WKEventModifiers, double time);
487     void simulateMouseMotion(WebCore::IntPoint, double time);
488     String viewportConfigurationAsText(int deviceDPI, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight);
489
490     void contextMenuShowing() { m_isShowingContextMenu = true; }
491
492 #if PLATFORM(QT)
493     void registerApplicationScheme(const String& scheme);
494     void applicationSchemeReply(const QtNetworkReplyData&);
495     void receivedApplicationSchemeRequest(const QNetworkRequest&, QtNetworkReply*);
496 #endif
497     void wheelEvent(const WebWheelEvent&);
498 #if ENABLE(GESTURE_EVENTS)
499     void gestureEvent(const WebGestureEvent&);
500 #endif
501
502 private:
503     WebPage(uint64_t pageID, const WebPageCreationParameters&);
504
505     virtual Type type() const { return APIType; }
506
507     void platformInitialize();
508
509     void didReceiveWebPageMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
510     void didReceiveSyncWebPageMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&);
511
512 #if !PLATFORM(MAC)
513     static const char* interpretKeyEvent(const WebCore::KeyboardEvent*);
514 #endif
515     bool performDefaultBehaviorForKeyEvent(const WebKeyboardEvent&);
516
517 #if PLATFORM(MAC)
518     bool executeKeypressCommandsInternal(const Vector<WebCore::KeypressCommand>&, WebCore::KeyboardEvent*);
519 #endif
520
521     String sourceForFrame(WebFrame*);
522
523     void loadData(PassRefPtr<WebCore::SharedBuffer>, const String& MIMEType, const String& encodingName, const WebCore::KURL& baseURL, const WebCore::KURL& failingURL);
524
525     bool platformHasLocalDataForURL(const WebCore::KURL&);
526
527     // Actions
528     void tryClose();
529     void loadURL(const String&, const SandboxExtension::Handle&);
530     void loadURLRequest(const WebCore::ResourceRequest&, const SandboxExtension::Handle&);
531     void loadHTMLString(const String& htmlString, const String& baseURL);
532     void loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL);
533     void loadPlainTextString(const String&);
534     void linkClicked(const String& url, const WebMouseEvent&);
535     void reload(bool reloadFromOrigin);
536     void goForward(uint64_t, const SandboxExtension::Handle&);
537     void goBack(uint64_t, const SandboxExtension::Handle&);
538     void goToBackForwardItem(uint64_t, const SandboxExtension::Handle&);
539     void tryRestoreScrollPosition();
540     void setActive(bool);
541     void setFocused(bool);
542     void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&);
543     void setWindowResizerSize(const WebCore::IntSize&);
544     void setIsInWindow(bool);
545     void validateCommand(const String&, uint64_t);
546     void executeEditCommand(const String&);
547
548     void mouseEvent(const WebMouseEvent&);
549     void mouseEventSyncForTesting(const WebMouseEvent&, bool&);
550     void wheelEventSyncForTesting(const WebWheelEvent&, bool&);
551     void keyEvent(const WebKeyboardEvent&);
552     void keyEventSyncForTesting(const WebKeyboardEvent&, bool&);
553 #if ENABLE(TOUCH_EVENTS)
554     void touchEvent(const WebTouchEvent&);
555     void touchEventSyncForTesting(const WebTouchEvent&, bool& handled);
556 #if PLATFORM(QT)
557     void highlightPotentialActivation(const WebCore::IntPoint&);
558 #endif
559 #endif
560     void contextMenuHidden() { m_isShowingContextMenu = false; }
561
562     static void scroll(WebCore::Page*, WebCore::ScrollDirection, WebCore::ScrollGranularity);
563     static void logicalScroll(WebCore::Page*, WebCore::ScrollLogicalDirection, WebCore::ScrollGranularity);
564
565     uint64_t restoreSession(const SessionState&);
566     void restoreSessionAndNavigateToCurrentItem(const SessionState&, const SandboxExtension::Handle&);
567
568     void didRemoveBackForwardItem(uint64_t);
569
570     void setDrawsBackground(bool);
571     void setDrawsTransparentBackground(bool);
572
573     void viewWillStartLiveResize();
574     void viewWillEndLiveResize();
575
576     void getContentsAsString(uint64_t callbackID);
577     void getMainResourceDataOfFrame(uint64_t frameID, uint64_t callbackID);
578     void getResourceDataFromFrame(uint64_t frameID, const String& resourceURL, uint64_t callbackID);
579     void getRenderTreeExternalRepresentation(uint64_t callbackID);
580     void getSelectionOrContentsAsString(uint64_t callbackID);
581     void getSourceForFrame(uint64_t frameID, uint64_t callbackID);
582     void getWebArchiveOfFrame(uint64_t frameID, uint64_t callbackID);
583     void runJavaScriptInMainFrame(const String&, uint64_t callbackID);
584     void forceRepaint(uint64_t callbackID);
585
586     void preferencesDidChange(const WebPreferencesStore&);
587     void platformPreferencesDidChange(const WebPreferencesStore&);
588     void updatePreferences(const WebPreferencesStore&);
589
590     void didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction, uint64_t downloadID);
591     void setUserAgent(const String&);
592     void setCustomTextEncodingName(const String&);
593
594 #if PLATFORM(MAC)
595     void performDictionaryLookupAtLocation(const WebCore::FloatPoint&);
596     void performDictionaryLookupForRange(DictionaryPopupInfo::Type, WebCore::Frame*, WebCore::Range*, NSDictionary *options);
597
598     void setWindowIsVisible(bool windowIsVisible);
599     void windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates, const WebCore::IntPoint& accessibilityViewCoordinates);
600 #endif
601
602     void unapplyEditCommand(uint64_t commandID);
603     void reapplyEditCommand(uint64_t commandID);
604     void didRemoveEditCommand(uint64_t commandID);
605
606     void findString(const String&, uint32_t findOptions, uint32_t maxMatchCount);
607     void hideFindUI();
608     void countStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount);
609
610 #if PLATFORM(QT)
611     void findZoomableAreaForPoint(const WebCore::IntPoint&);
612 #endif
613
614     void didChangeSelectedIndexForActivePopupMenu(int32_t newIndex);
615     void setTextForActivePopupMenu(int32_t index);
616
617 #if PLATFORM(GTK)
618     void failedToShowPopupMenu();
619 #endif
620
621     void didChooseFilesForOpenPanel(const Vector<String>&);
622     void didCancelForOpenPanel();
623 #if ENABLE(WEB_PROCESS_SANDBOX)
624     void extendSandboxForFileFromOpenPanel(const SandboxExtension::Handle&);
625 #endif
626
627     void didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed);
628     void didReceiveNotificationPermissionDecision(uint64_t notificationID, bool allowed);
629
630     void advanceToNextMisspelling(bool startBeforeSelection);
631     void changeSpellingToWord(const String& word);
632 #if PLATFORM(MAC)
633     void uppercaseWord();
634     void lowercaseWord();
635     void capitalizeWord();
636
637     void setSmartInsertDeleteEnabled(bool isSmartInsertDeleteEnabled) { m_isSmartInsertDeleteEnabled = isSmartInsertDeleteEnabled; }
638 #endif
639
640 #if ENABLE(CONTEXT_MENUS)
641     void didSelectItemFromActiveContextMenu(const WebContextMenuItemData&);
642 #endif
643
644     void setCanStartMediaTimerFired();
645
646     static bool platformCanHandleRequest(const WebCore::ResourceRequest&);
647
648     OwnPtr<WebCore::Page> m_page;
649     RefPtr<WebFrame> m_mainFrame;
650     RefPtr<InjectedBundleBackForwardList> m_backForwardList;
651
652     RefPtr<WebPageGroupProxy> m_pageGroup;
653
654     String m_userAgent;
655
656     WebCore::IntSize m_viewSize;
657     OwnPtr<DrawingArea> m_drawingArea;
658     bool m_useFixedLayout;
659
660     bool m_drawsBackground;
661     bool m_drawsTransparentBackground;
662
663     bool m_isInRedo;
664     bool m_isClosed;
665
666     bool m_tabToLinks;
667
668 #if PLATFORM(MAC)
669     // Whether the containing window is visible or not.
670     bool m_windowIsVisible;
671
672     // Whether smart insert/delete is enabled or not.
673     bool m_isSmartInsertDeleteEnabled;
674
675     // The frame of the containing window in screen coordinates.
676     WebCore::IntRect m_windowFrameInScreenCoordinates;
677
678     // The frame of the view in window coordinates.
679     WebCore::IntRect m_viewFrameInWindowCoordinates;
680
681     // The accessibility position of the view.
682     WebCore::IntPoint m_accessibilityPosition;
683     
684     // All plug-in views on this web page.
685     HashSet<PluginView*> m_pluginViews;
686
687     RetainPtr<WKAccessibilityWebPageObject> m_mockAccessibilityElement;
688
689     WebCore::KeyboardEvent* m_keyboardEventBeingInterpreted;
690
691 #elif PLATFORM(WIN)
692     // Our view's window (in the UI process).
693     HWND m_nativeWindow;
694
695     RefPtr<WebCore::Node> m_gestureTargetNode;
696 #elif PLATFORM(GTK)
697     WebPageAccessibilityObject* m_accessibilityObject;
698 #endif
699     
700     WebCore::RunLoop::Timer<WebPage> m_setCanStartMediaTimer;
701
702     HashMap<uint64_t, RefPtr<WebUndoStep> > m_undoStepMap;
703
704     WebCore::IntSize m_windowResizerSize;
705
706     InjectedBundlePageContextMenuClient m_contextMenuClient;
707     InjectedBundlePageEditorClient m_editorClient;
708     InjectedBundlePageFormClient m_formClient;
709     InjectedBundlePageLoaderClient m_loaderClient;
710     InjectedBundlePagePolicyClient m_policyClient;
711     InjectedBundlePageResourceLoadClient m_resourceLoadClient;
712     InjectedBundlePageUIClient m_uiClient;
713 #if ENABLE(FULLSCREEN_API)
714     InjectedBundlePageFullScreenClient m_fullScreenClient;
715 #endif
716
717 #if USE(TILED_BACKING_STORE)
718     WebCore::IntSize m_resizesToContentsLayoutSize;
719     WebCore::IntSize m_viewportSize;
720 #endif
721
722     FindController m_findController;
723 #if PLATFORM(QT)
724     TapHighlightController m_tapHighlightController;
725 #endif
726     RefPtr<PageOverlay> m_pageOverlay;
727
728     RefPtr<WebPage> m_underlayPage;
729
730 #if ENABLE(INSPECTOR)
731     RefPtr<WebInspector> m_inspector;
732 #endif
733 #if ENABLE(FULLSCREEN_API)
734     RefPtr<WebFullScreenManager> m_fullScreenManager;
735 #endif
736     RefPtr<WebPopupMenu> m_activePopupMenu;
737     RefPtr<WebContextMenu> m_contextMenu;
738     RefPtr<WebOpenPanelResultListener> m_activeOpenPanelResultListener;
739     GeolocationPermissionRequestManager m_geolocationPermissionRequestManager;
740     RefPtr<NotificationPermissionRequestManager> m_notificationPermissionRequestManager;
741
742     OwnPtr<WebCore::PrintContext> m_printContext;
743 #if PLATFORM(GTK)
744     RefPtr<WebPrintOperationGtk> m_printOperation;
745 #endif
746
747     SandboxExtensionTracker m_sandboxExtensionTracker;
748     uint64_t m_pageID;
749
750     RefPtr<SandboxExtension> m_pendingDropSandboxExtension;
751
752     bool m_canRunBeforeUnloadConfirmPanel;
753
754     bool m_canRunModal;
755     bool m_isRunningModal;
756
757     bool m_cachedMainFrameIsPinnedToLeftSide;
758     bool m_cachedMainFrameIsPinnedToRightSide;
759
760     unsigned m_cachedPageCount;
761
762     bool m_isShowingContextMenu;
763
764 #if PLATFORM(WIN)
765     bool m_gestureReachedScrollingLimit;
766 #endif
767 #if PLATFORM(QT)
768     HashMap<String, QtNetworkReply*> m_applicationSchemeReplies;
769 #endif
770 };
771
772 } // namespace WebKit
773
774 #endif // WebPage_h