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 PageClient_h 27 #define PageClient_h 28 29 #include "ShareableBitmap.h" 30 #include "WebPageProxy.h" 31 #include "WebPopupMenuProxy.h" 32 #include <wtf/Forward.h> 33 34 namespace WebCore { 35 class Cursor; 36 struct ViewportArguments; 37 } 38 39 namespace WebKit { 40 41 class DrawingAreaProxy; 42 class FindIndicator; 43 class NativeWebKeyboardEvent; 44 class NativeWebKeyboardEvent; 45 class WebContextMenuProxy; 46 class WebEditCommandProxy; 47 class WebPopupMenuProxy; 48 49 class PageClient { 50 public: ~PageClient()51 virtual ~PageClient() { } 52 53 // Create a new drawing area proxy for the given page. 54 virtual PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy() = 0; 55 56 // Tell the view to invalidate the given rect. The rect is in view coordinates. 57 virtual void setViewNeedsDisplay(const WebCore::IntRect&) = 0; 58 59 // Tell the view to immediately display its invalid rect. 60 virtual void displayView() = 0; 61 62 // Tell the view to scroll scrollRect by scrollOffset. 63 virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset) = 0; 64 65 // Return the size of the view the page is associated with. 66 virtual WebCore::IntSize viewSize() = 0; 67 68 // Return whether the view's containing window is active. 69 virtual bool isViewWindowActive() = 0; 70 71 // Return whether the view is focused. 72 virtual bool isViewFocused() = 0; 73 74 // Return whether the view is visible. 75 virtual bool isViewVisible() = 0; 76 77 // Return whether the view is in a window. 78 virtual bool isViewInWindow() = 0; 79 80 virtual void processDidCrash() = 0; 81 virtual void didRelaunchProcess() = 0; 82 virtual void pageClosed() = 0; 83 84 virtual void toolTipChanged(const String&, const String&) = 0; 85 86 #if ENABLE(TILED_BACKING_STORE) 87 virtual void pageDidRequestScroll(const WebCore::IntPoint&) = 0; 88 #endif 89 #if PLATFORM(QT) 90 virtual void didChangeContentsSize(const WebCore::IntSize&) = 0; 91 virtual void didFindZoomableArea(const WebCore::IntRect&) = 0; 92 #endif 93 94 virtual void setCursor(const WebCore::Cursor&) = 0; 95 virtual void setViewportArguments(const WebCore::ViewportArguments&) = 0; 96 97 virtual void registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo) = 0; 98 virtual void clearAllEditCommands() = 0; 99 virtual bool canUndoRedo(WebPageProxy::UndoOrRedo) = 0; 100 virtual void executeUndoRedo(WebPageProxy::UndoOrRedo) = 0; 101 #if PLATFORM(MAC) 102 virtual void accessibilityWebProcessTokenReceived(const CoreIPC::DataReference&) = 0; 103 virtual bool interpretKeyEvent(const NativeWebKeyboardEvent&, Vector<WebCore::KeypressCommand>&) = 0; 104 virtual bool executeSavedCommandBySelector(const String& selector) = 0; 105 virtual void setDragImage(const WebCore::IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, bool isLinkDrag) = 0; 106 virtual void updateSecureInputState() = 0; 107 #endif 108 #if PLATFORM(WIN) 109 virtual void compositionSelectionChanged(bool) = 0; 110 #endif 111 #if PLATFORM(GTK) 112 virtual void getEditorCommandsForKeyEvent(const NativeWebKeyboardEvent&, Vector<WTF::String>&) = 0; 113 #endif 114 virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&) = 0; 115 virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&) = 0; 116 virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&) = 0; 117 118 virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled) = 0; 119 120 virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*) = 0; 121 virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*) = 0; 122 123 virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut) = 0; 124 125 #if USE(ACCELERATED_COMPOSITING) 126 virtual void enterAcceleratedCompositingMode(const LayerTreeContext&) = 0; 127 virtual void exitAcceleratedCompositingMode() = 0; 128 #endif 129 130 #if PLATFORM(WIN) 131 virtual HWND nativeWindow() = 0; 132 virtual void setGestureReachedScrollingLimit(bool) = 0; 133 #endif 134 135 #if PLATFORM(MAC) 136 virtual void setComplexTextInputEnabled(uint64_t pluginComplexTextInputIdentifier, bool complexTextInputEnabled) = 0; 137 virtual CGContextRef containingWindowGraphicsContext() = 0; 138 virtual void didPerformDictionaryLookup(const String&, double scaleFactor, const DictionaryPopupInfo&) = 0; 139 virtual void dismissDictionaryLookupPanel() = 0; 140 virtual void showCorrectionPanel(WebCore::CorrectionPanelInfo::PanelType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings) = 0; 141 virtual void dismissCorrectionPanel(WebCore::ReasonForDismissingCorrectionPanel) = 0; 142 virtual String dismissCorrectionPanelSoon(WebCore::ReasonForDismissingCorrectionPanel) = 0; 143 virtual void recordAutocorrectionResponse(WebCore::EditorClient::AutocorrectionResponseType, const String& replacedString, const String& replacementString) = 0; 144 #endif 145 146 virtual void didChangeScrollbarsForMainFrame() const = 0; 147 148 // Custom representations. 149 virtual void didCommitLoadForMainFrame(bool useCustomRepresentation) = 0; 150 virtual void didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference&) = 0; 151 virtual double customRepresentationZoomFactor() = 0; 152 virtual void setCustomRepresentationZoomFactor(double) = 0; 153 154 virtual void flashBackingStoreUpdates(const Vector<WebCore::IntRect>& updateRects) = 0; 155 virtual void findStringInCustomRepresentation(const String&, FindOptions, unsigned maxMatchCount) = 0; 156 virtual void countStringMatchesInCustomRepresentation(const String&, FindOptions, unsigned maxMatchCount) = 0; 157 158 virtual float userSpaceScaleFactor() const = 0; 159 }; 160 161 } // namespace WebKit 162 163 #endif // PageClient_h 164