| /* |
| * Copyright (C) 2019 Apple Inc. All rights reserved. |
| * |
| * Redistribution and use in source and binary forms, with or without |
| * modification, are permitted provided that the following conditions |
| * are met: |
| * 1. Redistributions of source code must retain the above copyright |
| * notice, this list of conditions and the following disclaimer. |
| * 2. Redistributions in binary form must reproduce the above copyright |
| * notice, this list of conditions and the following disclaimer in the |
| * documentation and/or other materials provided with the distribution. |
| * |
| * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' |
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
| * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS |
| * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
| * THE POSSIBILITY OF SUCH DAMAGE. |
| */ |
| |
| #pragma once |
| |
| #include "MessageReceiver.h" |
| #include "MessageSender.h" |
| #include "PolicyDecision.h" |
| #include "SandboxExtension.h" |
| #include "WebFramePolicyListenerProxy.h" |
| #include "WebPageProxyMessagesReplies.h" |
| #include "WebsitePoliciesData.h" |
| #include <WebCore/FrameIdentifier.h> |
| #include <WebCore/ResourceRequest.h> |
| #include <wtf/WeakPtr.h> |
| |
| namespace API { |
| class Navigation; |
| } |
| |
| namespace IPC { |
| class FormDataReference; |
| } |
| |
| namespace WebCore { |
| class ResourceRequest; |
| struct BackForwardItemIdentifier; |
| } |
| |
| namespace WebKit { |
| |
| class DrawingAreaProxy; |
| class SuspendedPageProxy; |
| class UserData; |
| class WebFrameProxy; |
| class WebPageProxy; |
| class WebProcessProxy; |
| struct FrameInfoData; |
| struct NavigationActionData; |
| struct URLSchemeTaskParameters; |
| struct WebNavigationDataStore; |
| |
| #if HAVE(VISIBILITY_PROPAGATION_VIEW) |
| using LayerHostingContextID = uint32_t; |
| #endif |
| |
| class ProvisionalPageProxy : public IPC::MessageReceiver, public IPC::MessageSender, public CanMakeWeakPtr<ProvisionalPageProxy> { |
| WTF_MAKE_FAST_ALLOCATED; |
| public: |
| ProvisionalPageProxy(WebPageProxy&, Ref<WebProcessProxy>&&, std::unique_ptr<SuspendedPageProxy>, uint64_t navigationID, bool isServerRedirect, const WebCore::ResourceRequest&, ProcessSwapRequestedByClient, API::WebsitePolicies*); |
| ~ProvisionalPageProxy(); |
| |
| WebPageProxy& page() const { return m_page; } |
| WebCore::PageIdentifier webPageID() const { return m_webPageID; } |
| WebFrameProxy* mainFrame() const { return m_mainFrame.get(); } |
| WebProcessProxy& process() { return m_process.get(); } |
| ProcessSwapRequestedByClient processSwapRequestedByClient() const { return m_processSwapRequestedByClient; } |
| uint64_t navigationID() const { return m_navigationID; } |
| const URL& provisionalURL() const { return m_provisionalLoadURL; } |
| |
| DrawingAreaProxy* drawingArea() const { return m_drawingArea.get(); } |
| std::unique_ptr<DrawingAreaProxy> takeDrawingArea(); |
| |
| void setNavigationID(uint64_t navigationID) { m_navigationID = navigationID; } |
| |
| #if PLATFORM(COCOA) |
| Vector<uint8_t> takeAccessibilityToken() { return WTFMove(m_accessibilityToken); } |
| #endif |
| #if HAVE(VISIBILITY_PROPAGATION_VIEW) |
| LayerHostingContextID contextIDForVisibilityPropagation() const { return m_contextIDForVisibilityPropagation; } |
| #endif |
| |
| void loadData(API::Navigation&, const IPC::DataReference&, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData, Optional<NavigatingToAppBoundDomain>, Optional<WebsitePoliciesData>&& = WTF::nullopt); |
| void loadRequest(API::Navigation&, WebCore::ResourceRequest&&, API::Object* userData, Optional<NavigatingToAppBoundDomain>, Optional<WebsitePoliciesData>&& = WTF::nullopt); |
| void goToBackForwardItem(API::Navigation&, WebBackForwardListItem&, RefPtr<API::WebsitePolicies>&&); |
| void cancel(); |
| |
| void unfreezeLayerTreeDueToSwipeAnimation(); |
| |
| void processDidTerminate(); |
| |
| private: |
| // IPC::MessageReceiver |
| void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final; |
| void didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&) final; |
| |
| // IPC::MessageSender |
| IPC::Connection* messageSenderConnection() const final; |
| uint64_t messageSenderDestinationID() const final; |
| bool sendMessage(std::unique_ptr<IPC::Encoder>, OptionSet<IPC::SendOption>, Optional<std::pair<CompletionHandler<void(IPC::Decoder*)>, uint64_t>>&&) final; |
| |
| void decidePolicyForNavigationActionAsync(WebCore::FrameIdentifier, FrameInfoData&&, WebCore::PolicyCheckIdentifier, uint64_t navigationID, NavigationActionData&&, FrameInfoData&& originatingFrameInfo, |
| Optional<WebPageProxyIdentifier> originatingPageID, const WebCore::ResourceRequest& originalRequest, WebCore::ResourceRequest&&, IPC::FormDataReference&& requestBody, |
| WebCore::ResourceResponse&& redirectResponse, const UserData&, uint64_t listenerID); |
| void decidePolicyForResponse(WebCore::FrameIdentifier, FrameInfoData&&, WebCore::PolicyCheckIdentifier, uint64_t navigationID, const WebCore::ResourceResponse&, |
| const WebCore::ResourceRequest&, bool canShowMIMEType, const String& downloadAttribute, uint64_t listenerID, const UserData&); |
| void didChangeProvisionalURLForFrame(WebCore::FrameIdentifier, uint64_t navigationID, URL&&); |
| void didPerformServerRedirect(const String& sourceURLString, const String& destinationURLString, WebCore::FrameIdentifier); |
| void didReceiveServerRedirectForProvisionalLoadForFrame(WebCore::FrameIdentifier, uint64_t navigationID, WebCore::ResourceRequest&&, const UserData&); |
| void didNavigateWithNavigationData(const WebNavigationDataStore&, WebCore::FrameIdentifier); |
| void didPerformClientRedirect(const String& sourceURLString, const String& destinationURLString, WebCore::FrameIdentifier); |
| void didCreateMainFrame(WebCore::FrameIdentifier); |
| void didStartProvisionalLoadForFrame(WebCore::FrameIdentifier, FrameInfoData&&, WebCore::ResourceRequest&&, uint64_t navigationID, URL&&, URL&& unreachableURL, const UserData&); |
| void didCommitLoadForFrame(WebCore::FrameIdentifier, FrameInfoData&&, WebCore::ResourceRequest&&, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, WebCore::FrameLoadType, const WebCore::CertificateInfo&, bool usedLegacyTLS, bool containsPluginDocument, Optional<WebCore::HasInsecureContent> forcedHasInsecureContent, WebCore::MouseEventPolicy, const UserData&); |
| void didFailProvisionalLoadForFrame(WebCore::FrameIdentifier, FrameInfoData&&, WebCore::ResourceRequest&&, uint64_t navigationID, const String& provisionalURL, const WebCore::ResourceError&, WebCore::WillContinueLoading, const UserData&); |
| void startURLSchemeTask(URLSchemeTaskParameters&&); |
| void backForwardGoToItem(const WebCore::BackForwardItemIdentifier&, CompletionHandler<void(const WebBackForwardListCounts&)>&&); |
| void decidePolicyForNavigationActionSync(WebCore::FrameIdentifier, bool isMainFrame, FrameInfoData&&, WebCore::PolicyCheckIdentifier, uint64_t navigationID, NavigationActionData&&, FrameInfoData&& originatingFrameInfo, |
| Optional<WebPageProxyIdentifier> originatingPageID, const WebCore::ResourceRequest& originalRequest, WebCore::ResourceRequest&&, IPC::FormDataReference&& requestBody, |
| WebCore::ResourceResponse&& redirectResponse, const UserData&, Messages::WebPageProxy::DecidePolicyForNavigationActionSyncDelayedReply&&); |
| #if USE(QUICK_LOOK) |
| void requestPasswordForQuickLookDocumentInMainFrame(const String& fileName, CompletionHandler<void(const String&)>&&); |
| #endif |
| #if PLATFORM(COCOA) |
| void registerWebProcessAccessibilityToken(const IPC::DataReference&); |
| #endif |
| #if ENABLE(CONTENT_FILTERING) |
| void contentFilterDidBlockLoadForFrame(const WebCore::ContentFilterUnblockHandler&, WebCore::FrameIdentifier); |
| #endif |
| #if HAVE(VISIBILITY_PROPAGATION_VIEW) |
| void didCreateContextForVisibilityPropagation(LayerHostingContextID); |
| #endif |
| |
| void initializeWebPage(RefPtr<API::WebsitePolicies>&&); |
| bool validateInput(WebCore::FrameIdentifier, const Optional<uint64_t>& navigationID = WTF::nullopt); |
| |
| WebPageProxy& m_page; |
| WebCore::PageIdentifier m_webPageID; |
| Ref<WebProcessProxy> m_process; |
| std::unique_ptr<DrawingAreaProxy> m_drawingArea; |
| RefPtr<WebFrameProxy> m_mainFrame; |
| uint64_t m_navigationID; |
| bool m_isServerRedirect; |
| WebCore::ResourceRequest m_request; |
| ProcessSwapRequestedByClient m_processSwapRequestedByClient; |
| bool m_wasCommitted { false }; |
| URL m_provisionalLoadURL; |
| |
| #if PLATFORM(COCOA) |
| Vector<uint8_t> m_accessibilityToken; |
| #endif |
| #if PLATFORM(IOS_FAMILY) |
| UniqueRef<ProcessThrottler::ForegroundActivity> m_provisionalLoadActivity; |
| #endif |
| #if HAVE(VISIBILITY_PROPAGATION_VIEW) |
| LayerHostingContextID m_contextIDForVisibilityPropagation { 0 }; |
| #endif |
| }; |
| |
| } // namespace WebKit |