|
1 /* |
|
2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. |
|
3 * 2007 Apple Inc. All rights reserved. |
|
4 * |
|
5 * Redistribution and use in source and binary forms, with or without |
|
6 * modification, are permitted provided that the following conditions |
|
7 * are met: |
|
8 * 1. Redistributions of source code must retain the above copyright |
|
9 * notice, this list of conditions and the following disclaimer. |
|
10 * 2. Redistributions in binary form must reproduce the above copyright |
|
11 * notice, this list of conditions and the following disclaimer in the |
|
12 * documentation and/or other materials provided with the distribution. |
|
13 * |
|
14 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
|
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
|
18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
|
19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
|
20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
|
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
|
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
25 */ |
|
26 |
|
27 cpp_quote("/*") |
|
28 cpp_quote(" * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.") |
|
29 cpp_quote(" * 2007 Apple Inc. All rights reserved.") |
|
30 cpp_quote(" *") |
|
31 cpp_quote(" * Redistribution and use in source and binary forms, with or without") |
|
32 cpp_quote(" * modification, are permitted provided that the following conditions") |
|
33 cpp_quote(" * are met:") |
|
34 cpp_quote(" * 1. Redistributions of source code must retain the above copyright") |
|
35 cpp_quote(" * notice, this list of conditions and the following disclaimer.") |
|
36 cpp_quote(" * 2. Redistributions in binary form must reproduce the above copyright") |
|
37 cpp_quote(" * notice, this list of conditions and the following disclaimer in the") |
|
38 cpp_quote(" * documentation and/or other materials provided with the distribution.") |
|
39 cpp_quote(" *") |
|
40 cpp_quote(" * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY") |
|
41 cpp_quote(" * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE") |
|
42 cpp_quote(" * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR") |
|
43 cpp_quote(" * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR") |
|
44 cpp_quote(" * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,") |
|
45 cpp_quote(" * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,") |
|
46 cpp_quote(" * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR") |
|
47 cpp_quote(" * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY") |
|
48 cpp_quote(" * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT") |
|
49 cpp_quote(" * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE") |
|
50 cpp_quote(" * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ") |
|
51 cpp_quote(" */") |
|
52 |
|
53 import "oaidl.idl"; |
|
54 import "ocidl.idl"; |
|
55 import "IWebError.idl"; |
|
56 import "IWebMutableURLRequest.idl"; |
|
57 import "IWebURLAuthenticationChallenge.idl"; |
|
58 import "IWebURLResponse.idl"; |
|
59 import "IWebURLRequest.idl"; |
|
60 |
|
61 interface IWebDownloadDelegate; |
|
62 /*! |
|
63 @class WebDownload |
|
64 @discussion A WebDownload works just like an NSURLDownload, with |
|
65 one extra feature: if you do not implement the |
|
66 authentication-related delegate methods, it will automatically |
|
67 prompt for authentication using the standard WebKit authentication |
|
68 panel, as either a sheet or window. It provides no extra methods, |
|
69 but does have one additional delegate method. |
|
70 */ |
|
71 |
|
72 [ |
|
73 object, |
|
74 oleautomation, |
|
75 hidden, |
|
76 uuid(65EFE83B-A9E4-4516-8F3B-BAA25DA90FFD), |
|
77 pointer_default(unique) |
|
78 ] |
|
79 interface IWebDownload : IUnknown |
|
80 { |
|
81 /* |
|
82 + (BOOL)canResumeDownloadDecodedWithEncodingMIMEType:(NSString *)MIMEType |
|
83 */ |
|
84 HRESULT canResumeDownloadDecodedWithEncodingMIMEType([in] BSTR mimeType, [out, retval] BOOL* result); |
|
85 |
|
86 /* |
|
87 - (void)cancel |
|
88 */ |
|
89 HRESULT cancel(); |
|
90 |
|
91 /* |
|
92 - (void)cancelForResume(); |
|
93 */ |
|
94 HRESULT cancelForResume(); |
|
95 |
|
96 /* |
|
97 - (void)start |
|
98 */ |
|
99 HRESULT start(); |
|
100 |
|
101 /* |
|
102 - (BOOL)deletesFileUponFailure |
|
103 */ |
|
104 HRESULT deletesFileUponFailure([out, retval] BOOL* result); |
|
105 |
|
106 /* |
|
107 - (id)initWithRequest:(NSURLRequest *)request delegate:(id)delegate |
|
108 */ |
|
109 HRESULT initWithRequest([in] IWebURLRequest* request, [in] IWebDownloadDelegate* delegate); |
|
110 |
|
111 /* |
|
112 - (id)initWithResumeData:(NSData *)resumeData delegate:(id)delegate path:(NSString *)path |
|
113 */ |
|
114 HRESULT initToResumeWithBundle([in] BSTR bundlePath, [in] IWebDownloadDelegate* delegate); |
|
115 |
|
116 /* |
|
117 - (String)bundlePathForTargetPath:(String)targetPath |
|
118 */ |
|
119 HRESULT bundlePathForTargetPath([in] BSTR target, [out, retval] BSTR* bundle); |
|
120 |
|
121 /* |
|
122 - (NSURLRequest *)request |
|
123 */ |
|
124 HRESULT request([out, retval] IWebURLRequest** request); |
|
125 |
|
126 /* |
|
127 - (void)setDeletesFileUponFailure:(BOOL)deletesFileUponFailure |
|
128 */ |
|
129 HRESULT setDeletesFileUponFailure([in] BOOL deletesFileUponFailure); |
|
130 |
|
131 /* |
|
132 - (void)setDestination:(NSString *)path allowOverwrite:(BOOL)allowOverwrite |
|
133 */ |
|
134 HRESULT setDestination([in] BSTR path, [in] BOOL allowOverwrite); |
|
135 } |
|
136 |
|
137 |
|
138 /*! |
|
139 @protocol WebDownloadDelegate |
|
140 @discussion The WebDownloadDelegate delegate has one extra method used to choose |
|
141 the right window when automatically prompting with a sheet. |
|
142 @interface NSObject (WebDownloadDelegate) |
|
143 */ |
|
144 |
|
145 [ |
|
146 object, |
|
147 oleautomation, |
|
148 uuid(16A32AE6-C862-40cd-9225-2CAF823F40F9), |
|
149 pointer_default(unique) |
|
150 ] |
|
151 interface IWebDownloadDelegate : IUnknown |
|
152 { |
|
153 HRESULT decideDestinationWithSuggestedFilename([in] IWebDownload* download, [in] BSTR filename); |
|
154 |
|
155 HRESULT didCancelAuthenticationChallenge([in] IWebDownload* download, [in] IWebURLAuthenticationChallenge* challenge); |
|
156 |
|
157 HRESULT didCreateDestination([in] IWebDownload* download, [in] BSTR destination); |
|
158 |
|
159 HRESULT didFailWithError([in] IWebDownload* download, [in] IWebError* error); |
|
160 |
|
161 HRESULT didReceiveAuthenticationChallenge([in] IWebDownload* download, [in] IWebURLAuthenticationChallenge* challenge); |
|
162 |
|
163 HRESULT didReceiveDataOfLength([in] IWebDownload* download, [in] unsigned length); |
|
164 |
|
165 HRESULT didReceiveResponse([in] IWebDownload* download, [in] IWebURLResponse* response); |
|
166 |
|
167 HRESULT shouldDecodeSourceDataOfMIMEType([in] IWebDownload* download, [in] BSTR encodingType, [out, retval] BOOL* shouldDecode); |
|
168 |
|
169 HRESULT willResumeWithResponse([in] IWebDownload* download, [in] IWebURLResponse* response, [in] long long fromByte); |
|
170 |
|
171 HRESULT willSendRequest([in] IWebDownload* download, [in] IWebMutableURLRequest* request, [in] IWebURLResponse* redirectResponse, [out] IWebMutableURLRequest** finalRequest); |
|
172 |
|
173 HRESULT didBegin([in] IWebDownload* download); |
|
174 |
|
175 HRESULT didFinish([in] IWebDownload* download); |
|
176 } |