objc2_web_kit/generated/WKURLSchemeTask.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_protocol!(
11 /// [Apple's documentation](https://developer.apple.com/documentation/webkit/wkurlschemetask?language=objc)
12 pub unsafe trait WKURLSchemeTask: NSObjectProtocol {
13 /// The request to load for this task.
14 #[unsafe(method(request))]
15 #[unsafe(method_family = none)]
16 unsafe fn request(&self) -> Retained<NSURLRequest>;
17
18 /// Set the current response object for the task.
19 ///
20 /// Parameter `response`: The response to use.
21 ///
22 /// This method must be called at least once for each URL scheme handler task.
23 /// Cross-origin requests require CORS header fields.
24 /// An exception will be thrown if you try to send a new response object after the task has already been completed.
25 /// An exception will be thrown if your app has been told to stop loading this task via the registered WKURLSchemeHandler object.
26 #[unsafe(method(didReceiveResponse:))]
27 #[unsafe(method_family = none)]
28 unsafe fn didReceiveResponse(&self, response: &NSURLResponse);
29
30 /// Add received data to the task.
31 ///
32 /// Parameter `data`: The data to add.
33 ///
34 /// After a URL scheme handler task's final response object is received you should
35 /// start sending it data.
36 /// Each time this method is called the data you send will be appended to all previous data.
37 /// An exception will be thrown if you try to send the task any data before sending it a response.
38 /// An exception will be thrown if you try to send the task any data after the task has already been completed.
39 /// An exception will be thrown if your app has been told to stop loading this task via the registered WKURLSchemeHandler object.
40 #[unsafe(method(didReceiveData:))]
41 #[unsafe(method_family = none)]
42 unsafe fn didReceiveData(&self, data: &NSData);
43
44 /// Mark the task as successfully completed.
45 ///
46 /// An exception will be thrown if you try to finish the task before sending it a response.
47 /// An exception will be thrown if you try to mark a task completed after it has already been marked completed or failed.
48 /// An exception will be thrown if your app has been told to stop loading this task via the registered WKURLSchemeHandler object.
49 #[unsafe(method(didFinish))]
50 #[unsafe(method_family = none)]
51 unsafe fn didFinish(&self);
52
53 /// Mark the task as failed.
54 ///
55 /// Parameter `error`: A description of the error that caused the task to fail.
56 ///
57 /// An exception will be thrown if you try to mark a task failed after it has already been marked completed or failed.
58 /// An exception will be thrown if your app has been told to stop loading this task via the registered WKURLSchemeHandler object.
59 #[unsafe(method(didFailWithError:))]
60 #[unsafe(method_family = none)]
61 unsafe fn didFailWithError(&self, error: &NSError);
62 }
63);