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 #[deprecated]
34 #[optional]
35 #[unsafe(method(webView:didStartProvisionalLoadForFrame:))]
36 #[unsafe(method_family = none)]
37 unsafe fn webView_didStartProvisionalLoadForFrame(
38 &self,
39 sender: Option<&WebView>,
40 frame: Option<&WebFrame>,
41 );
42
43 #[cfg(all(feature = "WebFrame", feature = "WebView", feature = "objc2-app-kit"))]
44 #[cfg(target_os = "macos")]
45 /// Notifies the delegate that a server redirect occurred during the provisional load
46 ///
47 /// Parameter `sender`: The WebView sending the message
48 ///
49 /// Parameter `frame`: The frame for which the redirect occurred
50 #[deprecated]
51 #[optional]
52 #[unsafe(method(webView:didReceiveServerRedirectForProvisionalLoadForFrame:))]
53 #[unsafe(method_family = none)]
54 unsafe fn webView_didReceiveServerRedirectForProvisionalLoadForFrame(
55 &self,
56 sender: Option<&WebView>,
57 frame: Option<&WebFrame>,
58 );
59
60 #[cfg(all(feature = "WebFrame", feature = "WebView", feature = "objc2-app-kit"))]
61 #[cfg(target_os = "macos")]
62 /// Notifies the delegate that the provisional load has failed
63 ///
64 /// Parameter `sender`: The WebView sending the message
65 ///
66 /// Parameter `error`: The error that occurred
67 ///
68 /// Parameter `frame`: The frame for which the error occurred
69 ///
70 /// This method is called after the provisional data source has failed to load.
71 /// The frame will continue to display the contents of the committed data source if there is one.
72 #[deprecated]
73 #[optional]
74 #[unsafe(method(webView:didFailProvisionalLoadWithError:forFrame:))]
75 #[unsafe(method_family = none)]
76 unsafe fn webView_didFailProvisionalLoadWithError_forFrame(
77 &self,
78 sender: Option<&WebView>,
79 error: Option<&NSError>,
80 frame: Option<&WebFrame>,
81 );
82
83 #[cfg(all(feature = "WebFrame", feature = "WebView", feature = "objc2-app-kit"))]
84 #[cfg(target_os = "macos")]
85 /// Notifies the delegate that the load has changed from provisional to committed
86 ///
87 /// Parameter `sender`: The WebView sending the message
88 ///
89 /// Parameter `frame`: The frame for which the load has committed
90 ///
91 /// This method is called after the provisional data source has become the
92 /// committed data source.
93 ///
94 /// In some cases, a single load may be committed more than once. This happens
95 /// in the case of multipart/x-mixed-replace, also known as "server push". In this case,
96 /// a single location change leads to multiple documents that are loaded in sequence. When
97 /// this happens, a new commit will be sent for each document.
98 #[deprecated]
99 #[optional]
100 #[unsafe(method(webView:didCommitLoadForFrame:))]
101 #[unsafe(method_family = none)]
102 unsafe fn webView_didCommitLoadForFrame(
103 &self,
104 sender: Option<&WebView>,
105 frame: Option<&WebFrame>,
106 );
107
108 #[cfg(all(feature = "WebFrame", feature = "WebView", feature = "objc2-app-kit"))]
109 #[cfg(target_os = "macos")]
110 /// Notifies the delegate that the page title for a frame has been received
111 ///
112 /// Parameter `sender`: The WebView sending the message
113 ///
114 /// Parameter `title`: The new page title
115 ///
116 /// Parameter `frame`: The frame for which the title has been received
117 ///
118 /// The title may update during loading; clients should be prepared for this.
119 #[deprecated]
120 #[optional]
121 #[unsafe(method(webView:didReceiveTitle:forFrame:))]
122 #[unsafe(method_family = none)]
123 unsafe fn webView_didReceiveTitle_forFrame(
124 &self,
125 sender: Option<&WebView>,
126 title: Option<&NSString>,
127 frame: Option<&WebFrame>,
128 );
129
130 #[cfg(all(feature = "WebFrame", feature = "WebView", feature = "objc2-app-kit"))]
131 #[cfg(target_os = "macos")]
132 /// Notifies the delegate that a page icon image for a frame has been received
133 ///
134 /// Parameter `webView`: The WebView sending the message
135 ///
136 /// Parameter `image`: The icon image. Also known as a "favicon".
137 ///
138 /// Parameter `frame`: The frame for which a page icon has been received
139 #[deprecated]
140 #[optional]
141 #[unsafe(method(webView:didReceiveIcon:forFrame:))]
142 #[unsafe(method_family = none)]
143 unsafe fn webView_didReceiveIcon_forFrame(
144 &self,
145 sender: Option<&WebView>,
146 image: Option<&NSImage>,
147 frame: Option<&WebFrame>,
148 );
149
150 #[cfg(all(feature = "WebFrame", feature = "WebView", feature = "objc2-app-kit"))]
151 #[cfg(target_os = "macos")]
152 /// Notifies the delegate that the committed load of a frame has completed
153 ///
154 /// Parameter `sender`: The WebView sending the message
155 ///
156 /// Parameter `frame`: The frame that finished loading
157 ///
158 /// This method is called after the committed data source of a frame has successfully loaded
159 /// and will only be called when all subresources such as images and stylesheets are done loading.
160 /// Plug-In content and JavaScript-requested loads may occur after this method is called.
161 #[deprecated]
162 #[optional]
163 #[unsafe(method(webView:didFinishLoadForFrame:))]
164 #[unsafe(method_family = none)]
165 unsafe fn webView_didFinishLoadForFrame(
166 &self,
167 sender: Option<&WebView>,
168 frame: Option<&WebFrame>,
169 );
170
171 #[cfg(all(feature = "WebFrame", feature = "WebView", feature = "objc2-app-kit"))]
172 #[cfg(target_os = "macos")]
173 /// Notifies the delegate that the committed load of a frame has failed
174 ///
175 /// Parameter `sender`: The WebView sending the message
176 ///
177 /// Parameter `error`: The error that occurred
178 ///
179 /// Parameter `frame`: The frame that failed to load
180 ///
181 /// This method is called after a data source has committed but failed to completely load.
182 #[deprecated]
183 #[optional]
184 #[unsafe(method(webView:didFailLoadWithError:forFrame:))]
185 #[unsafe(method_family = none)]
186 unsafe fn webView_didFailLoadWithError_forFrame(
187 &self,
188 sender: Option<&WebView>,
189 error: Option<&NSError>,
190 frame: Option<&WebFrame>,
191 );
192
193 #[cfg(all(feature = "WebFrame", feature = "WebView", feature = "objc2-app-kit"))]
194 #[cfg(target_os = "macos")]
195 /// Notifies the delegate that the scroll position in a frame has changed
196 ///
197 /// Parameter `sender`: The WebView sending the message
198 ///
199 /// Parameter `frame`: The frame that scrolled
200 ///
201 /// This method is called when anchors within a page have been clicked.
202 #[deprecated]
203 #[optional]
204 #[unsafe(method(webView:didChangeLocationWithinPageForFrame:))]
205 #[unsafe(method_family = none)]
206 unsafe fn webView_didChangeLocationWithinPageForFrame(
207 &self,
208 sender: Option<&WebView>,
209 frame: Option<&WebFrame>,
210 );
211
212 #[cfg(all(feature = "WebFrame", feature = "WebView", feature = "objc2-app-kit"))]
213 #[cfg(target_os = "macos")]
214 /// Notifies the delegate that a frame will perform a client-side redirect
215 ///
216 /// Parameter `sender`: The WebView sending the message
217 ///
218 /// Parameter `URL`: The URL to be redirected to
219 ///
220 /// Parameter `seconds`: Seconds in which the redirect will happen
221 ///
222 /// Parameter `date`: The fire date
223 ///
224 /// Parameter `frame`: The frame on which the redirect will occur
225 ///
226 /// This method can be used to continue progress feedback while a client-side
227 /// redirect is pending.
228 #[deprecated]
229 #[optional]
230 #[unsafe(method(webView:willPerformClientRedirectToURL:delay:fireDate:forFrame:))]
231 #[unsafe(method_family = none)]
232 unsafe fn webView_willPerformClientRedirectToURL_delay_fireDate_forFrame(
233 &self,
234 sender: Option<&WebView>,
235 url: Option<&NSURL>,
236 seconds: NSTimeInterval,
237 date: Option<&NSDate>,
238 frame: Option<&WebFrame>,
239 );
240
241 #[cfg(all(feature = "WebFrame", feature = "WebView", feature = "objc2-app-kit"))]
242 #[cfg(target_os = "macos")]
243 /// Notifies the delegate that a pending client-side redirect has been cancelled
244 ///
245 /// Parameter `sender`: The WebView sending the message
246 ///
247 /// Parameter `frame`: The frame for which the pending redirect was cancelled
248 ///
249 /// A client-side redirect can be cancelled if a frame changes location before the timeout.
250 #[deprecated]
251 #[optional]
252 #[unsafe(method(webView:didCancelClientRedirectForFrame:))]
253 #[unsafe(method_family = none)]
254 unsafe fn webView_didCancelClientRedirectForFrame(
255 &self,
256 sender: Option<&WebView>,
257 frame: Option<&WebFrame>,
258 );
259
260 #[cfg(all(feature = "WebFrame", feature = "WebView", feature = "objc2-app-kit"))]
261 #[cfg(target_os = "macos")]
262 /// Notifies the delegate that a frame will be closed
263 ///
264 /// Parameter `sender`: The WebView sending the message
265 ///
266 /// Parameter `frame`: The frame that will be closed
267 ///
268 /// This method is called right before WebKit is done with the frame
269 /// and the objects that it contains.
270 #[deprecated]
271 #[optional]
272 #[unsafe(method(webView:willCloseFrame:))]
273 #[unsafe(method_family = none)]
274 unsafe fn webView_willCloseFrame(&self, sender: Option<&WebView>, frame: Option<&WebFrame>);
275
276 #[cfg(all(
277 feature = "WebFrame",
278 feature = "WebScriptObject",
279 feature = "WebView",
280 feature = "objc2-app-kit"
281 ))]
282 #[cfg(target_os = "macos")]
283 /// Notifies the delegate that the JavaScript window object in a frame has
284 /// been cleared in preparation for a new load. This is the preferred place to set custom
285 /// properties on the window object using the WebScriptObject and JavaScriptCore APIs.
286 ///
287 /// Parameter `webView`: The webView sending the message.
288 ///
289 /// Parameter `windowObject`: The WebScriptObject representing the frame's JavaScript window object.
290 ///
291 /// Parameter `frame`: The WebFrame to which windowObject belongs.
292 ///
293 /// If a delegate implements both webView:didClearWindowObject:forFrame:
294 /// and webView:windowScriptObjectAvailable:, only webView:didClearWindowObject:forFrame:
295 /// will be invoked. This enables a delegate to implement both methods for backwards
296 /// compatibility with older versions of WebKit.
297 #[deprecated]
298 #[optional]
299 #[unsafe(method(webView:didClearWindowObject:forFrame:))]
300 #[unsafe(method_family = none)]
301 unsafe fn webView_didClearWindowObject_forFrame(
302 &self,
303 web_view: Option<&WebView>,
304 window_object: Option<&WebScriptObject>,
305 frame: Option<&WebFrame>,
306 );
307
308 #[cfg(all(
309 feature = "WebScriptObject",
310 feature = "WebView",
311 feature = "objc2-app-kit"
312 ))]
313 #[cfg(target_os = "macos")]
314 /// Notifies the delegate that the scripting object for a page is available. This is called
315 /// before the page is loaded. It may be useful to allow delegates to bind native objects to the window.
316 ///
317 /// Parameter `webView`: The webView sending the message.
318 ///
319 /// Parameter `windowScriptObject`: The WebScriptObject for the window in the scripting environment.
320 ///
321 /// This method is deprecated. Consider using webView:didClearWindowObject:forFrame:
322 /// instead.
323 #[deprecated]
324 #[optional]
325 #[unsafe(method(webView:windowScriptObjectAvailable:))]
326 #[unsafe(method_family = none)]
327 unsafe fn webView_windowScriptObjectAvailable(
328 &self,
329 web_view: Option<&WebView>,
330 window_script_object: Option<&WebScriptObject>,
331 );
332
333 #[cfg(all(
334 feature = "WebFrame",
335 feature = "WebView",
336 feature = "objc2-app-kit",
337 feature = "objc2-javascript-core"
338 ))]
339 #[cfg(target_os = "macos")]
340 /// Notifies the delegate that a new JavaScript context has been created created.
341 ///
342 /// Parameter `webView`: The WebView sending the message.
343 ///
344 /// Parameter `context`: The JSContext representing the frame's JavaScript window object.
345 ///
346 /// Parameter `frame`: The WebFrame to which the context belongs.
347 ///
348 /// If a delegate implements webView:didCreateJavaScriptContext:forFrame: along with either
349 /// webView:didClearWindowObject:forFrame: or webView:windowScriptObjectAvailable:, only
350 /// webView:didCreateJavaScriptContext:forFrame will be invoked. This enables a delegate to implement
351 /// multiple versions to maintain backwards compatibility with older versions of WebKit.
352 #[deprecated]
353 #[optional]
354 #[unsafe(method(webView:didCreateJavaScriptContext:forFrame:))]
355 #[unsafe(method_family = none)]
356 unsafe fn webView_didCreateJavaScriptContext_forFrame(
357 &self,
358 web_view: Option<&WebView>,
359 context: Option<&JSContext>,
360 frame: Option<&WebFrame>,
361 );
362 }
363);