1 /* 2 * Copyright (C) 2003, 2006, 2010 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 COMPUTER, 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 COMPUTER, 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 #ifndef FrameLoadRequest_h 27 #define FrameLoadRequest_h 28 29 #include "core/dom/Document.h" 30 #include "core/events/Event.h" 31 #include "core/fetch/ResourceLoaderOptions.h" 32 #include "core/html/HTMLFormElement.h" 33 #include "core/loader/FrameLoaderTypes.h" 34 #include "core/loader/SubstituteData.h" 35 #include "platform/network/ResourceRequest.h" 36 37 namespace blink { 38 39 struct FrameLoadRequest { 40 STACK_ALLOCATED(); 41 public: FrameLoadRequestFrameLoadRequest42 explicit FrameLoadRequest(Document* originDocument) 43 : m_originDocument(originDocument) 44 , m_lockBackForwardList(false) 45 , m_clientRedirect(NotClientRedirect) 46 , m_shouldSendReferrer(MaybeSendReferrer) 47 , m_shouldCheckMainWorldContentSecurityPolicy(CheckContentSecurityPolicy) 48 { 49 } 50 FrameLoadRequestFrameLoadRequest51 FrameLoadRequest(Document* originDocument, const ResourceRequest& resourceRequest) 52 : m_originDocument(originDocument) 53 , m_resourceRequest(resourceRequest) 54 , m_lockBackForwardList(false) 55 , m_clientRedirect(NotClientRedirect) 56 , m_shouldSendReferrer(MaybeSendReferrer) 57 , m_shouldCheckMainWorldContentSecurityPolicy(CheckContentSecurityPolicy) 58 { 59 } 60 FrameLoadRequestFrameLoadRequest61 FrameLoadRequest(Document* originDocument, const ResourceRequest& resourceRequest, const AtomicString& frameName) 62 : m_originDocument(originDocument) 63 , m_resourceRequest(resourceRequest) 64 , m_frameName(frameName) 65 , m_lockBackForwardList(false) 66 , m_clientRedirect(NotClientRedirect) 67 , m_shouldSendReferrer(MaybeSendReferrer) 68 , m_shouldCheckMainWorldContentSecurityPolicy(CheckContentSecurityPolicy) 69 { 70 } 71 FrameLoadRequestFrameLoadRequest72 FrameLoadRequest(Document* originDocument, const ResourceRequest& resourceRequest, const AtomicString& frameName, ContentSecurityPolicyCheck shouldCheckMainWorldContentSecurityPolicy) 73 : m_originDocument(originDocument) 74 , m_resourceRequest(resourceRequest) 75 , m_frameName(frameName) 76 , m_lockBackForwardList(false) 77 , m_clientRedirect(NotClientRedirect) 78 , m_shouldSendReferrer(MaybeSendReferrer) 79 , m_shouldCheckMainWorldContentSecurityPolicy(shouldCheckMainWorldContentSecurityPolicy) 80 { 81 } 82 FrameLoadRequestFrameLoadRequest83 FrameLoadRequest(Document* originDocument, const ResourceRequest& resourceRequest, const SubstituteData& substituteData) 84 : m_originDocument(originDocument) 85 , m_resourceRequest(resourceRequest) 86 , m_substituteData(substituteData) 87 , m_lockBackForwardList(false) 88 , m_clientRedirect(NotClientRedirect) 89 , m_shouldSendReferrer(MaybeSendReferrer) 90 , m_shouldCheckMainWorldContentSecurityPolicy(CheckContentSecurityPolicy) 91 { 92 } 93 originDocumentFrameLoadRequest94 Document* originDocument() const { return m_originDocument.get(); } 95 resourceRequestFrameLoadRequest96 ResourceRequest& resourceRequest() { return m_resourceRequest; } resourceRequestFrameLoadRequest97 const ResourceRequest& resourceRequest() const { return m_resourceRequest; } 98 frameNameFrameLoadRequest99 const AtomicString& frameName() const { return m_frameName; } setFrameNameFrameLoadRequest100 void setFrameName(const AtomicString& frameName) { m_frameName = frameName; } 101 substituteDataFrameLoadRequest102 const SubstituteData& substituteData() const { return m_substituteData; } 103 lockBackForwardListFrameLoadRequest104 bool lockBackForwardList() const { return m_lockBackForwardList; } setLockBackForwardListFrameLoadRequest105 void setLockBackForwardList(bool lockBackForwardList) { m_lockBackForwardList = lockBackForwardList; } 106 clientRedirectFrameLoadRequest107 ClientRedirectPolicy clientRedirect() const { return m_clientRedirect; } setClientRedirectFrameLoadRequest108 void setClientRedirect(ClientRedirectPolicy clientRedirect) { m_clientRedirect = clientRedirect; } 109 triggeringEventFrameLoadRequest110 Event* triggeringEvent() const { return m_triggeringEvent.get(); } setTriggeringEventFrameLoadRequest111 void setTriggeringEvent(PassRefPtrWillBeRawPtr<Event> triggeringEvent) { m_triggeringEvent = triggeringEvent; } 112 formStateFrameLoadRequest113 FormState* formState() const { return m_formState.get(); } setFormStateFrameLoadRequest114 void setFormState(PassRefPtrWillBeRawPtr<FormState> formState) { m_formState = formState; } 115 shouldSendReferrerFrameLoadRequest116 ShouldSendReferrer shouldSendReferrer() const { return m_shouldSendReferrer; } setShouldSendReferrerFrameLoadRequest117 void setShouldSendReferrer(ShouldSendReferrer shouldSendReferrer) { m_shouldSendReferrer = shouldSendReferrer; } 118 shouldCheckMainWorldContentSecurityPolicyFrameLoadRequest119 ContentSecurityPolicyCheck shouldCheckMainWorldContentSecurityPolicy() const { return m_shouldCheckMainWorldContentSecurityPolicy; } 120 121 private: 122 RefPtrWillBeMember<Document> m_originDocument; 123 ResourceRequest m_resourceRequest; 124 AtomicString m_frameName; 125 SubstituteData m_substituteData; 126 bool m_lockBackForwardList; 127 ClientRedirectPolicy m_clientRedirect; 128 RefPtrWillBeMember<Event> m_triggeringEvent; 129 RefPtrWillBeMember<FormState> m_formState; 130 ShouldSendReferrer m_shouldSendReferrer; 131 ContentSecurityPolicyCheck m_shouldCheckMainWorldContentSecurityPolicy; 132 }; 133 134 } 135 136 #endif // FrameLoadRequest_h 137