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 updateTextInputState() = 0;
130 virtual void handleAuthenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password) = 0;
131 virtual void handleCertificateVerificationRequest(const String& hostname, bool& ignoreErrors) = 0;
132 virtual void handleProxyAuthenticationRequiredRequest(const String& hostname, uint16_t port, const String& prefilledUsername, String& username, String& password) = 0;
133 #endif // PLATFORM(QT).
136 virtual void updateTextInputState() = 0;
137 virtual void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&) = 0;
138 #endif // #if OS(TIZEN)
140 #if PLATFORM(QT) || PLATFORM(EFL)
141 virtual void handleDownloadRequest(DownloadProxy*) = 0;
142 #endif // PLATFORM(QT) || PLATFORM(EFL)
144 #if PLATFORM(QT) || PLATFORM(GTK) || ENABLE(TIZEN_DRAG_SUPPORT)
145 virtual void startDrag(const WebCore::DragData&, PassRefPtr<ShareableBitmap> dragImage) = 0;
148 virtual void setCursor(const WebCore::Cursor&) = 0;
149 virtual void setCursorHiddenUntilMouseMoves(bool) = 0;
150 virtual void didChangeViewportProperties(const WebCore::ViewportAttributes&) = 0;
152 virtual void registerEditCommand(PassRefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo) = 0;
153 virtual void clearAllEditCommands() = 0;
154 virtual bool canUndoRedo(WebPageProxy::UndoOrRedo) = 0;
155 virtual void executeUndoRedo(WebPageProxy::UndoOrRedo) = 0;
157 virtual void accessibilityWebProcessTokenReceived(const CoreIPC::DataReference&) = 0;
158 virtual bool interpretKeyEvent(const NativeWebKeyboardEvent&, Vector<WebCore::KeypressCommand>&) = 0;
159 virtual bool executeSavedCommandBySelector(const String& selector) = 0;
160 virtual void setDragImage(const WebCore::IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, bool isLinkDrag) = 0;
161 virtual void updateTextInputState(bool updateSecureInputState) = 0;
162 virtual void resetTextInputState() = 0;
163 virtual void makeFirstResponder() = 0;
164 virtual void setPromisedData(const String& pasteboardName, PassRefPtr<WebCore::SharedBuffer> imageBuffer, const String& filename, const String& extension, const String& title,
165 const String& url, const String& visibleUrl, PassRefPtr<WebCore::SharedBuffer> archiveBuffer) = 0;
168 virtual void compositionSelectionChanged(bool) = 0;
171 virtual void getEditorCommandsForKeyEvent(const NativeWebKeyboardEvent&, const AtomicString&, Vector<WTF::String>&) = 0;
173 virtual WebCore::FloatRect convertToDeviceSpace(const WebCore::FloatRect&) = 0;
174 virtual WebCore::FloatRect convertToUserSpace(const WebCore::FloatRect&) = 0;
175 virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint&) = 0;
176 virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&) = 0;
178 virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled) = 0;
179 #if ENABLE(GESTURE_EVENTS)
180 virtual void doneWithGestureEvent(const WebGestureEvent&, bool wasEventHandled) = 0;
182 #if ENABLE(TOUCH_EVENTS)
183 virtual void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled) = 0;
186 virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*) = 0;
187 virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*) = 0;
189 #if ENABLE(INPUT_TYPE_COLOR)
190 virtual PassRefPtr<WebColorChooserProxy> createColorChooserProxy(WebPageProxy*, const WebCore::Color& initialColor) = 0;
193 virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut, bool animate) = 0;
195 virtual void didInstallOrUninstallPageOverlay(bool) = 0;
198 #if USE(ACCELERATED_COMPOSITING)
199 virtual void enterAcceleratedCompositingMode(const LayerTreeContext&) = 0;
200 virtual void exitAcceleratedCompositingMode() = 0;
201 virtual void updateAcceleratedCompositingMode(const LayerTreeContext&) = 0;
205 virtual HWND nativeWindow() = 0;
206 virtual void setGestureReachedScrollingLimit(bool) = 0;
207 virtual void scheduleChildWindowGeometryUpdate(const WindowGeometry&) = 0;
211 virtual void pluginFocusOrWindowFocusChanged(uint64_t pluginComplexTextInputIdentifier, bool pluginHasFocusAndWindowHasFocus) = 0;
212 virtual void setPluginComplexTextInputState(uint64_t pluginComplexTextInputIdentifier, PluginComplexTextInputState) = 0;
213 virtual CGContextRef containingWindowGraphicsContext() = 0;
214 virtual void didPerformDictionaryLookup(const String&, double scaleFactor, const DictionaryPopupInfo&) = 0;
215 virtual void dismissDictionaryLookupPanel() = 0;
216 virtual void showCorrectionPanel(WebCore::AlternativeTextType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings) = 0;
217 virtual void dismissCorrectionPanel(WebCore::ReasonForDismissingAlternativeText) = 0;
218 virtual String dismissCorrectionPanelSoon(WebCore::ReasonForDismissingAlternativeText) = 0;
219 virtual void recordAutocorrectionResponse(WebCore::AutocorrectionResponseType, const String& replacedString, const String& replacementString) = 0;
220 virtual void recommendedScrollbarStyleDidChange(int32_t newStyle) = 0;
222 virtual ColorSpaceData colorSpace() = 0;
225 virtual WKView* wkView() const = 0;
226 #if USE(DICTATION_ALTERNATIVES)
227 virtual uint64_t addDictationAlternatives(const RetainPtr<NSTextAlternatives>&) = 0;
228 virtual void removeDictationAlternatives(uint64_t dictationContext) = 0;
229 virtual void showDictationAlternativeUI(const WebCore::FloatRect& boundingBoxOfDictatedText, uint64_t dictationContext) = 0;
230 virtual void dismissDictationAlternativeUI() = 0;
231 virtual Vector<String> dictationAlternatives(uint64_t dictationContext) = 0;
232 #endif // USE(DICTATION_ALTERNATIVES)
233 #endif // USE(APPKIT)
234 #endif // PLATFORM(MAC)
236 virtual void didChangeScrollbarsForMainFrame() const = 0;
239 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
240 virtual void setIsTextSelectionMode(bool isTextSelectionMode) = 0;
243 virtual void didFirstVisuallyNonEmptyLayoutForMainFrame() = 0;
244 virtual void didChangeContentsSize(const WebCore::IntSize) = 0;
245 virtual void pageScaleFactorDidChange() = 0;
246 virtual void didRenderFrame() = 0;
249 // Custom representations.
250 virtual void didCommitLoadForMainFrame(bool useCustomRepresentation) = 0;
251 virtual void didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference&) = 0;
252 virtual double customRepresentationZoomFactor() = 0;
253 virtual void setCustomRepresentationZoomFactor(double) = 0;
255 virtual void flashBackingStoreUpdates(const Vector<WebCore::IntRect>& updateRects) = 0;
256 virtual void findStringInCustomRepresentation(const String&, FindOptions, unsigned maxMatchCount) = 0;
257 virtual void countStringMatchesInCustomRepresentation(const String&, FindOptions, unsigned maxMatchCount) = 0;
259 #if ENABLE(TIZEN_REGISTER_PROTOCOL_HANDLER)
260 virtual void registerProtocolHandler(const String& scheme, const String& baseURL, const String& url, const String& title) = 0;
262 #if ENABLE(TIZEN_CUSTOM_SCHEME_HANDLER)
263 virtual unsigned int isProtocolHandlerRegistered(const String& scheme, const String& baseURL, const String& url) = 0;
264 virtual void unregisterProtocolHandler(const String& scheme, const String& baseURL, const String& url) = 0;
266 #if ENABLE(TIZEN_REGISTER_CONTENT_HANDLER)
267 virtual void registerContentHandler(const String& mimeType, const String& baseURL, const String& url, const String& title) = 0;
268 virtual unsigned int isContentHandlerRegistered(const String& mimeType, const String& baseURL, const String& url) = 0;
269 virtual void unregisterContentHandler(const String& mimeType, const String& baseURL, const String& url) = 0;
271 #if ENABLE(TIZEN_SEARCH_PROVIDER)
272 virtual void addSearchProvider(const String& baseURL, const String& engineURL) = 0;
273 virtual unsigned long isSearchProviderInstalled(const String& baseURL, const String& engineURL) = 0;
275 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
276 virtual bool getStandaloneStatus() = 0;
278 #if ENABLE(SCREEN_ORIENTATION_SUPPORT) && ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT)
279 virtual bool lockOrientation(int willLockOrientation) = 0;
280 virtual void unlockOrientation() = 0;
284 } // namespace WebKit
286 #endif // PageClient_h