objc2_web_kit/generated/
WebDownload.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5#[cfg(feature = "objc2-app-kit")]
6#[cfg(target_os = "macos")]
7use objc2_app_kit::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12extern_class!(
13    /// A WebDownload works just like an NSURLDownload, with
14    /// one extra feature: if you do not implement the
15    /// authentication-related delegate methods, it will automatically
16    /// prompt for authentication using the standard WebKit authentication
17    /// panel, as either a sheet or window. It provides no extra methods,
18    /// but does have one additional delegate method.
19    ///
20    /// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/webdownload?language=objc)
21    #[unsafe(super(NSURLDownload, NSObject))]
22    #[derive(Debug, PartialEq, Eq, Hash)]
23    #[deprecated]
24    pub struct WebDownload;
25);
26
27unsafe impl NSObjectProtocol for WebDownload {}
28
29impl WebDownload {
30    extern_methods!();
31}
32
33/// Methods declared on superclass `NSURLDownload`.
34impl WebDownload {
35    extern_methods!(
36        /// Initializes a NSURLDownload object and starts the download.
37        ///
38        /// Parameter `request`: The request to download. Must not be nil.
39        ///
40        /// Parameter `delegate`: The delegate of the download.
41        ///
42        /// Returns: An initialized NSURLDownload object.
43        #[deprecated = "Use NSURLSession downloadTask (see NSURLSession.h)"]
44        #[unsafe(method(initWithRequest:delegate:))]
45        #[unsafe(method_family = init)]
46        pub unsafe fn initWithRequest_delegate(
47            this: Allocated<Self>,
48            request: &NSURLRequest,
49            delegate: Option<&ProtocolObject<dyn NSURLDownloadDelegate>>,
50        ) -> Retained<Self>;
51
52        /// Initializes a NSURLDownload object for resuming a previous download.
53        ///
54        /// Parameter `resumeData`: The resume data from the previous download.
55        ///
56        /// Parameter `delegate`: The delegate of the download.
57        ///
58        /// Parameter `path`: The path of the incomplete downloaded file.
59        ///
60        /// Returns: An initialized NSURLDownload object.
61        #[deprecated = "Use NSURLSession downloadTask (see NSURLSession.h)"]
62        #[unsafe(method(initWithResumeData:delegate:path:))]
63        #[unsafe(method_family = init)]
64        pub unsafe fn initWithResumeData_delegate_path(
65            this: Allocated<Self>,
66            resume_data: &NSData,
67            delegate: Option<&ProtocolObject<dyn NSURLDownloadDelegate>>,
68            path: &NSString,
69        ) -> Retained<Self>;
70    );
71}
72
73/// Methods declared on superclass `NSObject`.
74impl WebDownload {
75    extern_methods!(
76        #[unsafe(method(init))]
77        #[unsafe(method_family = init)]
78        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
79
80        #[unsafe(method(new))]
81        #[unsafe(method_family = new)]
82        pub unsafe fn new() -> Retained<Self>;
83    );
84}
85
86extern_protocol!(
87    /// The WebDownloadDelegate delegate has one extra method used to choose
88    /// the right window when automatically prompting with a sheet.
89    ///
90    /// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/webdownloaddelegate?language=objc)
91    #[deprecated]
92    pub unsafe trait WebDownloadDelegate: NSURLDownloadDelegate {
93        #[cfg(feature = "objc2-app-kit")]
94        #[cfg(target_os = "macos")]
95        #[deprecated]
96        #[optional]
97        #[unsafe(method(downloadWindowForAuthenticationSheet:))]
98        #[unsafe(method_family = none)]
99        unsafe fn downloadWindowForAuthenticationSheet(
100            &self,
101            download: Option<&WebDownload>,
102            mtm: MainThreadMarker,
103        ) -> Option<Retained<NSWindow>>;
104    }
105);