WebUIClient.h revision 81bc750723a18f21cd17d1b173cd2a4dda9cea6e
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
36namespace WebCore {
37    class FloatRect;
38    class IntSize;
39    struct WindowFeatures;
40}
41
42namespace WebKit {
43
44class APIObject;
45class GeolocationPermissionRequestProxy;
46class NativeWebKeyboardEvent;
47class WebFrameProxy;
48class WebPageProxy;
49class WebSecurityOrigin;
50class WebOpenPanelResultListenerProxy;
51
52class WebUIClient : public APIClient<WKPageUIClient> {
53public:
54    PassRefPtr<WebPageProxy> createNewPage(WebPageProxy*, const WebCore::WindowFeatures&, WebEvent::Modifiers, WebMouseEvent::Button);
55    void showPage(WebPageProxy*);
56    void close(WebPageProxy*);
57
58    void runJavaScriptAlert(WebPageProxy*, const String&, WebFrameProxy*);
59    bool runJavaScriptConfirm(WebPageProxy*, const String&, WebFrameProxy*);
60    String runJavaScriptPrompt(WebPageProxy*, const String&, const String&, WebFrameProxy*);
61
62    void setStatusText(WebPageProxy*, const String&);
63    void mouseDidMoveOverElement(WebPageProxy*, WebEvent::Modifiers, APIObject*);
64    void missingPluginButtonClicked(WebPageProxy*, const String& mimeType, const String& url, const String& pluginsPageURL);
65    void didNotHandleKeyEvent(WebPageProxy*, const NativeWebKeyboardEvent&);
66
67    bool toolbarsAreVisible(WebPageProxy*);
68    void setToolbarsAreVisible(WebPageProxy*, bool);
69    bool menuBarIsVisible(WebPageProxy*);
70    void setMenuBarIsVisible(WebPageProxy*, bool);
71    bool statusBarIsVisible(WebPageProxy*);
72    void setStatusBarIsVisible(WebPageProxy*, bool);
73    bool isResizable(WebPageProxy*);
74    void setIsResizable(WebPageProxy*, bool);
75
76    void setWindowFrame(WebPageProxy*, const WebCore::FloatRect&);
77    WebCore::FloatRect windowFrame(WebPageProxy*);
78
79    bool canRunBeforeUnloadConfirmPanel() const;
80    bool runBeforeUnloadConfirmPanel(WebPageProxy*, const String&, WebFrameProxy*);
81
82    void didDraw(WebPageProxy*);
83    void pageDidScroll(WebPageProxy*);
84
85    unsigned long long exceededDatabaseQuota(WebPageProxy*, WebFrameProxy*, WebSecurityOrigin*, const String& databaseName, const String& databaseDisplayName, unsigned long long currentQuota, unsigned long long currentUsage, unsigned long long expectedUsage);
86
87    bool runOpenPanel(WebPageProxy*, WebFrameProxy*, const WebOpenPanelParameters::Data&, WebOpenPanelResultListenerProxy*);
88    bool decidePolicyForGeolocationPermissionRequest(WebPageProxy*, WebFrameProxy*, WebSecurityOrigin*, GeolocationPermissionRequestProxy*);
89
90    // Printing.
91    float headerHeight(WebPageProxy*, WebFrameProxy*);
92    float footerHeight(WebPageProxy*, WebFrameProxy*);
93    void drawHeader(WebPageProxy*, WebFrameProxy*, const WebCore::FloatRect&);
94    void drawFooter(WebPageProxy*, WebFrameProxy*, const WebCore::FloatRect&);
95    void printFrame(WebPageProxy*, WebFrameProxy*);
96
97    bool canRunModal() const;
98    void runModal(WebPageProxy*);
99
100    void didCompleteRubberBandForMainFrame(WebPageProxy*, const WebCore::IntSize&);
101};
102
103} // namespace WebKit
104
105#endif // WebUIClient_h
106