objc2_web_kit/generated/WebResourceLoadDelegate.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9extern_protocol!(
10 /// Implementors of this protocol will receive messages indicating
11 /// that a resource is about to be loaded, data has been received for a resource,
12 /// an error has been received for a resource, and completion of a resource load.
13 /// Implementors are also given the opportunity to mutate requests before they are sent.
14 /// The various progress methods of this protocol all receive an identifier as the
15 /// parameter. This identifier can be used to track messages associated with a single
16 /// resource. For example, a single resource may generate multiple
17 /// resource:willSendRequest:redirectResponse:fromDataSource: messages as it's URL is redirected.
18 ///
19 /// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/webresourceloaddelegate?language=objc)
20 #[deprecated]
21 pub unsafe trait WebResourceLoadDelegate: NSObjectProtocol {
22 #[cfg(all(
23 feature = "WebDataSource",
24 feature = "WebView",
25 feature = "objc2-app-kit"
26 ))]
27 #[cfg(target_os = "macos")]
28 /// Parameter `sender`: The WebView sending the message.
29 ///
30 /// Parameter `request`: The request about to be sent.
31 ///
32 /// Parameter `dataSource`: The datasource that initiated the load.
33 ///
34 /// An implementor of WebResourceLoadDelegate should provide an identifier
35 /// that can be used to track the load of a single resource. This identifier will be
36 /// passed as the first argument for all of the other WebResourceLoadDelegate methods. The
37 /// identifier is useful to track changes to a resources request, which will be
38 /// provided by one or more calls to resource:willSendRequest:redirectResponse:fromDataSource:.
39 ///
40 /// Returns: An identifier that will be passed back to the implementor for each callback.
41 /// The identifier will be retained.
42 #[deprecated]
43 #[optional]
44 #[unsafe(method(webView:identifierForInitialRequest:fromDataSource:))]
45 #[unsafe(method_family = none)]
46 unsafe fn webView_identifierForInitialRequest_fromDataSource(
47 &self,
48 sender: Option<&WebView>,
49 request: Option<&NSURLRequest>,
50 data_source: Option<&WebDataSource>,
51 ) -> Option<Retained<AnyObject>>;
52
53 #[cfg(all(
54 feature = "WebDataSource",
55 feature = "WebView",
56 feature = "objc2-app-kit"
57 ))]
58 #[cfg(target_os = "macos")]
59 /// This message is sent before a load is initiated. The request may be modified
60 /// as necessary by the receiver.
61 ///
62 /// Parameter `sender`: The WebView sending the message.
63 ///
64 /// Parameter `identifier`: An identifier that can be used to track the progress of a resource load across
65 /// multiple call backs.
66 ///
67 /// Parameter `request`: The request about to be sent.
68 ///
69 /// Parameter `redirectResponse`: If the request is being made in response to a redirect we received,
70 /// the response that conveyed that redirect.
71 ///
72 /// Parameter `dataSource`: The dataSource that initiated the load.
73 ///
74 /// Returns: Returns the request, which may be mutated by the implementor, although typically
75 /// will be request.
76 #[deprecated]
77 #[optional]
78 #[unsafe(method(webView:resource:willSendRequest:redirectResponse:fromDataSource:))]
79 #[unsafe(method_family = none)]
80 unsafe fn webView_resource_willSendRequest_redirectResponse_fromDataSource(
81 &self,
82 sender: Option<&WebView>,
83 identifier: Option<&AnyObject>,
84 request: Option<&NSURLRequest>,
85 redirect_response: Option<&NSURLResponse>,
86 data_source: Option<&WebDataSource>,
87 ) -> Option<Retained<NSURLRequest>>;
88
89 #[cfg(all(
90 feature = "WebDataSource",
91 feature = "WebView",
92 feature = "objc2-app-kit"
93 ))]
94 #[cfg(target_os = "macos")]
95 /// Start authentication for the resource, providing a challenge
96 ///
97 /// Call useCredential::, continueWithoutCredential or
98 /// cancel on the challenge when done.
99 ///
100 /// Parameter `challenge`: The NSURLAuthenticationChallenge to start authentication for
101 ///
102 /// If you do not implement this delegate method, WebKit will handle authentication
103 /// automatically by prompting with a sheet on the window that the WebView is associated with.
104 #[deprecated]
105 #[optional]
106 #[unsafe(method(webView:resource:didReceiveAuthenticationChallenge:fromDataSource:))]
107 #[unsafe(method_family = none)]
108 unsafe fn webView_resource_didReceiveAuthenticationChallenge_fromDataSource(
109 &self,
110 sender: Option<&WebView>,
111 identifier: Option<&AnyObject>,
112 challenge: Option<&NSURLAuthenticationChallenge>,
113 data_source: Option<&WebDataSource>,
114 );
115
116 #[cfg(all(
117 feature = "WebDataSource",
118 feature = "WebView",
119 feature = "objc2-app-kit"
120 ))]
121 #[cfg(target_os = "macos")]
122 /// Cancel authentication for a given request
123 ///
124 /// Parameter `challenge`: The NSURLAuthenticationChallenge for which to cancel authentication
125 #[deprecated]
126 #[optional]
127 #[unsafe(method(webView:resource:didCancelAuthenticationChallenge:fromDataSource:))]
128 #[unsafe(method_family = none)]
129 unsafe fn webView_resource_didCancelAuthenticationChallenge_fromDataSource(
130 &self,
131 sender: Option<&WebView>,
132 identifier: Option<&AnyObject>,
133 challenge: Option<&NSURLAuthenticationChallenge>,
134 data_source: Option<&WebDataSource>,
135 );
136
137 #[cfg(all(
138 feature = "WebDataSource",
139 feature = "WebView",
140 feature = "objc2-app-kit"
141 ))]
142 #[cfg(target_os = "macos")]
143 /// This message is sent after a response has been received for this load.
144 ///
145 /// Parameter `sender`: The WebView sending the message.
146 ///
147 /// Parameter `identifier`: An identifier that can be used to track the progress of a resource load across
148 /// multiple call backs.
149 ///
150 /// Parameter `response`: The response for the request.
151 ///
152 /// Parameter `dataSource`: The dataSource that initiated the load.
153 ///
154 /// In some rare cases, multiple responses may be received for a single load.
155 /// This occurs with multipart/x-mixed-replace, or "server push". In this case, the client
156 /// should assume that each new response resets progress so far for the resource back to 0,
157 /// and should check the new response for the expected content length.
158 #[deprecated]
159 #[optional]
160 #[unsafe(method(webView:resource:didReceiveResponse:fromDataSource:))]
161 #[unsafe(method_family = none)]
162 unsafe fn webView_resource_didReceiveResponse_fromDataSource(
163 &self,
164 sender: Option<&WebView>,
165 identifier: Option<&AnyObject>,
166 response: Option<&NSURLResponse>,
167 data_source: Option<&WebDataSource>,
168 );
169
170 #[cfg(all(
171 feature = "WebDataSource",
172 feature = "WebView",
173 feature = "objc2-app-kit"
174 ))]
175 #[cfg(target_os = "macos")]
176 /// Multiple of these messages may be sent as data arrives.
177 ///
178 /// Parameter `sender`: The WebView sending the message.
179 ///
180 /// Parameter `identifier`: An identifier that can be used to track the progress of a resource load across
181 /// multiple call backs.
182 ///
183 /// Parameter `length`: The amount of new data received. This is not the total amount, just the new amount received.
184 ///
185 /// Parameter `dataSource`: The dataSource that initiated the load.
186 #[deprecated]
187 #[optional]
188 #[unsafe(method(webView:resource:didReceiveContentLength:fromDataSource:))]
189 #[unsafe(method_family = none)]
190 unsafe fn webView_resource_didReceiveContentLength_fromDataSource(
191 &self,
192 sender: Option<&WebView>,
193 identifier: Option<&AnyObject>,
194 length: NSInteger,
195 data_source: Option<&WebDataSource>,
196 );
197
198 #[cfg(all(
199 feature = "WebDataSource",
200 feature = "WebView",
201 feature = "objc2-app-kit"
202 ))]
203 #[cfg(target_os = "macos")]
204 /// This message is sent after a load has successfully completed.
205 ///
206 /// Parameter `sender`: The WebView sending the message.
207 ///
208 /// Parameter `identifier`: An identifier that can be used to track the progress of a resource load across
209 /// multiple call backs.
210 ///
211 /// Parameter `dataSource`: The dataSource that initiated the load.
212 #[deprecated]
213 #[optional]
214 #[unsafe(method(webView:resource:didFinishLoadingFromDataSource:))]
215 #[unsafe(method_family = none)]
216 unsafe fn webView_resource_didFinishLoadingFromDataSource(
217 &self,
218 sender: Option<&WebView>,
219 identifier: Option<&AnyObject>,
220 data_source: Option<&WebDataSource>,
221 );
222
223 #[cfg(all(
224 feature = "WebDataSource",
225 feature = "WebView",
226 feature = "objc2-app-kit"
227 ))]
228 #[cfg(target_os = "macos")]
229 /// This message is sent after a load has failed to load due to an error.
230 ///
231 /// Parameter `sender`: The WebView sending the message.
232 ///
233 /// Parameter `identifier`: An identifier that can be used to track the progress of a resource load across
234 /// multiple call backs.
235 ///
236 /// Parameter `error`: The error associated with this load.
237 ///
238 /// Parameter `dataSource`: The dataSource that initiated the load.
239 #[deprecated]
240 #[optional]
241 #[unsafe(method(webView:resource:didFailLoadingWithError:fromDataSource:))]
242 #[unsafe(method_family = none)]
243 unsafe fn webView_resource_didFailLoadingWithError_fromDataSource(
244 &self,
245 sender: Option<&WebView>,
246 identifier: Option<&AnyObject>,
247 error: Option<&NSError>,
248 data_source: Option<&WebDataSource>,
249 );
250
251 #[cfg(all(
252 feature = "WebDataSource",
253 feature = "WebView",
254 feature = "objc2-app-kit"
255 ))]
256 #[cfg(target_os = "macos")]
257 /// Called when a plug-in is not found, fails to load or is not available for some reason.
258 ///
259 /// Parameter `sender`: The WebView sending the message.
260 ///
261 /// Parameter `error`: The plug-in error. In the userInfo dictionary of the error, the object for the
262 /// NSErrorFailingURLKey key is a URL string of the SRC attribute, the object for the WebKitErrorPlugInNameKey
263 /// key is a string of the plug-in's name, the object for the WebKitErrorPlugInPageURLStringKey key is a URL string
264 /// of the PLUGINSPAGE attribute and the object for the WebKitErrorMIMETypeKey key is a string of the TYPE attribute.
265 /// Some, none or all of the mentioned attributes can be present in the userInfo. The error returns nil for userInfo
266 /// when none are present.
267 ///
268 /// Parameter `dataSource`: The dataSource that contains the plug-in.
269 #[deprecated]
270 #[optional]
271 #[unsafe(method(webView:plugInFailedWithError:dataSource:))]
272 #[unsafe(method_family = none)]
273 unsafe fn webView_plugInFailedWithError_dataSource(
274 &self,
275 sender: Option<&WebView>,
276 error: Option<&NSError>,
277 data_source: Option<&WebDataSource>,
278 );
279 }
280);