objc2-browser-engine-kit 0.3.2

Bindings to the BrowserEngineKit framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use objc2_ui_kit::*;

use crate::*;

extern_class!(
    /// An object that represents a running web content extension process.
    ///
    /// The system guarantees that the extension process has launched by the time the initializer methods return.
    /// If the extension process exits, the system calls ``interruptionHandler``. There can multiple web content process
    /// per  host browser. Each time this type is initialized, a new extension process will be launched.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/browserenginekit/bewebcontentprocess?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct BEWebContentProcess;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for BEWebContentProcess {}
);

impl BEWebContentProcess {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;

        #[cfg(feature = "block2")]
        /// Asynchronously launches a web content process
        ///
        /// This initializer launches a new web content extension process.
        ///
        /// - Parameters:
        /// - `interruptionHandler` : A block that is called if the extension process terminates.
        /// - `completion` : A block called with a new ``BEWebContentProcess`` when the extension process has
        /// launched or with an error.
        #[unsafe(method(webContentProcessWithInterruptionHandler:completion:))]
        #[unsafe(method_family = none)]
        pub unsafe fn webContentProcessWithInterruptionHandler_completion(
            interruption_handler: &block2::DynBlock<dyn Fn()>,
            completion: &block2::DynBlock<dyn Fn(*mut BEWebContentProcess, *mut NSError)>,
        );

        #[cfg(feature = "block2")]
        /// Asynchronously launches a web content process
        ///
        /// This initializer launches a new web content extension process.
        ///
        /// - Parameters:
        /// - `bundleID` : The bundle identifier of the WebContent process to launch.
        /// - `interruptionHandler` : A block that is called if the extension process terminates.
        /// - `completion` : A block called with a new ``BEWebContentProcess`` when the extension process has
        /// launched or with an error.
        #[unsafe(method(webContentProcessWithBundleID:interruptionHandler:completion:))]
        #[unsafe(method_family = none)]
        pub unsafe fn webContentProcessWithBundleID_interruptionHandler_completion(
            bundle_id: &NSString,
            interruption_handler: &block2::DynBlock<dyn Fn()>,
            completion: &block2::DynBlock<dyn Fn(*mut BEWebContentProcess, *mut NSError)>,
        );

        /// Stops the extension process.
        ///
        /// When you call this method, you tell the system your app no longer needs this extension process.
        /// If this is the last connection from the host process to the extension process, the system terminates
        /// the extension process.
        #[unsafe(method(invalidate))]
        #[unsafe(method_family = none)]
        pub unsafe fn invalidate(&self);

        /// attach the created interaction to a view to express that the content of that view is directly related to the working of this process.
        /// therefore, if the view is considered visible by the system then this process must also be considered to be visible.
        /// do not attempt to set an interaction on multiple views as interactions track their views - instead create a new interaction for each view that you want to propogate visibility to this process.
        #[unsafe(method(createVisibilityPropagationInteraction))]
        #[unsafe(method_family = none)]
        pub unsafe fn createVisibilityPropagationInteraction(
            &self,
            mtm: MainThreadMarker,
        ) -> Retained<ProtocolObject<dyn UIInteraction>>;
    );
}

/// BEExtensionProcessConformance.
impl BEWebContentProcess {
    extern_methods!();
}

#[cfg(feature = "BEExtensionProcess")]
extern_conformance!(
    unsafe impl BEExtensionProcess for BEWebContentProcess {}
);