webengine/osswebengine/WebKit/win/WebMutableURLRequest.h
changeset 0 dd21522fd290
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2  * Copyright (C) 2006, 2007 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 WebMutableURLRequest_H
       
    27 #define WebMutableURLRequest_H
       
    28 
       
    29 #include "IWebMutableURLRequest.h"
       
    30 #pragma warning(push, 0)
       
    31 #include <WebCore/ResourceRequest.h>
       
    32 #pragma warning(pop)
       
    33 
       
    34 namespace WebCore
       
    35 {
       
    36     class FormData;
       
    37 }
       
    38 
       
    39 inline WebCore::ResourceRequestCachePolicy core(WebURLRequestCachePolicy policy)
       
    40 {
       
    41     return static_cast<WebCore::ResourceRequestCachePolicy>(policy);
       
    42 }
       
    43 
       
    44 inline WebURLRequestCachePolicy kit(WebCore::ResourceRequestCachePolicy policy)
       
    45 {
       
    46     return static_cast<WebURLRequestCachePolicy>(policy);
       
    47 }
       
    48 
       
    49 class WebMutableURLRequest : public IWebMutableURLRequest
       
    50 {
       
    51 public:
       
    52     static WebMutableURLRequest* createInstance();
       
    53     static WebMutableURLRequest* createInstance(IWebMutableURLRequest* req);
       
    54     static WebMutableURLRequest* createInstance(const WebCore::ResourceRequest&);
       
    55 
       
    56     static WebMutableURLRequest* createImmutableInstance();
       
    57     static WebMutableURLRequest* createImmutableInstance(const WebCore::ResourceRequest&);
       
    58 protected:
       
    59     WebMutableURLRequest(bool isMutable);
       
    60     ~WebMutableURLRequest();
       
    61 
       
    62 public:
       
    63     // IUnknown
       
    64     virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
       
    65     virtual ULONG STDMETHODCALLTYPE AddRef(void);
       
    66     virtual ULONG STDMETHODCALLTYPE Release(void);
       
    67 
       
    68     // IWebURLRequest
       
    69     virtual HRESULT STDMETHODCALLTYPE requestWithURL( 
       
    70         /* [in] */ BSTR theURL,
       
    71         /* [optional][in] */ WebURLRequestCachePolicy cachePolicy,
       
    72         /* [optional][in] */ double timeoutInterval);
       
    73     
       
    74     virtual HRESULT STDMETHODCALLTYPE allHTTPHeaderFields( 
       
    75         /* [retval][out] */ IPropertyBag **result);
       
    76     
       
    77     virtual HRESULT STDMETHODCALLTYPE cachePolicy( 
       
    78         /* [retval][out] */ WebURLRequestCachePolicy *result);
       
    79     
       
    80     virtual HRESULT STDMETHODCALLTYPE HTTPBody( 
       
    81         /* [retval][out] */ IStream **result);
       
    82     
       
    83     virtual HRESULT STDMETHODCALLTYPE HTTPBodyStream( 
       
    84         /* [retval][out] */ IStream **result);
       
    85     
       
    86     virtual HRESULT STDMETHODCALLTYPE HTTPMethod( 
       
    87         /* [retval][out] */ BSTR *result);
       
    88     
       
    89     virtual HRESULT STDMETHODCALLTYPE HTTPShouldHandleCookies( 
       
    90         /* [retval][out] */ BOOL *result);
       
    91     
       
    92     virtual HRESULT STDMETHODCALLTYPE initWithURL( 
       
    93         /* [in] */ BSTR url,
       
    94         /* [optional][in] */ WebURLRequestCachePolicy cachePolicy,
       
    95         /* [optional][in] */ double timeoutInterval);
       
    96     
       
    97     virtual HRESULT STDMETHODCALLTYPE mainDocumentURL( 
       
    98         /* [retval][out] */ BSTR *result);
       
    99     
       
   100     virtual HRESULT STDMETHODCALLTYPE timeoutInterval( 
       
   101         /* [retval][out] */ double *result);
       
   102     
       
   103     virtual HRESULT STDMETHODCALLTYPE URL( 
       
   104         /* [retval][out] */ BSTR *result);
       
   105     
       
   106     virtual HRESULT STDMETHODCALLTYPE valueForHTTPHeaderField( 
       
   107         /* [in] */ BSTR field,
       
   108         /* [retval][out] */ BSTR *result);
       
   109 
       
   110     virtual HRESULT STDMETHODCALLTYPE isEmpty(
       
   111     /* [retval][out] */ BOOL* result);
       
   112 
       
   113     // WebMutableURLRequest
       
   114     virtual HRESULT STDMETHODCALLTYPE addValue( 
       
   115         /* [in] */ BSTR value,
       
   116         /* [in] */ BSTR field);
       
   117     
       
   118     virtual HRESULT STDMETHODCALLTYPE setAllHTTPHeaderFields( 
       
   119         /* [in] */ IPropertyBag *headerFields);
       
   120     
       
   121     virtual HRESULT STDMETHODCALLTYPE setCachePolicy( 
       
   122         /* [in] */ WebURLRequestCachePolicy policy);
       
   123     
       
   124     virtual HRESULT STDMETHODCALLTYPE setHTTPBody( 
       
   125         /* [in] */ IStream *data);
       
   126     
       
   127     virtual HRESULT STDMETHODCALLTYPE setHTTPBodyStream( 
       
   128         /* [in] */ IStream *data);
       
   129     
       
   130     virtual HRESULT STDMETHODCALLTYPE setHTTPMethod( 
       
   131         /* [in] */ BSTR method);
       
   132     
       
   133     virtual HRESULT STDMETHODCALLTYPE setHTTPShouldHandleCookies( 
       
   134         /* [in] */ BOOL handleCookies);
       
   135     
       
   136     virtual HRESULT STDMETHODCALLTYPE setMainDocumentURL( 
       
   137         /* [in] */ BSTR theURL);
       
   138     
       
   139     virtual HRESULT STDMETHODCALLTYPE setTimeoutInterval( 
       
   140         /* [in] */ double timeoutInterval);
       
   141     
       
   142     virtual HRESULT STDMETHODCALLTYPE setURL( 
       
   143         /* [in] */ BSTR theURL);
       
   144     
       
   145     virtual HRESULT STDMETHODCALLTYPE setValue( 
       
   146         /* [in] */ BSTR value,
       
   147         /* [in] */ BSTR field);
       
   148 
       
   149     virtual HRESULT STDMETHODCALLTYPE setAllowsAnyHTTPSCertificate(void);
       
   150 
       
   151     // WebMutableURLRequest
       
   152     void setFormData(const PassRefPtr<WebCore::FormData> data);
       
   153     const PassRefPtr<WebCore::FormData> formData() const;
       
   154     
       
   155     void addHTTPHeaderFields(const WebCore::HTTPHeaderMap& headerFields);
       
   156     const WebCore::HTTPHeaderMap& httpHeaderFields() const;
       
   157 
       
   158     const WebCore::ResourceRequest& resourceRequest() const;
       
   159 protected:
       
   160     ULONG m_refCount;
       
   161     bool m_isMutable;
       
   162     WebCore::ResourceRequest m_request;
       
   163 };
       
   164 
       
   165 #endif