objc2_web_kit/generated/WebFrameLoadDelegate.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use objc2::__framework_prelude::*;
5#[cfg(feature = "objc2-app-kit")]
6#[cfg(target_os = "macos")]
7use objc2_app_kit::*;
8use objc2_foundation::*;
9#[cfg(feature = "objc2-javascript-core")]
10use objc2_javascript_core::*;
11
12use crate::*;
13
14extern_protocol!(
15 /// A WebView's WebFrameLoadDelegate tracks the loading progress of its frames.
16 /// When a data source of a frame starts to load, the data source is considered "provisional".
17 /// Once at least one byte is received, the data source is considered "committed". This is done
18 /// so the contents of the frame will not be lost if the new data source fails to successfully load.
19 ///
20 /// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/webframeloaddelegate?language=objc)
21 #[deprecated]
22 pub unsafe trait WebFrameLoadDelegate: NSObjectProtocol {
23 #[cfg(all(feature = "WebFrame", feature = "WebView", feature = "objc2-app-kit"))]
24 #[cfg(target_os = "macos")]
25 /// Notifies the delegate that the provisional load of a frame has started
26 ///
27 /// Parameter `sender`: The WebView sending the message
28 ///
29 /// Parameter `frame`: The frame for which the provisional load has started
30 ///
31 /// This method is called after the provisional data source of a frame
32 /// has started to load.
33 ///
34 /// # Safety
35 ///
36 /// - `sender` might not allow `None`.
37 /// - `frame` might not allow `None`.
38 #[deprecated]
39 #[optional]
40 #[unsafe(method(webView:didStartProvisionalLoadForFrame:))]
41 #[unsafe(method_family = none)]
42 unsafe fn webView_didStartProvisionalLoadForFrame(
43 &self,
44 sender: Option<&WebView>,
45 frame: Option<&WebFrame>,
46 );
47
48 #[cfg(all(feature = "WebFrame", feature = "WebView", feature = "objc2-app-kit"))]
49 #[cfg(target_os = "macos")]
50 /// Notifies the delegate that a server redirect occurred during the provisional load
51 ///
52 /// Parameter `sender`: The WebView sending the message
53 ///
54 /// Parameter `frame`: The frame for which the redirect occurred
55 ///
56 /// # Safety
57 ///
58 /// - `sender` might not allow `None`.
59 /// - `frame` might not allow `None`.
60 #[deprecated]
61 #[optional]
62 #[unsafe(method(webView:didReceiveServerRedirectForProvisionalLoadForFrame:))]
63 #[unsafe(method_family = none)]
64 unsafe fn webView_didReceiveServerRedirectForProvisionalLoadForFrame(
65 &self,
66 sender: Option<&WebView>,
67 frame: Option<&WebFrame>,
68 );
69
70 #[cfg(all(feature = "WebFrame", feature = "WebView", feature = "objc2-app-kit"))]
71 #[cfg(target_os = "macos")]
72 /// Notifies the delegate that the provisional load has failed
73 ///
74 /// Parameter `sender`: The WebView sending the message
75 ///
76 /// Parameter `error`: The error that occurred
77 ///
78 /// Parameter `frame`: The frame for which the error occurred
79 ///
80 /// This method is called after the provisional data source has failed to load.
81 /// The frame will continue to display the contents of the committed data source if there is one.
82 ///
83 /// # Safety
84 ///
85 /// - `sender` might not allow `None`.
86 /// - `error` might not allow `None`.
87 /// - `frame` might not allow `None`.
88 #[deprecated]
89 #[optional]
90 #[unsafe(method(webView:didFailProvisionalLoadWithError:forFrame:))]
91 #[unsafe(method_family = none)]
92 unsafe fn webView_didFailProvisionalLoadWithError_forFrame(
93 &self,
94 sender: Option<&WebView>,
95 error: Option<&NSError>,
96 frame: Option<&WebFrame>,
97 );
98
99 #[cfg(all(feature = "WebFrame", feature = "WebView", feature = "objc2-app-kit"))]
100 #[cfg(target_os = "macos")]
101 /// Notifies the delegate that the load has changed from provisional to committed
102 ///
103 /// Parameter `sender`: The WebView sending the message
104 ///
105 /// Parameter `frame`: The frame for which the load has committed
106 ///
107 /// This method is called after the provisional data source has become the
108 /// committed data source.
109 ///
110 /// In some cases, a single load may be committed more than once. This happens
111 /// in the case of multipart/x-mixed-replace, also known as "server push". In this case,
112 /// a single location change leads to multiple documents that are loaded in sequence. When
113 /// this happens, a new commit will be sent for each document.
114 ///
115 /// # Safety
116 ///
117 /// - `sender` might not allow `None`.
118 /// - `frame` might not allow `None`.
119 #[deprecated]
120 #[optional]
121 #[unsafe(method(webView:didCommitLoadForFrame:))]
122 #[unsafe(method_family = none)]
123 unsafe fn webView_didCommitLoadForFrame(
124 &self,
125 sender: Option<&WebView>,
126 frame: Option<&WebFrame>,
127 );
128
129 #[cfg(all(feature = "WebFrame", feature = "WebView", feature = "objc2-app-kit"))]
130 #[cfg(target_os = "macos")]
131 /// Notifies the delegate that the page title for a frame has been received
132 ///
133 /// Parameter `sender`: The WebView sending the message
134 ///
135 /// Parameter `title`: The new page title
136 ///
137 /// Parameter `frame`: The frame for which the title has been received
138 ///
139 /// The title may update during loading; clients should be prepared for this.
140 ///
141 /// # Safety
142 ///
143 /// - `sender` might not allow `None`.
144 /// - `title` might not allow `None`.
145 /// - `frame` might not allow `None`.
146 #[deprecated]
147 #[optional]
148 #[unsafe(method(webView:didReceiveTitle:forFrame:))]
149 #[unsafe(method_family = none)]
150 unsafe fn webView_didReceiveTitle_forFrame(
151 &self,
152 sender: Option<&WebView>,
153 title: Option<&NSString>,
154 frame: Option<&WebFrame>,
155 );
156
157 #[cfg(all(feature = "WebFrame", feature = "WebView", feature = "objc2-app-kit"))]
158 #[cfg(target_os = "macos")]
159 /// Notifies the delegate that a page icon image for a frame has been received
160 ///
161 /// Parameter `webView`: The WebView sending the message
162 ///
163 /// Parameter `image`: The icon image. Also known as a "favicon".
164 ///
165 /// Parameter `frame`: The frame for which a page icon has been received
166 ///
167 /// # Safety
168 ///
169 /// - `sender` might not allow `None`.
170 /// - `image` might not allow `None`.
171 /// - `frame` might not allow `None`.
172 #[deprecated]
173 #[optional]
174 #[unsafe(method(webView:didReceiveIcon:forFrame:))]
175 #[unsafe(method_family = none)]
176 unsafe fn webView_didReceiveIcon_forFrame(
177 &self,
178 sender: Option<&WebView>,
179 image: Option<&NSImage>,
180 frame: Option<&WebFrame>,
181 );
182
183 #[cfg(all(feature = "WebFrame", feature = "WebView", feature = "objc2-app-kit"))]
184 #[cfg(target_os = "macos")]
185 /// Notifies the delegate that the committed load of a frame has completed
186 ///
187 /// Parameter `sender`: The WebView sending the message
188 ///
189 /// Parameter `frame`: The frame that finished loading
190 ///
191 /// This method is called after the committed data source of a frame has successfully loaded
192 /// and will only be called when all subresources such as images and stylesheets are done loading.
193 /// Plug-In content and JavaScript-requested loads may occur after this method is called.
194 ///
195 /// # Safety
196 ///
197 /// - `sender` might not allow `None`.
198 /// - `frame` might not allow `None`.
199 #[deprecated]
200 #[optional]
201 #[unsafe(method(webView:didFinishLoadForFrame:))]
202 #[unsafe(method_family = none)]
203 unsafe fn webView_didFinishLoadForFrame(
204 &self,
205 sender: Option<&WebView>,
206 frame: Option<&WebFrame>,
207 );
208
209 #[cfg(all(feature = "WebFrame", feature = "WebView", feature = "objc2-app-kit"))]
210 #[cfg(target_os = "macos")]
211 /// Notifies the delegate that the committed load of a frame has failed
212 ///
213 /// Parameter `sender`: The WebView sending the message
214 ///
215 /// Parameter `error`: The error that occurred
216 ///
217 /// Parameter `frame`: The frame that failed to load
218 ///
219 /// This method is called after a data source has committed but failed to completely load.
220 ///
221 /// # Safety
222 ///
223 /// - `sender` might not allow `None`.
224 /// - `error` might not allow `None`.
225 /// - `frame` might not allow `None`.
226 #[deprecated]
227 #[optional]
228 #[unsafe(method(webView:didFailLoadWithError:forFrame:))]
229 #[unsafe(method_family = none)]
230 unsafe fn webView_didFailLoadWithError_forFrame(
231 &self,
232 sender: Option<&WebView>,
233 error: Option<&NSError>,
234 frame: Option<&WebFrame>,
235 );
236
237 #[cfg(all(feature = "WebFrame", feature = "WebView", feature = "objc2-app-kit"))]
238 #[cfg(target_os = "macos")]
239 /// Notifies the delegate that the scroll position in a frame has changed
240 ///
241 /// Parameter `sender`: The WebView sending the message
242 ///
243 /// Parameter `frame`: The frame that scrolled
244 ///
245 /// This method is called when anchors within a page have been clicked.
246 ///
247 /// # Safety
248 ///
249 /// - `sender` might not allow `None`.
250 /// - `frame` might not allow `None`.
251 #[deprecated]
252 #[optional]
253 #[unsafe(method(webView:didChangeLocationWithinPageForFrame:))]
254 #[unsafe(method_family = none)]
255 unsafe fn webView_didChangeLocationWithinPageForFrame(
256 &self,
257 sender: Option<&WebView>,
258 frame: Option<&WebFrame>,
259 );
260
261 #[cfg(all(feature = "WebFrame", feature = "WebView", feature = "objc2-app-kit"))]
262 #[cfg(target_os = "macos")]
263 /// Notifies the delegate that a frame will perform a client-side redirect
264 ///
265 /// Parameter `sender`: The WebView sending the message
266 ///
267 /// Parameter `URL`: The URL to be redirected to
268 ///
269 /// Parameter `seconds`: Seconds in which the redirect will happen
270 ///
271 /// Parameter `date`: The fire date
272 ///
273 /// Parameter `frame`: The frame on which the redirect will occur
274 ///
275 /// This method can be used to continue progress feedback while a client-side
276 /// redirect is pending.
277 ///
278 /// # Safety
279 ///
280 /// - `sender` might not allow `None`.
281 /// - `url` might not allow `None`.
282 /// - `date` might not allow `None`.
283 /// - `frame` might not allow `None`.
284 #[deprecated]
285 #[optional]
286 #[unsafe(method(webView:willPerformClientRedirectToURL:delay:fireDate:forFrame:))]
287 #[unsafe(method_family = none)]
288 unsafe fn webView_willPerformClientRedirectToURL_delay_fireDate_forFrame(
289 &self,
290 sender: Option<&WebView>,
291 url: Option<&NSURL>,
292 seconds: NSTimeInterval,
293 date: Option<&NSDate>,
294 frame: Option<&WebFrame>,
295 );
296
297 #[cfg(all(feature = "WebFrame", feature = "WebView", feature = "objc2-app-kit"))]
298 #[cfg(target_os = "macos")]
299 /// Notifies the delegate that a pending client-side redirect has been cancelled
300 ///
301 /// Parameter `sender`: The WebView sending the message
302 ///
303 /// Parameter `frame`: The frame for which the pending redirect was cancelled
304 ///
305 /// A client-side redirect can be cancelled if a frame changes location before the timeout.
306 ///
307 /// # Safety
308 ///
309 /// - `sender` might not allow `None`.
310 /// - `frame` might not allow `None`.
311 #[deprecated]
312 #[optional]
313 #[unsafe(method(webView:didCancelClientRedirectForFrame:))]
314 #[unsafe(method_family = none)]
315 unsafe fn webView_didCancelClientRedirectForFrame(
316 &self,
317 sender: Option<&WebView>,
318 frame: Option<&WebFrame>,
319 );
320
321 #[cfg(all(feature = "WebFrame", feature = "WebView", feature = "objc2-app-kit"))]
322 #[cfg(target_os = "macos")]
323 /// Notifies the delegate that a frame will be closed
324 ///
325 /// Parameter `sender`: The WebView sending the message
326 ///
327 /// Parameter `frame`: The frame that will be closed
328 ///
329 /// This method is called right before WebKit is done with the frame
330 /// and the objects that it contains.
331 ///
332 /// # Safety
333 ///
334 /// - `sender` might not allow `None`.
335 /// - `frame` might not allow `None`.
336 #[deprecated]
337 #[optional]
338 #[unsafe(method(webView:willCloseFrame:))]
339 #[unsafe(method_family = none)]
340 unsafe fn webView_willCloseFrame(&self, sender: Option<&WebView>, frame: Option<&WebFrame>);
341
342 #[cfg(all(
343 feature = "WebFrame",
344 feature = "WebScriptObject",
345 feature = "WebView",
346 feature = "objc2-app-kit"
347 ))]
348 #[cfg(target_os = "macos")]
349 /// Notifies the delegate that the JavaScript window object in a frame has
350 /// been cleared in preparation for a new load. This is the preferred place to set custom
351 /// properties on the window object using the WebScriptObject and JavaScriptCore APIs.
352 ///
353 /// Parameter `webView`: The webView sending the message.
354 ///
355 /// Parameter `windowObject`: The WebScriptObject representing the frame's JavaScript window object.
356 ///
357 /// Parameter `frame`: The WebFrame to which windowObject belongs.
358 ///
359 /// If a delegate implements both webView:didClearWindowObject:forFrame:
360 /// and webView:windowScriptObjectAvailable:, only webView:didClearWindowObject:forFrame:
361 /// will be invoked. This enables a delegate to implement both methods for backwards
362 /// compatibility with older versions of WebKit.
363 ///
364 /// # Safety
365 ///
366 /// - `web_view` might not allow `None`.
367 /// - `window_object` might not allow `None`.
368 /// - `frame` might not allow `None`.
369 #[deprecated]
370 #[optional]
371 #[unsafe(method(webView:didClearWindowObject:forFrame:))]
372 #[unsafe(method_family = none)]
373 unsafe fn webView_didClearWindowObject_forFrame(
374 &self,
375 web_view: Option<&WebView>,
376 window_object: Option<&WebScriptObject>,
377 frame: Option<&WebFrame>,
378 );
379
380 #[cfg(all(
381 feature = "WebScriptObject",
382 feature = "WebView",
383 feature = "objc2-app-kit"
384 ))]
385 #[cfg(target_os = "macos")]
386 /// Notifies the delegate that the scripting object for a page is available. This is called
387 /// before the page is loaded. It may be useful to allow delegates to bind native objects to the window.
388 ///
389 /// Parameter `webView`: The webView sending the message.
390 ///
391 /// Parameter `windowScriptObject`: The WebScriptObject for the window in the scripting environment.
392 ///
393 /// This method is deprecated. Consider using webView:didClearWindowObject:forFrame:
394 /// instead.
395 ///
396 /// # Safety
397 ///
398 /// - `web_view` might not allow `None`.
399 /// - `window_script_object` might not allow `None`.
400 #[deprecated]
401 #[optional]
402 #[unsafe(method(webView:windowScriptObjectAvailable:))]
403 #[unsafe(method_family = none)]
404 unsafe fn webView_windowScriptObjectAvailable(
405 &self,
406 web_view: Option<&WebView>,
407 window_script_object: Option<&WebScriptObject>,
408 );
409
410 #[cfg(all(
411 feature = "WebFrame",
412 feature = "WebView",
413 feature = "objc2-app-kit",
414 feature = "objc2-javascript-core"
415 ))]
416 #[cfg(target_os = "macos")]
417 /// Notifies the delegate that a new JavaScript context has been created created.
418 ///
419 /// Parameter `webView`: The WebView sending the message.
420 ///
421 /// Parameter `context`: The JSContext representing the frame's JavaScript window object.
422 ///
423 /// Parameter `frame`: The WebFrame to which the context belongs.
424 ///
425 /// If a delegate implements webView:didCreateJavaScriptContext:forFrame: along with either
426 /// webView:didClearWindowObject:forFrame: or webView:windowScriptObjectAvailable:, only
427 /// webView:didCreateJavaScriptContext:forFrame will be invoked. This enables a delegate to implement
428 /// multiple versions to maintain backwards compatibility with older versions of WebKit.
429 ///
430 /// # Safety
431 ///
432 /// - `web_view` might not allow `None`.
433 /// - `context` might not allow `None`.
434 /// - `frame` might not allow `None`.
435 #[deprecated]
436 #[optional]
437 #[unsafe(method(webView:didCreateJavaScriptContext:forFrame:))]
438 #[unsafe(method_family = none)]
439 unsafe fn webView_didCreateJavaScriptContext_forFrame(
440 &self,
441 web_view: Option<&WebView>,
442 context: Option<&JSContext>,
443 frame: Option<&WebFrame>,
444 );
445 }
446);