Home | History | Annotate | Download | only in loader
      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/html/HTMLFormElement.h"
     32 #include "core/loader/FrameLoaderTypes.h"
     33 #include "core/loader/SubstituteData.h"
     34 #include "platform/network/ResourceRequest.h"
     35 
     36 namespace WebCore {
     37 class LocalFrame;
     38 
     39 struct FrameLoadRequest {
     40     STACK_ALLOCATED();
     41 public:
     42     explicit FrameLoadRequest(Document* originDocument)
     43         : m_originDocument(originDocument)
     44         , m_lockBackForwardList(false)
     45         , m_clientRedirect(NotClientRedirect)
     46         , m_shouldSendReferrer(MaybeSendReferrer)
     47     {
     48     }
     49 
     50     FrameLoadRequest(Document* originDocument, const ResourceRequest& resourceRequest)
     51         : m_originDocument(originDocument)
     52         , m_resourceRequest(resourceRequest)
     53         , m_lockBackForwardList(false)
     54         , m_clientRedirect(NotClientRedirect)
     55         , m_shouldSendReferrer(MaybeSendReferrer)
     56     {
     57     }
     58 
     59     FrameLoadRequest(Document* originDocument, const ResourceRequest& resourceRequest, const AtomicString& frameName)
     60         : m_originDocument(originDocument)
     61         , m_resourceRequest(resourceRequest)
     62         , m_frameName(frameName)
     63         , m_lockBackForwardList(false)
     64         , m_clientRedirect(NotClientRedirect)
     65         , m_shouldSendReferrer(MaybeSendReferrer)
     66     {
     67     }
     68 
     69     FrameLoadRequest(Document* originDocument, const ResourceRequest& resourceRequest, const SubstituteData& substituteData)
     70         : m_originDocument(originDocument)
     71         , m_resourceRequest(resourceRequest)
     72         , m_substituteData(substituteData)
     73         , m_lockBackForwardList(false)
     74         , m_clientRedirect(NotClientRedirect)
     75         , m_shouldSendReferrer(MaybeSendReferrer)
     76     {
     77     }
     78 
     79     Document* originDocument() const { return m_originDocument.get(); }
     80 
     81     ResourceRequest& resourceRequest() { return m_resourceRequest; }
     82     const ResourceRequest& resourceRequest() const { return m_resourceRequest; }
     83 
     84     const AtomicString& frameName() const { return m_frameName; }
     85     void setFrameName(const AtomicString& frameName) { m_frameName = frameName; }
     86 
     87     const SubstituteData& substituteData() const { return m_substituteData; }
     88 
     89     bool lockBackForwardList() const { return m_lockBackForwardList; }
     90     void setLockBackForwardList(bool lockBackForwardList) { m_lockBackForwardList = lockBackForwardList; }
     91 
     92     ClientRedirectPolicy clientRedirect() const { return m_clientRedirect; }
     93     void setClientRedirect(ClientRedirectPolicy clientRedirect) { m_clientRedirect = clientRedirect; }
     94 
     95     Event* triggeringEvent() const { return m_triggeringEvent.get(); }
     96     void setTriggeringEvent(PassRefPtrWillBeRawPtr<Event> triggeringEvent) { m_triggeringEvent = triggeringEvent; }
     97 
     98     FormState* formState() const { return m_formState.get(); }
     99     void setFormState(PassRefPtrWillBeRawPtr<FormState> formState) { m_formState = formState; }
    100 
    101     ShouldSendReferrer shouldSendReferrer() const { return m_shouldSendReferrer; }
    102     void setShouldSendReferrer(ShouldSendReferrer shouldSendReferrer) { m_shouldSendReferrer = shouldSendReferrer; }
    103 
    104 private:
    105     RefPtrWillBeMember<Document> m_originDocument;
    106     ResourceRequest m_resourceRequest;
    107     AtomicString m_frameName;
    108     SubstituteData m_substituteData;
    109     bool m_lockBackForwardList;
    110     ClientRedirectPolicy m_clientRedirect;
    111     RefPtrWillBeMember<Event> m_triggeringEvent;
    112     RefPtrWillBeMember<FormState> m_formState;
    113     ShouldSendReferrer m_shouldSendReferrer;
    114 };
    115 
    116 }
    117 
    118 #endif // FrameLoadRequest_h
    119