2 * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
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.
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.
26 #ifndef WebPageProxy_h
27 #define WebPageProxy_h
29 #include "APIObject.h"
30 #include "Connection.h"
31 #include "ContextMenuState.h"
32 #include "DragControllerAction.h"
33 #include "DrawingAreaProxy.h"
34 #include "EditorState.h"
35 #include "GeolocationPermissionRequestManagerProxy.h"
36 #include "SandboxExtension.h"
37 #include "SharedMemory.h"
39 #include "WKPagePrivate.h"
40 #include "WebContextMenuItemData.h"
41 #include "WebFindClient.h"
42 #include "WebFormClient.h"
43 #include "WebFrameProxy.h"
44 #include "WebHistoryClient.h"
45 #include "WebLoaderClient.h"
46 #include "WebPageContextMenuClient.h"
47 #include "WebPolicyClient.h"
48 #include "WebPopupMenuProxy.h"
49 #include "WebResourceLoadClient.h"
50 #include "WebUIClient.h"
51 #include <WebCore/ScrollTypes.h>
52 #include <wtf/HashMap.h>
53 #include <wtf/HashSet.h>
54 #include <wtf/OwnPtr.h>
55 #include <wtf/PassOwnPtr.h>
56 #include <wtf/PassRefPtr.h>
57 #include <wtf/RefPtr.h>
58 #include <wtf/text/WTFString.h>
61 class ArgumentDecoder;
67 class AuthenticationChallenge;
72 class ProtectionSpace;
73 struct TextCheckingResult;
74 struct ViewportArguments;
75 struct WindowFeatures;
88 class NativeWebKeyboardEvent;
89 class NativeWebMouseEvent;
91 class PlatformCertificateInfo;
92 class StringPairVector;
93 class WebBackForwardList;
94 class WebBackForwardListItem;
95 class WebContextMenuProxy;
97 class WebEditCommandProxy;
98 class WebFullScreenManagerProxy;
99 class WebKeyboardEvent;
101 class WebOpenPanelResultListenerProxy;
103 class WebProcessProxy;
106 struct AttributedString;
107 struct DictionaryPopupInfo;
109 struct PlatformPopupMenuData;
111 struct WebPageCreationParameters;
114 #if ENABLE(GESTURE_EVENTS)
115 class WebGestureEvent;
118 typedef GenericCallback<WKStringRef, StringImpl*> StringCallback;
119 typedef GenericCallback<WKSerializedScriptValueRef, WebSerializedScriptValue*> ScriptValueCallback;
121 // FIXME: Make a version of CallbackBase with three arguments, and define ValidateCommandCallback as a specialization.
122 class ValidateCommandCallback : public CallbackBase {
124 typedef void (*CallbackFunction)(WKStringRef, bool, int32_t, WKErrorRef, void*);
126 static PassRefPtr<ValidateCommandCallback> create(void* context, CallbackFunction callback)
128 return adoptRef(new ValidateCommandCallback(context, callback));
131 virtual ~ValidateCommandCallback()
136 void performCallbackWithReturnValue(StringImpl* returnValue1, bool returnValue2, int returnValue3)
140 m_callback(toAPI(returnValue1), returnValue2, returnValue3, 0, context());
149 RefPtr<WebError> error = WebError::create();
150 m_callback(0, 0, 0, toAPI(error.get()), context());
157 ValidateCommandCallback(void* context, CallbackFunction callback)
158 : CallbackBase(context)
159 , m_callback(callback)
163 CallbackFunction m_callback;
166 class WebPageProxy : public APIObject, public WebPopupMenuProxy::Client {
168 static const Type APIType = TypePage;
170 static PassRefPtr<WebPageProxy> create(PageClient*, PassRefPtr<WebProcessProxy>, WebPageGroup*, uint64_t pageID);
171 virtual ~WebPageProxy();
173 uint64_t pageID() const { return m_pageID; }
175 WebFrameProxy* mainFrame() const { return m_mainFrame.get(); }
176 WebFrameProxy* focusedFrame() const { return m_focusedFrame.get(); }
177 WebFrameProxy* frameSetLargestFrame() const { return m_frameSetLargestFrame.get(); }
179 DrawingAreaProxy* drawingArea() { return m_drawingArea.get(); }
180 void setDrawingArea(PassOwnPtr<DrawingAreaProxy>);
182 WebBackForwardList* backForwardList() { return m_backForwardList.get(); }
184 #if ENABLE(INSPECTOR)
185 WebInspectorProxy* inspector();
188 #if ENABLE(FULLSCREEN_API)
189 WebFullScreenManagerProxy* fullScreenManager();
192 void initializeContextMenuClient(const WKPageContextMenuClient*);
193 void initializeFindClient(const WKPageFindClient*);
194 void initializeFormClient(const WKPageFormClient*);
195 void initializeLoaderClient(const WKPageLoaderClient*);
196 void initializePolicyClient(const WKPagePolicyClient*);
197 void initializeResourceLoadClient(const WKPageResourceLoadClient*);
198 void initializeUIClient(const WKPageUIClient*);
200 void initializeWebPage();
204 bool isClosed() const { return m_isClosed; }
206 void loadURL(const String&);
207 void loadURLRequest(WebURLRequest*);
208 void loadHTMLString(const String& htmlString, const String& baseURL);
209 void loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL);
210 void loadPlainTextString(const String& string);
213 void reload(bool reloadFromOrigin);
216 bool canGoForward() const;
218 bool canGoBack() const;
220 void goToBackForwardItem(WebBackForwardListItem*);
221 void didChangeBackForwardList(WebBackForwardListItem* addedItem, Vector<RefPtr<APIObject> >* removedItems);
222 void shouldGoToBackForwardListItem(uint64_t itemID, bool& shouldGoToBackForwardListItem);
224 bool canShowMIMEType(const String& mimeType) const;
226 bool drawsBackground() const { return m_drawsBackground; }
227 void setDrawsBackground(bool);
229 bool drawsTransparentBackground() const { return m_drawsTransparentBackground; }
230 void setDrawsTransparentBackground(bool);
232 void viewWillStartLiveResize();
233 void viewWillEndLiveResize();
235 void setInitialFocus(bool);
236 void setWindowResizerSize(const WebCore::IntSize&);
238 void clearSelection();
240 void setViewNeedsDisplay(const WebCore::IntRect&);
242 void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
245 ViewWindowIsActive = 1 << 0,
246 ViewIsFocused = 1 << 1,
247 ViewIsVisible = 1 << 2,
248 ViewIsInWindow = 1 << 3
250 typedef unsigned ViewStateFlags;
251 void viewStateDidChange(ViewStateFlags flags);
253 WebCore::IntSize viewSize() const;
254 bool isViewVisible() const { return m_isVisible; }
255 bool isViewWindowActive() const;
257 void executeEditCommand(const String& commandName);
258 void validateCommand(const String& commandName, PassRefPtr<ValidateCommandCallback>);
260 const EditorState& editorState() const { return m_editorState; }
261 bool canDelete() const { return hasSelectedRange() && isContentEditable(); }
262 bool hasSelectedRange() const { return m_editorState.selectionIsRange; }
263 bool isContentEditable() const { return m_editorState.isContentEditable; }
265 bool maintainsInactiveSelection() const { return m_maintainsInactiveSelection; }
266 void setMaintainsInactiveSelection(bool);
269 void updateWindowIsVisible(bool windowIsVisible);
270 void windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates, const WebCore::IntPoint& accessibilityViewCoordinates);
272 void setComposition(const String& text, Vector<WebCore::CompositionUnderline> underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeEnd);
273 void confirmComposition();
274 void confirmCompositionWithoutDisturbingSelection();
275 bool insertText(const String& text, uint64_t replacementRangeStart, uint64_t replacementRangeEnd);
276 void getMarkedRange(uint64_t& location, uint64_t& length);
277 void getSelectedRange(uint64_t& location, uint64_t& length);
278 void getAttributedSubstringFromRange(uint64_t location, uint64_t length, AttributedString&);
279 uint64_t characterIndexForPoint(const WebCore::IntPoint);
280 WebCore::IntRect firstRectForCharacterRange(uint64_t, uint64_t);
281 bool executeKeypressCommands(const Vector<WebCore::KeypressCommand>&);
283 void sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String& textInput);
284 CGContextRef containingWindowGraphicsContext();
285 bool shouldDelayWindowOrderingForEvent(const WebMouseEvent&);
286 bool acceptsFirstMouse(int eventNumber, const WebMouseEvent&);
288 WKView* wkView() const;
291 void didChangeCompositionSelection(bool);
292 void confirmComposition(const String&);
293 void setComposition(const String&, Vector<WebCore::CompositionUnderline>&, int);
294 WebCore::IntRect firstRectForCharacterInSelectedRange(int);
295 String getSelectedText();
297 bool gestureWillBegin(const WebCore::IntPoint&);
298 void gestureDidScroll(const WebCore::IntSize&);
299 void gestureDidEnd();
301 void setGestureReachedScrollingLimit(bool);
303 HWND nativeWindow() const;
305 #if ENABLE(TILED_BACKING_STORE)
306 void setActualVisibleContentRect(const WebCore::IntRect& rect);
309 void handleMouseEvent(const NativeWebMouseEvent&);
310 void handleWheelEvent(const WebWheelEvent&);
311 void handleKeyboardEvent(const NativeWebKeyboardEvent&);
312 #if ENABLE(GESTURE_EVENTS)
313 void handleGestureEvent(const WebGestureEvent&);
315 #if ENABLE(TOUCH_EVENTS)
316 void handleTouchEvent(const WebTouchEvent&);
319 void scrollBy(WebCore::ScrollDirection, WebCore::ScrollGranularity);
321 String pageTitle() const;
322 const String& toolTip() const { return m_toolTip; }
324 void setUserAgent(const String&);
325 const String& userAgent() const { return m_userAgent; }
326 void setApplicationNameForUserAgent(const String&);
327 const String& applicationNameForUserAgent() const { return m_applicationNameForUserAgent; }
328 void setCustomUserAgent(const String&);
329 const String& customUserAgent() const { return m_customUserAgent; }
331 bool supportsTextEncoding() const;
332 void setCustomTextEncodingName(const String&);
333 String customTextEncodingName() const { return m_customTextEncodingName; }
335 double estimatedProgress() const;
337 void terminateProcess();
339 typedef bool (*WebPageProxySessionStateFilterCallback)(WKPageRef, WKStringRef type, WKTypeRef object, void* context);
340 PassRefPtr<WebData> sessionStateData(WebPageProxySessionStateFilterCallback, void* context) const;
341 void restoreFromSessionStateData(WebData*);
343 bool supportsTextZoom() const;
344 double textZoomFactor() const { return m_mainFrameHasCustomRepresentation ? 1 : m_textZoomFactor; }
345 void setTextZoomFactor(double);
346 double pageZoomFactor() const;
347 void setPageZoomFactor(double);
348 void setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor);
350 void scaleWebView(double scale, const WebCore::IntPoint& origin);
351 double viewScaleFactor() const { return m_viewScaleFactor; }
353 void setUseFixedLayout(bool);
354 void setFixedLayoutSize(const WebCore::IntSize&);
355 bool useFixedLayout() const { return m_useFixedLayout; };
356 const WebCore::IntSize& fixedLayoutSize() const { return m_fixedLayoutSize; };
358 bool hasHorizontalScrollbar() const { return m_mainFrameHasHorizontalScrollbar; }
359 bool hasVerticalScrollbar() const { return m_mainFrameHasVerticalScrollbar; }
361 bool isPinnedToLeftSide() const { return m_mainFrameIsPinnedToLeftSide; }
362 bool isPinnedToRightSide() const { return m_mainFrameIsPinnedToRightSide; }
365 // Called by the web process through a message.
366 void registerWebProcessAccessibilityToken(const CoreIPC::DataReference&);
367 // Called by the UI process when it is ready to send its tokens to the web process.
368 void registerUIProcessAccessibilityTokens(const CoreIPC::DataReference& elemenToken, const CoreIPC::DataReference& windowToken);
369 bool writeSelectionToPasteboard(const String& pasteboardName, const Vector<String>& pasteboardTypes);
370 bool readSelectionFromPasteboard(const String& pasteboardName);
373 void viewScaleFactorDidChange(double);
375 void setMemoryCacheClientCallsEnabled(bool);
378 void findString(const String&, FindOptions, unsigned maxMatchCount);
380 void countStringMatches(const String&, FindOptions, unsigned maxMatchCount);
381 void didCountStringMatches(const String&, uint32_t matchCount);
382 void setFindIndicator(const WebCore::FloatRect& selectionRectInWindowCoordinates, const Vector<WebCore::FloatRect>& textRectsInSelectionRectCoordinates, const ShareableBitmap::Handle& contentImageHandle, bool fadeOut);
383 void didFindString(const String&, uint32_t matchCount);
384 void didFailToFindString(const String&);
386 void getContentsAsString(PassRefPtr<StringCallback>);
387 void getMainResourceDataOfFrame(WebFrameProxy*, PassRefPtr<DataCallback>);
388 void getResourceDataFromFrame(WebFrameProxy*, WebURL*, PassRefPtr<DataCallback>);
389 void getRenderTreeExternalRepresentation(PassRefPtr<StringCallback>);
390 void getSelectionOrContentsAsString(PassRefPtr<StringCallback>);
391 void getSourceForFrame(WebFrameProxy*, PassRefPtr<StringCallback>);
392 void getWebArchiveOfFrame(WebFrameProxy*, PassRefPtr<DataCallback>);
393 void runJavaScriptInMainFrame(const String&, PassRefPtr<ScriptValueCallback>);
394 void forceRepaint(PassRefPtr<VoidCallback>);
396 float headerHeight(WebFrameProxy*);
397 float footerHeight(WebFrameProxy*);
398 void drawHeader(WebFrameProxy*, const WebCore::FloatRect&);
399 void drawFooter(WebFrameProxy*, const WebCore::FloatRect&);
403 void performDictionaryLookupAtLocation(const WebCore::FloatPoint&);
406 void receivedPolicyDecision(WebCore::PolicyAction, WebFrameProxy*, uint64_t listenerID);
408 void backForwardRemovedItem(uint64_t itemID);
410 // Drag and drop support.
411 void dragEntered(WebCore::DragData*, const String& dragStorageName = String());
412 void dragUpdated(WebCore::DragData*, const String& dragStorageName = String());
413 void dragExited(WebCore::DragData*, const String& dragStorageName = String());
414 void performDrag(WebCore::DragData*, const String& dragStorageName, const SandboxExtension::Handle&);
416 void didPerformDragControllerAction(uint64_t resultOperation);
417 void dragEnded(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition, uint64_t operation);
419 void setDragImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& dragImageHandle, bool isLinkDrag);
422 void startDragDrop(const WebCore::IntPoint& imagePoint, const WebCore::IntPoint& dragPoint, uint64_t okEffect, const HashMap<UINT, Vector<String> >& dataMap, const WebCore::IntSize& dragImageSize, const SharedMemory::Handle& dragImageHandle, bool isLinkDrag);
424 void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
425 void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*);
427 void processDidBecomeUnresponsive();
428 void processDidBecomeResponsive();
429 void processDidCrash();
431 #if USE(ACCELERATED_COMPOSITING)
432 virtual void enterAcceleratedCompositingMode(const LayerTreeContext&);
433 virtual void exitAcceleratedCompositingMode();
438 enum UndoOrRedo { Undo, Redo };
439 void addEditCommand(WebEditCommandProxy*);
440 void removeEditCommand(WebEditCommandProxy*);
441 bool isValidEditCommand(WebEditCommandProxy*);
442 void registerEditCommand(PassRefPtr<WebEditCommandProxy>, UndoOrRedo);
444 WebProcessProxy* process() const;
446 WebPageGroup* pageGroup() const { return m_pageGroup.get(); }
450 WebCore::DragOperation dragOperation() { return m_currentDragOperation; }
451 void resetDragOperation() { m_currentDragOperation = WebCore::DragOperationNone; }
453 void preferencesDidChange();
455 #if ENABLE(TILED_BACKING_STORE)
456 void setResizesToContentsUsingLayoutSize(const WebCore::IntSize&);
459 // Called by the WebContextMenuProxy.
460 void contextMenuItemSelected(const WebContextMenuItemData&);
462 // Called by the WebOpenPanelResultListenerProxy.
463 void didChooseFilesForOpenPanel(const Vector<String>&);
464 void didCancelForOpenPanel();
466 WebPageCreationParameters creationParameters() const;
469 void findZoomableAreaForPoint(const WebCore::IntPoint&);
472 void advanceToNextMisspelling(bool startBeforeSelection) const;
473 void changeSpellingToWord(const String& word) const;
475 void uppercaseWord();
476 void lowercaseWord();
477 void capitalizeWord();
479 bool isSmartInsertDeleteEnabled() const { return m_isSmartInsertDeleteEnabled; }
480 void setSmartInsertDeleteEnabled(bool);
483 void beginPrinting(WebFrameProxy*, const PrintInfo&);
485 void computePagesForPrinting(WebFrameProxy*, const PrintInfo&, PassRefPtr<ComputedPagesCallback>);
486 #if PLATFORM(MAC) || PLATFORM(WIN)
487 void drawRectToPDF(WebFrameProxy*, const WebCore::IntRect&, PassRefPtr<DataCallback>);
488 void drawPagesToPDF(WebFrameProxy*, uint32_t first, uint32_t count, PassRefPtr<DataCallback>);
491 const String& pendingAPIRequestURL() const { return m_pendingAPIRequestURL; }
493 void flashBackingStoreUpdates(const Vector<WebCore::IntRect>& updateRects);
496 void handleCorrectionPanelResult(const String& result);
499 static void setDebugPaintFlags(WKPageDebugPaintFlags flags) { s_debugPaintFlags = flags; }
500 static WKPageDebugPaintFlags debugPaintFlags() { return s_debugPaintFlags; }
502 // Color to be used with kWKDebugFlashViewUpdates.
503 static WebCore::Color viewUpdatesFlashColor();
505 // Color to be used with kWKDebugFlashBackingStoreUpdates.
506 static WebCore::Color backingStoreUpdatesFlashColor();
508 void saveDataToFileInDownloadsFolder(const String& suggestedFilename, const String& mimeType, const String& originatingURLString, WebData*);
510 void linkClicked(const String&, const WebMouseEvent&);
512 WebCore::IntRect visibleScrollerThumbRect() const { return m_visibleScrollerThumbRect; }
514 // FIXME: This is in violation of the no synchronous messages to the Web Process policy and
515 // should be removed as soon as possible.
516 PassRefPtr<WebImage> createSnapshotOfVisibleContent();
519 WebPageProxy(PageClient*, PassRefPtr<WebProcessProxy>, WebPageGroup*, uint64_t pageID);
521 virtual Type type() const { return APIType; }
523 // WebPopupMenuProxy::Client
524 virtual void valueChangedForPopupMenu(WebPopupMenuProxy*, int32_t newSelectedIndex);
525 virtual void setTextFromItemForPopupMenu(WebPopupMenuProxy*, int32_t index);
526 virtual NativeWebMouseEvent* currentlyProcessedMouseDownEvent();
528 // Implemented in generated WebPageProxyMessageReceiver.cpp
529 void didReceiveWebPageProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
530 CoreIPC::SyncReplyMode didReceiveSyncWebPageProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*);
532 void didCreateMainFrame(uint64_t frameID);
533 void didCreateSubframe(uint64_t frameID, uint64_t parentFrameID);
534 void didSaveFrameToPageCache(uint64_t frameID);
535 void didRestoreFrameFromPageCache(uint64_t frameID, uint64_t parentFrameID);
537 void didStartProvisionalLoadForFrame(uint64_t frameID, const String& url, const String& unreachableURL, CoreIPC::ArgumentDecoder*);
538 void didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, const String&, CoreIPC::ArgumentDecoder*);
539 void didFailProvisionalLoadForFrame(uint64_t frameID, const WebCore::ResourceError&, CoreIPC::ArgumentDecoder*);
540 void didCommitLoadForFrame(uint64_t frameID, const String& mimeType, bool frameHasCustomRepresentation, const PlatformCertificateInfo&, CoreIPC::ArgumentDecoder*);
541 void didFinishDocumentLoadForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*);
542 void didFinishLoadForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*);
543 void didFailLoadForFrame(uint64_t frameID, const WebCore::ResourceError&, CoreIPC::ArgumentDecoder*);
544 void didSameDocumentNavigationForFrame(uint64_t frameID, uint32_t sameDocumentNavigationType, const String&, CoreIPC::ArgumentDecoder*);
545 void didReceiveTitleForFrame(uint64_t frameID, const String&, CoreIPC::ArgumentDecoder*);
546 void didFirstLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*);
547 void didFirstVisuallyNonEmptyLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*);
548 void didRemoveFrameFromHierarchy(uint64_t frameID, CoreIPC::ArgumentDecoder*);
549 void didDisplayInsecureContentForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*);
550 void didRunInsecureContentForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*);
551 void frameDidBecomeFrameSet(uint64_t frameID, bool);
552 void didStartProgress();
553 void didChangeProgress(double);
554 void didFinishProgress();
556 void decidePolicyForNavigationAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, const WebCore::ResourceRequest&, uint64_t listenerID, CoreIPC::ArgumentDecoder*, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID);
557 void decidePolicyForNewWindowAction(uint64_t frameID, uint32_t navigationType, uint32_t modifiers, int32_t mouseButton, const WebCore::ResourceRequest&, const String& frameName, uint64_t listenerID, CoreIPC::ArgumentDecoder*);
558 void decidePolicyForResponse(uint64_t frameID, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID);
559 void unableToImplementPolicy(uint64_t frameID, const WebCore::ResourceError&, CoreIPC::ArgumentDecoder* arguments);
561 void willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const StringPairVector& textFieldValues, uint64_t listenerID, CoreIPC::ArgumentDecoder*);
563 // Resource load client
564 void didInitiateLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, const WebCore::ResourceRequest&, bool pageIsProvisionallyLoading);
565 void didSendRequestForResource(uint64_t frameID, uint64_t resourceIdentifier, const WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse);
566 void didReceiveResponseForResource(uint64_t frameID, uint64_t resourceIdentifier, const WebCore::ResourceResponse&);
567 void didReceiveContentLengthForResource(uint64_t frameID, uint64_t resourceIdentifier, uint64_t contentLength);
568 void didFinishLoadForResource(uint64_t frameID, uint64_t resourceIdentifier);
569 void didFailLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, const WebCore::ResourceError&);
572 void createNewPage(const WebCore::WindowFeatures&, uint32_t modifiers, int32_t mouseButton, uint64_t& newPageID, WebPageCreationParameters&);
575 void runJavaScriptAlert(uint64_t frameID, const String&);
576 void runJavaScriptConfirm(uint64_t frameID, const String&, bool& result);
577 void runJavaScriptPrompt(uint64_t frameID, const String&, const String&, String& result);
578 void shouldInterruptJavaScript(bool& result);
579 void setStatusText(const String&);
580 void mouseDidMoveOverElement(uint32_t modifiers, CoreIPC::ArgumentDecoder*);
581 void missingPluginButtonClicked(const String& mimeType, const String& url, const String& pluginsPageURL);
582 void setToolbarsAreVisible(bool toolbarsAreVisible);
583 void getToolbarsAreVisible(bool& toolbarsAreVisible);
584 void setMenuBarIsVisible(bool menuBarIsVisible);
585 void getMenuBarIsVisible(bool& menuBarIsVisible);
586 void setStatusBarIsVisible(bool statusBarIsVisible);
587 void getStatusBarIsVisible(bool& statusBarIsVisible);
588 void setIsResizable(bool isResizable);
589 void getIsResizable(bool& isResizable);
590 void setWindowFrame(const WebCore::FloatRect&);
591 void getWindowFrame(WebCore::FloatRect&);
592 void windowToScreen(const WebCore::IntRect& viewRect, WebCore::IntRect& result);
593 void runBeforeUnloadConfirmPanel(const String& message, uint64_t frameID, bool& shouldClose);
594 void didChangeViewportData(const WebCore::ViewportArguments&);
595 void pageDidScroll();
596 void runOpenPanel(uint64_t frameID, const WebOpenPanelParameters::Data&);
597 void printFrame(uint64_t frameID);
598 void exceededDatabaseQuota(uint64_t frameID, const String& originIdentifier, const String& databaseName, const String& displayName, uint64_t currentQuota, uint64_t currentUsage, uint64_t expectedUsage, uint64_t& newQuota);
599 void requestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, String originIdentifier);
600 void runModal() { m_uiClient.runModal(this); }
601 void didCompleteRubberBandForMainFrame(const WebCore::IntSize&);
602 void notifyScrollerThumbIsVisibleInRect(const WebCore::IntRect&);
603 void didChangeScrollbarsForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar);
604 void didChangeScrollOffsetPinningForMainFrame(bool pinnedToLeftSide, bool pinnedToRightSide);
605 void didFailToInitializePlugin(const String& mimeType);
607 void reattachToWebProcess();
608 void reattachToWebProcessWithItem(WebBackForwardListItem*);
610 #if ENABLE(TILED_BACKING_STORE)
611 void pageDidRequestScroll(const WebCore::IntPoint&);
615 void didChangeContentsSize(const WebCore::IntSize&);
616 void didFindZoomableArea(const WebCore::IntRect&);
619 void editorStateChanged(const EditorState&);
621 // Back/Forward list management
622 void backForwardAddItem(uint64_t itemID);
623 void backForwardGoToItem(uint64_t itemID);
624 void backForwardItemAtIndex(int32_t index, uint64_t& itemID);
625 void backForwardBackListCount(int32_t& count);
626 void backForwardForwardListCount(int32_t& count);
627 void backForwardClear();
630 void registerEditCommandForUndo(uint64_t commandID, uint32_t editAction);
631 void clearAllEditCommands();
632 void canUndoRedo(uint32_t action, bool& result);
633 void executeUndoRedo(uint32_t action, bool& result);
637 void interpretQueuedKeyEvent(const EditorState&, bool& handled, Vector<WebCore::KeypressCommand>&);
638 void executeSavedCommandBySelector(const String& selector, bool& handled);
642 void getEditorCommandsForKeyEvent(Vector<String>&);
646 void showPopupMenu(const WebCore::IntRect& rect, uint64_t textDirection, const Vector<WebPopupItem>& items, int32_t selectedIndex, const PlatformPopupMenuData&);
647 void hidePopupMenu();
649 void setPopupMenuSelectedIndex(int32_t);
653 void showContextMenu(const WebCore::IntPoint& menuLocation, const ContextMenuState&, const Vector<WebContextMenuItemData>&, CoreIPC::ArgumentDecoder*);
654 void internalShowContextMenu(const WebCore::IntPoint& menuLocation, const ContextMenuState&, const Vector<WebContextMenuItemData>&, CoreIPC::ArgumentDecoder*);
656 // Search popup results
657 void saveRecentSearches(const String&, const Vector<String>&);
658 void loadRecentSearches(const String&, Vector<String>&);
662 void getIsSpeaking(bool&);
663 void speak(const String&);
667 void searchWithSpotlight(const String&);
670 void didPerformDictionaryLookup(const String&, const DictionaryPopupInfo&);
673 // Spelling and grammar.
674 int64_t spellDocumentTag();
675 #if USE(UNIFIED_TEXT_CHECKING)
676 void checkTextOfParagraph(const String& text, uint64_t checkingTypes, Vector<WebCore::TextCheckingResult>& results);
678 void checkSpellingOfString(const String& text, int32_t& misspellingLocation, int32_t& misspellingLength);
679 void checkGrammarOfString(const String& text, Vector<WebCore::GrammarDetail>&, int32_t& badGrammarLocation, int32_t& badGrammarLength);
680 void spellingUIIsShowing(bool&);
681 void updateSpellingUIWithMisspelledWord(const String& misspelledWord);
682 void updateSpellingUIWithGrammarString(const String& badGrammarPhrase, const WebCore::GrammarDetail&);
683 void getGuessesForWord(const String& word, const String& context, Vector<String>& guesses);
684 void learnWord(const String& word);
685 void ignoreWord(const String& word);
687 void setFocus(bool focused);
688 void takeFocus(uint32_t direction);
689 void setToolTip(const String&);
690 void setCursor(const WebCore::Cursor&);
692 void didReceiveEvent(uint32_t opaqueType, bool handled);
694 void voidCallback(uint64_t);
695 void dataCallback(const CoreIPC::DataReference&, uint64_t);
696 void stringCallback(const String&, uint64_t);
697 void scriptValueCallback(const CoreIPC::DataReference&, uint64_t);
698 void computedPagesCallback(const Vector<WebCore::IntRect>&, double totalScaleFactorForPrinting, uint64_t);
699 void validateCommandCallback(const String&, bool, int, uint64_t);
701 void focusedFrameChanged(uint64_t frameID);
702 void frameSetLargestFrameChanged(uint64_t frameID);
704 void canAuthenticateAgainstProtectionSpaceInFrame(uint64_t frameID, const WebCore::ProtectionSpace&, bool& canAuthenticate);
705 void didReceiveAuthenticationChallenge(uint64_t frameID, const WebCore::AuthenticationChallenge&, uint64_t challengeID);
707 void didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference&);
710 void setComplexTextInputEnabled(uint64_t pluginComplexTextInputIdentifier, bool complexTextInputEnabled);
713 static String standardUserAgent(const String& applicationName = String());
715 void clearPendingAPIRequestURL() { m_pendingAPIRequestURL = String(); }
716 void setPendingAPIRequestURL(const String& pendingAPIRequestURL) { m_pendingAPIRequestURL = pendingAPIRequestURL; }
718 void initializeSandboxExtensionHandle(const WebCore::KURL&, SandboxExtension::Handle&);
721 void substitutionsPanelIsShowing(bool&);
722 #if !defined(BUILDING_ON_SNOW_LEOPARD)
723 void showCorrectionPanel(int32_t panelType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings);
724 void dismissCorrectionPanel(int32_t reason);
725 void dismissCorrectionPanelSoon(int32_t reason, String& result);
726 void recordAutocorrectionResponse(int32_t responseType, const String& replacedString, const String& replacementString);
727 #endif // !defined(BUILDING_ON_SNOW_LEOPARD)
728 #endif // PLATFORM(MAC)
730 void clearLoadDependentCallbacks();
732 void performDragControllerAction(DragControllerAction, WebCore::DragData*, const String& dragStorageName, const SandboxExtension::Handle&);
734 void updateBackingStoreDiscardableState();
736 PageClient* m_pageClient;
737 WebLoaderClient m_loaderClient;
738 WebPolicyClient m_policyClient;
739 WebFormClient m_formClient;
740 WebResourceLoadClient m_resourceLoadClient;
741 WebUIClient m_uiClient;
742 WebFindClient m_findClient;
743 WebPageContextMenuClient m_contextMenuClient;
745 OwnPtr<DrawingAreaProxy> m_drawingArea;
746 RefPtr<WebProcessProxy> m_process;
747 RefPtr<WebPageGroup> m_pageGroup;
748 RefPtr<WebFrameProxy> m_mainFrame;
749 RefPtr<WebFrameProxy> m_focusedFrame;
750 RefPtr<WebFrameProxy> m_frameSetLargestFrame;
753 String m_applicationNameForUserAgent;
754 String m_customUserAgent;
755 String m_customTextEncodingName;
757 #if ENABLE(INSPECTOR)
758 RefPtr<WebInspectorProxy> m_inspector;
761 #if ENABLE(FULLSCREEN_API)
762 RefPtr<WebFullScreenManagerProxy> m_fullScreenManager;
765 HashMap<uint64_t, RefPtr<VoidCallback> > m_voidCallbacks;
766 HashMap<uint64_t, RefPtr<DataCallback> > m_dataCallbacks;
767 HashMap<uint64_t, RefPtr<StringCallback> > m_stringCallbacks;
768 HashSet<uint64_t> m_loadDependentStringCallbackIDs;
769 HashMap<uint64_t, RefPtr<ScriptValueCallback> > m_scriptValueCallbacks;
770 HashMap<uint64_t, RefPtr<ComputedPagesCallback> > m_computedPagesCallbacks;
771 HashMap<uint64_t, RefPtr<ValidateCommandCallback> > m_validateCommandCallbacks;
773 HashSet<WebEditCommandProxy*> m_editCommandSet;
775 RefPtr<WebPopupMenuProxy> m_activePopupMenu;
776 RefPtr<WebContextMenuProxy> m_activeContextMenu;
777 ContextMenuState m_activeContextMenuState;
778 RefPtr<WebOpenPanelResultListenerProxy> m_openPanelResultListener;
779 GeolocationPermissionRequestManagerProxy m_geolocationPermissionRequestManager;
781 double m_estimatedProgress;
783 // Whether the web page is contained in a top-level window.
786 // Whether the page is visible; if the backing view is visible and inserted into a window.
791 RefPtr<WebBackForwardList> m_backForwardList;
793 bool m_maintainsInactiveSelection;
797 EditorState m_editorState;
799 double m_textZoomFactor;
800 double m_pageZoomFactor;
801 double m_viewScaleFactor;
803 bool m_drawsBackground;
804 bool m_drawsTransparentBackground;
806 bool m_areMemoryCacheClientCallsEnabled;
808 bool m_useFixedLayout;
809 WebCore::IntSize m_fixedLayoutSize;
811 // If the process backing the web page is alive and kicking.
814 // Whether WebPageProxy::close() has been called on this page.
817 bool m_isInPrintingMode;
818 bool m_isPerformingDOMPrintOperation;
820 bool m_inDecidePolicyForMIMEType;
821 bool m_syncMimeTypePolicyActionIsValid;
822 WebCore::PolicyAction m_syncMimeTypePolicyAction;
823 uint64_t m_syncMimeTypePolicyDownloadID;
825 bool m_inDecidePolicyForNavigationAction;
826 bool m_syncNavigationActionPolicyActionIsValid;
827 WebCore::PolicyAction m_syncNavigationActionPolicyAction;
828 uint64_t m_syncNavigationActionPolicyDownloadID;
830 Deque<NativeWebKeyboardEvent> m_keyEventQueue;
831 bool m_processingWheelEvent;
832 OwnPtr<WebWheelEvent> m_nextWheelEvent;
834 bool m_processingMouseMoveEvent;
835 OwnPtr<NativeWebMouseEvent> m_nextMouseMoveEvent;
836 OwnPtr<NativeWebMouseEvent> m_currentlyProcessedMouseDownEvent;
841 bool m_isSmartInsertDeleteEnabled;
844 int64_t m_spellDocumentTag;
845 bool m_hasSpellDocumentTag;
846 unsigned m_pendingLearnOrIgnoreWordMessageCount;
848 bool m_mainFrameHasCustomRepresentation;
849 WebCore::DragOperation m_currentDragOperation;
851 String m_pendingAPIRequestURL;
853 bool m_mainFrameHasHorizontalScrollbar;
854 bool m_mainFrameHasVerticalScrollbar;
856 bool m_mainFrameIsPinnedToLeftSide;
857 bool m_mainFrameIsPinnedToRightSide;
859 WebCore::IntRect m_visibleScrollerThumbRect;
861 static WKPageDebugPaintFlags s_debugPaintFlags;
864 } // namespace WebKit
866 #endif // WebPageProxy_h