objc2_web_kit/generated/
WebDataSource.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
8use crate::*;
9
10extern_class!(
11    /// A WebDataSource represents the data associated with a web page.
12    /// A datasource has a WebDocumentRepresentation which holds an appropriate
13    /// representation of the data.  WebDataSources manage a hierarchy of WebFrames.
14    /// WebDataSources are typically related to a view by their containing WebFrame.
15    ///
16    /// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/webdatasource?language=objc)
17    #[unsafe(super(NSObject))]
18    #[derive(Debug, PartialEq, Eq, Hash)]
19    #[deprecated]
20    pub struct WebDataSource;
21);
22
23extern_conformance!(
24    unsafe impl NSObjectProtocol for WebDataSource {}
25);
26
27impl WebDataSource {
28    extern_methods!(
29        /// The designated initializer for WebDataSource.
30        ///
31        /// Parameter `request`: The request to use in creating a datasource.
32        ///
33        /// Returns: Returns an initialized WebDataSource.
34        ///
35        /// # Safety
36        ///
37        /// `request` might not allow `None`.
38        #[deprecated]
39        #[unsafe(method(initWithRequest:))]
40        #[unsafe(method_family = init)]
41        pub unsafe fn initWithRequest(
42            this: Allocated<Self>,
43            request: Option<&NSURLRequest>,
44        ) -> Option<Retained<Self>>;
45
46        /// Returns the raw data associated with the datasource.  Returns nil
47        /// if the datasource hasn't loaded any data.
48        ///
49        /// The data will be incomplete until the datasource has completely loaded.
50        #[deprecated]
51        #[unsafe(method(data))]
52        #[unsafe(method_family = none)]
53        pub unsafe fn data(&self) -> Retained<NSData>;
54
55        #[cfg(feature = "WebDocument")]
56        /// The representation associated with this datasource.
57        /// Returns nil if the datasource hasn't created its representation.
58        ///
59        /// A representation holds a type specific representation
60        /// of the datasource's data.  The representation class is determined by mapping
61        /// a MIME type to a class.  The representation is created once the MIME type
62        /// of the datasource content has been determined.
63        #[deprecated]
64        #[unsafe(method(representation))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn representation(
67            &self,
68        ) -> Option<Retained<ProtocolObject<dyn WebDocumentRepresentation>>>;
69
70        #[cfg(feature = "WebFrame")]
71        /// The frame that represents this data source.
72        #[deprecated]
73        #[unsafe(method(webFrame))]
74        #[unsafe(method_family = none)]
75        pub unsafe fn webFrame(&self) -> Option<Retained<WebFrame>>;
76
77        /// A reference to the original request that created the
78        /// datasource.  This request will be unmodified by WebKit.
79        #[deprecated]
80        #[unsafe(method(initialRequest))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn initialRequest(&self) -> Option<Retained<NSURLRequest>>;
83
84        /// The request that was used to create this datasource.
85        #[deprecated]
86        #[unsafe(method(request))]
87        #[unsafe(method_family = none)]
88        pub unsafe fn request(&self) -> Option<Retained<NSMutableURLRequest>>;
89
90        /// The NSURLResponse for the data source.
91        #[deprecated]
92        #[unsafe(method(response))]
93        #[unsafe(method_family = none)]
94        pub unsafe fn response(&self) -> Option<Retained<NSURLResponse>>;
95
96        /// Returns either the override encoding, as set on the WebView for this
97        /// dataSource or the encoding from the response.
98        #[deprecated]
99        #[unsafe(method(textEncodingName))]
100        #[unsafe(method_family = none)]
101        pub unsafe fn textEncodingName(&self) -> Retained<NSString>;
102
103        /// Returns YES if there are any pending loads.
104        #[deprecated]
105        #[unsafe(method(isLoading))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn isLoading(&self) -> bool;
108
109        /// The page title or nil.
110        #[deprecated]
111        #[unsafe(method(pageTitle))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn pageTitle(&self) -> Retained<NSString>;
114
115        /// The unreachableURL for which this dataSource is showing alternate content, or nil.
116        ///
117        /// This will be non-nil only for dataSources created by calls to the
118        /// WebFrame method loadAlternateHTMLString:baseURL:forUnreachableURL:.
119        #[deprecated]
120        #[unsafe(method(unreachableURL))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn unreachableURL(&self) -> Option<Retained<NSURL>>;
123
124        #[cfg(feature = "WebArchive")]
125        /// A WebArchive representing the data source, its subresources and child frames.
126        /// This method constructs a WebArchive using the original downloaded data.
127        /// In the case of HTML, if the current state of the document is preferred, webArchive should be
128        /// called on the DOM document instead.
129        #[deprecated]
130        #[unsafe(method(webArchive))]
131        #[unsafe(method_family = none)]
132        pub unsafe fn webArchive(&self) -> Option<Retained<WebArchive>>;
133
134        #[cfg(feature = "WebResource")]
135        /// A WebResource representing the data source.
136        /// This method constructs a WebResource using the original downloaded data.
137        /// This method can be used to construct a WebArchive in case the archive returned by
138        /// WebDataSource's webArchive isn't sufficient.
139        #[deprecated]
140        #[unsafe(method(mainResource))]
141        #[unsafe(method_family = none)]
142        pub unsafe fn mainResource(&self) -> Option<Retained<WebResource>>;
143
144        /// All the subresources associated with the data source.
145        /// The returned array only contains subresources that have fully downloaded.
146        #[deprecated]
147        #[unsafe(method(subresources))]
148        #[unsafe(method_family = none)]
149        pub unsafe fn subresources(&self) -> Retained<NSArray>;
150
151        #[cfg(feature = "WebResource")]
152        /// method subresourceForURL:
153        ///
154        /// Returns a subresource for a given URL.
155        ///
156        /// Parameter `URL`: The URL of the subresource.
157        /// Returns non-nil if the data source has fully downloaded a subresource with the given URL.
158        ///
159        /// # Safety
160        ///
161        /// `url` might not allow `None`.
162        #[deprecated]
163        #[unsafe(method(subresourceForURL:))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn subresourceForURL(
166            &self,
167            url: Option<&NSURL>,
168        ) -> Option<Retained<WebResource>>;
169
170        #[cfg(feature = "WebResource")]
171        /// Adds a subresource to the data source.
172        ///
173        /// Parameter `subresource`: The subresource to be added.
174        /// addSubresource: adds a subresource to the data source's list of subresources.
175        /// Later, if something causes the data source to load the URL of the subresource, the data source
176        /// will load the data from the subresource instead of from the network. For example, if one wants to add
177        /// an image that is already downloaded to a web page, addSubresource: can be called so that the data source
178        /// uses the downloaded image rather than accessing the network. NOTE: If the data source already has a
179        /// subresource with the same URL, addSubresource: will replace it.
180        ///
181        /// # Safety
182        ///
183        /// `subresource` might not allow `None`.
184        #[deprecated]
185        #[unsafe(method(addSubresource:))]
186        #[unsafe(method_family = none)]
187        pub unsafe fn addSubresource(&self, subresource: Option<&WebResource>);
188    );
189}
190
191/// Methods declared on superclass `NSObject`.
192impl WebDataSource {
193    extern_methods!(
194        #[unsafe(method(init))]
195        #[unsafe(method_family = init)]
196        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
197
198        #[unsafe(method(new))]
199        #[unsafe(method_family = new)]
200        pub unsafe fn new() -> Retained<Self>;
201    );
202}