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