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
27extern_conformance!(
28    unsafe impl NSObjectProtocol for WebDownload {}
29);
30
31impl WebDownload {
32    extern_methods!();
33}
34
35/// Methods declared on superclass `NSURLDownload`.
36impl WebDownload {
37    extern_methods!(
38        /// Initializes a NSURLDownload object and starts the download.
39        ///
40        /// Parameter `request`: The request to download. Must not be nil.
41        ///
42        /// Parameter `delegate`: The delegate of the download.
43        ///
44        /// Returns: An initialized NSURLDownload object.
45        #[deprecated = "Use NSURLSession downloadTask (see NSURLSession.h)"]
46        #[unsafe(method(initWithRequest:delegate:))]
47        #[unsafe(method_family = init)]
48        pub unsafe fn initWithRequest_delegate(
49            this: Allocated<Self>,
50            request: &NSURLRequest,
51            delegate: Option<&ProtocolObject<dyn NSURLDownloadDelegate>>,
52        ) -> Retained<Self>;
53
54        /// Initializes a NSURLDownload object for resuming a previous download.
55        ///
56        /// Parameter `resumeData`: The resume data from the previous download.
57        ///
58        /// Parameter `delegate`: The delegate of the download.
59        ///
60        /// Parameter `path`: The path of the incomplete downloaded file.
61        ///
62        /// Returns: An initialized NSURLDownload object.
63        #[deprecated = "Use NSURLSession downloadTask (see NSURLSession.h)"]
64        #[unsafe(method(initWithResumeData:delegate:path:))]
65        #[unsafe(method_family = init)]
66        pub unsafe fn initWithResumeData_delegate_path(
67            this: Allocated<Self>,
68            resume_data: &NSData,
69            delegate: Option<&ProtocolObject<dyn NSURLDownloadDelegate>>,
70            path: &NSString,
71        ) -> Retained<Self>;
72    );
73}
74
75/// Methods declared on superclass `NSObject`.
76impl WebDownload {
77    extern_methods!(
78        #[unsafe(method(init))]
79        #[unsafe(method_family = init)]
80        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
81
82        #[unsafe(method(new))]
83        #[unsafe(method_family = new)]
84        pub unsafe fn new() -> Retained<Self>;
85    );
86}
87
88extern_protocol!(
89    /// The WebDownloadDelegate delegate has one extra method used to choose
90    /// the right window when automatically prompting with a sheet.
91    ///
92    /// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/webdownloaddelegate?language=objc)
93    #[deprecated]
94    pub unsafe trait WebDownloadDelegate: NSURLDownloadDelegate {
95        #[cfg(feature = "objc2-app-kit")]
96        #[cfg(target_os = "macos")]
97        #[deprecated]
98        #[optional]
99        #[unsafe(method(downloadWindowForAuthenticationSheet:))]
100        #[unsafe(method_family = none)]
101        unsafe fn downloadWindowForAuthenticationSheet(
102            &self,
103            download: Option<&WebDownload>,
104            mtm: MainThreadMarker,
105        ) -> Option<Retained<NSWindow>>;
106    }
107);