1/*
2 * Copyright (C) 2006, 2007, 2008 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#ifndef DO_NO_IMPORTS
27import "oaidl.idl";
28import "ocidl.idl";
29#endif
30
31typedef enum _WebURLRequestCachePolicy
32{
33    WebURLRequestUseProtocolCachePolicy,
34    WebURLRequestReloadIgnoringCacheData,
35    WebURLRequestReturnCacheDataElseLoad,
36    WebURLRequestReturnCacheDataDontLoad
37} WebURLRequestCachePolicy;
38
39[
40    object,
41    oleautomation,
42    hidden,
43    uuid(F4B85F1D-F3B2-493d-B786-0930E804A3BA),
44    pointer_default(unique)
45]
46interface IWebURLRequest : IUnknown
47{
48    /*
49        + (id)requestWithURL:(NSURL *)theURL
50        + (id)requestWithURL:(NSURL *)theURL cachePolicy:(NSURLRequestCachePolicy)cachePolicy timeoutInterval:(NSTimeInterval)timeoutInterval
51    */
52    HRESULT requestWithURL([in] BSTR theURL, [in] WebURLRequestCachePolicy cachePolicy, [in] double timeoutInterval);
53
54    /*
55        - (NSDictionary *)allHTTPHeaderFields
56    */
57    HRESULT allHTTPHeaderFields([out, retval] IPropertyBag** result);
58
59    /*
60        - (NSURLRequestCachePolicy)cachePolicy
61    */
62    HRESULT cachePolicy([out, retval] WebURLRequestCachePolicy* result);
63
64    /*
65        - (NSData *)HTTPBody
66    */
67    HRESULT HTTPBody([out, retval] IStream** result);
68
69    /*
70        - (NSInputStream *)HTTPBodyStream
71    */
72    HRESULT HTTPBodyStream([out, retval] IStream** result);
73
74    /*
75        - (NSString *)HTTPMethod
76    */
77    HRESULT HTTPMethod([out, retval] BSTR *result);
78
79    /*
80        - (BOOL)HTTPShouldHandleCookies
81    */
82    HRESULT HTTPShouldHandleCookies([out, retval] BOOL *result);
83
84    /*
85        - (id)initWithURL:(NSURL *)theURL
86        - (id)initWithURL:(NSURL *)theURL cachePolicy:(NSURLRequestCachePolicy)cachePolicy timeoutInterval:(NSTimeInterval)timeoutInterval
87    */
88    HRESULT initWithURL([in] BSTR url, [in] WebURLRequestCachePolicy cachePolicy, [in] double timeoutInterval);
89
90    /*
91        - (NSURL *)mainDocumentURL
92    */
93    HRESULT mainDocumentURL([out, retval] BSTR* result);
94
95    /*
96        -(NSTimeInterval)timeoutInterval
97    */
98    HRESULT timeoutInterval([out, retval] double* result);
99
100    /*
101        -(NSURL *)URL
102    */
103    HRESULT URL([out, retval] BSTR* result);
104
105    /*
106        -(NSString *)valueForHTTPHeaderField:(NSString *)field
107    */
108    HRESULT valueForHTTPHeaderField([in] BSTR field, [out, retval] BSTR* result);
109
110    HRESULT isEmpty([out, retval] BOOL* result);
111
112    HRESULT mutableCopy([out, retval] IWebMutableURLRequest** result);
113
114    HRESULT isEqual([in] IWebURLRequest* other, [out, retval] BOOL* result);
115}
116