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 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
26cpp_quote("#define WebURLErrorDomain TEXT(\"CFURLErrorDomain\")")
27/*!
28    @enum NSURL-related Error Codes
29    @abstract Constants used by NSError to indicate errors in the WebFoundation domain
30    @discussion Documentation on each constant forthcoming.
31*/
32enum
33{
34    WebURLErrorUnknown =                         -1,
35    WebURLErrorCancelled =                       -999,
36    WebURLErrorBadURL =                          -1000,
37    WebURLErrorTimedOut =                        -1001,
38    WebURLErrorUnsupportedURL =                  -1002,
39    WebURLErrorCannotFindHost =                  -1003,
40    WebURLErrorCannotConnectToHost =             -1004,
41    WebURLErrorNetworkConnectionLost =           -1005,
42    WebURLErrorDNSLookupFailed =                 -1006,
43    WebURLErrorHTTPTooManyRedirects =            -1007,
44    WebURLErrorResourceUnavailable =             -1008,
45    WebURLErrorNotConnectedToInternet =          -1009,
46    WebURLErrorRedirectToNonExistentLocation =   -1010,
47    WebURLErrorBadServerResponse =               -1011,
48    WebURLErrorUserCancelledAuthentication =     -1012,
49    WebURLErrorUserAuthenticationRequired =      -1013,
50    WebURLErrorZeroByteResource =                -1014,
51    WebURLErrorFileDoesNotExist =                -1100,
52    WebURLErrorFileIsDirectory =                 -1101,
53    WebURLErrorNoPermissionsToReadFile =         -1102,
54    WebURLErrorSecureConnectionFailed =          -1200,
55    WebURLErrorServerCertificateHasBadDate =     -1201,
56    WebURLErrorServerCertificateUntrusted =      -1202,
57    WebURLErrorServerCertificateHasUnknownRoot = -1203,
58    WebURLErrorServerCertificateNotYetValid =    -1204,
59    WebURLErrorClientCertificateRejected =       -1205,
60    WebURLErrorClientCertificateRequired =       -1206,
61    WebURLErrorCannotLoadFromNetwork =           -2000,
62
63    // Download and file I/O errors
64    WebURLErrorCannotCreateFile =                -3000,
65    WebURLErrorCannotOpenFile =                  -3001,
66    WebURLErrorCannotCloseFile =                 -3002,
67    WebURLErrorCannotWriteToFile =               -3003,
68    WebURLErrorCannotRemoveFile =                -3004,
69    WebURLErrorCannotMoveFile =                  -3005,
70    WebURLErrorDownloadDecodingFailedMidStream = -3006,
71    WebURLErrorDownloadDecodingFailedToComplete =-3007,
72};
73
74cpp_quote("#define WebKitErrorDomain TEXT(\"WebKitErrorDomain\")")
75/*!
76    @enum
77    @abstract Policy errors
78    @constant WebKitErrorCannotShowMIMEType
79    @constant WebKitErrorCannotShowURL
80    @constant WebKitErrorFrameLoadInterruptedByPolicyChange
81*/
82enum {
83    WebKitErrorCannotShowMIMEType =                             100,
84    WebKitErrorCannotShowURL =                                  101,
85    WebKitErrorFrameLoadInterruptedByPolicyChange =             102,
86    WebKitErrorCannotUseRestrictedPort =                        103,
87};
88
89/*!
90    @enum
91    @abstract Plug-in and java errors
92    @constant WebKitErrorCannotFindPlugIn
93    @constant WebKitErrorCannotLoadPlugIn
94    @constant WebKitErrorJavaUnavailable
95*/
96enum {
97    WebKitErrorCannotFindPlugIn =                               200,
98    WebKitErrorCannotLoadPlugIn =                               201,
99    WebKitErrorJavaUnavailable =                                202,
100};
101
102/*!
103    @enum
104    @abstract Geolocation errors
105    @constant WebKitErrorGeolocationLocationUnknown
106*/
107enum {
108    WebKitErrorGeolocationLocationUnknown  =                    300,
109};
110
111cpp_quote("#define WebKitErrorMIMETypeKey TEXT(\"WebKitErrorMIMETypeKey\")")
112cpp_quote("#define WebKitErrorPlugInNameKey TEXT(\"WebKitErrorPlugInNameKey\")")
113cpp_quote("#define WebKitErrorPlugInPageURLStringKey TEXT(\"WebKitErrorPlugInPageURLStringKey\")")
114
115cpp_quote("#define WebPOSIXErrorDomain TEXT(\"NSPOSIXErrorDomain\")")
116cpp_quote("#define WebPOSIXErrorECONNRESET 54")
117
118#ifndef DO_NO_IMPORTS
119import "oaidl.idl";
120import "ocidl.idl";
121#endif
122
123[
124    object,
125    oleautomation,
126    hidden,
127    uuid(89E3B189-0B60-4d6b-A87A-3F1172CB5538),
128    pointer_default(unique)
129]
130interface IWebError : IUnknown
131{
132    HRESULT init([in] BSTR domain, [in] int code, [in] BSTR url);
133
134    /*
135        - (int)code
136    */
137    HRESULT code([out, retval] int* result);
138
139    /*
140        - (NSString *)domain
141    */
142    HRESULT domain([out, retval] BSTR* result);
143
144    /*
145        - (NSString *)localizedDescription
146    */
147    HRESULT localizedDescription([out, retval] BSTR* result);
148
149    /*
150        - (NSString *)localizedFailureReason
151    */
152    HRESULT localizedFailureReason([out, retval] BSTR* result);
153
154    /*
155        - (NSArray *)localizedRecoveryOptions
156    */
157    HRESULT localizedRecoveryOptions([out, retval] IEnumVARIANT** enumOptions);
158
159    /*
160        - (NSString *)localizedRecoverySuggestion
161    */
162    HRESULT localizedRecoverySuggestion([out, retval] BSTR* result);
163
164    /*
165        - (id)recoverAttempter
166    */
167    HRESULT recoverAttempter([out, retval] IUnknown** result);
168
169    /*
170        - (NSDictionary *)userInfo
171    */
172    HRESULT userInfo([out, retval] IPropertyBag** result);
173
174    HRESULT failingURL([out, retval] BSTR* result);
175
176    HRESULT isPolicyChangeError([out, retval] BOOL* result);
177}
178