objc2_web_kit/generated/WebFrame.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7#[cfg(feature = "objc2-javascript-core")]
8use objc2_javascript_core::*;
9
10use crate::*;
11
12extern_class!(
13 /// Every web page is represented by at least one WebFrame. A WebFrame
14 /// has a WebFrameView and a WebDataSource.
15 ///
16 /// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/webframe?language=objc)
17 #[unsafe(super(NSObject))]
18 #[derive(Debug, PartialEq, Eq, Hash)]
19 #[deprecated]
20 pub struct WebFrame;
21);
22
23extern_conformance!(
24 unsafe impl NSObjectProtocol for WebFrame {}
25);
26
27impl WebFrame {
28 extern_methods!(
29 #[cfg(all(
30 feature = "WebFrameView",
31 feature = "WebView",
32 feature = "objc2-app-kit"
33 ))]
34 #[cfg(target_os = "macos")]
35 /// The designated initializer of WebFrame.
36 ///
37 /// WebFrames are normally created for you by the WebView. You should
38 /// not need to invoke this method directly.
39 ///
40 /// Parameter `name`: The name of the frame.
41 ///
42 /// Parameter `view`: The WebFrameView for the frame.
43 ///
44 /// Parameter `webView`: The WebView that manages the frame.
45 ///
46 /// Returns: Returns an initialized WebFrame.
47 ///
48 /// # Safety
49 ///
50 /// - `name` might not allow `None`.
51 /// - `view` might not allow `None`.
52 /// - `web_view` might not allow `None`.
53 #[deprecated]
54 #[unsafe(method(initWithName:webFrameView:webView:))]
55 #[unsafe(method_family = init)]
56 pub unsafe fn initWithName_webFrameView_webView(
57 this: Allocated<Self>,
58 name: Option<&NSString>,
59 view: Option<&WebFrameView>,
60 web_view: Option<&WebView>,
61 ) -> Option<Retained<Self>>;
62
63 /// The frame name.
64 #[deprecated]
65 #[unsafe(method(name))]
66 #[unsafe(method_family = none)]
67 pub unsafe fn name(&self) -> Retained<NSString>;
68
69 #[cfg(all(feature = "WebView", feature = "objc2-app-kit"))]
70 #[cfg(target_os = "macos")]
71 /// The WebView for the document that includes this frame.
72 #[deprecated]
73 #[unsafe(method(webView))]
74 #[unsafe(method_family = none)]
75 pub unsafe fn webView(&self, mtm: MainThreadMarker) -> Option<Retained<WebView>>;
76
77 #[cfg(all(feature = "WebFrameView", feature = "objc2-app-kit"))]
78 #[cfg(target_os = "macos")]
79 /// The WebFrameView for this frame.
80 #[deprecated]
81 #[unsafe(method(frameView))]
82 #[unsafe(method_family = none)]
83 pub unsafe fn frameView(&self, mtm: MainThreadMarker) -> Option<Retained<WebFrameView>>;
84
85 #[cfg(all(
86 feature = "DOMDocument",
87 feature = "DOMNode",
88 feature = "DOMObject",
89 feature = "WebScriptObject"
90 ))]
91 /// The DOM document of the frame.
92 /// Returns nil if the frame does not contain a DOM document such as a standalone image.
93 #[deprecated]
94 #[unsafe(method(DOMDocument))]
95 #[unsafe(method_family = none)]
96 pub unsafe fn DOMDocument(&self) -> Option<Retained<DOMDocument>>;
97
98 #[cfg(all(
99 feature = "DOMElement",
100 feature = "DOMHTMLElement",
101 feature = "DOMNode",
102 feature = "DOMObject",
103 feature = "WebScriptObject"
104 ))]
105 /// The frame element of the frame.
106 /// The class of the result is either DOMHTMLFrameElement, DOMHTMLIFrameElement or DOMHTMLObjectElement.
107 /// Returns nil if the frame is the main frame since there is no frame element for the frame in this case.
108 #[deprecated]
109 #[unsafe(method(frameElement))]
110 #[unsafe(method_family = none)]
111 pub unsafe fn frameElement(&self) -> Option<Retained<DOMHTMLElement>>;
112
113 /// Parameter `request`: The web request to load.
114 ///
115 /// # Safety
116 ///
117 /// `request` might not allow `None`.
118 #[deprecated]
119 #[unsafe(method(loadRequest:))]
120 #[unsafe(method_family = none)]
121 pub unsafe fn loadRequest(&self, request: Option<&NSURLRequest>);
122
123 /// Parameter `data`: The data to use for the main page of the document.
124 ///
125 /// Parameter `MIMEType`: The MIME type of the data.
126 ///
127 /// Parameter `encodingName`: The encoding of the data.
128 ///
129 /// Parameter `URL`: The base URL to apply to relative URLs within the document.
130 ///
131 /// # Safety
132 ///
133 /// - `data` might not allow `None`.
134 /// - `mime_type` might not allow `None`.
135 /// - `encoding_name` might not allow `None`.
136 /// - `url` might not allow `None`.
137 #[deprecated]
138 #[unsafe(method(loadData:MIMEType:textEncodingName:baseURL:))]
139 #[unsafe(method_family = none)]
140 pub unsafe fn loadData_MIMEType_textEncodingName_baseURL(
141 &self,
142 data: Option<&NSData>,
143 mime_type: Option<&NSString>,
144 encoding_name: Option<&NSString>,
145 url: Option<&NSURL>,
146 );
147
148 /// Parameter `string`: The string to use for the main page of the document.
149 ///
150 /// Parameter `URL`: The base URL to apply to relative URLs within the document.
151 ///
152 /// # Safety
153 ///
154 /// - `string` might not allow `None`.
155 /// - `url` might not allow `None`.
156 #[deprecated]
157 #[unsafe(method(loadHTMLString:baseURL:))]
158 #[unsafe(method_family = none)]
159 pub unsafe fn loadHTMLString_baseURL(&self, string: Option<&NSString>, url: Option<&NSURL>);
160
161 /// Loads a page to display as a substitute for a URL that could not be reached.
162 ///
163 /// This allows clients to display page-loading errors in the webview itself.
164 /// This is typically called while processing the WebFrameLoadDelegate method
165 /// -webView:didFailProvisionalLoadWithError:forFrame: or one of the WebPolicyDelegate methods
166 /// -webView:decidePolicyForMIMEType:request:frame:decisionListener: or
167 /// -webView:unableToImplementPolicyWithError:frame:. If it is called from within one of those
168 /// three delegate methods then the back/forward list will be maintained appropriately.
169 ///
170 /// Parameter `string`: The string to use for the main page of the document.
171 ///
172 /// Parameter `baseURL`: The baseURL to apply to relative URLs within the document.
173 ///
174 /// Parameter `unreachableURL`: The URL for which this page will serve as alternate content.
175 ///
176 /// # Safety
177 ///
178 /// - `string` might not allow `None`.
179 /// - `base_url` might not allow `None`.
180 /// - `unreachable_url` might not allow `None`.
181 #[deprecated]
182 #[unsafe(method(loadAlternateHTMLString:baseURL:forUnreachableURL:))]
183 #[unsafe(method_family = none)]
184 pub unsafe fn loadAlternateHTMLString_baseURL_forUnreachableURL(
185 &self,
186 string: Option<&NSString>,
187 base_url: Option<&NSURL>,
188 unreachable_url: Option<&NSURL>,
189 );
190
191 #[cfg(feature = "WebArchive")]
192 /// Causes WebFrame to load a WebArchive.
193 ///
194 /// Parameter `archive`: The archive to be loaded.
195 ///
196 /// # Safety
197 ///
198 /// `archive` might not allow `None`.
199 #[deprecated]
200 #[unsafe(method(loadArchive:))]
201 #[unsafe(method_family = none)]
202 pub unsafe fn loadArchive(&self, archive: Option<&WebArchive>);
203
204 #[cfg(feature = "WebDataSource")]
205 /// The datasource for this frame.
206 ///
207 /// Returns the committed data source. Will return nil if the
208 /// provisional data source hasn't yet been loaded.
209 #[deprecated]
210 #[unsafe(method(dataSource))]
211 #[unsafe(method_family = none)]
212 pub unsafe fn dataSource(&self) -> Option<Retained<WebDataSource>>;
213
214 #[cfg(feature = "WebDataSource")]
215 /// The provisional datasource of this frame.
216 ///
217 /// Will return the provisional data source. The provisional data source will
218 /// be nil if no data source has been set on the frame, or the data source
219 /// has successfully transitioned to the committed data source.
220 #[deprecated]
221 #[unsafe(method(provisionalDataSource))]
222 #[unsafe(method_family = none)]
223 pub unsafe fn provisionalDataSource(&self) -> Option<Retained<WebDataSource>>;
224
225 /// Stop any pending loads on the frame's data source,
226 /// and its children.
227 #[deprecated]
228 #[unsafe(method(stopLoading))]
229 #[unsafe(method_family = none)]
230 pub unsafe fn stopLoading(&self);
231
232 /// Performs HTTP/1.1 end-to-end revalidation using cache-validating conditionals if possible.
233 #[deprecated]
234 #[unsafe(method(reload))]
235 #[unsafe(method_family = none)]
236 pub unsafe fn reload(&self);
237
238 /// Performs HTTP/1.1 end-to-end reload.
239 #[deprecated]
240 #[unsafe(method(reloadFromOrigin))]
241 #[unsafe(method_family = none)]
242 pub unsafe fn reloadFromOrigin(&self);
243
244 /// This method returns a frame with the given name. findFrameNamed returns self
245 /// for _self and _current, the parent frame for _parent and the main frame for _top.
246 /// findFrameNamed returns self for _parent and _top if the receiver is the mainFrame.
247 /// findFrameNamed first searches from the current frame to all descending frames then the
248 /// rest of the frames in the WebView. If still not found, findFrameNamed searches the
249 /// frames of the other WebViews.
250 ///
251 /// Parameter `name`: The name of the frame to find.
252 ///
253 /// Returns: The frame matching the provided name. nil if the frame is not found.
254 ///
255 /// # Safety
256 ///
257 /// `name` might not allow `None`.
258 #[deprecated]
259 #[unsafe(method(findFrameNamed:))]
260 #[unsafe(method_family = none)]
261 pub unsafe fn findFrameNamed(&self, name: Option<&NSString>) -> Option<Retained<WebFrame>>;
262
263 /// The frame containing this frame, or nil if this is a top level frame.
264 #[deprecated]
265 #[unsafe(method(parentFrame))]
266 #[unsafe(method_family = none)]
267 pub unsafe fn parentFrame(&self) -> Option<Retained<WebFrame>>;
268
269 /// An array of WebFrame.
270 ///
271 /// The frames in the array are associated with a frame set or iframe.
272 #[deprecated]
273 #[unsafe(method(childFrames))]
274 #[unsafe(method_family = none)]
275 pub unsafe fn childFrames(&self) -> Retained<NSArray>;
276
277 #[cfg(feature = "WebScriptObject")]
278 /// The WebScriptObject representing the frame's JavaScript window object.
279 #[deprecated]
280 #[unsafe(method(windowObject))]
281 #[unsafe(method_family = none)]
282 pub unsafe fn windowObject(&self) -> Option<Retained<WebScriptObject>>;
283
284 #[cfg(feature = "objc2-javascript-core")]
285 /// The frame's global JavaScript execution context.
286 ///
287 /// Use this method to bridge between the WebKit and JavaScriptCore APIs.
288 #[deprecated]
289 #[unsafe(method(globalContext))]
290 #[unsafe(method_family = none)]
291 pub unsafe fn globalContext(&self) -> JSGlobalContextRef;
292
293 #[cfg(feature = "objc2-javascript-core")]
294 /// The frame's global JavaScript execution context.
295 ///
296 /// Use this method to bridge between the WebKit and Objective-C JavaScriptCore API.
297 #[deprecated]
298 #[unsafe(method(javaScriptContext))]
299 #[unsafe(method_family = none)]
300 pub unsafe fn javaScriptContext(&self) -> Option<Retained<JSContext>>;
301 );
302}
303
304/// Methods declared on superclass `NSObject`.
305impl WebFrame {
306 extern_methods!(
307 #[unsafe(method(init))]
308 #[unsafe(method_family = init)]
309 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
310
311 #[unsafe(method(new))]
312 #[unsafe(method_family = new)]
313 pub unsafe fn new() -> Retained<Self>;
314 );
315}