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 #[deprecated]
48 #[unsafe(method(initWithName:webFrameView:webView:))]
49 #[unsafe(method_family = init)]
50 pub unsafe fn initWithName_webFrameView_webView(
51 this: Allocated<Self>,
52 name: Option<&NSString>,
53 view: Option<&WebFrameView>,
54 web_view: Option<&WebView>,
55 ) -> Option<Retained<Self>>;
56
57 /// The frame name.
58 #[deprecated]
59 #[unsafe(method(name))]
60 #[unsafe(method_family = none)]
61 pub unsafe fn name(&self) -> Retained<NSString>;
62
63 #[cfg(all(feature = "WebView", feature = "objc2-app-kit"))]
64 #[cfg(target_os = "macos")]
65 /// The WebView for the document that includes this frame.
66 #[deprecated]
67 #[unsafe(method(webView))]
68 #[unsafe(method_family = none)]
69 pub unsafe fn webView(&self, mtm: MainThreadMarker) -> Option<Retained<WebView>>;
70
71 #[cfg(all(feature = "WebFrameView", feature = "objc2-app-kit"))]
72 #[cfg(target_os = "macos")]
73 /// The WebFrameView for this frame.
74 #[deprecated]
75 #[unsafe(method(frameView))]
76 #[unsafe(method_family = none)]
77 pub unsafe fn frameView(&self, mtm: MainThreadMarker) -> Option<Retained<WebFrameView>>;
78
79 #[cfg(all(
80 feature = "DOMDocument",
81 feature = "DOMNode",
82 feature = "DOMObject",
83 feature = "WebScriptObject"
84 ))]
85 /// The DOM document of the frame.
86 /// Returns nil if the frame does not contain a DOM document such as a standalone image.
87 #[deprecated]
88 #[unsafe(method(DOMDocument))]
89 #[unsafe(method_family = none)]
90 pub unsafe fn DOMDocument(&self) -> Option<Retained<DOMDocument>>;
91
92 #[cfg(all(
93 feature = "DOMElement",
94 feature = "DOMHTMLElement",
95 feature = "DOMNode",
96 feature = "DOMObject",
97 feature = "WebScriptObject"
98 ))]
99 /// The frame element of the frame.
100 /// The class of the result is either DOMHTMLFrameElement, DOMHTMLIFrameElement or DOMHTMLObjectElement.
101 /// Returns nil if the frame is the main frame since there is no frame element for the frame in this case.
102 #[deprecated]
103 #[unsafe(method(frameElement))]
104 #[unsafe(method_family = none)]
105 pub unsafe fn frameElement(&self) -> Option<Retained<DOMHTMLElement>>;
106
107 /// Parameter `request`: The web request to load.
108 #[deprecated]
109 #[unsafe(method(loadRequest:))]
110 #[unsafe(method_family = none)]
111 pub unsafe fn loadRequest(&self, request: Option<&NSURLRequest>);
112
113 /// Parameter `data`: The data to use for the main page of the document.
114 ///
115 /// Parameter `MIMEType`: The MIME type of the data.
116 ///
117 /// Parameter `encodingName`: The encoding of the data.
118 ///
119 /// Parameter `URL`: The base URL to apply to relative URLs within the document.
120 #[deprecated]
121 #[unsafe(method(loadData:MIMEType:textEncodingName:baseURL:))]
122 #[unsafe(method_family = none)]
123 pub unsafe fn loadData_MIMEType_textEncodingName_baseURL(
124 &self,
125 data: Option<&NSData>,
126 mime_type: Option<&NSString>,
127 encoding_name: Option<&NSString>,
128 url: Option<&NSURL>,
129 );
130
131 /// Parameter `string`: The string to use for the main page of the document.
132 ///
133 /// Parameter `URL`: The base URL to apply to relative URLs within the document.
134 #[deprecated]
135 #[unsafe(method(loadHTMLString:baseURL:))]
136 #[unsafe(method_family = none)]
137 pub unsafe fn loadHTMLString_baseURL(&self, string: Option<&NSString>, url: Option<&NSURL>);
138
139 /// Loads a page to display as a substitute for a URL that could not be reached.
140 ///
141 /// This allows clients to display page-loading errors in the webview itself.
142 /// This is typically called while processing the WebFrameLoadDelegate method
143 /// -webView:didFailProvisionalLoadWithError:forFrame: or one of the WebPolicyDelegate methods
144 /// -webView:decidePolicyForMIMEType:request:frame:decisionListener: or
145 /// -webView:unableToImplementPolicyWithError:frame:. If it is called from within one of those
146 /// three delegate methods then the back/forward list will be maintained appropriately.
147 ///
148 /// Parameter `string`: The string to use for the main page of the document.
149 ///
150 /// Parameter `baseURL`: The baseURL to apply to relative URLs within the document.
151 ///
152 /// Parameter `unreachableURL`: The URL for which this page will serve as alternate content.
153 #[deprecated]
154 #[unsafe(method(loadAlternateHTMLString:baseURL:forUnreachableURL:))]
155 #[unsafe(method_family = none)]
156 pub unsafe fn loadAlternateHTMLString_baseURL_forUnreachableURL(
157 &self,
158 string: Option<&NSString>,
159 base_url: Option<&NSURL>,
160 unreachable_url: Option<&NSURL>,
161 );
162
163 #[cfg(feature = "WebArchive")]
164 /// Causes WebFrame to load a WebArchive.
165 ///
166 /// Parameter `archive`: The archive to be loaded.
167 #[deprecated]
168 #[unsafe(method(loadArchive:))]
169 #[unsafe(method_family = none)]
170 pub unsafe fn loadArchive(&self, archive: Option<&WebArchive>);
171
172 #[cfg(feature = "WebDataSource")]
173 /// The datasource for this frame.
174 ///
175 /// Returns the committed data source. Will return nil if the
176 /// provisional data source hasn't yet been loaded.
177 #[deprecated]
178 #[unsafe(method(dataSource))]
179 #[unsafe(method_family = none)]
180 pub unsafe fn dataSource(&self) -> Option<Retained<WebDataSource>>;
181
182 #[cfg(feature = "WebDataSource")]
183 /// The provisional datasource of this frame.
184 ///
185 /// Will return the provisional data source. The provisional data source will
186 /// be nil if no data source has been set on the frame, or the data source
187 /// has successfully transitioned to the committed data source.
188 #[deprecated]
189 #[unsafe(method(provisionalDataSource))]
190 #[unsafe(method_family = none)]
191 pub unsafe fn provisionalDataSource(&self) -> Option<Retained<WebDataSource>>;
192
193 /// Stop any pending loads on the frame's data source,
194 /// and its children.
195 #[deprecated]
196 #[unsafe(method(stopLoading))]
197 #[unsafe(method_family = none)]
198 pub unsafe fn stopLoading(&self);
199
200 /// Performs HTTP/1.1 end-to-end revalidation using cache-validating conditionals if possible.
201 #[deprecated]
202 #[unsafe(method(reload))]
203 #[unsafe(method_family = none)]
204 pub unsafe fn reload(&self);
205
206 /// Performs HTTP/1.1 end-to-end reload.
207 #[deprecated]
208 #[unsafe(method(reloadFromOrigin))]
209 #[unsafe(method_family = none)]
210 pub unsafe fn reloadFromOrigin(&self);
211
212 /// This method returns a frame with the given name. findFrameNamed returns self
213 /// for _self and _current, the parent frame for _parent and the main frame for _top.
214 /// findFrameNamed returns self for _parent and _top if the receiver is the mainFrame.
215 /// findFrameNamed first searches from the current frame to all descending frames then the
216 /// rest of the frames in the WebView. If still not found, findFrameNamed searches the
217 /// frames of the other WebViews.
218 ///
219 /// Parameter `name`: The name of the frame to find.
220 ///
221 /// Returns: The frame matching the provided name. nil if the frame is not found.
222 #[deprecated]
223 #[unsafe(method(findFrameNamed:))]
224 #[unsafe(method_family = none)]
225 pub unsafe fn findFrameNamed(&self, name: Option<&NSString>) -> Option<Retained<WebFrame>>;
226
227 /// The frame containing this frame, or nil if this is a top level frame.
228 #[deprecated]
229 #[unsafe(method(parentFrame))]
230 #[unsafe(method_family = none)]
231 pub unsafe fn parentFrame(&self) -> Option<Retained<WebFrame>>;
232
233 /// An array of WebFrame.
234 ///
235 /// The frames in the array are associated with a frame set or iframe.
236 #[deprecated]
237 #[unsafe(method(childFrames))]
238 #[unsafe(method_family = none)]
239 pub unsafe fn childFrames(&self) -> Retained<NSArray>;
240
241 #[cfg(feature = "WebScriptObject")]
242 /// The WebScriptObject representing the frame's JavaScript window object.
243 #[deprecated]
244 #[unsafe(method(windowObject))]
245 #[unsafe(method_family = none)]
246 pub unsafe fn windowObject(&self) -> Option<Retained<WebScriptObject>>;
247
248 #[cfg(feature = "objc2-javascript-core")]
249 /// The frame's global JavaScript execution context.
250 ///
251 /// Use this method to bridge between the WebKit and JavaScriptCore APIs.
252 #[deprecated]
253 #[unsafe(method(globalContext))]
254 #[unsafe(method_family = none)]
255 pub unsafe fn globalContext(&self) -> JSGlobalContextRef;
256
257 #[cfg(feature = "objc2-javascript-core")]
258 /// The frame's global JavaScript execution context.
259 ///
260 /// Use this method to bridge between the WebKit and Objective-C JavaScriptCore API.
261 #[deprecated]
262 #[unsafe(method(javaScriptContext))]
263 #[unsafe(method_family = none)]
264 pub unsafe fn javaScriptContext(&self) -> Option<Retained<JSContext>>;
265 );
266}
267
268/// Methods declared on superclass `NSObject`.
269impl WebFrame {
270 extern_methods!(
271 #[unsafe(method(init))]
272 #[unsafe(method_family = init)]
273 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
274
275 #[unsafe(method(new))]
276 #[unsafe(method_family = new)]
277 pub unsafe fn new() -> Retained<Self>;
278 );
279}