objc2_browser_engine_kit/generated/
BECapability.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::*;
6#[cfg(feature = "objc2-av-foundation")]
7use objc2_av_foundation::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12extern_protocol!(
13    /// An object that represents a granted capability.
14    ///
15    /// See also [Apple's documentation](https://developer.apple.com/documentation/browserenginekit/beprocesscapabilitygrant?language=objc)
16    pub unsafe trait BEProcessCapabilityGrant: NSObjectProtocol {
17        /// Invalidates the grant, removing the capability from the process it was granted to.
18        #[unsafe(method(invalidate))]
19        #[unsafe(method_family = none)]
20        unsafe fn invalidate(&self) -> bool;
21
22        /// `YES` if the process has been granted the capability and the grant is still valid.
23        #[unsafe(method(isValid))]
24        #[unsafe(method_family = none)]
25        unsafe fn isValid(&self) -> bool;
26    }
27);
28
29extern_class!(
30    /// An object that represents a media playback environment
31    ///
32    /// See also [Apple's documentation](https://developer.apple.com/documentation/browserenginekit/bemediaenvironment?language=objc)
33    #[unsafe(super(NSObject))]
34    #[derive(Debug, PartialEq, Eq, Hash)]
35    pub struct BEMediaEnvironment;
36);
37
38extern_conformance!(
39    unsafe impl NSObjectProtocol for BEMediaEnvironment {}
40);
41
42impl BEMediaEnvironment {
43    extern_methods!(
44        #[unsafe(method(init))]
45        #[unsafe(method_family = init)]
46        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
47
48        #[unsafe(method(new))]
49        #[unsafe(method_family = new)]
50        pub unsafe fn new() -> Retained<Self>;
51
52        /// Creates a new media playback environment identified by the web page URL
53        ///
54        /// - Parameters:
55        /// - url: The URL identifying the media playback environment
56        #[unsafe(method(initWithWebPageURL:))]
57        #[unsafe(method_family = init)]
58        pub unsafe fn initWithWebPageURL(this: Allocated<Self>, url: &NSURL) -> Retained<Self>;
59
60        /// Activates the media environment.
61        #[unsafe(method(activateWithError:_))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn activateWithError(&self) -> Result<(), Retained<NSError>>;
64
65        /// Suspends the media environment.
66        #[unsafe(method(suspendWithError:_))]
67        #[unsafe(method_family = none)]
68        pub unsafe fn suspendWithError(&self) -> Result<(), Retained<NSError>>;
69
70        #[cfg(feature = "objc2-av-foundation")]
71        /// Creates a new capture session in this media environment.
72        ///
73        /// The media environment must be activated before the capture session can be started.
74        #[unsafe(method(makeCaptureSessionWithError:_))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn makeCaptureSessionWithError(
77            &self,
78        ) -> Result<Retained<AVCaptureSession>, Retained<NSError>>;
79    );
80}
81
82extern_class!(
83    /// An object representing capabilities that can be granted to a helper extension process.
84    ///
85    /// See also [Apple's documentation](https://developer.apple.com/documentation/browserenginekit/beprocesscapability?language=objc)
86    #[unsafe(super(NSObject))]
87    #[derive(Debug, PartialEq, Eq, Hash)]
88    pub struct BEProcessCapability;
89);
90
91extern_conformance!(
92    unsafe impl NSObjectProtocol for BEProcessCapability {}
93);
94
95impl BEProcessCapability {
96    extern_methods!(
97        /// The helper extension process may access AV hardware required for media capture and playback.
98        #[unsafe(method(mediaPlaybackAndCaptureWithEnvironment:))]
99        #[unsafe(method_family = none)]
100        pub unsafe fn mediaPlaybackAndCaptureWithEnvironment(
101            environment: &BEMediaEnvironment,
102        ) -> Retained<Self>;
103
104        /// The helper extension process may run in the background to finish work.
105        #[unsafe(method(background))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn background() -> Retained<Self>;
108
109        /// The helper extension process may run at foreground priority to work on behalf of the host process while it is foreground.
110        #[unsafe(method(foreground))]
111        #[unsafe(method_family = none)]
112        pub unsafe fn foreground() -> Retained<Self>;
113
114        /// The helper extension process may remain resident in a suspended state (it will not be granted CPU time).
115        #[unsafe(method(suspended))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn suspended() -> Retained<Self>;
118    );
119}
120
121/// Methods declared on superclass `NSObject`.
122impl BEProcessCapability {
123    extern_methods!(
124        #[unsafe(method(init))]
125        #[unsafe(method_family = init)]
126        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
127
128        #[unsafe(method(new))]
129        #[unsafe(method_family = new)]
130        pub unsafe fn new() -> Retained<Self>;
131    );
132}
133
134/// Capability.
135#[cfg(feature = "BEWebContentProcess")]
136impl BEWebContentProcess {
137    extern_methods!(
138        /// Grants the specified capability to the process.
139        ///
140        /// This method grants the specified capability to the process or returns nil and an error if it can not be granted.
141        ///
142        /// - Parameters:
143        /// - capability: The capability to be granted
144        /// - error: The error out param populated if the capability cannot be granted.
145        ///
146        /// - Returns: an invalidatable grant object that represents the granted capability.
147        #[unsafe(method(grantCapability:error:_))]
148        #[unsafe(method_family = none)]
149        pub unsafe fn grantCapability_error(
150            &self,
151            capability: &BEProcessCapability,
152        ) -> Result<Retained<ProtocolObject<dyn BEProcessCapabilityGrant>>, Retained<NSError>>;
153    );
154}
155
156/// CapabilityInvalidationHandler.
157#[cfg(feature = "BEWebContentProcess")]
158impl BEWebContentProcess {
159    extern_methods!(
160        #[cfg(feature = "block2")]
161        /// Grants the specified capability to the process with invalidation handler.
162        ///
163        /// This method grants the specified capability to the process or returns nil and an error if it can not be granted.
164        ///
165        /// - Parameters:
166        /// - capability: The capability to be granted
167        /// - error: The error out param populated if the capability cannot be granted.
168        /// - invalidationHandler: The invalidation handler
169        ///
170        /// - Returns: an invalidatable grant object that represents the granted capability.
171        #[unsafe(method(grantCapability:error:invalidationHandler:))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn grantCapability_error_invalidationHandler(
174            &self,
175            capability: &BEProcessCapability,
176            error: Option<&mut Option<Retained<NSError>>>,
177            invalidation_handler: &block2::DynBlock<dyn Fn()>,
178        ) -> Option<Retained<ProtocolObject<dyn BEProcessCapabilityGrant>>>;
179    );
180}
181
182/// Capability.
183#[cfg(feature = "BERenderingProcess")]
184impl BERenderingProcess {
185    extern_methods!(
186        /// Grants the specified capability to the process.
187        ///
188        /// This method grants the specified capability to the process or returns nil and an error if it can not be granted.
189        ///
190        /// - Parameters:
191        /// - capability: The capability to be granted
192        /// - error: The error out param populated if the capability cannot be granted.
193        ///
194        /// - Returns: an invalidatable grant object that represents the granted capability.
195        #[unsafe(method(grantCapability:error:_))]
196        #[unsafe(method_family = none)]
197        pub unsafe fn grantCapability_error(
198            &self,
199            capability: &BEProcessCapability,
200        ) -> Result<Retained<ProtocolObject<dyn BEProcessCapabilityGrant>>, Retained<NSError>>;
201    );
202}
203
204/// CapabilityInvalidationHandler.
205#[cfg(feature = "BERenderingProcess")]
206impl BERenderingProcess {
207    extern_methods!(
208        #[cfg(feature = "block2")]
209        /// Grants the specified capability to the process with invalidation handler.
210        ///
211        /// This method grants the specified capability to the process or returns nil and an error if it can not be granted.
212        ///
213        /// - Parameters:
214        /// - capability: The capability to be granted
215        /// - error: The error out param populated if the capability cannot be granted.
216        /// - invalidationHandler: The invalidation handler
217        ///
218        /// - Returns: an invalidatable grant object that represents the granted capability.
219        #[unsafe(method(grantCapability:error:invalidationHandler:))]
220        #[unsafe(method_family = none)]
221        pub unsafe fn grantCapability_error_invalidationHandler(
222            &self,
223            capability: &BEProcessCapability,
224            error: Option<&mut Option<Retained<NSError>>>,
225            invalidation_handler: &block2::DynBlock<dyn Fn()>,
226        ) -> Option<Retained<ProtocolObject<dyn BEProcessCapabilityGrant>>>;
227    );
228}
229
230/// Capability.
231#[cfg(feature = "BENetworkingProcess")]
232impl BENetworkingProcess {
233    extern_methods!(
234        /// Grants the specified capability to the process.
235        ///
236        /// This method grants the specified capability to the process or returns nil and an error if it can not be granted.
237        ///
238        /// - Parameters:
239        /// - capability: The capability to be granted
240        /// - error: The error out param populated if the capability cannot be granted.
241        ///
242        /// - Returns: an invalidatable grant object that represents the granted capability.
243        #[unsafe(method(grantCapability:error:_))]
244        #[unsafe(method_family = none)]
245        pub unsafe fn grantCapability_error(
246            &self,
247            capability: &BEProcessCapability,
248        ) -> Result<Retained<ProtocolObject<dyn BEProcessCapabilityGrant>>, Retained<NSError>>;
249    );
250}
251
252/// CapabilityInvalidationHandler.
253#[cfg(feature = "BENetworkingProcess")]
254impl BENetworkingProcess {
255    extern_methods!(
256        #[cfg(feature = "block2")]
257        /// Grants the specified capability to the process with invalidation handler.
258        ///
259        /// This method grants the specified capability to the process or returns nil and an error if it can not be granted.
260        ///
261        /// - Parameters:
262        /// - capability: The capability to be granted
263        /// - error: The error out param populated if the capability cannot be granted.
264        /// - invalidationHandler: The invalidation handler
265        ///
266        /// - Returns: an invalidatable grant object that represents the granted capability.
267        #[unsafe(method(grantCapability:error:invalidationHandler:))]
268        #[unsafe(method_family = none)]
269        pub unsafe fn grantCapability_error_invalidationHandler(
270            &self,
271            capability: &BEProcessCapability,
272            error: Option<&mut Option<Retained<NSError>>>,
273            invalidation_handler: &block2::DynBlock<dyn Fn()>,
274        ) -> Option<Retained<ProtocolObject<dyn BEProcessCapabilityGrant>>>;
275    );
276}