Merge "[CherryPick] [EFL][Qt][WK2] Fixed position elements are not always fixed"...
[framework/web/webkit-efl.git] / Source / WebKit2 / UIProcess / WebUIClient.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 WebUIClient_h
27 #define WebUIClient_h
28
29 #include "APIClient.h"
30 #include "WKPage.h"
31 #include "WebEvent.h"
32 #include "WebHitTestResult.h"
33 #include "WebOpenPanelParameters.h"
34 #include <wtf/Forward.h>
35 #include <wtf/PassRefPtr.h>
36
37 namespace WebCore {
38     class FloatRect;
39     class IntSize;
40     class ResourceRequest;
41     struct WindowFeatures;
42 }
43
44 namespace WebKit {
45
46 class APIObject;
47 class GeolocationPermissionRequestProxy;
48 class NativeWebKeyboardEvent;
49 class NativeWebWheelEvent;
50 class NotificationPermissionRequest;
51 #if ENABLE(TIZEN_INPUT_COLOR_PICKER) // wait for upstream
52 class WebColorPickerResultListenerProxy;
53 #endif
54 class WebData;
55 class WebFrameProxy;
56 class WebPageProxy;
57 class WebSecurityOrigin;
58 class WebOpenPanelResultListenerProxy;
59
60 class WebUIClient : public APIClient<WKPageUIClient, kWKPageUIClientCurrentVersion> {
61 public:
62     PassRefPtr<WebPageProxy> createNewPage(WebPageProxy*, const WebCore::ResourceRequest&, const WebCore::WindowFeatures&, WebEvent::Modifiers, WebMouseEvent::Button);
63     void showPage(WebPageProxy*);
64     void close(WebPageProxy*);
65
66     void takeFocus(WebPageProxy*, WKFocusDirection);
67     void focus(WebPageProxy*);
68     void unfocus(WebPageProxy*);
69
70 #if OS(TIZEN)
71     bool runJavaScriptAlert(WebPageProxy*, const String&, WebFrameProxy*);
72     bool runJavaScriptConfirm(WebPageProxy*, const String&, WebFrameProxy*);
73     bool runJavaScriptPrompt(WebPageProxy*, const String&, const String&, WebFrameProxy*);
74 #else
75     void runJavaScriptAlert(WebPageProxy*, const String&, WebFrameProxy*);
76     bool runJavaScriptConfirm(WebPageProxy*, const String&, WebFrameProxy*);
77     String runJavaScriptPrompt(WebPageProxy*, const String&, const String&, WebFrameProxy*);
78 #endif
79
80     void setStatusText(WebPageProxy*, const String&);
81     void mouseDidMoveOverElement(WebPageProxy*, const WebHitTestResult::Data&, WebEvent::Modifiers, APIObject*);
82     void unavailablePluginButtonClicked(WebPageProxy*, WKPluginUnavailabilityReason, const String& mimeType, const String& url, const String& pluginsPageURL);
83     
84     bool implementsDidNotHandleKeyEvent() const;
85     void didNotHandleKeyEvent(WebPageProxy*, const NativeWebKeyboardEvent&);
86
87     bool implementsDidNotHandleWheelEvent() const;
88     void didNotHandleWheelEvent(WebPageProxy*, const NativeWebWheelEvent&);
89
90     bool toolbarsAreVisible(WebPageProxy*);
91     void setToolbarsAreVisible(WebPageProxy*, bool);
92     bool menuBarIsVisible(WebPageProxy*);
93     void setMenuBarIsVisible(WebPageProxy*, bool);
94     bool statusBarIsVisible(WebPageProxy*);
95     void setStatusBarIsVisible(WebPageProxy*, bool);
96     bool isResizable(WebPageProxy*);
97     void setIsResizable(WebPageProxy*, bool);
98
99     void setWindowFrame(WebPageProxy*, const WebCore::FloatRect&);
100     WebCore::FloatRect windowFrame(WebPageProxy*);
101
102     bool canRunBeforeUnloadConfirmPanel() const;
103     bool runBeforeUnloadConfirmPanel(WebPageProxy*, const String&, WebFrameProxy*);
104
105     void didDraw(WebPageProxy*);
106     void pageDidScroll(WebPageProxy*);
107
108 #if ENABLE(TIZEN_SQL_DATABASE)
109     bool exceededDatabaseQuota(WebPageProxy*, WebFrameProxy*, WebSecurityOrigin*, const String& databaseDisplayName, unsigned long long expectedUsage);
110 #else
111     unsigned long long exceededDatabaseQuota(WebPageProxy*, WebFrameProxy*, WebSecurityOrigin*, const String& databaseName, const String& databaseDisplayName, unsigned long long currentQuota, unsigned long long currentOriginUsage, unsigned long long currentDatabaseUsage, unsigned long long expectedUsage);
112 #endif
113
114     bool runOpenPanel(WebPageProxy*, WebFrameProxy*, WebOpenPanelParameters*, WebOpenPanelResultListenerProxy*);
115     bool decidePolicyForGeolocationPermissionRequest(WebPageProxy*, WebFrameProxy*, WebSecurityOrigin*, GeolocationPermissionRequestProxy*);
116     bool decidePolicyForNotificationPermissionRequest(WebPageProxy*, WebSecurityOrigin*, NotificationPermissionRequest*);
117
118     // Printing.
119     float headerHeight(WebPageProxy*, WebFrameProxy*);
120     float footerHeight(WebPageProxy*, WebFrameProxy*);
121     void drawHeader(WebPageProxy*, WebFrameProxy*, const WebCore::FloatRect&);
122     void drawFooter(WebPageProxy*, WebFrameProxy*, const WebCore::FloatRect&);
123     void printFrame(WebPageProxy*, WebFrameProxy*);
124
125     bool canRunModal() const;
126     void runModal(WebPageProxy*);
127
128     void saveDataToFileInDownloadsFolder(WebPageProxy*, const String& suggestedFilename, const String& mimeType, const String& originatingURLString, WebData*);
129
130     bool shouldInterruptJavaScript(WebPageProxy*);
131
132 #if ENABLE(TIZEN_INPUT_COLOR_PICKER) // wait for upstream
133 #if ENABLE(INPUT_TYPE_COLOR)
134     bool showColorPicker(WebPageProxy*, const String&, WebColorPickerResultListenerProxy*);
135     bool hideColorPicker(WebPageProxy*);
136 #endif
137 #endif
138 };
139
140 } // namespace WebKit
141
142 #endif // WebUIClient_h