[Qt][WK2] Build failure when using --no-touch-events
[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 setPaginationBehavesLikeColumns(bool);
283     void setPageLength(double);
284     void setGapBetweenPages(double);
285
286     bool drawsBackground() const { return m_drawsBackground; }
287     bool drawsTransparentBackground() const { return m_drawsTransparentBackground; }
288
289     void stopLoading();
290     void stopLoadingFrame(uint64_t frameID);
291     void setDefersLoading(bool deferLoading);
292
293 #if USE(ACCELERATED_COMPOSITING)
294     void enterAcceleratedCompositingMode(WebCore::GraphicsLayer*);
295     void exitAcceleratedCompositingMode();
296 #endif
297
298 #if PLATFORM(MAC)
299     void addPluginView(PluginView*);
300     void removePluginView(PluginView*);
301
302     bool windowIsVisible() const { return m_windowIsVisible; }
303     const WebCore::IntRect& windowFrameInScreenCoordinates() const { return m_windowFrameInScreenCoordinates; }
304     const WebCore::IntRect& viewFrameInWindowCoordinates() const { return m_viewFrameInWindowCoordinates; }
305 #elif PLATFORM(WIN)
306     HWND nativeWindow() const { return m_nativeWindow; }
307 #endif
308
309     bool windowIsFocused() const;
310     void installPageOverlay(PassRefPtr<PageOverlay>);
311     void uninstallPageOverlay(PageOverlay*, bool fadeOut);
312     bool hasPageOverlay() const { return m_pageOverlay; }
313     WebCore::IntPoint screenToWindow(const WebCore::IntPoint&);
314     WebCore::IntRect windowToScreen(const WebCore::IntRect&);
315
316     PassRefPtr<WebImage> snapshotInViewCoordinates(const WebCore::IntRect&, ImageOptions);
317     PassRefPtr<WebImage> snapshotInDocumentCoordinates(const WebCore::IntRect&, ImageOptions);
318     PassRefPtr<WebImage> scaledSnapshotInDocumentCoordinates(const WebCore::IntRect&, double scaleFactor, ImageOptions);
319
320     static const WebEvent* currentEvent();
321
322     FindController& findController() { return m_findController; }
323 #if ENABLE(TOUCH_EVENTS) && PLATFORM(QT)
324     TapHighlightController& tapHighlightController() { return m_tapHighlightController; }
325 #endif
326
327 #if ENABLE(GEOLOCATION)
328     GeolocationPermissionRequestManager& geolocationPermissionRequestManager() { return m_geolocationPermissionRequestManager; }
329 #endif
330
331     NotificationPermissionRequestManager* notificationPermissionRequestManager();
332
333     void pageDidScroll();
334 #if USE(TILED_BACKING_STORE)
335     void pageDidRequestScroll(const WebCore::IntPoint&);
336     void setFixedVisibleContentRect(const WebCore::IntRect&);
337     void setResizesToContentsUsingLayoutSize(const WebCore::IntSize&);
338     void resizeToContentsIfNeeded();
339     void setViewportSize(const WebCore::IntSize&);
340     WebCore::IntSize viewportSize() const { return m_viewportSize; }
341 #endif
342
343     WebContextMenu* contextMenu();
344     
345     bool hasLocalDataForURL(const WebCore::KURL&);
346     String cachedResponseMIMETypeForURL(const WebCore::KURL&);
347     String cachedSuggestedFilenameForURL(const WebCore::KURL&);
348     PassRefPtr<WebCore::SharedBuffer> cachedResponseDataForURL(const WebCore::KURL&);
349
350     static bool canHandleRequest(const WebCore::ResourceRequest&);
351
352     class SandboxExtensionTracker {
353     public:
354         ~SandboxExtensionTracker();
355
356         void invalidate();
357
358         void beginLoad(WebFrame*, const SandboxExtension::Handle& handle);
359         void willPerformLoadDragDestinationAction(PassRefPtr<SandboxExtension> pendingDropSandboxExtension);
360         void didStartProvisionalLoad(WebFrame*);
361         void didCommitProvisionalLoad(WebFrame*);
362         void didFailProvisionalLoad(WebFrame*);
363
364     private:
365         void setPendingProvisionalSandboxExtension(PassRefPtr<SandboxExtension>);
366
367         RefPtr<SandboxExtension> m_pendingProvisionalSandboxExtension;
368         RefPtr<SandboxExtension> m_provisionalSandboxExtension;
369         RefPtr<SandboxExtension> m_committedSandboxExtension;
370     };
371
372     SandboxExtensionTracker& sandboxExtensionTracker() { return m_sandboxExtensionTracker; }
373
374 #if PLATFORM(QT)
375     void setComposition(const String& text, Vector<WebCore::CompositionUnderline> underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeEnd);
376     void confirmComposition(const String& text, int64_t selectionStart, int64_t selectionLength);
377     void cancelComposition();
378 #endif
379
380 #if PLATFORM(MAC)
381     void registerUIProcessAccessibilityTokens(const CoreIPC::DataReference& elemenToken, const CoreIPC::DataReference& windowToken);
382     WKAccessibilityWebPageObject* accessibilityRemoteObject();
383     WebCore::IntPoint accessibilityPosition() const { return m_accessibilityPosition; }    
384     
385     void sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String& textInput);
386
387     void setComposition(const String& text, Vector<WebCore::CompositionUnderline> underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeEnd, EditorState& newState);
388     void confirmComposition(EditorState& newState);
389     void cancelComposition(EditorState& newState);
390     void insertText(const String& text, uint64_t replacementRangeStart, uint64_t replacementRangeEnd, bool& handled, EditorState& newState);
391     void getMarkedRange(uint64_t& location, uint64_t& length);
392     void getSelectedRange(uint64_t& location, uint64_t& length);
393     void getAttributedSubstringFromRange(uint64_t location, uint64_t length, AttributedString&);
394     void characterIndexForPoint(const WebCore::IntPoint point, uint64_t& result);
395     void firstRectForCharacterRange(uint64_t location, uint64_t length, WebCore::IntRect& resultRect);
396     void executeKeypressCommands(const Vector<WebCore::KeypressCommand>&, bool& handled, EditorState& newState);
397     void writeSelectionToPasteboard(const WTF::String& pasteboardName, const WTF::Vector<WTF::String>& pasteboardTypes, bool& result);
398     void readSelectionFromPasteboard(const WTF::String& pasteboardName, bool& result);
399     void shouldDelayWindowOrderingEvent(const WebKit::WebMouseEvent&, bool& result);
400     void acceptsFirstMouse(int eventNumber, const WebKit::WebMouseEvent&, bool& result);
401     bool performNonEditingBehaviorForSelector(const String&);
402
403 #elif PLATFORM(WIN)
404     void confirmComposition(const String& compositionString);
405     void setComposition(const WTF::String& compositionString, const WTF::Vector<WebCore::CompositionUnderline>& underlines, uint64_t cursorPosition);
406     void firstRectForCharacterInSelectedRange(const uint64_t characterPosition, WebCore::IntRect& resultRect);
407     void getSelectedText(WTF::String&);
408
409     void gestureWillBegin(const WebCore::IntPoint&, bool& canBeginPanning);
410     void gestureDidScroll(const WebCore::IntSize&);
411     void gestureDidEnd();
412
413 #elif PLATFORM(GTK)
414     void updateAccessibilityTree();
415 #endif
416
417     void setCompositionForTesting(const String& compositionString, uint64_t from, uint64_t length);
418     bool hasCompositionForTesting();
419     void confirmCompositionForTesting(const String& compositionString);
420
421     // FIXME: This a dummy message, to avoid breaking the build for platforms that don't require
422     // any synchronous messages, and should be removed when <rdar://problem/8775115> is fixed.
423     void dummy(bool&);
424
425 #if PLATFORM(MAC)
426     void performDictionaryLookupForSelection(DictionaryPopupInfo::Type, WebCore::Frame*, const WebCore::VisibleSelection&);
427
428     bool isSpeaking();
429     void speak(const String&);
430     void stopSpeaking();
431
432     bool isSmartInsertDeleteEnabled() const { return m_isSmartInsertDeleteEnabled; }
433 #endif
434
435     void replaceSelectionWithText(WebCore::Frame*, const String&);
436     void clearSelection();
437 #if PLATFORM(WIN)
438     void performDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, const WebCore::DragDataMap&, uint32_t flags);
439 #elif PLATFORM(QT) || PLATFORM(GTK)
440     void performDragControllerAction(uint64_t action, WebCore::DragData);
441 #else
442     void performDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, const WTF::String& dragStorageName, uint32_t flags, const SandboxExtension::Handle&);
443 #endif
444     void dragEnded(WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t operation);
445
446     void willPerformLoadDragDestinationAction();
447
448     void beginPrinting(uint64_t frameID, const PrintInfo&);
449     void endPrinting();
450     void computePagesForPrinting(uint64_t frameID, const PrintInfo&, uint64_t callbackID);
451 #if PLATFORM(MAC) || PLATFORM(WIN)
452     void drawRectToPDF(uint64_t frameID, const PrintInfo&, const WebCore::IntRect&, uint64_t callbackID);
453     void drawPagesToPDF(uint64_t frameID, const PrintInfo&, uint32_t first, uint32_t count, uint64_t callbackID);
454 #elif PLATFORM(GTK)
455     void drawPagesForPrinting(uint64_t frameID, const PrintInfo&, uint64_t callbackID);
456 #endif
457
458     void setMediaVolume(float);
459
460     bool mainFrameHasCustomRepresentation() const;
461
462     void didChangeScrollOffsetForMainFrame();
463
464     void mainFrameDidLayout();
465
466     bool canRunBeforeUnloadConfirmPanel() const { return m_canRunBeforeUnloadConfirmPanel; }
467     void setCanRunBeforeUnloadConfirmPanel(bool canRunBeforeUnloadConfirmPanel) { m_canRunBeforeUnloadConfirmPanel = canRunBeforeUnloadConfirmPanel; }
468
469     bool canRunModal() const { return m_canRunModal; }
470     void setCanRunModal(bool canRunModal) { m_canRunModal = canRunModal; }
471
472     void runModal();
473
474     void setDeviceScaleFactor(float);
475     float deviceScaleFactor() const;
476
477     void setMemoryCacheMessagesEnabled(bool);
478
479     void forceRepaintWithoutCallback();
480
481     void unmarkAllMisspellings();
482     void unmarkAllBadGrammar();
483
484 #if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD)
485     void handleCorrectionPanelResult(const String&);
486 #endif
487
488     // For testing purpose.
489     void simulateMouseDown(int button, WebCore::IntPoint, int clickCount, WKEventModifiers, double time);
490     void simulateMouseUp(int button, WebCore::IntPoint, int clickCount, WKEventModifiers, double time);
491     void simulateMouseMotion(WebCore::IntPoint, double time);
492     String viewportConfigurationAsText(int deviceDPI, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight);
493
494     void contextMenuShowing() { m_isShowingContextMenu = true; }
495
496 #if PLATFORM(QT)
497     void registerApplicationScheme(const String& scheme);
498     void applicationSchemeReply(const QtNetworkReplyData&);
499     void receivedApplicationSchemeRequest(const QNetworkRequest&, QtNetworkReply*);
500 #endif
501     void wheelEvent(const WebWheelEvent&);
502 #if ENABLE(GESTURE_EVENTS)
503     void gestureEvent(const WebGestureEvent&);
504 #endif
505
506     void numWheelEventHandlersChanged(unsigned);
507     void recomputeShortCircuitHorizontalWheelEventsState();
508
509     bool willGoToBackForwardItemCallbackEnabled() const { return m_willGoToBackForwardItemCallbackEnabled; }
510     
511 private:
512     WebPage(uint64_t pageID, const WebPageCreationParameters&);
513
514     virtual Type type() const { return APIType; }
515
516     void platformInitialize();
517
518     void didReceiveWebPageMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
519     void didReceiveSyncWebPageMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&);
520
521 #if !PLATFORM(MAC)
522     static const char* interpretKeyEvent(const WebCore::KeyboardEvent*);
523 #endif
524     bool performDefaultBehaviorForKeyEvent(const WebKeyboardEvent&);
525
526 #if PLATFORM(MAC)
527     bool executeKeypressCommandsInternal(const Vector<WebCore::KeypressCommand>&, WebCore::KeyboardEvent*);
528 #endif
529
530     String sourceForFrame(WebFrame*);
531
532     void loadData(PassRefPtr<WebCore::SharedBuffer>, const String& MIMEType, const String& encodingName, const WebCore::KURL& baseURL, const WebCore::KURL& failingURL);
533
534     bool platformHasLocalDataForURL(const WebCore::KURL&);
535
536     // Actions
537     void tryClose();
538     void loadURL(const String&, const SandboxExtension::Handle&);
539     void loadURLRequest(const WebCore::ResourceRequest&, const SandboxExtension::Handle&);
540     void loadHTMLString(const String& htmlString, const String& baseURL);
541     void loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL);
542     void loadPlainTextString(const String&);
543     void loadWebArchiveData(const CoreIPC::DataReference&);
544     void linkClicked(const String& url, const WebMouseEvent&);
545     void reload(bool reloadFromOrigin, const SandboxExtension::Handle&);
546     void goForward(uint64_t);
547     void goBack(uint64_t);
548     void goToBackForwardItem(uint64_t);
549     void tryRestoreScrollPosition();
550     void setActive(bool);
551     void setFocused(bool);
552     void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&);
553     void setWindowResizerSize(const WebCore::IntSize&);
554     void setIsInWindow(bool);
555     void validateCommand(const String&, uint64_t);
556     void executeEditCommand(const String&);
557
558     void mouseEvent(const WebMouseEvent&);
559     void mouseEventSyncForTesting(const WebMouseEvent&, bool&);
560     void wheelEventSyncForTesting(const WebWheelEvent&, bool&);
561     void keyEvent(const WebKeyboardEvent&);
562     void keyEventSyncForTesting(const WebKeyboardEvent&, bool&);
563 #if ENABLE(TOUCH_EVENTS)
564     void touchEvent(const WebTouchEvent&);
565     void touchEventSyncForTesting(const WebTouchEvent&, bool& handled);
566 #if PLATFORM(QT)
567     void highlightPotentialActivation(const WebCore::IntPoint&);
568 #endif
569 #endif
570     void contextMenuHidden() { m_isShowingContextMenu = false; }
571
572     static void scroll(WebCore::Page*, WebCore::ScrollDirection, WebCore::ScrollGranularity);
573     static void logicalScroll(WebCore::Page*, WebCore::ScrollLogicalDirection, WebCore::ScrollGranularity);
574
575     uint64_t restoreSession(const SessionState&);
576     void restoreSessionAndNavigateToCurrentItem(const SessionState&);
577
578     void didRemoveBackForwardItem(uint64_t);
579
580     void setWillGoToBackForwardItemCallbackEnabled(bool enabled) { m_willGoToBackForwardItemCallbackEnabled = enabled; }
581     
582     void setDrawsBackground(bool);
583     void setDrawsTransparentBackground(bool);
584
585     void viewWillStartLiveResize();
586     void viewWillEndLiveResize();
587
588     void getContentsAsString(uint64_t callbackID);
589     void getMainResourceDataOfFrame(uint64_t frameID, uint64_t callbackID);
590     void getResourceDataFromFrame(uint64_t frameID, const String& resourceURL, uint64_t callbackID);
591     void getRenderTreeExternalRepresentation(uint64_t callbackID);
592     void getSelectionOrContentsAsString(uint64_t callbackID);
593     void getSourceForFrame(uint64_t frameID, uint64_t callbackID);
594     void getWebArchiveOfFrame(uint64_t frameID, uint64_t callbackID);
595     void runJavaScriptInMainFrame(const String&, uint64_t callbackID);
596     void forceRepaint(uint64_t callbackID);
597
598     void preferencesDidChange(const WebPreferencesStore&);
599     void platformPreferencesDidChange(const WebPreferencesStore&);
600     void updatePreferences(const WebPreferencesStore&);
601
602     void didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction, uint64_t downloadID);
603     void setUserAgent(const String&);
604     void setCustomTextEncodingName(const String&);
605     void suspendActiveDOMObjectsAndAnimations();
606     void resumeActiveDOMObjectsAndAnimations();
607
608 #if PLATFORM(MAC)
609     void performDictionaryLookupAtLocation(const WebCore::FloatPoint&);
610     void performDictionaryLookupForRange(DictionaryPopupInfo::Type, WebCore::Frame*, WebCore::Range*, NSDictionary *options);
611
612     void setWindowIsVisible(bool windowIsVisible);
613     void windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates, const WebCore::IntPoint& accessibilityViewCoordinates);
614 #endif
615
616     void unapplyEditCommand(uint64_t commandID);
617     void reapplyEditCommand(uint64_t commandID);
618     void didRemoveEditCommand(uint64_t commandID);
619
620     void findString(const String&, uint32_t findOptions, uint32_t maxMatchCount);
621     void hideFindUI();
622     void countStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount);
623
624 #if PLATFORM(QT)
625     void findZoomableAreaForPoint(const WebCore::IntPoint&);
626 #endif
627
628     void didChangeSelectedIndexForActivePopupMenu(int32_t newIndex);
629     void setTextForActivePopupMenu(int32_t index);
630
631 #if PLATFORM(GTK)
632     void failedToShowPopupMenu();
633 #endif
634
635     void didChooseFilesForOpenPanel(const Vector<String>&);
636     void didCancelForOpenPanel();
637 #if ENABLE(WEB_PROCESS_SANDBOX)
638     void extendSandboxForFileFromOpenPanel(const SandboxExtension::Handle&);
639 #endif
640
641     void didReceiveGeolocationPermissionDecision(uint64_t geolocationID, bool allowed);
642
643     void didReceiveNotificationPermissionDecision(uint64_t notificationID, bool allowed);
644
645     void advanceToNextMisspelling(bool startBeforeSelection);
646     void changeSpellingToWord(const String& word);
647 #if PLATFORM(MAC)
648     void uppercaseWord();
649     void lowercaseWord();
650     void capitalizeWord();
651
652     void setSmartInsertDeleteEnabled(bool isSmartInsertDeleteEnabled) { m_isSmartInsertDeleteEnabled = isSmartInsertDeleteEnabled; }
653 #endif
654
655 #if ENABLE(CONTEXT_MENUS)
656     void didSelectItemFromActiveContextMenu(const WebContextMenuItemData&);
657 #endif
658
659     void setCanStartMediaTimerFired();
660
661     static bool platformCanHandleRequest(const WebCore::ResourceRequest&);
662
663     OwnPtr<WebCore::Page> m_page;
664     RefPtr<WebFrame> m_mainFrame;
665     RefPtr<InjectedBundleBackForwardList> m_backForwardList;
666
667     RefPtr<WebPageGroupProxy> m_pageGroup;
668
669     String m_userAgent;
670
671     WebCore::IntSize m_viewSize;
672     OwnPtr<DrawingArea> m_drawingArea;
673     bool m_useFixedLayout;
674
675     bool m_drawsBackground;
676     bool m_drawsTransparentBackground;
677
678     bool m_isInRedo;
679     bool m_isClosed;
680
681     bool m_tabToLinks;
682
683 #if PLATFORM(MAC)
684     // Whether the containing window is visible or not.
685     bool m_windowIsVisible;
686
687     // Whether smart insert/delete is enabled or not.
688     bool m_isSmartInsertDeleteEnabled;
689
690     // The frame of the containing window in screen coordinates.
691     WebCore::IntRect m_windowFrameInScreenCoordinates;
692
693     // The frame of the view in window coordinates.
694     WebCore::IntRect m_viewFrameInWindowCoordinates;
695
696     // The accessibility position of the view.
697     WebCore::IntPoint m_accessibilityPosition;
698     
699     // All plug-in views on this web page.
700     HashSet<PluginView*> m_pluginViews;
701
702     RetainPtr<WKAccessibilityWebPageObject> m_mockAccessibilityElement;
703
704     WebCore::KeyboardEvent* m_keyboardEventBeingInterpreted;
705
706 #elif PLATFORM(WIN)
707     // Our view's window (in the UI process).
708     HWND m_nativeWindow;
709
710     RefPtr<WebCore::Node> m_gestureTargetNode;
711 #elif PLATFORM(GTK)
712     WebPageAccessibilityObject* m_accessibilityObject;
713 #endif
714     
715     WebCore::RunLoop::Timer<WebPage> m_setCanStartMediaTimer;
716
717     HashMap<uint64_t, RefPtr<WebUndoStep> > m_undoStepMap;
718
719     WebCore::IntSize m_windowResizerSize;
720
721     InjectedBundlePageContextMenuClient m_contextMenuClient;
722     InjectedBundlePageEditorClient m_editorClient;
723     InjectedBundlePageFormClient m_formClient;
724     InjectedBundlePageLoaderClient m_loaderClient;
725     InjectedBundlePagePolicyClient m_policyClient;
726     InjectedBundlePageResourceLoadClient m_resourceLoadClient;
727     InjectedBundlePageUIClient m_uiClient;
728 #if ENABLE(FULLSCREEN_API)
729     InjectedBundlePageFullScreenClient m_fullScreenClient;
730 #endif
731
732 #if USE(TILED_BACKING_STORE)
733     WebCore::IntSize m_viewportSize;
734 #endif
735
736     FindController m_findController;
737 #if ENABLE(TOUCH_EVENTS) && PLATFORM(QT)
738     TapHighlightController m_tapHighlightController;
739 #endif
740     RefPtr<PageOverlay> m_pageOverlay;
741
742     RefPtr<WebPage> m_underlayPage;
743
744 #if ENABLE(INSPECTOR)
745     RefPtr<WebInspector> m_inspector;
746 #endif
747 #if ENABLE(FULLSCREEN_API)
748     RefPtr<WebFullScreenManager> m_fullScreenManager;
749 #endif
750     RefPtr<WebPopupMenu> m_activePopupMenu;
751     RefPtr<WebContextMenu> m_contextMenu;
752     RefPtr<WebOpenPanelResultListener> m_activeOpenPanelResultListener;
753     RefPtr<NotificationPermissionRequestManager> m_notificationPermissionRequestManager;
754
755 #if ENABLE(GEOLOCATION)
756     GeolocationPermissionRequestManager m_geolocationPermissionRequestManager;
757 #endif
758
759     OwnPtr<WebCore::PrintContext> m_printContext;
760 #if PLATFORM(GTK)
761     RefPtr<WebPrintOperationGtk> m_printOperation;
762 #endif
763
764     SandboxExtensionTracker m_sandboxExtensionTracker;
765     uint64_t m_pageID;
766
767     RefPtr<SandboxExtension> m_pendingDropSandboxExtension;
768
769     bool m_canRunBeforeUnloadConfirmPanel;
770
771     bool m_canRunModal;
772     bool m_isRunningModal;
773
774     bool m_cachedMainFrameIsPinnedToLeftSide;
775     bool m_cachedMainFrameIsPinnedToRightSide;
776     bool m_canShortCircuitHorizontalWheelEvents;
777     unsigned m_numWheelEventHandlers;
778
779     unsigned m_cachedPageCount;
780
781     bool m_isShowingContextMenu;
782     
783     bool m_willGoToBackForwardItemCallbackEnabled;
784
785 #if PLATFORM(WIN)
786     bool m_gestureReachedScrollingLimit;
787 #endif
788 #if PLATFORM(QT)
789     HashMap<String, QtNetworkReply*> m_applicationSchemeReplies;
790 #endif
791 };
792
793 } // namespace WebKit
794
795 #endif // WebPage_h