PageClient.h 10.4 KB
Newer Older
1
/*
2
 * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 * THE POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef PageClient_h
#define PageClient_h

29
#include "ShareableBitmap.h"
30
#include "WebColorPicker.h"
31
#include "WebPageProxy.h"
32
#include "WebPopupMenuProxy.h"
33
#include <WebCore/AlternativeTextClient.h>
34
#include <WebCore/EditorClient.h>
35 36
#include <wtf/Forward.h>

37
#if PLATFORM(MAC)
38 39
#include "PluginComplexTextInputState.h"

40 41
OBJC_CLASS CALayer;

42
#if USE(APPKIT)
43
OBJC_CLASS WKView;
44
OBJC_CLASS NSTextAlternatives;
45
#endif
46
#endif
47

48
namespace WebCore {
49
    class Cursor;
50
    struct ViewportAttributes;
51 52 53 54
}

namespace WebKit {

55
class DrawingAreaProxy;
andersca@apple.com's avatar
andersca@apple.com committed
56
class FindIndicator;
57
class NativeWebKeyboardEvent;
58 59
class WebContextMenuProxy;
class WebEditCommandProxy;
60
class WebPopupMenuProxy;
61 62 63 64 65

#if ENABLE(TOUCH_EVENTS)
class NativeWebTouchEvent;
#endif

66
#if ENABLE(INPUT_TYPE_COLOR)
67
class WebColorPicker;
68
#endif
weinig@apple.com's avatar
weinig@apple.com committed
69

70 71 72 73
#if ENABLE(FULLSCREEN_API)
class WebFullScreenManagerProxyClient;
#endif

74 75 76 77
#if PLATFORM(MAC)
struct ColorSpaceData;
#endif

78 79 80 81
class PageClient {
public:
    virtual ~PageClient() { }

82
    // Create a new drawing area proxy for the given page.
83
    virtual std::unique_ptr<DrawingAreaProxy> createDrawingAreaProxy() = 0;
84 85 86 87

    // Tell the view to invalidate the given rect. The rect is in view coordinates.
    virtual void setViewNeedsDisplay(const WebCore::IntRect&) = 0;

88 89 90
    // Tell the view to immediately display its invalid rect.
    virtual void displayView() = 0;

91 92
    // Return true if scrollView() can copy bits in the view.
    virtual bool canScrollView() = 0;
93 94 95
    // Tell the view to scroll scrollRect by scrollOffset.
    virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset) = 0;

96 97 98 99 100 101 102 103 104 105 106 107 108 109
    // Return the size of the view the page is associated with.
    virtual WebCore::IntSize viewSize() = 0;

    // Return whether the view's containing window is active.
    virtual bool isViewWindowActive() = 0;

    // Return whether the view is focused.
    virtual bool isViewFocused() = 0;

    // Return whether the view is visible.
    virtual bool isViewVisible() = 0;

    // Return whether the view is in a window.
    virtual bool isViewInWindow() = 0;
110

111 112 113 114
#if HAVE(LAYER_HOSTING_IN_WINDOW_SERVER)
    // Return whether the layer is window server hosted.
    virtual bool isLayerWindowServerHosted() = 0;
#endif
115

116
    virtual void processDidCrash() = 0;
117
    virtual void didRelaunchProcess() = 0;
118
    virtual void pageClosed() = 0;
119

120 121
    virtual void preferencesDidChange() = 0;

122
    virtual void toolTipChanged(const String&, const String&) = 0;
123

124 125 126 127 128
    virtual bool decidePolicyForGeolocationPermissionRequest(WebFrameProxy&, WebSecurityOrigin&, GeolocationPermissionRequestProxy&)
    {
        return false;
    }

129 130
    virtual void didCommitLoadForMainFrame() = 0;

131
#if USE(TILED_BACKING_STORE)
132
    virtual void pageDidRequestScroll(const WebCore::IntPoint&) = 0;
133
    virtual void didRenderFrame(const WebCore::IntSize& contentsSize, const WebCore::IntRect& coveredRect) = 0;
134
    virtual void pageTransitionViewportReady() = 0;
135
#endif
136
#if USE(COORDINATED_GRAPHICS)
137
    virtual void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&) = 0;
138
#endif
139 140

#if PLATFORM(EFL) || PLATFORM(GTK)
141
    virtual void updateTextInputState() = 0;
142
#endif // PLATFORM(EFL) || PLATOFRM(GTK)
143

144
#if PLATFORM(EFL) || PLATFORM(GTK)
145
    virtual void handleDownloadRequest(DownloadProxy*) = 0;
146
#endif // PLATFORM(EFL) || PLATFORM(GTK)
147

148 149
#if PLATFORM(EFL) || PLATFORM(IOS)
    virtual void didChangeContentSize(const WebCore::IntSize&) = 0;
150 151
#endif

152
#if PLATFORM(GTK)
153
    virtual void startDrag(const WebCore::DragData&, PassRefPtr<ShareableBitmap> dragImage) = 0;
154 155
#endif

156
    virtual void setCursor(const WebCore::Cursor&) = 0;
157
    virtual void setCursorHiddenUntilMouseMoves(bool) = 0;
158
    virtual void didChangeViewportProperties(const WebCore::ViewportAttributes&) = 0;
159

160
    virtual void registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo) = 0;
weinig@apple.com's avatar
weinig@apple.com committed
161
    virtual void clearAllEditCommands() = 0;
162 163
    virtual bool canUndoRedo(WebPageProxy::UndoOrRedo) = 0;
    virtual void executeUndoRedo(WebPageProxy::UndoOrRedo) = 0;
164
#if PLATFORM(MAC)
165
    virtual void accessibilityWebProcessTokenReceived(const IPC::DataReference&) = 0;
ap@apple.com's avatar
ap@apple.com committed
166
    virtual bool interpretKeyEvent(const NativeWebKeyboardEvent&, Vector<WebCore::KeypressCommand>&) = 0;
167
    virtual bool executeSavedCommandBySelector(const String& selector) = 0;
aroben@apple.com's avatar
aroben@apple.com committed
168
    virtual void setDragImage(const WebCore::IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, bool isLinkDrag) = 0;
169
    virtual void updateSecureInputState() = 0;
170 171
    virtual void resetSecureInputState() = 0;
    virtual void notifyInputContextAboutDiscardedComposition() = 0;
172
    virtual void makeFirstResponder() = 0;
173
    virtual void setAcceleratedCompositingRootLayer(CALayer *) = 0;
174 175 176
#endif

#if USE(APPKIT)
177 178
    virtual void setPromisedData(const String& pasteboardName, PassRefPtr<WebCore::SharedBuffer> imageBuffer, const String& filename, const String& extension, const String& title,
                                 const String& url, const String& visibleUrl, PassRefPtr<WebCore::SharedBuffer> archiveBuffer) = 0;
179
#endif
180

181
#if PLATFORM(GTK)
182
    virtual void getEditorCommandsForKeyEvent(const NativeWebKeyboardEvent&, const AtomicString&, Vector<WTF::String>&) = 0;
183
#endif
184 185
    virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&) = 0;
    virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&) = 0;
186
    virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint&) = 0;
187 188
    virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&) = 0;
    
189
    virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled) = 0;
190 191 192
#if ENABLE(TOUCH_EVENTS)
    virtual void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled) = 0;
#endif
193

194
    virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*) = 0;
195
    virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*) = 0;
196

197
#if ENABLE(INPUT_TYPE_COLOR)
198
    virtual PassRefPtr<WebColorPicker> createColorPicker(WebPageProxy*, const WebCore::Color& initialColor, const WebCore::IntRect&) = 0;
199 200
#endif

201
    virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut, bool animate) = 0;
andersca@apple.com's avatar
andersca@apple.com committed
202

203
#if USE(ACCELERATED_COMPOSITING)
204 205
    virtual void enterAcceleratedCompositingMode(const LayerTreeContext&) = 0;
    virtual void exitAcceleratedCompositingMode() = 0;
206
    virtual void updateAcceleratedCompositingMode(const LayerTreeContext&) = 0;
207
#endif
208

209
#if !PLATFORM(IOS) && PLATFORM(MAC)
210
    virtual void pluginFocusOrWindowFocusChanged(uint64_t pluginComplexTextInputIdentifier, bool pluginHasFocusAndWindowHasFocus) = 0;
211
    virtual void setPluginComplexTextInputState(uint64_t pluginComplexTextInputIdentifier, PluginComplexTextInputState) = 0;
212
    virtual void didPerformDictionaryLookup(const AttributedString&, const DictionaryPopupInfo&) = 0;
213
    virtual void dismissDictionaryLookupPanel() = 0;
214 215 216
    virtual void showCorrectionPanel(WebCore::AlternativeTextType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings) = 0;
    virtual void dismissCorrectionPanel(WebCore::ReasonForDismissingAlternativeText) = 0;
    virtual String dismissCorrectionPanelSoon(WebCore::ReasonForDismissingAlternativeText) = 0;
217
    virtual void recordAutocorrectionResponse(WebCore::AutocorrectionResponseType, const String& replacedString, const String& replacementString) = 0;
218
    virtual void recommendedScrollbarStyleDidChange(int32_t newStyle) = 0;
219 220 221

    virtual ColorSpaceData colorSpace() = 0;

222
#if USE(APPKIT)
223
    virtual WKView* wkView() const = 0;
224
    virtual void intrinsicContentSizeDidChange(const WebCore::IntSize& intrinsicContentSize) = 0;
225 226 227 228 229 230 231 232
#if USE(DICTATION_ALTERNATIVES)
    virtual uint64_t addDictationAlternatives(const RetainPtr<NSTextAlternatives>&) = 0;
    virtual void removeDictationAlternatives(uint64_t dictationContext) = 0;
    virtual void showDictationAlternativeUI(const WebCore::FloatRect& boundingBoxOfDictatedText, uint64_t dictationContext) = 0;
    virtual Vector<String> dictationAlternatives(uint64_t dictationContext) = 0;
#endif // USE(DICTATION_ALTERNATIVES)
#endif // USE(APPKIT)
#endif // PLATFORM(MAC)
233 234 235 236 237 238 239 240 241 242 243 244 245

#if PLATFORM(IOS)
    virtual void mainDocumentDidReceiveMobileDocType() = 0;

    virtual void didGetTapHighlightGeometries(uint64_t requestID, const WebCore::Color&, const Vector<WebCore::FloatQuad>& highlightedQuads, const WebCore::IntSize& topLeftRadius, const WebCore::IntSize& topRightRadius, const WebCore::IntSize& bottomLeftRadius, const WebCore::IntSize& bottomRightRadius) = 0;

    virtual void didChangeViewportArguments(const WebCore::ViewportArguments&) = 0;

    virtual void startAssistingNode(const WebCore::IntRect&, bool hasNextFocusable, bool hasPreviousFocusable) = 0;
    virtual void stopAssistingNode() = 0;
    virtual void selectionDidChange() = 0;
    virtual bool interpretKeyEvent(const NativeWebKeyboardEvent&, bool isCharEvent) = 0;
#endif
246 247 248 249 250

    // Auxiliary Client Creation
#if ENABLE(FULLSCREEN_API)
    virtual WebFullScreenManagerProxyClient& fullScreenManagerProxyClient() = 0;
#endif
251 252 253 254 255
};

} // namespace WebKit

#endif // PageClient_h