objc2-web-kit 0.2.2

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

use crate::*;

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct WKDownloadRedirectPolicy(pub NSInteger);
impl WKDownloadRedirectPolicy {
    #[doc(alias = "WKDownloadRedirectPolicyCancel")]
    pub const Cancel: Self = Self(0);
    #[doc(alias = "WKDownloadRedirectPolicyAllow")]
    pub const Allow: Self = Self(1);
}

unsafe impl Encode for WKDownloadRedirectPolicy {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for WKDownloadRedirectPolicy {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_protocol!(
    pub unsafe trait WKDownloadDelegate: NSObjectProtocol {
        #[cfg(all(feature = "WKDownload", feature = "block2"))]
        #[method(download:decideDestinationUsingResponse:suggestedFilename:completionHandler:)]
        unsafe fn download_decideDestinationUsingResponse_suggestedFilename_completionHandler(
            &self,
            download: &WKDownload,
            response: &NSURLResponse,
            suggested_filename: &NSString,
            completion_handler: &block2::Block<dyn Fn(*mut NSURL)>,
        );

        #[cfg(all(feature = "WKDownload", feature = "block2"))]
        #[optional]
        #[method(download:willPerformHTTPRedirection:newRequest:decisionHandler:)]
        unsafe fn download_willPerformHTTPRedirection_newRequest_decisionHandler(
            &self,
            download: &WKDownload,
            response: &NSHTTPURLResponse,
            request: &NSURLRequest,
            decision_handler: &block2::Block<dyn Fn(WKDownloadRedirectPolicy)>,
        );

        #[cfg(all(feature = "WKDownload", feature = "block2"))]
        #[optional]
        #[method(download:didReceiveAuthenticationChallenge:completionHandler:)]
        unsafe fn download_didReceiveAuthenticationChallenge_completionHandler(
            &self,
            download: &WKDownload,
            challenge: &NSURLAuthenticationChallenge,
            completion_handler: &block2::Block<
                dyn Fn(NSURLSessionAuthChallengeDisposition, *mut NSURLCredential),
            >,
        );

        #[cfg(feature = "WKDownload")]
        #[optional]
        #[method(downloadDidFinish:)]
        unsafe fn downloadDidFinish(&self, download: &WKDownload);

        #[cfg(feature = "WKDownload")]
        #[optional]
        #[method(download:didFailWithError:resumeData:)]
        unsafe fn download_didFailWithError_resumeData(
            &self,
            download: &WKDownload,
            error: &NSError,
            resume_data: Option<&NSData>,
        );
    }

    unsafe impl ProtocolType for dyn WKDownloadDelegate {}
);