initial import
[vuplus_webkit] / 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 "WebOpenPanelParameters.h"
33 #include <wtf/Forward.h>
34 #include <wtf/PassRefPtr.h>
35
36 namespace WebCore {
37     class FloatRect;
38     class IntSize;
39     class ResourceRequest;
40     struct WindowFeatures;
41 }
42
43 namespace WebKit {
44
45 class APIObject;
46 class GeolocationPermissionRequestProxy;
47 class NativeWebKeyboardEvent;
48 class NativeWebWheelEvent;
49 class WebData;
50 class WebFrameProxy;
51 class WebPageProxy;
52 class WebSecurityOrigin;
53 class WebOpenPanelResultListenerProxy;
54
55 class WebUIClient : public APIClient<WKPageUIClient, kWKPageUIClientCurrentVersion> {
56 public:
57     PassRefPtr<WebPageProxy> createNewPage(WebPageProxy*, const WebCore::ResourceRequest&, const WebCore::WindowFeatures&, WebEvent::Modifiers, WebMouseEvent::Button);
58     void showPage(WebPageProxy*);
59     void close(WebPageProxy*);
60
61     void takeFocus(WebPageProxy*, WKFocusDirection);
62     void focus(WebPageProxy*);
63     void unfocus(WebPageProxy*);
64
65     void runJavaScriptAlert(WebPageProxy*, const String&, WebFrameProxy*);
66     bool runJavaScriptConfirm(WebPageProxy*, const String&, WebFrameProxy*);
67     String runJavaScriptPrompt(WebPageProxy*, const String&, const String&, WebFrameProxy*);
68
69     void setStatusText(WebPageProxy*, const String&);
70     void mouseDidMoveOverElement(WebPageProxy*, WebEvent::Modifiers, APIObject*);
71     void missingPluginButtonClicked(WebPageProxy*, const String& mimeType, const String& url, const String& pluginsPageURL);
72     
73     bool implementsDidNotHandleKeyEvent() const;
74     void didNotHandleKeyEvent(WebPageProxy*, const NativeWebKeyboardEvent&);
75
76     bool implementsDidNotHandleWheelEvent() const;
77     void didNotHandleWheelEvent(WebPageProxy*, const NativeWebWheelEvent&);
78
79     bool toolbarsAreVisible(WebPageProxy*);
80     void setToolbarsAreVisible(WebPageProxy*, bool);
81     bool menuBarIsVisible(WebPageProxy*);
82     void setMenuBarIsVisible(WebPageProxy*, bool);
83     bool statusBarIsVisible(WebPageProxy*);
84     void setStatusBarIsVisible(WebPageProxy*, bool);
85     bool isResizable(WebPageProxy*);
86     void setIsResizable(WebPageProxy*, bool);
87
88     void setWindowFrame(WebPageProxy*, const WebCore::FloatRect&);
89     WebCore::FloatRect windowFrame(WebPageProxy*);
90
91     bool canRunBeforeUnloadConfirmPanel() const;
92     bool runBeforeUnloadConfirmPanel(WebPageProxy*, const String&, WebFrameProxy*);
93
94     void didDraw(WebPageProxy*);
95     void pageDidScroll(WebPageProxy*);
96
97     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);
98
99     bool runOpenPanel(WebPageProxy*, WebFrameProxy*, const WebOpenPanelParameters::Data&, WebOpenPanelResultListenerProxy*);
100     bool decidePolicyForGeolocationPermissionRequest(WebPageProxy*, WebFrameProxy*, WebSecurityOrigin*, GeolocationPermissionRequestProxy*);
101
102     // Printing.
103     float headerHeight(WebPageProxy*, WebFrameProxy*);
104     float footerHeight(WebPageProxy*, WebFrameProxy*);
105     void drawHeader(WebPageProxy*, WebFrameProxy*, const WebCore::FloatRect&);
106     void drawFooter(WebPageProxy*, WebFrameProxy*, const WebCore::FloatRect&);
107     void printFrame(WebPageProxy*, WebFrameProxy*);
108
109     bool canRunModal() const;
110     void runModal(WebPageProxy*);
111
112     void didCompleteRubberBandForMainFrame(WebPageProxy*, const WebCore::IntSize&);
113
114     void saveDataToFileInDownloadsFolder(WebPageProxy*, const String& suggestedFilename, const String& mimeType, const String& originatingURLString, WebData*);
115
116     bool shouldInterruptJavaScript(WebPageProxy*);
117 };
118
119 } // namespace WebKit
120
121 #endif // WebUIClient_h