| 1 | /* |
| 2 | * Copyright (C) 2003-2017 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. ``AS IS'' AND ANY |
| 14 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR |
| 17 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 21 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 | */ |
| 25 | |
| 26 | #pragma once |
| 27 | |
| 28 | #include "FrameLoaderTypes.h" |
| 29 | #include "ResourceRequest.h" |
| 30 | #include "SubstituteData.h" |
| 31 | #include <wtf/Forward.h> |
| 32 | |
| 33 | namespace WebCore { |
| 34 | |
| 35 | class Document; |
| 36 | class Frame; |
| 37 | class SecurityOrigin; |
| 38 | |
| 39 | class FrameLoadRequest { |
| 40 | public: |
| 41 | WEBCORE_EXPORT FrameLoadRequest(Document&, SecurityOrigin&, const ResourceRequest&, const String& frameName, LockHistory, LockBackForwardList, ShouldSendReferrer, AllowNavigationToInvalidURL, NewFrameOpenerPolicy, ShouldOpenExternalURLsPolicy, InitiatedByMainFrame, ShouldReplaceDocumentIfJavaScriptURL = ReplaceDocumentIfJavaScriptURL, const AtomicString& downloadAttribute = { }, const SystemPreviewInfo& = { }); |
| 42 | WEBCORE_EXPORT FrameLoadRequest(Frame&, const ResourceRequest&, ShouldOpenExternalURLsPolicy, const SubstituteData& = SubstituteData()); |
| 43 | |
| 44 | WEBCORE_EXPORT ~FrameLoadRequest(); |
| 45 | |
| 46 | WEBCORE_EXPORT FrameLoadRequest(FrameLoadRequest&&); |
| 47 | WEBCORE_EXPORT FrameLoadRequest& operator=(FrameLoadRequest&&); |
| 48 | |
| 49 | bool isEmpty() const { return m_resourceRequest.isEmpty(); } |
| 50 | |
| 51 | Document& requester(); |
| 52 | const SecurityOrigin& requesterSecurityOrigin() const; |
| 53 | |
| 54 | ResourceRequest& resourceRequest() { return m_resourceRequest; } |
| 55 | const ResourceRequest& resourceRequest() const { return m_resourceRequest; } |
| 56 | |
| 57 | const String& frameName() const { return m_frameName; } |
| 58 | void setFrameName(const String& frameName) { m_frameName = frameName; } |
| 59 | |
| 60 | void setShouldCheckNewWindowPolicy(bool checkPolicy) { m_shouldCheckNewWindowPolicy = checkPolicy; } |
| 61 | bool shouldCheckNewWindowPolicy() const { return m_shouldCheckNewWindowPolicy; } |
| 62 | |
| 63 | void setShouldTreatAsContinuingLoad(bool value) { m_shouldTreatAsContinuingLoad = value; } |
| 64 | bool shouldTreatAsContinuingLoad() const { return m_shouldTreatAsContinuingLoad; } |
| 65 | |
| 66 | const SubstituteData& substituteData() const { return m_substituteData; } |
| 67 | void setSubstituteData(const SubstituteData& data) { m_substituteData = data; } |
| 68 | bool hasSubstituteData() { return m_substituteData.isValid(); } |
| 69 | |
| 70 | LockHistory lockHistory() const { return m_lockHistory; } |
| 71 | void setLockHistory(LockHistory value) { m_lockHistory = value; } |
| 72 | |
| 73 | LockBackForwardList lockBackForwardList() const { return m_lockBackForwardList; } |
| 74 | void setlockBackForwardList(LockBackForwardList value) { m_lockBackForwardList = value; } |
| 75 | |
| 76 | const String& clientRedirectSourceForHistory() const { return m_clientRedirectSourceForHistory; } |
| 77 | void setClientRedirectSourceForHistory(const String& clientRedirectSourceForHistory) { m_clientRedirectSourceForHistory = clientRedirectSourceForHistory; } |
| 78 | |
| 79 | ShouldSendReferrer shouldSendReferrer() const { return m_shouldSendReferrer; } |
| 80 | AllowNavigationToInvalidURL allowNavigationToInvalidURL() const { return m_allowNavigationToInvalidURL; } |
| 81 | NewFrameOpenerPolicy newFrameOpenerPolicy() const { return m_newFrameOpenerPolicy; } |
| 82 | |
| 83 | // The shouldReplaceDocumentIfJavaScriptURL parameter will go away when the FIXME to eliminate the |
| 84 | // corresponding parameter from ScriptController::executeIfJavaScriptURL() is addressed. |
| 85 | ShouldReplaceDocumentIfJavaScriptURL shouldReplaceDocumentIfJavaScriptURL() const { return m_shouldReplaceDocumentIfJavaScriptURL; } |
| 86 | |
| 87 | void setShouldOpenExternalURLsPolicy(ShouldOpenExternalURLsPolicy policy) { m_shouldOpenExternalURLsPolicy = policy; } |
| 88 | ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy() const { return m_shouldOpenExternalURLsPolicy; } |
| 89 | |
| 90 | const AtomicString& downloadAttribute() const { return m_downloadAttribute; } |
| 91 | |
| 92 | InitiatedByMainFrame initiatedByMainFrame() const { return m_initiatedByMainFrame; } |
| 93 | |
| 94 | bool isSystemPreview() const { return m_systemPreviewInfo.isSystemPreview; } |
| 95 | const IntRect& systemPreviewRect() const { return m_systemPreviewInfo.systemPreviewRect; } |
| 96 | |
| 97 | void setIsRequestFromClientOrUserInput() { m_isRequestFromClientOrUserInput = true; } |
| 98 | bool isRequestFromClientOrUserInput() const { return m_isRequestFromClientOrUserInput; } |
| 99 | |
| 100 | private: |
| 101 | Ref<Document> m_requester; |
| 102 | Ref<SecurityOrigin> m_requesterSecurityOrigin; |
| 103 | ResourceRequest m_resourceRequest; |
| 104 | String m_frameName; |
| 105 | SubstituteData m_substituteData; |
| 106 | String m_clientRedirectSourceForHistory; |
| 107 | |
| 108 | bool m_shouldCheckNewWindowPolicy { false }; |
| 109 | bool m_shouldTreatAsContinuingLoad { false }; |
| 110 | LockHistory m_lockHistory; |
| 111 | LockBackForwardList m_lockBackForwardList; |
| 112 | ShouldSendReferrer m_shouldSendReferrer; |
| 113 | AllowNavigationToInvalidURL m_allowNavigationToInvalidURL; |
| 114 | NewFrameOpenerPolicy m_newFrameOpenerPolicy; |
| 115 | ShouldReplaceDocumentIfJavaScriptURL m_shouldReplaceDocumentIfJavaScriptURL; |
| 116 | ShouldOpenExternalURLsPolicy m_shouldOpenExternalURLsPolicy { ShouldOpenExternalURLsPolicy::ShouldNotAllow }; |
| 117 | AtomicString m_downloadAttribute; |
| 118 | InitiatedByMainFrame m_initiatedByMainFrame { InitiatedByMainFrame::Unknown }; |
| 119 | SystemPreviewInfo m_systemPreviewInfo; |
| 120 | bool m_isRequestFromClientOrUserInput { false }; |
| 121 | }; |
| 122 | |
| 123 | } // namespace WebCore |
| 124 | |