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