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