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.
29 #include "ShareableBitmap.h"
30 #include "WebColorChooserProxy.h"
31 #include "WebPageProxy.h"
32 #include "WebPopupMenuProxy.h"
33 #include <WebCore/AlternativeTextClient.h>
34 #include <WebCore/EditorClient.h>
35 #include <wtf/Forward.h>
38 #include "PluginComplexTextInputState.h"
42 OBJC_CLASS NSTextAlternatives;
48 struct ViewportAttributes;
53 class DrawingAreaProxy;
55 class NativeWebKeyboardEvent;
56 #if ENABLE(TOUCH_EVENTS)
57 class NativeWebTouchEvent;
59 #if ENABLE(GESTURE_EVENTS)
60 class WebGestureEvent;
62 class WebContextMenuProxy;
63 class WebEditCommandProxy;
64 class WebPopupMenuProxy;
65 #if ENABLE(INPUT_TYPE_COLOR)
66 class WebColorChooserProxy;
70 struct WindowGeometry;
74 struct ColorSpaceData;
79 virtual ~PageClient() { }
81 // Create a new drawing area proxy for the given page.
82 virtual PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy() = 0;
84 // Tell the view to invalidate the given rect. The rect is in view coordinates.
85 virtual void setViewNeedsDisplay(const WebCore::IntRect&) = 0;
87 // Tell the view to immediately display its invalid rect.
88 virtual void displayView() = 0;
90 // Tell the view to scroll scrollRect by scrollOffset.
91 virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset) = 0;
93 // Return the size of the view the page is associated with.
94 virtual WebCore::IntSize viewSize() = 0;
96 // Return whether the view's containing window is active.
97 virtual bool isViewWindowActive() = 0;
99 // Return whether the view is focused.
100 virtual bool isViewFocused() = 0;
102 // Return whether the view is visible.
103 virtual bool isViewVisible() = 0;
105 // Return whether the view is in a window.
106 virtual bool isViewInWindow() = 0;
108 // Return the layer hosting mode for the view.
109 virtual LayerHostingMode viewLayerHostingMode() { return LayerHostingModeDefault; }
111 virtual void processDidCrash() = 0;
112 virtual void didRelaunchProcess() = 0;
113 virtual void pageClosed() = 0;
115 virtual void toolTipChanged(const String&, const String&) = 0;
117 #if USE(TILED_BACKING_STORE)
118 virtual void pageDidRequestScroll(const WebCore::IntPoint&) = 0;
121 #if ENABLE(TIZEN_WEBKIT2_HISTORICAL_RESTORE_VISIBLE_CONTENT_RECT)
122 virtual void pageDidRequestRestoreVisibleContentRect(const WebCore::IntPoint&, float) = 0;
126 virtual void didChangeContentsSize(const WebCore::IntSize&) = 0;
127 virtual void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&) = 0;
128 virtual void didReceiveMessageFromNavigatorQtObject(const String&) = 0;
129 virtual void handleAuthenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password) = 0;
130 virtual void handleCertificateVerificationRequest(const String& hostname, bool& ignoreErrors) = 0;
131 virtual void handleProxyAuthenticationRequiredRequest(const String& hostname, uint16_t port, const String& prefilledUsername, String& username, String& password) = 0;
132 #endif // PLATFORM(QT).
135 virtual void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&) = 0;
136 #endif // #if OS(TIZEN)
138 #if PLATFORM(QT) || PLATFORM(EFL)
139 virtual void updateTextInputState() = 0;
140 virtual void handleDownloadRequest(DownloadProxy*) = 0;
141 #endif // PLATFORM(QT) || PLATFORM(EFL)
143 #if PLATFORM(QT) || PLATFORM(GTK) || ENABLE(TIZEN_DRAG_SUPPORT)
144 virtual void startDrag(const WebCore::DragData&, PassRefPtr<ShareableBitmap> dragImage) = 0;
147 virtual void setCursor(const WebCore::Cursor&) = 0;
148 virtual void setCursorHiddenUntilMouseMoves(bool) = 0;
149 virtual void didChangeViewportProperties(const WebCore::ViewportAttributes&) = 0;
151 virtual void registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo) = 0;
152 virtual void clearAllEditCommands() = 0;
153 virtual bool canUndoRedo(WebPageProxy::UndoOrRedo) = 0;
154 virtual void executeUndoRedo(WebPageProxy::UndoOrRedo) = 0;
156 virtual void accessibilityWebProcessTokenReceived(const CoreIPC::DataReference&) = 0;
157 virtual bool interpretKeyEvent(const NativeWebKeyboardEvent&, Vector<WebCore::KeypressCommand>&) = 0;
158 virtual bool executeSavedCommandBySelector(const String& selector) = 0;
159 virtual void setDragImage(const WebCore::IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, bool isLinkDrag) = 0;
160 virtual void updateTextInputState(bool updateSecureInputState) = 0;
161 virtual void resetTextInputState() = 0;
162 virtual void makeFirstResponder() = 0;
163 virtual void setPromisedData(const String& pasteboardName, PassRefPtr<WebCore::SharedBuffer> imageBuffer, const String& filename, const String& extension, const String& title,
164 const String& url, const String& visibleUrl, PassRefPtr<WebCore::SharedBuffer> archiveBuffer) = 0;
167 virtual void compositionSelectionChanged(bool) = 0;
170 virtual void getEditorCommandsForKeyEvent(const NativeWebKeyboardEvent&, const AtomicString&, Vector<WTF::String>&) = 0;
172 virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&) = 0;
173 virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&) = 0;
174 virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint&) = 0;
175 virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&) = 0;
177 virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled) = 0;
178 #if ENABLE(GESTURE_EVENTS)
179 virtual void doneWithGestureEvent(const WebGestureEvent&, bool wasEventHandled) = 0;
181 #if ENABLE(TOUCH_EVENTS)
182 virtual void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled) = 0;
185 virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*) = 0;
186 virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*) = 0;
188 #if ENABLE(INPUT_TYPE_COLOR)
189 virtual PassRefPtr<WebColorChooserProxy> createColorChooserProxy(WebPageProxy*, const WebCore::Color& initialColor) = 0;
192 virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut, bool animate) = 0;
194 virtual void didInstallOrUninstallPageOverlay(bool) = 0;
197 #if USE(ACCELERATED_COMPOSITING)
198 virtual void enterAcceleratedCompositingMode(const LayerTreeContext&) = 0;
199 virtual void exitAcceleratedCompositingMode() = 0;
200 virtual void updateAcceleratedCompositingMode(const LayerTreeContext&) = 0;
204 virtual HWND nativeWindow() = 0;
205 virtual void setGestureReachedScrollingLimit(bool) = 0;
206 virtual void scheduleChildWindowGeometryUpdate(const WindowGeometry&) = 0;
210 virtual void pluginFocusOrWindowFocusChanged(uint64_t pluginComplexTextInputIdentifier, bool pluginHasFocusAndWindowHasFocus) = 0;
211 virtual void setPluginComplexTextInputState(uint64_t pluginComplexTextInputIdentifier, PluginComplexTextInputState) = 0;
212 virtual CGContextRef containingWindowGraphicsContext() = 0;
213 virtual void didPerformDictionaryLookup(const String&, double scaleFactor, const DictionaryPopupInfo&) = 0;
214 virtual void dismissDictionaryLookupPanel() = 0;
215 virtual void showCorrectionPanel(WebCore::AlternativeTextType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings) = 0;
216 virtual void dismissCorrectionPanel(WebCore::ReasonForDismissingAlternativeText) = 0;
217 virtual String dismissCorrectionPanelSoon(WebCore::ReasonForDismissingAlternativeText) = 0;
218 virtual void recordAutocorrectionResponse(WebCore::AutocorrectionResponseType, const String& replacedString, const String& replacementString) = 0;
219 virtual void recommendedScrollbarStyleDidChange(int32_t newStyle) = 0;
221 virtual ColorSpaceData colorSpace() = 0;
224 virtual WKView* wkView() const = 0;
225 #if USE(DICTATION_ALTERNATIVES)
226 virtual uint64_t addDictationAlternatives(const RetainPtr<NSTextAlternatives>&) = 0;
227 virtual void removeDictationAlternatives(uint64_t dictationContext) = 0;
228 virtual void showDictationAlternativeUI(const WebCore::FloatRect& boundingBoxOfDictatedText, uint64_t dictationContext) = 0;
229 virtual void dismissDictationAlternativeUI() = 0;
230 virtual Vector<String> dictationAlternatives(uint64_t dictationContext) = 0;
231 #endif // USE(DICTATION_ALTERNATIVES)
232 #endif // USE(APPKIT)
233 #endif // PLATFORM(MAC)
235 virtual void didChangeScrollbarsForMainFrame() const = 0;
238 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
239 virtual void setIsTextSelectionMode(bool isTextSelectionMode) = 0;
242 virtual void didFirstVisuallyNonEmptyLayoutForMainFrame() = 0;
243 virtual void didChangeContentsSize(const WebCore::IntSize) = 0;
244 virtual void pageScaleFactorDidChange() = 0;
245 virtual void didRenderFrame() = 0;
248 // Custom representations.
249 virtual void didCommitLoadForMainFrame(bool useCustomRepresentation) = 0;
250 virtual void didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference&) = 0;
251 virtual double customRepresentationZoomFactor() = 0;
252 virtual void setCustomRepresentationZoomFactor(double) = 0;
254 virtual void flashBackingStoreUpdates(const Vector<WebCore::IntRect>& updateRects) = 0;
255 virtual void findStringInCustomRepresentation(const String&, FindOptions, unsigned maxMatchCount) = 0;
256 virtual void countStringMatchesInCustomRepresentation(const String&, FindOptions, unsigned maxMatchCount) = 0;
258 #if ENABLE(TIZEN_REGISTER_PROTOCOL_HANDLER)
259 virtual void registerProtocolHandler(const String& scheme, const String& baseURL, const String& url, const String& title) = 0;
261 #if ENABLE(TIZEN_CUSTOM_SCHEME_HANDLER)
262 virtual unsigned int isProtocolHandlerRegistered(const String& scheme, const String& baseURL, const String& url) = 0;
263 virtual void unregisterProtocolHandler(const String& scheme, const String& baseURL, const String& url) = 0;
265 #if ENABLE(TIZEN_REGISTER_CONTENT_HANDLER)
266 virtual void registerContentHandler(const String& mimeType, const String& baseURL, const String& url, const String& title) = 0;
267 virtual unsigned int isContentHandlerRegistered(const String& mimeType, const String& baseURL, const String& url) = 0;
268 virtual void unregisterContentHandler(const String& mimeType, const String& baseURL, const String& url) = 0;
270 #if ENABLE(TIZEN_SEARCH_PROVIDER)
271 virtual void addSearchProvider(const String& baseURL, const String& engineURL) = 0;
272 virtual unsigned long isSearchProviderInstalled(const String& baseURL, const String& engineURL) = 0;
274 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
275 virtual bool getStandaloneStatus() = 0;
277 #if ENABLE(SCREEN_ORIENTATION_SUPPORT) && ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT)
278 virtual bool lockOrientation(int willLockOrientation) = 0;
279 virtual void unlockOrientation() = 0;
283 } // namespace WebKit
285 #endif // PageClient_h