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