objc2_web_kit/generated/
WKDownload.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// [Apple's documentation](https://developer.apple.com/documentation/webkit/wkdownload?language=objc)
12    #[unsafe(super(NSObject))]
13    #[thread_kind = MainThreadOnly]
14    #[derive(Debug, PartialEq, Eq, Hash)]
15    pub struct WKDownload;
16);
17
18extern_conformance!(
19    unsafe impl NSObjectProtocol for WKDownload {}
20);
21
22extern_conformance!(
23    unsafe impl NSProgressReporting for WKDownload {}
24);
25
26impl WKDownload {
27    extern_methods!(
28        #[unsafe(method(originalRequest))]
29        #[unsafe(method_family = none)]
30        pub unsafe fn originalRequest(&self) -> Option<Retained<NSURLRequest>>;
31
32        #[cfg(all(feature = "WKWebView", feature = "objc2-app-kit"))]
33        #[cfg(target_os = "macos")]
34        #[unsafe(method(webView))]
35        #[unsafe(method_family = none)]
36        pub unsafe fn webView(&self) -> Option<Retained<WKWebView>>;
37
38        #[cfg(feature = "WKDownloadDelegate")]
39        #[unsafe(method(delegate))]
40        #[unsafe(method_family = none)]
41        pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn WKDownloadDelegate>>>;
42
43        #[cfg(feature = "WKDownloadDelegate")]
44        /// Setter for [`delegate`][Self::delegate].
45        ///
46        /// This is a [weak property][objc2::topics::weak_property].
47        #[unsafe(method(setDelegate:))]
48        #[unsafe(method_family = none)]
49        pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn WKDownloadDelegate>>);
50
51        #[unsafe(method(isUserInitiated))]
52        #[unsafe(method_family = none)]
53        pub unsafe fn isUserInitiated(&self) -> bool;
54
55        #[cfg(feature = "WKFrameInfo")]
56        #[unsafe(method(originatingFrame))]
57        #[unsafe(method_family = none)]
58        pub unsafe fn originatingFrame(&self) -> Retained<WKFrameInfo>;
59
60        #[cfg(feature = "block2")]
61        #[unsafe(method(cancel:))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn cancel(
64            &self,
65            completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSData)>>,
66        );
67    );
68}
69
70/// Methods declared on superclass `NSObject`.
71impl WKDownload {
72    extern_methods!(
73        #[unsafe(method(init))]
74        #[unsafe(method_family = init)]
75        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
76
77        #[unsafe(method(new))]
78        #[unsafe(method_family = new)]
79        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
80    );
81}