objc2_system_extensions/generated/
mod.rs

1// This file has been automatically generated by `objc2`'s `header-translator`.
2// DO NOT EDIT
3
4#![allow(unused_imports)]
5#![allow(deprecated)]
6#![allow(non_snake_case)]
7#![allow(non_camel_case_types)]
8#![allow(non_upper_case_globals)]
9#![allow(missing_docs)]
10#![allow(clippy::too_many_arguments)]
11#![allow(clippy::type_complexity)]
12#![allow(clippy::upper_case_acronyms)]
13#![allow(clippy::identity_op)]
14#![allow(clippy::missing_safety_doc)]
15#![allow(clippy::doc_lazy_continuation)]
16#![allow(rustdoc::broken_intra_doc_links)]
17#![allow(rustdoc::bare_urls)]
18#![allow(rustdoc::unportable_markdown)]
19#![allow(rustdoc::invalid_html_tags)]
20
21#[link(name = "SystemExtensions", kind = "framework")]
22extern "C" {}
23
24use core::ffi::*;
25use core::ptr::NonNull;
26#[cfg(feature = "dispatch2")]
27use dispatch2::*;
28use objc2::__framework_prelude::*;
29use objc2_foundation::*;
30
31use crate::*;
32
33extern "C" {
34    /// [Apple's documentation](https://developer.apple.com/documentation/systemextensions/ossystemextensionerrordomain?language=objc)
35    pub static OSSystemExtensionErrorDomain: &'static NSErrorDomain;
36}
37
38extern "C" {
39    /// A property of a Driver Extension bundle containing a message that tells
40    /// the user why the app is requesting to install it.
41    ///
42    ///
43    /// The 'OSBundleUsageDescription' key is required in your Driver
44    /// Extension if your app uses APIs that install them.
45    ///
46    /// See also [Apple's documentation](https://developer.apple.com/documentation/systemextensions/osbundleusagedescriptionkey?language=objc)
47    pub static OSBundleUsageDescriptionKey: &'static NSString;
48}
49
50extern "C" {
51    /// A property of a System Extension bundle containing a message that tells
52    /// the user why the app is requesting to install it.
53    ///
54    ///
55    /// The 'NSSystemExtensionUsageDescription' key is required in your
56    /// System Extension if your app uses APIs that install them.
57    ///
58    /// See also [Apple's documentation](https://developer.apple.com/documentation/systemextensions/nssystemextensionusagedescriptionkey?language=objc)
59    pub static NSSystemExtensionUsageDescriptionKey: &'static NSString;
60}
61
62extern "C" {
63    /// An optional property of a System Extension bundle naming the bundle
64    /// identifier of a kernel extension (kext) with similar purpose and capabilities.
65    ///
66    ///
67    /// The 'OSRelatedKernelExtension' key is optional. If one is present
68    /// and the related kernel extension has the same Team ID and is approved by the
69    /// system policy, this System Extension is also approved.
70    ///
71    /// See also [Apple's documentation](https://developer.apple.com/documentation/systemextensions/osrelatedkernelextensionkey?language=objc)
72    pub static OSRelatedKernelExtensionKey: &'static NSString;
73}
74
75/// [Apple's documentation](https://developer.apple.com/documentation/systemextensions/ossystemextensionerrorcode?language=objc)
76// NS_ERROR_ENUM
77#[repr(transparent)]
78#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
79pub struct OSSystemExtensionErrorCode(pub NSInteger);
80impl OSSystemExtensionErrorCode {
81    #[doc(alias = "OSSystemExtensionErrorUnknown")]
82    pub const Unknown: Self = Self(1);
83    #[doc(alias = "OSSystemExtensionErrorMissingEntitlement")]
84    pub const MissingEntitlement: Self = Self(2);
85    #[doc(alias = "OSSystemExtensionErrorUnsupportedParentBundleLocation")]
86    pub const UnsupportedParentBundleLocation: Self = Self(3);
87    #[doc(alias = "OSSystemExtensionErrorExtensionNotFound")]
88    pub const ExtensionNotFound: Self = Self(4);
89    #[doc(alias = "OSSystemExtensionErrorExtensionMissingIdentifier")]
90    pub const ExtensionMissingIdentifier: Self = Self(5);
91    #[doc(alias = "OSSystemExtensionErrorDuplicateExtensionIdentifer")]
92    pub const DuplicateExtensionIdentifer: Self = Self(6);
93    #[doc(alias = "OSSystemExtensionErrorUnknownExtensionCategory")]
94    pub const UnknownExtensionCategory: Self = Self(7);
95    #[doc(alias = "OSSystemExtensionErrorCodeSignatureInvalid")]
96    pub const CodeSignatureInvalid: Self = Self(8);
97    #[doc(alias = "OSSystemExtensionErrorValidationFailed")]
98    pub const ValidationFailed: Self = Self(9);
99    #[doc(alias = "OSSystemExtensionErrorForbiddenBySystemPolicy")]
100    pub const ForbiddenBySystemPolicy: Self = Self(10);
101    #[doc(alias = "OSSystemExtensionErrorRequestCanceled")]
102    pub const RequestCanceled: Self = Self(11);
103    #[doc(alias = "OSSystemExtensionErrorRequestSuperseded")]
104    pub const RequestSuperseded: Self = Self(12);
105    #[doc(alias = "OSSystemExtensionErrorAuthorizationRequired")]
106    pub const AuthorizationRequired: Self = Self(13);
107}
108
109unsafe impl Encode for OSSystemExtensionErrorCode {
110    const ENCODING: Encoding = NSInteger::ENCODING;
111}
112
113unsafe impl RefEncode for OSSystemExtensionErrorCode {
114    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
115}
116
117/// [Apple's documentation](https://developer.apple.com/documentation/systemextensions/ossystemextensionreplacementaction?language=objc)
118// NS_ENUM
119#[repr(transparent)]
120#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
121pub struct OSSystemExtensionReplacementAction(pub NSInteger);
122impl OSSystemExtensionReplacementAction {
123    /// Returned by the delegate when it determines that replacing an existing
124    /// System Extension should not proceed.
125    #[doc(alias = "OSSystemExtensionReplacementActionCancel")]
126    pub const Cancel: Self = Self(0);
127    /// Returned by the delegate when it determines that replacing an existing
128    /// System Extension is desired.
129    #[doc(alias = "OSSystemExtensionReplacementActionReplace")]
130    pub const Replace: Self = Self(1);
131}
132
133unsafe impl Encode for OSSystemExtensionReplacementAction {
134    const ENCODING: Encoding = NSInteger::ENCODING;
135}
136
137unsafe impl RefEncode for OSSystemExtensionReplacementAction {
138    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
139}
140
141/// Describes additional result feedback after completion of a system extension request
142///
143/// See also [Apple's documentation](https://developer.apple.com/documentation/systemextensions/ossystemextensionrequestresult?language=objc)
144// NS_ENUM
145#[repr(transparent)]
146#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
147pub struct OSSystemExtensionRequestResult(pub NSInteger);
148impl OSSystemExtensionRequestResult {
149    /// The request was successfully completed.
150    #[doc(alias = "OSSystemExtensionRequestCompleted")]
151    pub const Completed: Self = Self(0);
152    /// The request will be successfully completed after a reboot.
153    #[doc(alias = "OSSystemExtensionRequestWillCompleteAfterReboot")]
154    pub const WillCompleteAfterReboot: Self = Self(1);
155}
156
157unsafe impl Encode for OSSystemExtensionRequestResult {
158    const ENCODING: Encoding = NSInteger::ENCODING;
159}
160
161unsafe impl RefEncode for OSSystemExtensionRequestResult {
162    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
163}
164
165extern_class!(
166    /// [Apple's documentation](https://developer.apple.com/documentation/systemextensions/ossystemextensionrequest?language=objc)
167    #[unsafe(super(NSObject))]
168    #[derive(Debug, PartialEq, Eq, Hash)]
169    pub struct OSSystemExtensionRequest;
170);
171
172extern_conformance!(
173    unsafe impl NSObjectProtocol for OSSystemExtensionRequest {}
174);
175
176impl OSSystemExtensionRequest {
177    extern_methods!(
178        #[cfg(feature = "dispatch2")]
179        /// Creates a request to activate a System Extension.
180        ///
181        ///
182        /// This method creates a new request to activate a System Extension.
183        /// Extensions are bundles discovered from the `Contents/Library/SystemExtensions`
184        /// directory of the main application bundle.
185        ///
186        ///
187        /// Parameter `identifier`: The bundle identifier of the target extension.
188        ///
189        ///
190        /// Parameter `queue`: The dispatch queue to use when calling delegate methods.
191        ///
192        ///
193        /// Returns: A new extension request.
194        ///
195        ///
196        /// Note: It is expected that an application create and submit an activation
197        /// request whenever an extension should be active. Upon submitting an activation
198        /// request for an inactive extension, user approval may be required and the
199        /// request will not succeed until approval is given.
200        ///
201        /// If the extension is already active then the request will succeed in short
202        /// order without significant delay or user interaction. Activating an new version
203        /// of an already active extension will prompt the delegate to resolve the conflict
204        /// before proceeding.
205        ///
206        /// An activation request can be successful but also indicate that a reboot is
207        /// required in order for the extension to become active. This can occur when
208        /// replacing an existing extension that required a reboot in order to deactivate.
209        /// The most recently activated extension will then become active when the system
210        /// is next rebooted.
211        #[unsafe(method(activationRequestForExtension:queue:))]
212        #[unsafe(method_family = none)]
213        pub unsafe fn activationRequestForExtension_queue(
214            identifier: &NSString,
215            queue: &DispatchQueue,
216        ) -> Retained<Self>;
217
218        #[cfg(feature = "dispatch2")]
219        /// Creates a request to deactivate a System Extension.
220        ///
221        ///
222        /// This method creates a new request to deactivate a System Extension.
223        /// Extensions are discovered from the `Contents/Library/SystemExtensions`
224        /// directory of the main application bundle.
225        ///
226        ///
227        /// Parameter `identifier`: The bundle identifier of the target extension.
228        ///
229        ///
230        /// Parameter `queue`: The dispatch queue to use when calling delegate methods.
231        ///
232        ///
233        /// Note: It is possible for an extension to require a reboot before it is fully
234        /// deactivated. If a request succeeds and indicates a reboot is required, the
235        /// extension may still appear to be operational until that time.
236        #[unsafe(method(deactivationRequestForExtension:queue:))]
237        #[unsafe(method_family = none)]
238        pub unsafe fn deactivationRequestForExtension_queue(
239            identifier: &NSString,
240            queue: &DispatchQueue,
241        ) -> Retained<Self>;
242
243        #[cfg(feature = "dispatch2")]
244        /// Creates a request to get information about System Extensions.
245        ///
246        ///
247        /// This method creates a new request to retrieve the properties
248        /// of any System Extensions matching the given identifier.
249        ///
250        ///
251        /// Parameter `identifier`: The bundle identifier of the target extension(s).
252        ///
253        ///
254        /// Parameter `queue`: The dispatch queue to use when calling delegate methods.
255        #[unsafe(method(propertiesRequestForExtension:queue:))]
256        #[unsafe(method_family = none)]
257        pub unsafe fn propertiesRequestForExtension_queue(
258            identifier: &NSString,
259            queue: &DispatchQueue,
260        ) -> Retained<Self>;
261
262        /// A delegate to receive updates about the progress of a request
263        #[unsafe(method(delegate))]
264        #[unsafe(method_family = none)]
265        pub unsafe fn delegate(
266            &self,
267        ) -> Option<Retained<ProtocolObject<dyn OSSystemExtensionRequestDelegate>>>;
268
269        /// This is a [weak property][objc2::topics::weak_property].
270        /// Setter for [`delegate`][Self::delegate].
271        #[unsafe(method(setDelegate:))]
272        #[unsafe(method_family = none)]
273        pub unsafe fn setDelegate(
274            &self,
275            delegate: Option<&ProtocolObject<dyn OSSystemExtensionRequestDelegate>>,
276        );
277
278        /// The bundle identifier of the target extension
279        #[unsafe(method(identifier))]
280        #[unsafe(method_family = none)]
281        pub unsafe fn identifier(&self) -> Retained<NSString>;
282    );
283}
284
285/// Methods declared on superclass `NSObject`.
286impl OSSystemExtensionRequest {
287    extern_methods!(
288        #[unsafe(method(init))]
289        #[unsafe(method_family = init)]
290        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
291
292        #[unsafe(method(new))]
293        #[unsafe(method_family = new)]
294        pub unsafe fn new() -> Retained<Self>;
295    );
296}
297
298extern_class!(
299    /// [Apple's documentation](https://developer.apple.com/documentation/systemextensions/ossystemextensionproperties?language=objc)
300    #[unsafe(super(NSObject))]
301    #[derive(Debug, PartialEq, Eq, Hash)]
302    pub struct OSSystemExtensionProperties;
303);
304
305extern_conformance!(
306    unsafe impl NSObjectProtocol for OSSystemExtensionProperties {}
307);
308
309impl OSSystemExtensionProperties {
310    extern_methods!(
311        /// The file URL locating an indicating the extension bundle these properties
312        /// were retreived from.
313        #[unsafe(method(URL))]
314        #[unsafe(method_family = none)]
315        pub unsafe fn URL(&self) -> Retained<NSURL>;
316
317        /// The bundle identifier of the extension (CFBundleIdentifier)
318        #[unsafe(method(bundleIdentifier))]
319        #[unsafe(method_family = none)]
320        pub unsafe fn bundleIdentifier(&self) -> Retained<NSString>;
321
322        /// The bundle version of the extension (CFBundleVersion)
323        #[unsafe(method(bundleVersion))]
324        #[unsafe(method_family = none)]
325        pub unsafe fn bundleVersion(&self) -> Retained<NSString>;
326
327        /// The bundle short version string of the extension (CFBundleShortVersionString)
328        #[unsafe(method(bundleShortVersion))]
329        #[unsafe(method_family = none)]
330        pub unsafe fn bundleShortVersion(&self) -> Retained<NSString>;
331
332        /// Returns the enabled state of the extension
333        #[unsafe(method(isEnabled))]
334        #[unsafe(method_family = none)]
335        pub unsafe fn isEnabled(&self) -> bool;
336
337        /// Returns whether an extension is waiting for user approval
338        #[unsafe(method(isAwaitingUserApproval))]
339        #[unsafe(method_family = none)]
340        pub unsafe fn isAwaitingUserApproval(&self) -> bool;
341
342        /// Returns if an extension is being uninstalled
343        #[unsafe(method(isUninstalling))]
344        #[unsafe(method_family = none)]
345        pub unsafe fn isUninstalling(&self) -> bool;
346    );
347}
348
349/// Methods declared on superclass `NSObject`.
350impl OSSystemExtensionProperties {
351    extern_methods!(
352        #[unsafe(method(init))]
353        #[unsafe(method_family = init)]
354        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
355
356        #[unsafe(method(new))]
357        #[unsafe(method_family = new)]
358        pub unsafe fn new() -> Retained<Self>;
359    );
360}
361
362extern_protocol!(
363    /// [Apple's documentation](https://developer.apple.com/documentation/systemextensions/ossystemextensionrequestdelegate?language=objc)
364    pub unsafe trait OSSystemExtensionRequestDelegate: NSObjectProtocol {
365        /// Called when the target extension bundle identifier is already activated.
366        ///
367        ///
368        /// The delegate will receive this callback when an activation request
369        /// encounters an existing extension with the same team and bundle identifiers but
370        /// with different version identifiers. The delegate must make a decision on
371        /// whether or not to replace the existing extension.
372        ///
373        ///
374        /// Parameter `request`: The request that encountered the conflict
375        ///
376        ///
377        /// Parameter `existing`: The NSBundle of the existing extension
378        ///
379        ///
380        /// Parameter `ext`: The NSBundle of the extension matching the bundle identifier of the request
381        ///
382        ///
383        /// Returns: A replacement action indicating the desired outcome of the conflict
384        ///
385        ///
386        /// Note: This method is invoked if the `CFBundleVersion` or `CFBundleShortVersionString`
387        /// identifiers of the target and existing extension differ.
388        ///
389        /// If the local system has System Extension developer mode enabled, this callback
390        /// will always fire when an existing extension is found, regardless of version
391        /// identifiers.
392        ///
393        /// Returning OSSystemExtensionReplacementActionAbortRequest will trigger a callback
394        /// to `request:didFailWithError:` with the OSSystemExtensionErrorRequestCanceled
395        /// error code.
396        #[unsafe(method(request:actionForReplacingExtension:withExtension:))]
397        #[unsafe(method_family = none)]
398        unsafe fn request_actionForReplacingExtension_withExtension(
399            &self,
400            request: &OSSystemExtensionRequest,
401            existing: &OSSystemExtensionProperties,
402            ext: &OSSystemExtensionProperties,
403        ) -> OSSystemExtensionReplacementAction;
404
405        /// Called when the target extension requires user approval to be activated.
406        ///
407        ///
408        /// Activating an extension may require explicit user approval in order
409        /// to proceed. For example, this can occur when the user has never previously
410        /// approved this extension. If approval is necessary, this callback will be
411        /// triggered and the activation request will remain pending until user approves,
412        /// or until the application exits.
413        #[unsafe(method(requestNeedsUserApproval:))]
414        #[unsafe(method_family = none)]
415        unsafe fn requestNeedsUserApproval(&self, request: &OSSystemExtensionRequest);
416
417        /// Called when the target extension request has completed.
418        ///
419        ///
420        /// Successful results can come with additional information regarding
421        /// the manner in which they were completed. See the OSSystemExtensionRequestResult
422        /// documentation for more information.
423        ///
424        ///
425        /// Parameter `result`: Additional result information from the completed request.
426        ///
427        ///
428        /// Note: If the request completes with the `OSSystemExtensionRequestWillCompleteAfterReboot`
429        /// result, then the extension will not be active until after the next reboot. Upon
430        /// reboot, a given extension will be in the state dictated by the most recently
431        /// processed request.
432        #[unsafe(method(request:didFinishWithResult:))]
433        #[unsafe(method_family = none)]
434        unsafe fn request_didFinishWithResult(
435            &self,
436            request: &OSSystemExtensionRequest,
437            result: OSSystemExtensionRequestResult,
438        );
439
440        /// Called when the target extension request failed.
441        #[unsafe(method(request:didFailWithError:))]
442        #[unsafe(method_family = none)]
443        unsafe fn request_didFailWithError(
444            &self,
445            request: &OSSystemExtensionRequest,
446            error: &NSError,
447        );
448
449        /// Called request for properties has completed.
450        ///
451        ///
452        /// Parameter `properties`: Returns an array of OSSystemExtensionProperties matching the
453        /// requested bundle identifier.
454        #[optional]
455        #[unsafe(method(request:foundProperties:))]
456        #[unsafe(method_family = none)]
457        unsafe fn request_foundProperties(
458            &self,
459            request: &OSSystemExtensionRequest,
460            properties: &NSArray<OSSystemExtensionProperties>,
461        );
462    }
463);
464
465extern_class!(
466    /// [Apple's documentation](https://developer.apple.com/documentation/systemextensions/ossystemextensionmanager?language=objc)
467    #[unsafe(super(NSObject))]
468    #[derive(Debug, PartialEq, Eq, Hash)]
469    pub struct OSSystemExtensionManager;
470);
471
472extern_conformance!(
473    unsafe impl NSObjectProtocol for OSSystemExtensionManager {}
474);
475
476impl OSSystemExtensionManager {
477    extern_methods!(
478        #[unsafe(method(init))]
479        #[unsafe(method_family = init)]
480        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
481
482        #[unsafe(method(new))]
483        #[unsafe(method_family = new)]
484        pub unsafe fn new(&self) -> Retained<Self>;
485
486        #[unsafe(method(sharedManager))]
487        #[unsafe(method_family = none)]
488        pub unsafe fn sharedManager() -> Retained<OSSystemExtensionManager>;
489
490        /// Submits a System Extension request to the manager.
491        ///
492        ///
493        /// Parameter `request`: The request to process.
494        #[unsafe(method(submitRequest:))]
495        #[unsafe(method_family = none)]
496        pub unsafe fn submitRequest(&self, request: &OSSystemExtensionRequest);
497    );
498}
499
500/// Methods declared on superclass `NSObject`.
501impl OSSystemExtensionManager {
502    extern_methods!(
503        #[unsafe(method(new))]
504        #[unsafe(method_family = new)]
505        pub unsafe fn new_class() -> Retained<Self>;
506    );
507}
508
509extern_class!(
510    /// [Apple's documentation](https://developer.apple.com/documentation/systemextensions/ossystemextensioninfo?language=objc)
511    #[unsafe(super(NSObject))]
512    #[derive(Debug, PartialEq, Eq, Hash)]
513    pub struct OSSystemExtensionInfo;
514);
515
516unsafe impl Send for OSSystemExtensionInfo {}
517
518unsafe impl Sync for OSSystemExtensionInfo {}
519
520extern_conformance!(
521    unsafe impl NSObjectProtocol for OSSystemExtensionInfo {}
522);
523
524impl OSSystemExtensionInfo {
525    extern_methods!(
526        /// The bundle identifier of the extension (CFBundleIdentifier)
527        #[unsafe(method(bundleIdentifier))]
528        #[unsafe(method_family = none)]
529        pub unsafe fn bundleIdentifier(&self) -> Retained<NSString>;
530
531        /// The bundle version of the extension (CFBundleVersion)
532        #[unsafe(method(bundleVersion))]
533        #[unsafe(method_family = none)]
534        pub unsafe fn bundleVersion(&self) -> Retained<NSString>;
535
536        /// The bundle short version string of the extension (CFBundleShortVersionString)
537        #[unsafe(method(bundleShortVersion))]
538        #[unsafe(method_family = none)]
539        pub unsafe fn bundleShortVersion(&self) -> Retained<NSString>;
540    );
541}
542
543/// Methods declared on superclass `NSObject`.
544impl OSSystemExtensionInfo {
545    extern_methods!(
546        #[unsafe(method(init))]
547        #[unsafe(method_family = init)]
548        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
549
550        #[unsafe(method(new))]
551        #[unsafe(method_family = new)]
552        pub unsafe fn new() -> Retained<Self>;
553    );
554}
555
556extern_protocol!(
557    /// [Apple's documentation](https://developer.apple.com/documentation/systemextensions/ossystemextensionsworkspaceobserver?language=objc)
558    pub unsafe trait OSSystemExtensionsWorkspaceObserver: NSObjectProtocol {
559        /// This delegate method will be called when a system extension has been validated and allowed by the user to run.
560        #[optional]
561        #[unsafe(method(systemExtensionWillBecomeEnabled:))]
562        #[unsafe(method_family = none)]
563        unsafe fn systemExtensionWillBecomeEnabled(
564            &self,
565            system_extension_info: &OSSystemExtensionInfo,
566        );
567
568        /// This delegate method will be called when the user disables an already enabled system extension, or when the system extension is first installed and is in the disabled state.
569        #[optional]
570        #[unsafe(method(systemExtensionWillBecomeDisabled:))]
571        #[unsafe(method_family = none)]
572        unsafe fn systemExtensionWillBecomeDisabled(
573            &self,
574            system_extension_info: &OSSystemExtensionInfo,
575        );
576
577        /// This delegate method will be called when a system extension is deactivated and is about to get uninstalled. The extension may still be running until the system is rebooted.
578        #[optional]
579        #[unsafe(method(systemExtensionWillBecomeInactive:))]
580        #[unsafe(method_family = none)]
581        unsafe fn systemExtensionWillBecomeInactive(
582            &self,
583            system_extension_info: &OSSystemExtensionInfo,
584        );
585    }
586);
587
588extern_class!(
589    /// Note: Using the workspace API requires the system extension entitlement
590    ///
591    /// See also [Apple's documentation](https://developer.apple.com/documentation/systemextensions/ossystemextensionsworkspace?language=objc)
592    #[unsafe(super(NSObject))]
593    #[derive(Debug, PartialEq, Eq, Hash)]
594    pub struct OSSystemExtensionsWorkspace;
595);
596
597unsafe impl Send for OSSystemExtensionsWorkspace {}
598
599unsafe impl Sync for OSSystemExtensionsWorkspace {}
600
601extern_conformance!(
602    unsafe impl NSObjectProtocol for OSSystemExtensionsWorkspace {}
603);
604
605impl OSSystemExtensionsWorkspace {
606    extern_methods!(
607        #[unsafe(method(sharedWorkspace))]
608        #[unsafe(method_family = none)]
609        pub unsafe fn sharedWorkspace() -> Retained<OSSystemExtensionsWorkspace>;
610
611        /// Start observing changes to System Extension(s) which are enabled or ready to be enabled.
612        #[unsafe(method(addObserver:error:_))]
613        #[unsafe(method_family = none)]
614        pub unsafe fn addObserver_error(
615            &self,
616            observer: &ProtocolObject<dyn OSSystemExtensionsWorkspaceObserver>,
617        ) -> Result<(), Retained<NSError>>;
618
619        /// Stop observing changes to System Extension(s).
620        #[unsafe(method(removeObserver:))]
621        #[unsafe(method_family = none)]
622        pub unsafe fn removeObserver(
623            &self,
624            observer: &ProtocolObject<dyn OSSystemExtensionsWorkspaceObserver>,
625        );
626
627        /// Get information about system extension(s) in an app with a bundle identifier
628        ///
629        ///
630        /// Parameter `bundleID`: BundleIdentifier of the application containing the system extension(s)
631        ///
632        /// Parameter `out_error`: Error parameter to be populated with relevant error information
633        ///
634        ///
635        /// Returns: A set of system extension property objects on success, nil otherwise.
636        #[unsafe(method(systemExtensionsForApplicationWithBundleID:error:_))]
637        #[unsafe(method_family = none)]
638        pub unsafe fn systemExtensionsForApplicationWithBundleID_error(
639            &self,
640            bundle_id: &NSString,
641        ) -> Result<Retained<NSSet<OSSystemExtensionProperties>>, Retained<NSError>>;
642    );
643}
644
645/// Methods declared on superclass `NSObject`.
646impl OSSystemExtensionsWorkspace {
647    extern_methods!(
648        #[unsafe(method(init))]
649        #[unsafe(method_family = init)]
650        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
651
652        #[unsafe(method(new))]
653        #[unsafe(method_family = new)]
654        pub unsafe fn new() -> Retained<Self>;
655    );
656}