Merge "Use EwkView's variables instead of drawingScaleFactor and drawingScrollPositio...
[framework/web/webkit-efl.git] / Source / WebKit2 / UIProcess / PageClient.h
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 "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>
36
37 #if PLATFORM(MAC)
38 #include "PluginComplexTextInputState.h"
39
40 #if USE(APPKIT)
41 OBJC_CLASS WKView;
42 OBJC_CLASS NSTextAlternatives;
43 #endif
44 #endif
45
46 namespace WebCore {
47     class Cursor;
48     struct ViewportAttributes;
49 }
50
51 namespace WebKit {
52
53 class DrawingAreaProxy;
54 class FindIndicator;
55 class NativeWebKeyboardEvent;
56 #if ENABLE(TOUCH_EVENTS)
57 class NativeWebTouchEvent;
58 #endif
59 #if ENABLE(GESTURE_EVENTS)
60 class WebGestureEvent;
61 #endif
62 class WebContextMenuProxy;
63 class WebEditCommandProxy;
64 class WebPopupMenuProxy;
65 #if ENABLE(INPUT_TYPE_COLOR)
66 class WebColorChooserProxy;
67 #endif
68
69 #if PLATFORM(WIN)
70 struct WindowGeometry;
71 #endif
72
73 #if PLATFORM(MAC)
74 struct ColorSpaceData;
75 #endif
76
77 class PageClient {
78 public:
79     virtual ~PageClient() { }
80
81     // Create a new drawing area proxy for the given page.
82     virtual PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy() = 0;
83
84     // Tell the view to invalidate the given rect. The rect is in view coordinates.
85     virtual void setViewNeedsDisplay(const WebCore::IntRect&) = 0;
86
87     // Tell the view to immediately display its invalid rect.
88     virtual void displayView() = 0;
89
90     // Tell the view to scroll scrollRect by scrollOffset.
91     virtual void scrollView(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset) = 0;
92
93     // Return the size of the view the page is associated with.
94     virtual WebCore::IntSize viewSize() = 0;
95
96     // Return whether the view's containing window is active.
97     virtual bool isViewWindowActive() = 0;
98
99     // Return whether the view is focused.
100     virtual bool isViewFocused() = 0;
101
102     // Return whether the view is visible.
103     virtual bool isViewVisible() = 0;
104
105     // Return whether the view is in a window.
106     virtual bool isViewInWindow() = 0;
107
108     // Return the layer hosting mode for the view.
109     virtual LayerHostingMode viewLayerHostingMode() { return LayerHostingModeDefault; }
110
111     virtual void processDidCrash() = 0;
112     virtual void didRelaunchProcess() = 0;
113     virtual void pageClosed() = 0;
114
115     virtual void toolTipChanged(const String&, const String&) = 0;
116
117 #if USE(TILED_BACKING_STORE)
118     virtual void pageDidRequestScroll(const WebCore::IntPoint&) = 0;
119 #endif
120
121 #if ENABLE(TIZEN_WEBKIT2_HISTORICAL_RESTORE_VISIBLE_CONTENT_RECT)
122     virtual void pageDidRequestRestoreVisibleContentRect(const WebCore::IntPoint&, float) = 0;
123 #endif
124
125 #if PLATFORM(QT)
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).
134
135 #if OS(TIZEN)
136     virtual void updateTextInputState() = 0;
137     virtual void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&) = 0;
138 #endif // #if OS(TIZEN)
139
140 #if PLATFORM(QT) || PLATFORM(EFL)
141     virtual void handleDownloadRequest(DownloadProxy*) = 0;
142 #endif // PLATFORM(QT) || PLATFORM(EFL)
143
144 #if PLATFORM(QT) || PLATFORM(GTK) || ENABLE(TIZEN_DRAG_SUPPORT)
145     virtual void startDrag(const WebCore::DragData&, PassRefPtr<ShareableBitmap> dragImage) = 0;
146 #endif
147
148     virtual void setCursor(const WebCore::Cursor&) = 0;
149     virtual void setCursorHiddenUntilMouseMoves(bool) = 0;
150     virtual void didChangeViewportProperties(const WebCore::ViewportAttributes&) = 0;
151
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;
156 #if PLATFORM(MAC)
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;
166 #endif
167 #if PLATFORM(WIN)
168     virtual void compositionSelectionChanged(bool) = 0;
169 #endif
170 #if PLATFORM(GTK)
171     virtual void getEditorCommandsForKeyEvent(const NativeWebKeyboardEvent&, const AtomicString&, Vector<WTF::String>&) = 0;
172 #endif
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;
177     
178     virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled) = 0;
179 #if ENABLE(GESTURE_EVENTS)
180     virtual void doneWithGestureEvent(const WebGestureEvent&, bool wasEventHandled) = 0;
181 #endif
182 #if ENABLE(TOUCH_EVENTS)
183     virtual void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled) = 0;
184 #endif
185
186     virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*) = 0;
187     virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*) = 0;
188
189 #if ENABLE(INPUT_TYPE_COLOR)
190     virtual PassRefPtr<WebColorChooserProxy> createColorChooserProxy(WebPageProxy*, const WebCore::Color& initialColor) = 0;
191 #endif
192
193     virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut, bool animate) = 0;
194 #if PLATFORM(WIN)
195     virtual void didInstallOrUninstallPageOverlay(bool) = 0;
196 #endif
197
198 #if USE(ACCELERATED_COMPOSITING)
199     virtual void enterAcceleratedCompositingMode(const LayerTreeContext&) = 0;
200     virtual void exitAcceleratedCompositingMode() = 0;
201     virtual void updateAcceleratedCompositingMode(const LayerTreeContext&) = 0;
202 #endif
203
204 #if PLATFORM(WIN)
205     virtual HWND nativeWindow() = 0;
206     virtual void setGestureReachedScrollingLimit(bool) = 0;
207     virtual void scheduleChildWindowGeometryUpdate(const WindowGeometry&) = 0;
208 #endif
209
210 #if PLATFORM(MAC)
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;
221
222     virtual ColorSpaceData colorSpace() = 0;
223
224 #if USE(APPKIT)
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)
235
236     virtual void didChangeScrollbarsForMainFrame() const = 0;
237
238 #if OS(TIZEN)
239 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
240     virtual void setIsTextSelectionMode(bool isTextSelectionMode) = 0;
241 #endif
242
243     virtual void didFirstVisuallyNonEmptyLayoutForMainFrame() = 0;
244     virtual void didChangeContentsSize(const WebCore::IntSize) = 0;
245     virtual void pageScaleFactorDidChange() = 0;
246     virtual void didRenderFrame() = 0;
247 #endif
248
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;
254
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;
258
259 #if ENABLE(TIZEN_REGISTER_PROTOCOL_HANDLER)
260     virtual void registerProtocolHandler(const String& scheme, const String& baseURL, const String& url, const String& title) = 0;
261 #endif
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;
265 #endif
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;
270 #endif
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;
274 #endif
275 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
276     virtual bool getStandaloneStatus() = 0;
277 #endif
278 #if ENABLE(SCREEN_ORIENTATION_SUPPORT) && ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT)
279     virtual bool lockOrientation(int willLockOrientation) = 0;
280     virtual void unlockOrientation() = 0;
281 #endif
282 };
283
284 } // namespace WebKit
285
286 #endif // PageClient_h