icrate 0.1.2

Bindings to Apple's frameworks
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use crate::common::*;
use crate::AppKit::*;
use crate::Foundation::*;
use crate::WebKit::*;

ns_enum!(
    #[underlying(NSInteger)]
    pub enum WKCookiePolicy {
        WKCookiePolicyAllow = 0,
        WKCookiePolicyDisallow = 1,
    }
);

extern_protocol!(
    pub unsafe trait WKHTTPCookieStoreObserver: NSObjectProtocol {
        #[cfg(feature = "WebKit_WKHTTPCookieStore")]
        #[optional]
        #[method(cookiesDidChangeInCookieStore:)]
        unsafe fn cookiesDidChangeInCookieStore(&self, cookie_store: &WKHTTPCookieStore);
    }

    unsafe impl ProtocolType for dyn WKHTTPCookieStoreObserver {}
);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "WebKit_WKHTTPCookieStore")]
    pub struct WKHTTPCookieStore;

    #[cfg(feature = "WebKit_WKHTTPCookieStore")]
    unsafe impl ClassType for WKHTTPCookieStore {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

#[cfg(feature = "WebKit_WKHTTPCookieStore")]
unsafe impl NSObjectProtocol for WKHTTPCookieStore {}

extern_methods!(
    #[cfg(feature = "WebKit_WKHTTPCookieStore")]
    unsafe impl WKHTTPCookieStore {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;

        #[cfg(all(feature = "Foundation_NSArray", feature = "Foundation_NSHTTPCookie"))]
        #[method(getAllCookies:)]
        pub unsafe fn getAllCookies(
            &self,
            completion_handler: &Block<(NonNull<NSArray<NSHTTPCookie>>,), ()>,
        );

        #[cfg(feature = "Foundation_NSHTTPCookie")]
        #[method(setCookie:completionHandler:)]
        pub unsafe fn setCookie_completionHandler(
            &self,
            cookie: &NSHTTPCookie,
            completion_handler: Option<&Block<(), ()>>,
        );

        #[cfg(feature = "Foundation_NSHTTPCookie")]
        #[method(deleteCookie:completionHandler:)]
        pub unsafe fn deleteCookie_completionHandler(
            &self,
            cookie: &NSHTTPCookie,
            completion_handler: Option<&Block<(), ()>>,
        );

        #[method(addObserver:)]
        pub unsafe fn addObserver(&self, observer: &ProtocolObject<dyn WKHTTPCookieStoreObserver>);

        #[method(removeObserver:)]
        pub unsafe fn removeObserver(
            &self,
            observer: &ProtocolObject<dyn WKHTTPCookieStoreObserver>,
        );

        #[method(setCookiePolicy:completionHandler:)]
        pub unsafe fn setCookiePolicy_completionHandler(
            &self,
            policy: WKCookiePolicy,
            completion_handler: Option<&Block<(), ()>>,
        );

        #[method(getCookiePolicy:)]
        pub unsafe fn getCookiePolicy(&self, completion_handler: &Block<(WKCookiePolicy,), ()>);
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    #[cfg(feature = "WebKit_WKHTTPCookieStore")]
    unsafe impl WKHTTPCookieStore {
        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Id<Self>;
    }
);