| 1 | /* |
| 2 | * Copyright (C) 2014, 2015 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 | #pragma once |
| 27 | |
| 28 | #include "APIData.h" |
| 29 | #include "APIString.h" |
| 30 | #include "AuthenticationChallengeDisposition.h" |
| 31 | #include "AuthenticationChallengeProxy.h" |
| 32 | #include "AuthenticationDecisionListener.h" |
| 33 | #include "PluginModuleInfo.h" |
| 34 | #include "ProcessTerminationReason.h" |
| 35 | #include "SameDocumentNavigationType.h" |
| 36 | #include "WebEvent.h" |
| 37 | #include "WebFramePolicyListenerProxy.h" |
| 38 | #include "WebsitePoliciesData.h" |
| 39 | #include <WebCore/FrameLoaderTypes.h> |
| 40 | #include <WebCore/LayoutMilestone.h> |
| 41 | #include <wtf/Forward.h> |
| 42 | |
| 43 | namespace WebCore { |
| 44 | struct ContentRuleListResults; |
| 45 | class ResourceError; |
| 46 | class ResourceRequest; |
| 47 | class ResourceResponse; |
| 48 | struct SecurityOriginData; |
| 49 | } |
| 50 | |
| 51 | namespace WebKit { |
| 52 | class AuthenticationChallengeProxy; |
| 53 | class QuickLookDocumentData; |
| 54 | class WebBackForwardListItem; |
| 55 | class WebFramePolicyListenerProxy; |
| 56 | class WebFrameProxy; |
| 57 | class WebPageProxy; |
| 58 | class WebProtectionSpace; |
| 59 | struct NavigationActionData; |
| 60 | struct WebNavigationDataStore; |
| 61 | } |
| 62 | |
| 63 | namespace API { |
| 64 | |
| 65 | class Dictionary; |
| 66 | class Navigation; |
| 67 | class NavigationAction; |
| 68 | class NavigationResponse; |
| 69 | class Object; |
| 70 | |
| 71 | class NavigationClient { |
| 72 | public: |
| 73 | virtual ~NavigationClient() { } |
| 74 | |
| 75 | virtual void didStartProvisionalNavigation(WebKit::WebPageProxy&, Navigation*, Object*) { } |
| 76 | virtual void didReceiveServerRedirectForProvisionalNavigation(WebKit::WebPageProxy&, Navigation*, Object*) { } |
| 77 | virtual void willPerformClientRedirect(WebKit::WebPageProxy&, const WTF::String& destinationURL, double) { } |
| 78 | virtual void didPerformClientRedirect(WebKit::WebPageProxy&, const WTF::String& sourceURL, const WTF::String& destinationURL) { } |
| 79 | virtual void didCancelClientRedirect(WebKit::WebPageProxy&) { } |
| 80 | virtual void didFailProvisionalNavigationWithError(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, Navigation*, const WebCore::ResourceError&, Object*) { } |
| 81 | virtual void didFailProvisionalLoadInSubframeWithError(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, const WebCore::SecurityOriginData&, Navigation*, const WebCore::ResourceError&, Object*) { } |
| 82 | virtual void didCommitNavigation(WebKit::WebPageProxy&, Navigation*, Object*) { } |
| 83 | virtual void didFinishDocumentLoad(WebKit::WebPageProxy&, Navigation*, Object*) { } |
| 84 | virtual void didFinishNavigation(WebKit::WebPageProxy&, Navigation*, Object*) { } |
| 85 | virtual void didFailNavigationWithError(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, Navigation*, const WebCore::ResourceError&, Object*) { } |
| 86 | virtual void didSameDocumentNavigation(WebKit::WebPageProxy&, Navigation*, WebKit::SameDocumentNavigationType, Object*) { } |
| 87 | |
| 88 | virtual void didDisplayInsecureContent(WebKit::WebPageProxy&, API::Object*) { } |
| 89 | virtual void didRunInsecureContent(WebKit::WebPageProxy&, API::Object*) { } |
| 90 | |
| 91 | virtual void renderingProgressDidChange(WebKit::WebPageProxy&, OptionSet<WebCore::LayoutMilestone>) { } |
| 92 | |
| 93 | virtual void didReceiveAuthenticationChallenge(WebKit::WebPageProxy&, WebKit::AuthenticationChallengeProxy& challenge) { challenge.listener().completeChallenge(WebKit::AuthenticationChallengeDisposition::PerformDefaultHandling); } |
| 94 | virtual bool shouldBypassCompatibilityModeSafeguards() const { return false; } |
| 95 | |
| 96 | // FIXME: These function should not be part of this client. |
| 97 | virtual bool processDidTerminate(WebKit::WebPageProxy&, WebKit::ProcessTerminationReason) { return false; } |
| 98 | virtual void processDidBecomeResponsive(WebKit::WebPageProxy&) { } |
| 99 | virtual void processDidBecomeUnresponsive(WebKit::WebPageProxy&) { } |
| 100 | |
| 101 | virtual RefPtr<Data> webCryptoMasterKey(WebKit::WebPageProxy&) { return nullptr; } |
| 102 | |
| 103 | virtual RefPtr<String> signedPublicKeyAndChallengeString(WebKit::WebPageProxy&, unsigned keySizeIndex, const RefPtr<String>& challengeString, const WTF::URL&) { return nullptr; } |
| 104 | |
| 105 | #if USE(QUICK_LOOK) |
| 106 | virtual void didStartLoadForQuickLookDocumentInMainFrame(const WTF::String& fileName, const WTF::String& uti) { } |
| 107 | virtual void didFinishLoadForQuickLookDocumentInMainFrame(const WebKit::QuickLookDocumentData&) { } |
| 108 | #endif |
| 109 | |
| 110 | virtual void decidePolicyForNavigationAction(WebKit::WebPageProxy&, Ref<NavigationAction>&&, Ref<WebKit::WebFramePolicyListenerProxy>&& listener, Object*) |
| 111 | { |
| 112 | listener->use(); |
| 113 | } |
| 114 | |
| 115 | virtual void decidePolicyForNavigationResponse(WebKit::WebPageProxy&, Ref<NavigationResponse>&&, Ref<WebKit::WebFramePolicyListenerProxy>&& listener, Object*) |
| 116 | { |
| 117 | listener->use(); |
| 118 | } |
| 119 | |
| 120 | virtual void contentRuleListNotification(WebKit::WebPageProxy&, WTF::URL&&, WebCore::ContentRuleListResults&&) { }; |
| 121 | |
| 122 | #if ENABLE(NETSCAPE_PLUGIN_API) |
| 123 | virtual bool didFailToInitializePlugIn(WebKit::WebPageProxy&, API::Dictionary&) { return false; } |
| 124 | virtual bool didBlockInsecurePluginVersion(WebKit::WebPageProxy&, API::Dictionary&) { return false; } |
| 125 | virtual void decidePolicyForPluginLoad(WebKit::WebPageProxy&, WebKit::PluginModuleLoadPolicy currentPluginLoadPolicy, Dictionary&, CompletionHandler<void(WebKit::PluginModuleLoadPolicy, const WTF::String&)>&& completionHandler) |
| 126 | { |
| 127 | completionHandler(currentPluginLoadPolicy, { }); |
| 128 | } |
| 129 | #endif |
| 130 | |
| 131 | #if ENABLE(WEBGL) |
| 132 | virtual void webGLLoadPolicy(WebKit::WebPageProxy&, const WTF::URL&, CompletionHandler<void(WebCore::WebGLLoadPolicy)>&& completionHandler) const { completionHandler(WebCore::WebGLLoadPolicy::WebGLAllowCreation); } |
| 133 | virtual void resolveWebGLLoadPolicy(WebKit::WebPageProxy&, const WTF::URL&, CompletionHandler<void(WebCore::WebGLLoadPolicy)>&& completionHandler) const { completionHandler(WebCore::WebGLLoadPolicy::WebGLAllowCreation); } |
| 134 | #endif |
| 135 | |
| 136 | virtual bool willGoToBackForwardListItem(WebKit::WebPageProxy&, WebKit::WebBackForwardListItem&, bool inPageCache) { return false; } |
| 137 | |
| 138 | virtual void didBeginNavigationGesture(WebKit::WebPageProxy&) { } |
| 139 | virtual void willEndNavigationGesture(WebKit::WebPageProxy&, bool willNavigate, WebKit::WebBackForwardListItem&) { } |
| 140 | virtual void didEndNavigationGesture(WebKit::WebPageProxy&, bool willNavigate, WebKit::WebBackForwardListItem&) { } |
| 141 | virtual void didRemoveNavigationGestureSnapshot(WebKit::WebPageProxy&) { } |
| 142 | virtual bool didChangeBackForwardList(WebKit::WebPageProxy&, WebKit::WebBackForwardListItem*, const Vector<Ref<WebKit::WebBackForwardListItem>>&) { return false; } |
| 143 | }; |
| 144 | |
| 145 | } // namespace API |
| 146 | |