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 ///
43 /// # Safety
44 ///
45 /// - `sender` might not allow `None`.
46 /// - `request` might not allow `None`.
47 /// - `data_source` might not allow `None`.
48 #[deprecated]
49 #[optional]
50 #[unsafe(method(webView:identifierForInitialRequest:fromDataSource:))]
51 #[unsafe(method_family = none)]
52 unsafe fn webView_identifierForInitialRequest_fromDataSource(
53 &self,
54 sender: Option<&WebView>,
55 request: Option<&NSURLRequest>,
56 data_source: Option<&WebDataSource>,
57 ) -> Option<Retained<AnyObject>>;
58
59 #[cfg(all(
60 feature = "WebDataSource",
61 feature = "WebView",
62 feature = "objc2-app-kit"
63 ))]
64 #[cfg(target_os = "macos")]
65 /// This message is sent before a load is initiated. The request may be modified
66 /// as necessary by the receiver.
67 ///
68 /// Parameter `sender`: The WebView sending the message.
69 ///
70 /// Parameter `identifier`: An identifier that can be used to track the progress of a resource load across
71 /// multiple call backs.
72 ///
73 /// Parameter `request`: The request about to be sent.
74 ///
75 /// Parameter `redirectResponse`: If the request is being made in response to a redirect we received,
76 /// the response that conveyed that redirect.
77 ///
78 /// Parameter `dataSource`: The dataSource that initiated the load.
79 ///
80 /// Returns: Returns the request, which may be mutated by the implementor, although typically
81 /// will be request.
82 ///
83 /// # Safety
84 ///
85 /// - `sender` might not allow `None`.
86 /// - `identifier` should be of the correct type.
87 /// - `identifier` might not allow `None`.
88 /// - `request` might not allow `None`.
89 /// - `redirect_response` might not allow `None`.
90 /// - `data_source` might not allow `None`.
91 #[deprecated]
92 #[optional]
93 #[unsafe(method(webView:resource:willSendRequest:redirectResponse:fromDataSource:))]
94 #[unsafe(method_family = none)]
95 unsafe fn webView_resource_willSendRequest_redirectResponse_fromDataSource(
96 &self,
97 sender: Option<&WebView>,
98 identifier: Option<&AnyObject>,
99 request: Option<&NSURLRequest>,
100 redirect_response: Option<&NSURLResponse>,
101 data_source: Option<&WebDataSource>,
102 ) -> Option<Retained<NSURLRequest>>;
103
104 #[cfg(all(
105 feature = "WebDataSource",
106 feature = "WebView",
107 feature = "objc2-app-kit"
108 ))]
109 #[cfg(target_os = "macos")]
110 /// Start authentication for the resource, providing a challenge
111 ///
112 /// Call useCredential::, continueWithoutCredential or
113 /// cancel on the challenge when done.
114 ///
115 /// Parameter `challenge`: The NSURLAuthenticationChallenge to start authentication for
116 ///
117 /// If you do not implement this delegate method, WebKit will handle authentication
118 /// automatically by prompting with a sheet on the window that the WebView is associated with.
119 ///
120 /// # Safety
121 ///
122 /// - `sender` might not allow `None`.
123 /// - `identifier` should be of the correct type.
124 /// - `identifier` might not allow `None`.
125 /// - `challenge` might not allow `None`.
126 /// - `data_source` might not allow `None`.
127 #[deprecated]
128 #[optional]
129 #[unsafe(method(webView:resource:didReceiveAuthenticationChallenge:fromDataSource:))]
130 #[unsafe(method_family = none)]
131 unsafe fn webView_resource_didReceiveAuthenticationChallenge_fromDataSource(
132 &self,
133 sender: Option<&WebView>,
134 identifier: Option<&AnyObject>,
135 challenge: Option<&NSURLAuthenticationChallenge>,
136 data_source: Option<&WebDataSource>,
137 );
138
139 #[cfg(all(
140 feature = "WebDataSource",
141 feature = "WebView",
142 feature = "objc2-app-kit"
143 ))]
144 #[cfg(target_os = "macos")]
145 /// Cancel authentication for a given request
146 ///
147 /// Parameter `challenge`: The NSURLAuthenticationChallenge for which to cancel authentication
148 ///
149 /// # Safety
150 ///
151 /// - `sender` might not allow `None`.
152 /// - `identifier` should be of the correct type.
153 /// - `identifier` might not allow `None`.
154 /// - `challenge` might not allow `None`.
155 /// - `data_source` might not allow `None`.
156 #[deprecated]
157 #[optional]
158 #[unsafe(method(webView:resource:didCancelAuthenticationChallenge:fromDataSource:))]
159 #[unsafe(method_family = none)]
160 unsafe fn webView_resource_didCancelAuthenticationChallenge_fromDataSource(
161 &self,
162 sender: Option<&WebView>,
163 identifier: Option<&AnyObject>,
164 challenge: Option<&NSURLAuthenticationChallenge>,
165 data_source: Option<&WebDataSource>,
166 );
167
168 #[cfg(all(
169 feature = "WebDataSource",
170 feature = "WebView",
171 feature = "objc2-app-kit"
172 ))]
173 #[cfg(target_os = "macos")]
174 /// This message is sent after a response has been received for this load.
175 ///
176 /// Parameter `sender`: The WebView sending the message.
177 ///
178 /// Parameter `identifier`: An identifier that can be used to track the progress of a resource load across
179 /// multiple call backs.
180 ///
181 /// Parameter `response`: The response for the request.
182 ///
183 /// Parameter `dataSource`: The dataSource that initiated the load.
184 ///
185 /// In some rare cases, multiple responses may be received for a single load.
186 /// This occurs with multipart/x-mixed-replace, or "server push". In this case, the client
187 /// should assume that each new response resets progress so far for the resource back to 0,
188 /// and should check the new response for the expected content length.
189 ///
190 /// # Safety
191 ///
192 /// - `sender` might not allow `None`.
193 /// - `identifier` should be of the correct type.
194 /// - `identifier` might not allow `None`.
195 /// - `response` might not allow `None`.
196 /// - `data_source` might not allow `None`.
197 #[deprecated]
198 #[optional]
199 #[unsafe(method(webView:resource:didReceiveResponse:fromDataSource:))]
200 #[unsafe(method_family = none)]
201 unsafe fn webView_resource_didReceiveResponse_fromDataSource(
202 &self,
203 sender: Option<&WebView>,
204 identifier: Option<&AnyObject>,
205 response: Option<&NSURLResponse>,
206 data_source: Option<&WebDataSource>,
207 );
208
209 #[cfg(all(
210 feature = "WebDataSource",
211 feature = "WebView",
212 feature = "objc2-app-kit"
213 ))]
214 #[cfg(target_os = "macos")]
215 /// Multiple of these messages may be sent as data arrives.
216 ///
217 /// Parameter `sender`: The WebView sending the message.
218 ///
219 /// Parameter `identifier`: An identifier that can be used to track the progress of a resource load across
220 /// multiple call backs.
221 ///
222 /// Parameter `length`: The amount of new data received. This is not the total amount, just the new amount received.
223 ///
224 /// Parameter `dataSource`: The dataSource that initiated the load.
225 ///
226 /// # Safety
227 ///
228 /// - `sender` might not allow `None`.
229 /// - `identifier` should be of the correct type.
230 /// - `identifier` might not allow `None`.
231 /// - `data_source` might not allow `None`.
232 #[deprecated]
233 #[optional]
234 #[unsafe(method(webView:resource:didReceiveContentLength:fromDataSource:))]
235 #[unsafe(method_family = none)]
236 unsafe fn webView_resource_didReceiveContentLength_fromDataSource(
237 &self,
238 sender: Option<&WebView>,
239 identifier: Option<&AnyObject>,
240 length: NSInteger,
241 data_source: Option<&WebDataSource>,
242 );
243
244 #[cfg(all(
245 feature = "WebDataSource",
246 feature = "WebView",
247 feature = "objc2-app-kit"
248 ))]
249 #[cfg(target_os = "macos")]
250 /// This message is sent after a load has successfully completed.
251 ///
252 /// Parameter `sender`: The WebView sending the message.
253 ///
254 /// Parameter `identifier`: An identifier that can be used to track the progress of a resource load across
255 /// multiple call backs.
256 ///
257 /// Parameter `dataSource`: The dataSource that initiated the load.
258 ///
259 /// # Safety
260 ///
261 /// - `sender` might not allow `None`.
262 /// - `identifier` should be of the correct type.
263 /// - `identifier` might not allow `None`.
264 /// - `data_source` might not allow `None`.
265 #[deprecated]
266 #[optional]
267 #[unsafe(method(webView:resource:didFinishLoadingFromDataSource:))]
268 #[unsafe(method_family = none)]
269 unsafe fn webView_resource_didFinishLoadingFromDataSource(
270 &self,
271 sender: Option<&WebView>,
272 identifier: Option<&AnyObject>,
273 data_source: Option<&WebDataSource>,
274 );
275
276 #[cfg(all(
277 feature = "WebDataSource",
278 feature = "WebView",
279 feature = "objc2-app-kit"
280 ))]
281 #[cfg(target_os = "macos")]
282 /// This message is sent after a load has failed to load due to an error.
283 ///
284 /// Parameter `sender`: The WebView sending the message.
285 ///
286 /// Parameter `identifier`: An identifier that can be used to track the progress of a resource load across
287 /// multiple call backs.
288 ///
289 /// Parameter `error`: The error associated with this load.
290 ///
291 /// Parameter `dataSource`: The dataSource that initiated the load.
292 ///
293 /// # Safety
294 ///
295 /// - `sender` might not allow `None`.
296 /// - `identifier` should be of the correct type.
297 /// - `identifier` might not allow `None`.
298 /// - `error` might not allow `None`.
299 /// - `data_source` might not allow `None`.
300 #[deprecated]
301 #[optional]
302 #[unsafe(method(webView:resource:didFailLoadingWithError:fromDataSource:))]
303 #[unsafe(method_family = none)]
304 unsafe fn webView_resource_didFailLoadingWithError_fromDataSource(
305 &self,
306 sender: Option<&WebView>,
307 identifier: Option<&AnyObject>,
308 error: Option<&NSError>,
309 data_source: Option<&WebDataSource>,
310 );
311
312 #[cfg(all(
313 feature = "WebDataSource",
314 feature = "WebView",
315 feature = "objc2-app-kit"
316 ))]
317 #[cfg(target_os = "macos")]
318 /// Called when a plug-in is not found, fails to load or is not available for some reason.
319 ///
320 /// Parameter `sender`: The WebView sending the message.
321 ///
322 /// Parameter `error`: The plug-in error. In the userInfo dictionary of the error, the object for the
323 /// NSErrorFailingURLKey key is a URL string of the SRC attribute, the object for the WebKitErrorPlugInNameKey
324 /// key is a string of the plug-in's name, the object for the WebKitErrorPlugInPageURLStringKey key is a URL string
325 /// of the PLUGINSPAGE attribute and the object for the WebKitErrorMIMETypeKey key is a string of the TYPE attribute.
326 /// Some, none or all of the mentioned attributes can be present in the userInfo. The error returns nil for userInfo
327 /// when none are present.
328 ///
329 /// Parameter `dataSource`: The dataSource that contains the plug-in.
330 ///
331 /// # Safety
332 ///
333 /// - `sender` might not allow `None`.
334 /// - `error` might not allow `None`.
335 /// - `data_source` might not allow `None`.
336 #[deprecated]
337 #[optional]
338 #[unsafe(method(webView:plugInFailedWithError:dataSource:))]
339 #[unsafe(method_family = none)]
340 unsafe fn webView_plugInFailedWithError_dataSource(
341 &self,
342 sender: Option<&WebView>,
343 error: Option<&NSError>,
344 data_source: Option<&WebDataSource>,
345 );
346 }
347);