Merge "[CherryPick] [EFL][Qt][WK2] Fixed position elements are not always fixed"...
[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 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).
133
134 #if OS(TIZEN)
135     virtual void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&) = 0;
136 #endif // #if OS(TIZEN)
137
138 #if PLATFORM(QT) || PLATFORM(EFL)
139     virtual void updateTextInputState() = 0;
140     virtual void handleDownloadRequest(DownloadProxy*) = 0;
141 #endif // PLATFORM(QT) || PLATFORM(EFL)
142
143 #if PLATFORM(QT) || PLATFORM(GTK) || ENABLE(TIZEN_DRAG_SUPPORT)
144     virtual void startDrag(const WebCore::DragData&, PassRefPtr<ShareableBitmap> dragImage) = 0;
145 #endif
146
147     virtual void setCursor(const WebCore::Cursor&) = 0;
148     virtual void setCursorHiddenUntilMouseMoves(bool) = 0;
149     virtual void didChangeViewportProperties(const WebCore::ViewportAttributes&) = 0;
150
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;
155 #if PLATFORM(MAC)
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;
165 #endif
166 #if PLATFORM(WIN)
167     virtual void compositionSelectionChanged(bool) = 0;
168 #endif
169 #if PLATFORM(GTK)
170     virtual void getEditorCommandsForKeyEvent(const NativeWebKeyboardEvent&, const AtomicString&, Vector<WTF::String>&) = 0;
171 #endif
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;
176     
177     virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled) = 0;
178 #if ENABLE(GESTURE_EVENTS)
179     virtual void doneWithGestureEvent(const WebGestureEvent&, bool wasEventHandled) = 0;
180 #endif
181 #if ENABLE(TOUCH_EVENTS)
182     virtual void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled) = 0;
183 #endif
184
185     virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*) = 0;
186     virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*) = 0;
187
188 #if ENABLE(INPUT_TYPE_COLOR)
189     virtual PassRefPtr<WebColorChooserProxy> createColorChooserProxy(WebPageProxy*, const WebCore::Color& initialColor) = 0;
190 #endif
191
192     virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut, bool animate) = 0;
193 #if PLATFORM(WIN)
194     virtual void didInstallOrUninstallPageOverlay(bool) = 0;
195 #endif
196
197 #if USE(ACCELERATED_COMPOSITING)
198     virtual void enterAcceleratedCompositingMode(const LayerTreeContext&) = 0;
199     virtual void exitAcceleratedCompositingMode() = 0;
200     virtual void updateAcceleratedCompositingMode(const LayerTreeContext&) = 0;
201 #endif
202
203 #if PLATFORM(WIN)
204     virtual HWND nativeWindow() = 0;
205     virtual void setGestureReachedScrollingLimit(bool) = 0;
206     virtual void scheduleChildWindowGeometryUpdate(const WindowGeometry&) = 0;
207 #endif
208
209 #if PLATFORM(MAC)
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;
220
221     virtual ColorSpaceData colorSpace() = 0;
222
223 #if USE(APPKIT)
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)
234
235     virtual void didChangeScrollbarsForMainFrame() const = 0;
236
237 #if OS(TIZEN)
238 #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
239     virtual void setIsTextSelectionMode(bool isTextSelectionMode) = 0;
240 #endif
241
242     virtual void didFirstVisuallyNonEmptyLayoutForMainFrame() = 0;
243     virtual void didChangeContentsSize(const WebCore::IntSize) = 0;
244     virtual void pageScaleFactorDidChange() = 0;
245     virtual void didRenderFrame() = 0;
246 #endif
247
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;
253
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;
257
258 #if ENABLE(TIZEN_REGISTER_PROTOCOL_HANDLER)
259     virtual void registerProtocolHandler(const String& scheme, const String& baseURL, const String& url, const String& title) = 0;
260 #endif
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;
264 #endif
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;
269 #endif
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;
273 #endif
274 #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
275     virtual bool getStandaloneStatus() = 0;
276 #endif
277 #if ENABLE(SCREEN_ORIENTATION_SUPPORT) && ENABLE(TIZEN_SCREEN_ORIENTATION_SUPPORT)
278     virtual bool lockOrientation(int willLockOrientation) = 0;
279     virtual void unlockOrientation() = 0;
280 #endif
281 };
282
283 } // namespace WebKit
284
285 #endif // PageClient_h