2 * Copyright (C) 2014 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
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.
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.
29 #import "WKFoundation.h"
33 #import "APIUIClient.h"
34 #import "WeakObjCPtr.h"
35 #import <wtf/RetainPtr.h>
37 @class _WKActivatedElementInfo;
39 @protocol WKUIDelegate;
45 explicit UIDelegate(WKWebView *);
48 std::unique_ptr<API::UIClient> createUIClient();
50 RetainPtr<id <WKUIDelegate> > delegate();
51 void setDelegate(id <WKUIDelegate>);
54 class UIClient : public API::UIClient {
56 explicit UIClient(UIDelegate&);
61 virtual PassRefPtr<WebKit::WebPageProxy> createNewPage(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, const WebKit::SecurityOriginData&, const WebCore::ResourceRequest&, const WebCore::WindowFeatures&, const WebKit::NavigationActionData&) override;
62 virtual void close(WebKit::WebPageProxy*) override;
63 virtual void fullscreenMayReturnToInline(WebKit::WebPageProxy*) override;
64 virtual void didEnterFullscreen(WebKit::WebPageProxy*) override;
65 virtual void didExitFullscreen(WebKit::WebPageProxy*) override;
66 virtual void runJavaScriptAlert(WebKit::WebPageProxy*, const WTF::String&, WebKit::WebFrameProxy*, const WebKit::SecurityOriginData&, std::function<void ()> completionHandler) override;
67 virtual void runJavaScriptConfirm(WebKit::WebPageProxy*, const WTF::String&, WebKit::WebFrameProxy*, const WebKit::SecurityOriginData&, std::function<void (bool)> completionHandler) override;
68 virtual void runJavaScriptPrompt(WebKit::WebPageProxy*, const WTF::String&, const WTF::String&, WebKit::WebFrameProxy*, const WebKit::SecurityOriginData&, std::function<void (const WTF::String&)> completionHandler) override;
69 virtual void exceededDatabaseQuota(WebPageProxy*, WebFrameProxy*, API::SecurityOrigin*, const WTF::String& databaseName, const WTF::String& displayName, unsigned long long currentQuota, unsigned long long currentOriginUsage, unsigned long long currentUsage, unsigned long long expectedUsage, std::function<void (unsigned long long)>) override;
70 virtual void reachedApplicationCacheOriginQuota(WebPageProxy*, const WebCore::SecurityOrigin&, uint64_t currentQuota, uint64_t totalBytesNeeded, std::function<void (unsigned long long)> completionHandler) override;
71 virtual void printFrame(WebKit::WebPageProxy*, WebKit::WebFrameProxy*) override;
74 virtual bool shouldIncludeAppLinkActionsForElement(_WKActivatedElementInfo *) override;
76 virtual RetainPtr<NSArray> actionsForElement(_WKActivatedElementInfo *, RetainPtr<NSArray> defaultActions) override;
77 virtual void didNotHandleTapAsClick(const WebCore::IntPoint&) override;
80 UIDelegate& m_uiDelegate;
84 WeakObjCPtr<id <WKUIDelegate> > m_delegate;
87 bool webViewCreateWebViewWithConfigurationForNavigationActionWindowFeatures : 1;
88 bool webViewRunJavaScriptAlertPanelWithMessageInitiatedByFrameCompletionHandler : 1;
89 bool webViewRunJavaScriptConfirmPanelWithMessageInitiatedByFrameCompletionHandler : 1;
90 bool webViewRunJavaScriptTextInputPanelWithPromptDefaultTextInitiatedByFrameCompletionHandler : 1;
91 bool webViewDecideDatabaseQuotaForSecurityOriginCurrentQuotaCurrentOriginUsageCurrentDatabaseUsageExpectedUsageDecisionHandler : 1;
92 bool webViewDecideWebApplicationCacheQuotaForSecurityOriginCurrentQuotaTotalBytesNeeded : 1;
93 bool webViewPrintFrame : 1;
94 bool webViewDidClose : 1;
95 bool webViewClose : 1;
96 bool webViewFullscreenMayReturnToInline : 1;
97 bool webViewDidEnterFullscreen : 1;
98 bool webViewDidExitFullscreen : 1;
101 bool webViewShouldIncludeAppLinkActionsForElement : 1;
103 bool webViewActionsForElementDefaultActions : 1;
104 bool webViewDidNotHandleTapAsClickAtPoint : 1;
109 } // namespace WebKit
111 #endif // WK_API_ENABLED