1 /* 2 * Copyright (C) 2010, 2011 Apple Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 * THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26 #ifndef WebPageProxy_h 27 #define WebPageProxy_h 28 29 #include "APIObject.h" 30 #include "Connection.h" 31 #include "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" 38 #include "WKBase.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> 59 60 namespace CoreIPC { 61 class ArgumentDecoder; 62 class Connection; 63 class MessageID; 64 } 65 66 namespace WebCore { 67 class AuthenticationChallenge; 68 class Cursor; 69 class DragData; 70 class FloatRect; 71 class IntSize; 72 class ProtectionSpace; 73 struct TextCheckingResult; 74 struct ViewportArguments; 75 struct WindowFeatures; 76 } 77 78 namespace WebKit { 79 80 class NativeWebKeyboardEvent; 81 class NativeWebMouseEvent; 82 class PageClient; 83 class PlatformCertificateInfo; 84 class StringPairVector; 85 class WebBackForwardList; 86 class WebBackForwardListItem; 87 class WebContextMenuProxy; 88 class WebData; 89 class WebEditCommandProxy; 90 class WebFullScreenManagerProxy; 91 class WebKeyboardEvent; 92 class WebMouseEvent; 93 class WebOpenPanelResultListenerProxy; 94 class WebPageGroup; 95 class WebProcessProxy; 96 class WebURLRequest; 97 class WebWheelEvent; 98 struct AttributedString; 99 struct DictionaryPopupInfo; 100 struct EditorState; 101 struct PlatformPopupMenuData; 102 struct PrintInfo; 103 struct WebPageCreationParameters; 104 struct WebPopupItem; 105 106 #if ENABLE(GESTURE_EVENTS) 107 class WebGestureEvent; 108 #endif 109 110 typedef GenericCallback<WKStringRef, StringImpl*> StringCallback; 111 typedef GenericCallback<WKSerializedScriptValueRef, WebSerializedScriptValue*> ScriptValueCallback; 112 113 // FIXME: Make a version of CallbackBase with three arguments, and define ValidateCommandCallback as a specialization. 114 class ValidateCommandCallback : public CallbackBase { 115 public: 116 typedef void (*CallbackFunction)(WKStringRef, bool, int32_t, WKErrorRef, void*); 117 create(void * context,CallbackFunction callback)118 static PassRefPtr<ValidateCommandCallback> create(void* context, CallbackFunction callback) 119 { 120 return adoptRef(new ValidateCommandCallback(context, callback)); 121 } 122 ~ValidateCommandCallback()123 virtual ~ValidateCommandCallback() 124 { 125 ASSERT(!m_callback); 126 } 127 performCallbackWithReturnValue(StringImpl * returnValue1,bool returnValue2,int returnValue3)128 void performCallbackWithReturnValue(StringImpl* returnValue1, bool returnValue2, int returnValue3) 129 { 130 ASSERT(m_callback); 131 132 m_callback(toAPI(returnValue1), returnValue2, returnValue3, 0, context()); 133 134 m_callback = 0; 135 } 136 invalidate()137 void invalidate() 138 { 139 ASSERT(m_callback); 140 141 RefPtr<WebError> error = WebError::create(); 142 m_callback(0, 0, 0, toAPI(error.get()), context()); 143 144 m_callback = 0; 145 } 146 147 private: 148 ValidateCommandCallback(void * context,CallbackFunction callback)149 ValidateCommandCallback(void* context, CallbackFunction callback) 150 : CallbackBase(context) 151 , m_callback(callback) 152 { 153 } 154 155 CallbackFunction m_callback; 156 }; 157 158 class WebPageProxy : public APIObject, public WebPopupMenuProxy::Client { 159 public: 160 static const Type APIType = TypePage; 161 162 static PassRefPtr<WebPageProxy> create(PageClient*, PassRefPtr<WebProcessProxy>, WebPageGroup*, uint64_t pageID); 163 virtual ~WebPageProxy(); 164 pageID()165 uint64_t pageID() const { return m_pageID; } 166 mainFrame()167 WebFrameProxy* mainFrame() const { return m_mainFrame.get(); } focusedFrame()168 WebFrameProxy* focusedFrame() const { return m_focusedFrame.get(); } frameSetLargestFrame()169 WebFrameProxy* frameSetLargestFrame() const { return m_frameSetLargestFrame.get(); } 170 drawingArea()171 DrawingAreaProxy* drawingArea() { return m_drawingArea.get(); } 172 void setDrawingArea(PassOwnPtr<DrawingAreaProxy>); 173 backForwardList()174 WebBackForwardList* backForwardList() { return m_backForwardList.get(); } 175 176 #if ENABLE(INSPECTOR) 177 WebInspectorProxy* inspector(); 178 #endif 179 180 #if ENABLE(FULLSCREEN_API) 181 WebFullScreenManagerProxy* fullScreenManager(); 182 #endif 183 184 void initializeContextMenuClient(const WKPageContextMenuClient*); 185 void initializeFindClient(const WKPageFindClient*); 186 void initializeFormClient(const WKPageFormClient*); 187 void initializeLoaderClient(const WKPageLoaderClient*); 188 void initializePolicyClient(const WKPagePolicyClient*); 189 void initializeResourceLoadClient(const WKPageResourceLoadClient*); 190 void initializeUIClient(const WKPageUIClient*); 191 192 void initializeWebPage(); 193 194 void close(); 195 bool tryClose(); isClosed()196 bool isClosed() const { return m_isClosed; } 197 198 void loadURL(const String&); 199 void loadURLRequest(WebURLRequest*); 200 void loadHTMLString(const String& htmlString, const String& baseURL); 201 void loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL); 202 void loadPlainTextString(const String& string); 203 204 void stopLoading(); 205 void reload(bool reloadFromOrigin); 206 207 void goForward(); 208 bool canGoForward() const; 209 void goBack(); 210 bool canGoBack() const; 211 212 void goToBackForwardItem(WebBackForwardListItem*); 213 void didChangeBackForwardList(WebBackForwardListItem* addedItem, Vector<RefPtr<APIObject> >* removedItems); 214 void shouldGoToBackForwardListItem(uint64_t itemID, bool& shouldGoToBackForwardListItem); 215 216 bool canShowMIMEType(const String& mimeType) const; 217 drawsBackground()218 bool drawsBackground() const { return m_drawsBackground; } 219 void setDrawsBackground(bool); 220 drawsTransparentBackground()221 bool drawsTransparentBackground() const { return m_drawsTransparentBackground; } 222 void setDrawsTransparentBackground(bool); 223 224 void viewWillStartLiveResize(); 225 void viewWillEndLiveResize(); 226 227 void setInitialFocus(bool); 228 void setWindowResizerSize(const WebCore::IntSize&); 229 230 void setViewNeedsDisplay(const WebCore::IntRect&); 231 void displayView(); 232 void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset); 233 234 enum { 235 ViewWindowIsActive = 1 << 0, 236 ViewIsFocused = 1 << 1, 237 ViewIsVisible = 1 << 2, 238 ViewIsInWindow = 1 << 3 239 }; 240 typedef unsigned ViewStateFlags; 241 void viewStateDidChange(ViewStateFlags flags); 242 243 WebCore::IntSize viewSize() const; isViewVisible()244 bool isViewVisible() const { return m_isVisible; } 245 bool isViewWindowActive() const; 246 247 void executeEditCommand(const String& commandName); 248 void validateCommand(const String& commandName, PassRefPtr<ValidateCommandCallback>); 249 editorState()250 const EditorState& editorState() const { return m_editorState; } canDelete()251 bool canDelete() const { return hasSelectedRange() && isContentEditable(); } hasSelectedRange()252 bool hasSelectedRange() const { return m_editorState.selectionIsRange; } isContentEditable()253 bool isContentEditable() const { return m_editorState.isContentEditable; } 254 255 #if PLATFORM(MAC) 256 void updateWindowIsVisible(bool windowIsVisible); 257 void windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates, const WebCore::IntPoint& accessibilityViewCoordinates); 258 259 void setComposition(const String& text, Vector<WebCore::CompositionUnderline> underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeEnd); 260 void confirmComposition(); 261 bool insertText(const String& text, uint64_t replacementRangeStart, uint64_t replacementRangeEnd); 262 void getMarkedRange(uint64_t& location, uint64_t& length); 263 void getSelectedRange(uint64_t& location, uint64_t& length); 264 void getAttributedSubstringFromRange(uint64_t location, uint64_t length, AttributedString&); 265 uint64_t characterIndexForPoint(const WebCore::IntPoint); 266 WebCore::IntRect firstRectForCharacterRange(uint64_t, uint64_t); 267 bool executeKeypressCommands(const Vector<WebCore::KeypressCommand>&); 268 269 void sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String& textInput); 270 CGContextRef containingWindowGraphicsContext(); 271 bool shouldDelayWindowOrderingForEvent(const WebMouseEvent&); 272 bool acceptsFirstMouse(int eventNumber, const WebMouseEvent&); 273 #endif 274 #if PLATFORM(WIN) 275 void didChangeCompositionSelection(bool); 276 void confirmComposition(const String&); 277 void setComposition(const String&, Vector<WebCore::CompositionUnderline>&, int); 278 WebCore::IntRect firstRectForCharacterInSelectedRange(int); 279 String getSelectedText(); 280 281 bool gestureWillBegin(const WebCore::IntPoint&); 282 void gestureDidScroll(const WebCore::IntSize&); 283 void gestureDidEnd(); 284 285 void setGestureReachedScrollingLimit(bool); 286 #endif 287 #if ENABLE(TILED_BACKING_STORE) 288 void setActualVisibleContentRect(const WebCore::IntRect& rect); 289 #endif 290 291 void handleMouseEvent(const NativeWebMouseEvent&); 292 void handleWheelEvent(const WebWheelEvent&); 293 void handleKeyboardEvent(const NativeWebKeyboardEvent&); 294 #if ENABLE(GESTURE_EVENTS) 295 void handleGestureEvent(const WebGestureEvent&); 296 #endif 297 #if ENABLE(TOUCH_EVENTS) 298 void handleTouchEvent(const WebTouchEvent&); 299 #endif 300 301 void scrollBy(WebCore::ScrollDirection, WebCore::ScrollGranularity); 302 303 String pageTitle() const; toolTip()304 const String& toolTip() const { return m_toolTip; } 305 306 void setUserAgent(const String&); userAgent()307 const String& userAgent() const { return m_userAgent; } 308 void setApplicationNameForUserAgent(const String&); applicationNameForUserAgent()309 const String& applicationNameForUserAgent() const { return m_applicationNameForUserAgent; } 310 void setCustomUserAgent(const String&); customUserAgent()311 const String& customUserAgent() const { return m_customUserAgent; } 312 313 bool supportsTextEncoding() const; 314 void setCustomTextEncodingName(const String&); customTextEncodingName()315 String customTextEncodingName() const { return m_customTextEncodingName; } 316 317 double estimatedProgress() const; 318 319 void terminateProcess(); 320 321 typedef bool (*WebPageProxySessionStateFilterCallback)(WKPageRef, WKStringRef type, WKTypeRef object, void* context); 322 PassRefPtr<WebData> sessionStateData(WebPageProxySessionStateFilterCallback, void* context) const; 323 void restoreFromSessionStateData(WebData*); 324 325 bool supportsTextZoom() const; textZoomFactor()326 double textZoomFactor() const { return m_mainFrameHasCustomRepresentation ? 1 : m_textZoomFactor; } 327 void setTextZoomFactor(double); 328 double pageZoomFactor() const; 329 void setPageZoomFactor(double); 330 void setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor); 331 332 void scaleWebView(double scale, const WebCore::IntPoint& origin); viewScaleFactor()333 double viewScaleFactor() const { return m_viewScaleFactor; } 334 335 void setUseFixedLayout(bool); 336 void setFixedLayoutSize(const WebCore::IntSize&); useFixedLayout()337 bool useFixedLayout() const { return m_useFixedLayout; }; fixedLayoutSize()338 const WebCore::IntSize& fixedLayoutSize() const { return m_fixedLayoutSize; }; 339 hasHorizontalScrollbar()340 bool hasHorizontalScrollbar() const { return m_mainFrameHasHorizontalScrollbar; } hasVerticalScrollbar()341 bool hasVerticalScrollbar() const { return m_mainFrameHasVerticalScrollbar; } 342 isPinnedToLeftSide()343 bool isPinnedToLeftSide() const { return m_mainFrameIsPinnedToLeftSide; } isPinnedToRightSide()344 bool isPinnedToRightSide() const { return m_mainFrameIsPinnedToRightSide; } 345 346 #if PLATFORM(MAC) 347 // Called by the web process through a message. 348 void registerWebProcessAccessibilityToken(const CoreIPC::DataReference&); 349 // Called by the UI process when it is ready to send its tokens to the web process. 350 void registerUIProcessAccessibilityTokens(const CoreIPC::DataReference& elemenToken, const CoreIPC::DataReference& windowToken); 351 bool writeSelectionToPasteboard(const String& pasteboardName, const Vector<String>& pasteboardTypes); 352 bool readSelectionFromPasteboard(const String& pasteboardName); 353 #endif 354 355 void viewScaleFactorDidChange(double); 356 357 void setMemoryCacheClientCallsEnabled(bool); 358 359 // Find. 360 void findString(const String&, FindOptions, unsigned maxMatchCount); 361 void hideFindUI(); 362 void countStringMatches(const String&, FindOptions, unsigned maxMatchCount); 363 void didCountStringMatches(const String&, uint32_t matchCount); 364 void setFindIndicator(const WebCore::FloatRect& selectionRectInWindowCoordinates, const Vector<WebCore::FloatRect>& textRectsInSelectionRectCoordinates, const ShareableBitmap::Handle& contentImageHandle, bool fadeOut); 365 void didFindString(const String&, uint32_t matchCount); 366 void didFailToFindString(const String&); 367 368 void getContentsAsString(PassRefPtr<StringCallback>); 369 void getMainResourceDataOfFrame(WebFrameProxy*, PassRefPtr<DataCallback>); 370 void getResourceDataFromFrame(WebFrameProxy*, WebURL*, PassRefPtr<DataCallback>); 371 void getRenderTreeExternalRepresentation(PassRefPtr<StringCallback>); 372 void getSelectionOrContentsAsString(PassRefPtr<StringCallback>); 373 void getSourceForFrame(WebFrameProxy*, PassRefPtr<StringCallback>); 374 void getWebArchiveOfFrame(WebFrameProxy*, PassRefPtr<DataCallback>); 375 void runJavaScriptInMainFrame(const String&, PassRefPtr<ScriptValueCallback>); 376 void forceRepaint(PassRefPtr<VoidCallback>); 377 378 float headerHeight(WebFrameProxy*); 379 float footerHeight(WebFrameProxy*); 380 void drawHeader(WebFrameProxy*, const WebCore::FloatRect&); 381 void drawFooter(WebFrameProxy*, const WebCore::FloatRect&); 382 383 #if PLATFORM(MAC) 384 // Dictionary. 385 void performDictionaryLookupAtLocation(const WebCore::FloatPoint&); 386 #endif 387 388 void receivedPolicyDecision(WebCore::PolicyAction, WebFrameProxy*, uint64_t listenerID); 389 390 void backForwardRemovedItem(uint64_t itemID); 391 392 // Drag and drop support. 393 void dragEntered(WebCore::DragData*, const String& dragStorageName = String()); 394 void dragUpdated(WebCore::DragData*, const String& dragStorageName = String()); 395 void dragExited(WebCore::DragData*, const String& dragStorageName = String()); 396 void performDrag(WebCore::DragData*, const String& dragStorageName, const SandboxExtension::Handle&); 397 398 void didPerformDragControllerAction(uint64_t resultOperation); 399 void dragEnded(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition, uint64_t operation); 400 #if PLATFORM(MAC) 401 void setDragImage(const WebCore::IntPoint& clientPosition, const ShareableBitmap::Handle& dragImageHandle, bool isLinkDrag); 402 #endif 403 #if PLATFORM(WIN) 404 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); 405 #endif 406 void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); 407 void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*); 408 409 void processDidBecomeUnresponsive(); 410 void processDidBecomeResponsive(); 411 void processDidCrash(); 412 413 #if USE(ACCELERATED_COMPOSITING) 414 virtual void enterAcceleratedCompositingMode(const LayerTreeContext&); 415 virtual void exitAcceleratedCompositingMode(); 416 #endif 417 418 void didDraw(); 419 420 enum UndoOrRedo { Undo, Redo }; 421 void addEditCommand(WebEditCommandProxy*); 422 void removeEditCommand(WebEditCommandProxy*); 423 bool isValidEditCommand(WebEditCommandProxy*); 424 void registerEditCommand(PassRefPtr<WebEditCommandProxy>, UndoOrRedo); 425 426 WebProcessProxy* process() const; 427 pageGroup()428 WebPageGroup* pageGroup() const { return m_pageGroup.get(); } 429 430 bool isValid(); 431 dragOperation()432 WebCore::DragOperation dragOperation() { return m_currentDragOperation; } resetDragOperation()433 void resetDragOperation() { m_currentDragOperation = WebCore::DragOperationNone; } 434 435 void preferencesDidChange(); 436 437 #if ENABLE(TILED_BACKING_STORE) 438 void setResizesToContentsUsingLayoutSize(const WebCore::IntSize&); 439 #endif 440 441 // Called by the WebContextMenuProxy. 442 void contextMenuItemSelected(const WebContextMenuItemData&); 443 444 // Called by the WebOpenPanelResultListenerProxy. 445 void didChooseFilesForOpenPanel(const Vector<String>&); 446 void didCancelForOpenPanel(); 447 448 WebPageCreationParameters creationParameters() const; 449 450 #if PLATFORM(QT) 451 void findZoomableAreaForPoint(const WebCore::IntPoint&); 452 #endif 453 454 void advanceToNextMisspelling(bool startBeforeSelection) const; 455 void changeSpellingToWord(const String& word) const; 456 #if PLATFORM(MAC) 457 void uppercaseWord(); 458 void lowercaseWord(); 459 void capitalizeWord(); 460 isSmartInsertDeleteEnabled()461 bool isSmartInsertDeleteEnabled() const { return m_isSmartInsertDeleteEnabled; } 462 void setSmartInsertDeleteEnabled(bool); 463 #endif 464 465 void beginPrinting(WebFrameProxy*, const PrintInfo&); 466 void endPrinting(); 467 void computePagesForPrinting(WebFrameProxy*, const PrintInfo&, PassRefPtr<ComputedPagesCallback>); 468 #if PLATFORM(MAC) || PLATFORM(WIN) 469 void drawRectToPDF(WebFrameProxy*, const WebCore::IntRect&, PassRefPtr<DataCallback>); 470 void drawPagesToPDF(WebFrameProxy*, uint32_t first, uint32_t count, PassRefPtr<DataCallback>); 471 #endif 472 pendingAPIRequestURL()473 const String& pendingAPIRequestURL() const { return m_pendingAPIRequestURL; } 474 475 void flashBackingStoreUpdates(const Vector<WebCore::IntRect>& updateRects); 476 477 #if PLATFORM(MAC) 478 void handleCorrectionPanelResult(const String& result); 479 #endif 480 setDebugPaintFlags(WKPageDebugPaintFlags flags)481 static void setDebugPaintFlags(WKPageDebugPaintFlags flags) { s_debugPaintFlags = flags; } debugPaintFlags()482 static WKPageDebugPaintFlags debugPaintFlags() { return s_debugPaintFlags; } 483 484 // Color to be used with kWKDebugFlashViewUpdates. 485 static WebCore::Color viewUpdatesFlashColor(); 486 487 // Color to be used with kWKDebugFlashBackingStoreUpdates. 488 static WebCore::Color backingStoreUpdatesFlashColor(); 489 490 void saveDataToFileInDownloadsFolder(const String& suggestedFilename, const String& mimeType, const String& originatingURLString, WebData*); 491 492 void linkClicked(const String&, const WebMouseEvent&); 493 494 private: 495 WebPageProxy(PageClient*, PassRefPtr<WebProcessProxy>, WebPageGroup*, uint64_t pageID); 496 type()497 virtual Type type() const { return APIType; } 498 499 // WebPopupMenuProxy::Client 500 virtual void valueChangedForPopupMenu(WebPopupMenuProxy*, int32_t newSelectedIndex); 501 virtual void setTextFromItemForPopupMenu(WebPopupMenuProxy*, int32_t index); 502 virtual NativeWebMouseEvent* currentlyProcessedMouseDownEvent(); 503 504 // Implemented in generated WebPageProxyMessageReceiver.cpp 505 void didReceiveWebPageProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); 506 CoreIPC::SyncReplyMode didReceiveSyncWebPageProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder*); 507 508 void didCreateMainFrame(uint64_t frameID); 509 void didCreateSubframe(uint64_t frameID, uint64_t parentFrameID); 510 void didSaveFrameToPageCache(uint64_t frameID); 511 void didRestoreFrameFromPageCache(uint64_t frameID, uint64_t parentFrameID); 512 513 void didStartProvisionalLoadForFrame(uint64_t frameID, const String& url, const String& unreachableURL, CoreIPC::ArgumentDecoder*); 514 void didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, const String&, CoreIPC::ArgumentDecoder*); 515 void didFailProvisionalLoadForFrame(uint64_t frameID, const WebCore::ResourceError&, CoreIPC::ArgumentDecoder*); 516 void didCommitLoadForFrame(uint64_t frameID, const String& mimeType, bool frameHasCustomRepresentation, const PlatformCertificateInfo&, CoreIPC::ArgumentDecoder*); 517 void didFinishDocumentLoadForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*); 518 void didFinishLoadForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*); 519 void didFailLoadForFrame(uint64_t frameID, const WebCore::ResourceError&, CoreIPC::ArgumentDecoder*); 520 void didSameDocumentNavigationForFrame(uint64_t frameID, uint32_t sameDocumentNavigationType, const String&, CoreIPC::ArgumentDecoder*); 521 void didReceiveTitleForFrame(uint64_t frameID, const String&, CoreIPC::ArgumentDecoder*); 522 void didFirstLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*); 523 void didFirstVisuallyNonEmptyLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*); 524 void didRemoveFrameFromHierarchy(uint64_t frameID, CoreIPC::ArgumentDecoder*); 525 void didDisplayInsecureContentForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*); 526 void didRunInsecureContentForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*); 527 void frameDidBecomeFrameSet(uint64_t frameID, bool); 528 void didStartProgress(); 529 void didChangeProgress(double); 530 void didFinishProgress(); 531 532 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); 533 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*); 534 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); 535 void unableToImplementPolicy(uint64_t frameID, const WebCore::ResourceError&, CoreIPC::ArgumentDecoder* arguments); 536 537 void willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const StringPairVector& textFieldValues, uint64_t listenerID, CoreIPC::ArgumentDecoder*); 538 539 // Resource load client 540 void didInitiateLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, const WebCore::ResourceRequest&, bool pageIsProvisionallyLoading); 541 void didSendRequestForResource(uint64_t frameID, uint64_t resourceIdentifier, const WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse); 542 void didReceiveResponseForResource(uint64_t frameID, uint64_t resourceIdentifier, const WebCore::ResourceResponse&); 543 void didReceiveContentLengthForResource(uint64_t frameID, uint64_t resourceIdentifier, uint64_t contentLength); 544 void didFinishLoadForResource(uint64_t frameID, uint64_t resourceIdentifier); 545 void didFailLoadForResource(uint64_t frameID, uint64_t resourceIdentifier, const WebCore::ResourceError&); 546 547 // UI client 548 void createNewPage(const WebCore::WindowFeatures&, uint32_t modifiers, int32_t mouseButton, uint64_t& newPageID, WebPageCreationParameters&); 549 void showPage(); 550 void closePage(); 551 void runJavaScriptAlert(uint64_t frameID, const String&); 552 void runJavaScriptConfirm(uint64_t frameID, const String&, bool& result); 553 void runJavaScriptPrompt(uint64_t frameID, const String&, const String&, String& result); 554 void setStatusText(const String&); 555 void mouseDidMoveOverElement(uint32_t modifiers, CoreIPC::ArgumentDecoder*); 556 void missingPluginButtonClicked(const String& mimeType, const String& url, const String& pluginsPageURL); 557 void setToolbarsAreVisible(bool toolbarsAreVisible); 558 void getToolbarsAreVisible(bool& toolbarsAreVisible); 559 void setMenuBarIsVisible(bool menuBarIsVisible); 560 void getMenuBarIsVisible(bool& menuBarIsVisible); 561 void setStatusBarIsVisible(bool statusBarIsVisible); 562 void getStatusBarIsVisible(bool& statusBarIsVisible); 563 void setIsResizable(bool isResizable); 564 void getIsResizable(bool& isResizable); 565 void setWindowFrame(const WebCore::FloatRect&); 566 void getWindowFrame(WebCore::FloatRect&); 567 void windowToScreen(const WebCore::IntRect& viewRect, WebCore::IntRect& result); 568 void runBeforeUnloadConfirmPanel(const String& message, uint64_t frameID, bool& shouldClose); 569 void didChangeViewportData(const WebCore::ViewportArguments&); 570 void pageDidScroll(); 571 void runOpenPanel(uint64_t frameID, const WebOpenPanelParameters::Data&); 572 void printFrame(uint64_t frameID); 573 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); 574 void requestGeolocationPermissionForFrame(uint64_t geolocationID, uint64_t frameID, String originIdentifier); runModal()575 void runModal() { m_uiClient.runModal(this); } 576 void didCompleteRubberBandForMainFrame(const WebCore::IntSize&); 577 void didChangeScrollbarsForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar); 578 void didChangeScrollOffsetPinningForMainFrame(bool pinnedToLeftSide, bool pinnedToRightSide); 579 580 void reattachToWebProcess(); 581 void reattachToWebProcessWithItem(WebBackForwardListItem*); 582 583 #if ENABLE(TILED_BACKING_STORE) 584 void pageDidRequestScroll(const WebCore::IntPoint&); 585 #endif 586 587 #if PLATFORM(QT) 588 void didChangeContentsSize(const WebCore::IntSize&); 589 void didFindZoomableArea(const WebCore::IntRect&); 590 #endif 591 592 void editorStateChanged(const EditorState&); 593 594 // Back/Forward list management 595 void backForwardAddItem(uint64_t itemID); 596 void backForwardGoToItem(uint64_t itemID); 597 void backForwardItemAtIndex(int32_t index, uint64_t& itemID); 598 void backForwardBackListCount(int32_t& count); 599 void backForwardForwardListCount(int32_t& count); 600 void backForwardClear(); 601 602 // Undo management 603 void registerEditCommandForUndo(uint64_t commandID, uint32_t editAction); 604 void clearAllEditCommands(); 605 void canUndoRedo(uint32_t action, bool& result); 606 void executeUndoRedo(uint32_t action, bool& result); 607 608 // Keyboard handling 609 #if PLATFORM(MAC) 610 void interpretQueuedKeyEvent(const EditorState&, bool& handled, Vector<WebCore::KeypressCommand>&); 611 void executeSavedCommandBySelector(const String& selector, bool& handled); 612 #endif 613 614 #if PLATFORM(GTK) 615 void getEditorCommandsForKeyEvent(Vector<String>&); 616 #endif 617 618 // Popup Menu. 619 void showPopupMenu(const WebCore::IntRect& rect, uint64_t textDirection, const Vector<WebPopupItem>& items, int32_t selectedIndex, const PlatformPopupMenuData&); 620 void hidePopupMenu(); 621 #if PLATFORM(WIN) 622 void setPopupMenuSelectedIndex(int32_t); 623 #endif 624 625 // Context Menu. 626 void showContextMenu(const WebCore::IntPoint& menuLocation, const ContextMenuState&, const Vector<WebContextMenuItemData>&, CoreIPC::ArgumentDecoder*); 627 void internalShowContextMenu(const WebCore::IntPoint& menuLocation, const ContextMenuState&, const Vector<WebContextMenuItemData>&, CoreIPC::ArgumentDecoder*); 628 629 // Search popup results 630 void saveRecentSearches(const String&, const Vector<String>&); 631 void loadRecentSearches(const String&, Vector<String>&); 632 633 #if PLATFORM(MAC) 634 // Speech. 635 void getIsSpeaking(bool&); 636 void speak(const String&); 637 void stopSpeaking(); 638 639 // Spotlight. 640 void searchWithSpotlight(const String&); 641 642 // Dictionary. 643 void didPerformDictionaryLookup(const String&, const DictionaryPopupInfo&); 644 #endif 645 646 // Spelling and grammar. 647 int64_t spellDocumentTag(); 648 #if USE(UNIFIED_TEXT_CHECKING) 649 void checkTextOfParagraph(const String& text, uint64_t checkingTypes, Vector<WebCore::TextCheckingResult>& results); 650 #endif 651 void checkSpellingOfString(const String& text, int32_t& misspellingLocation, int32_t& misspellingLength); 652 void checkGrammarOfString(const String& text, Vector<WebCore::GrammarDetail>&, int32_t& badGrammarLocation, int32_t& badGrammarLength); 653 void spellingUIIsShowing(bool&); 654 void updateSpellingUIWithMisspelledWord(const String& misspelledWord); 655 void updateSpellingUIWithGrammarString(const String& badGrammarPhrase, const WebCore::GrammarDetail&); 656 void getGuessesForWord(const String& word, const String& context, Vector<String>& guesses); 657 void learnWord(const String& word); 658 void ignoreWord(const String& word); 659 660 void setFocus(bool focused); 661 void takeFocus(uint32_t direction); 662 void setToolTip(const String&); 663 void setCursor(const WebCore::Cursor&); 664 665 void didReceiveEvent(uint32_t opaqueType, bool handled); 666 667 void voidCallback(uint64_t); 668 void dataCallback(const CoreIPC::DataReference&, uint64_t); 669 void stringCallback(const String&, uint64_t); 670 void scriptValueCallback(const CoreIPC::DataReference&, uint64_t); 671 void computedPagesCallback(const Vector<WebCore::IntRect>&, double totalScaleFactorForPrinting, uint64_t); 672 void validateCommandCallback(const String&, bool, int, uint64_t); 673 674 void focusedFrameChanged(uint64_t frameID); 675 void frameSetLargestFrameChanged(uint64_t frameID); 676 677 void canAuthenticateAgainstProtectionSpaceInFrame(uint64_t frameID, const WebCore::ProtectionSpace&, bool& canAuthenticate); 678 void didReceiveAuthenticationChallenge(uint64_t frameID, const WebCore::AuthenticationChallenge&, uint64_t challengeID); 679 680 void didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference&); 681 682 #if PLATFORM(MAC) 683 void setComplexTextInputEnabled(uint64_t pluginComplexTextInputIdentifier, bool complexTextInputEnabled); 684 #endif 685 686 static String standardUserAgent(const String& applicationName = String()); 687 clearPendingAPIRequestURL()688 void clearPendingAPIRequestURL() { m_pendingAPIRequestURL = String(); } setPendingAPIRequestURL(const String & pendingAPIRequestURL)689 void setPendingAPIRequestURL(const String& pendingAPIRequestURL) { m_pendingAPIRequestURL = pendingAPIRequestURL; } 690 691 void initializeSandboxExtensionHandle(const WebCore::KURL&, SandboxExtension::Handle&); 692 693 #if PLATFORM(MAC) 694 void substitutionsPanelIsShowing(bool&); 695 #if !defined(BUILDING_ON_SNOW_LEOPARD) 696 void showCorrectionPanel(int32_t panelType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings); 697 void dismissCorrectionPanel(int32_t reason); 698 void dismissCorrectionPanelSoon(int32_t reason, String& result); 699 void recordAutocorrectionResponse(int32_t responseType, const String& replacedString, const String& replacementString); 700 #endif // !defined(BUILDING_ON_SNOW_LEOPARD) 701 #endif // PLATFORM(MAC) 702 703 void clearLoadDependentCallbacks(); 704 705 void performDragControllerAction(DragControllerAction, WebCore::DragData*, const String& dragStorageName, const SandboxExtension::Handle&); 706 707 PageClient* m_pageClient; 708 WebLoaderClient m_loaderClient; 709 WebPolicyClient m_policyClient; 710 WebFormClient m_formClient; 711 WebResourceLoadClient m_resourceLoadClient; 712 WebUIClient m_uiClient; 713 WebFindClient m_findClient; 714 WebPageContextMenuClient m_contextMenuClient; 715 716 OwnPtr<DrawingAreaProxy> m_drawingArea; 717 RefPtr<WebProcessProxy> m_process; 718 RefPtr<WebPageGroup> m_pageGroup; 719 RefPtr<WebFrameProxy> m_mainFrame; 720 RefPtr<WebFrameProxy> m_focusedFrame; 721 RefPtr<WebFrameProxy> m_frameSetLargestFrame; 722 723 String m_userAgent; 724 String m_applicationNameForUserAgent; 725 String m_customUserAgent; 726 String m_customTextEncodingName; 727 728 #if ENABLE(INSPECTOR) 729 RefPtr<WebInspectorProxy> m_inspector; 730 #endif 731 732 #if ENABLE(FULLSCREEN_API) 733 RefPtr<WebFullScreenManagerProxy> m_fullScreenManager; 734 #endif 735 736 HashMap<uint64_t, RefPtr<VoidCallback> > m_voidCallbacks; 737 HashMap<uint64_t, RefPtr<DataCallback> > m_dataCallbacks; 738 HashMap<uint64_t, RefPtr<StringCallback> > m_stringCallbacks; 739 HashSet<uint64_t> m_loadDependentStringCallbackIDs; 740 HashMap<uint64_t, RefPtr<ScriptValueCallback> > m_scriptValueCallbacks; 741 HashMap<uint64_t, RefPtr<ComputedPagesCallback> > m_computedPagesCallbacks; 742 HashMap<uint64_t, RefPtr<ValidateCommandCallback> > m_validateCommandCallbacks; 743 744 HashSet<WebEditCommandProxy*> m_editCommandSet; 745 746 RefPtr<WebPopupMenuProxy> m_activePopupMenu; 747 RefPtr<WebContextMenuProxy> m_activeContextMenu; 748 ContextMenuState m_activeContextMenuState; 749 RefPtr<WebOpenPanelResultListenerProxy> m_openPanelResultListener; 750 GeolocationPermissionRequestManagerProxy m_geolocationPermissionRequestManager; 751 752 double m_estimatedProgress; 753 754 // Whether the web page is contained in a top-level window. 755 bool m_isInWindow; 756 757 // Whether the page is visible; if the backing view is visible and inserted into a window. 758 bool m_isVisible; 759 760 bool m_canGoBack; 761 bool m_canGoForward; 762 RefPtr<WebBackForwardList> m_backForwardList; 763 764 String m_toolTip; 765 766 EditorState m_editorState; 767 768 double m_textZoomFactor; 769 double m_pageZoomFactor; 770 double m_viewScaleFactor; 771 772 bool m_drawsBackground; 773 bool m_drawsTransparentBackground; 774 775 bool m_areMemoryCacheClientCallsEnabled; 776 777 bool m_useFixedLayout; 778 WebCore::IntSize m_fixedLayoutSize; 779 780 // If the process backing the web page is alive and kicking. 781 bool m_isValid; 782 783 // Whether WebPageProxy::close() has been called on this page. 784 bool m_isClosed; 785 786 bool m_isInPrintingMode; 787 bool m_isPerformingDOMPrintOperation; 788 789 bool m_inDecidePolicyForMIMEType; 790 bool m_syncMimeTypePolicyActionIsValid; 791 WebCore::PolicyAction m_syncMimeTypePolicyAction; 792 uint64_t m_syncMimeTypePolicyDownloadID; 793 794 bool m_inDecidePolicyForNavigationAction; 795 bool m_syncNavigationActionPolicyActionIsValid; 796 WebCore::PolicyAction m_syncNavigationActionPolicyAction; 797 uint64_t m_syncNavigationActionPolicyDownloadID; 798 799 Deque<NativeWebKeyboardEvent> m_keyEventQueue; 800 bool m_processingWheelEvent; 801 OwnPtr<WebWheelEvent> m_nextWheelEvent; 802 803 bool m_processingMouseMoveEvent; 804 OwnPtr<NativeWebMouseEvent> m_nextMouseMoveEvent; 805 OwnPtr<NativeWebMouseEvent> m_currentlyProcessedMouseDownEvent; 806 807 uint64_t m_pageID; 808 809 #if PLATFORM(MAC) 810 bool m_isSmartInsertDeleteEnabled; 811 #endif 812 813 int64_t m_spellDocumentTag; 814 bool m_hasSpellDocumentTag; 815 unsigned m_pendingLearnOrIgnoreWordMessageCount; 816 817 bool m_mainFrameHasCustomRepresentation; 818 WebCore::DragOperation m_currentDragOperation; 819 820 String m_pendingAPIRequestURL; 821 822 bool m_mainFrameHasHorizontalScrollbar; 823 bool m_mainFrameHasVerticalScrollbar; 824 825 bool m_mainFrameIsPinnedToLeftSide; 826 bool m_mainFrameIsPinnedToRightSide; 827 828 static WKPageDebugPaintFlags s_debugPaintFlags; 829 }; 830 831 } // namespace WebKit 832 833 #endif // WebPageProxy_h 834