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