1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
/// A WKWebsiteDataStore represents various types of data that a website might
/// make use of. This includes cookies, disk and memory caches, and persistent data such as WebSQL,
/// IndexedDB databases, and local storage.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/wkwebsitedatastore?language=objc)
#[unsafe(super(NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct WKWebsiteDataStore;
);
unsafe impl NSCoding for WKWebsiteDataStore {}
unsafe impl NSObjectProtocol for WKWebsiteDataStore {}
unsafe impl NSSecureCoding for WKWebsiteDataStore {}
impl WKWebsiteDataStore {
extern_methods!(
#[unsafe(method(defaultDataStore))]
#[unsafe(method_family = none)]
pub unsafe fn defaultDataStore(mtm: MainThreadMarker) -> Retained<WKWebsiteDataStore>;
/// Returns a new non-persistent data store.
///
/// If a WKWebView is associated with a non-persistent data store, no data will
/// be written to the file system. This is useful for implementing "private browsing" in a web view.
#[unsafe(method(nonPersistentDataStore))]
#[unsafe(method_family = none)]
pub unsafe fn nonPersistentDataStore(mtm: MainThreadMarker)
-> Retained<WKWebsiteDataStore>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new(&self) -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
/// Whether the data store is persistent or not.
#[unsafe(method(isPersistent))]
#[unsafe(method_family = none)]
pub unsafe fn isPersistent(&self) -> bool;
/// Returns a set of all available website data types.
#[unsafe(method(allWebsiteDataTypes))]
#[unsafe(method_family = none)]
pub unsafe fn allWebsiteDataTypes(mtm: MainThreadMarker) -> Retained<NSSet<NSString>>;
#[cfg(all(feature = "WKWebsiteDataRecord", feature = "block2"))]
/// Fetches data records containing the given website data types.
///
/// Parameter `dataTypes`: The website data types to fetch records for.
///
/// Parameter `completionHandler`: A block to invoke when the data records have been fetched.
#[unsafe(method(fetchDataRecordsOfTypes:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn fetchDataRecordsOfTypes_completionHandler(
&self,
data_types: &NSSet<NSString>,
completion_handler: &block2::Block<dyn Fn(NonNull<NSArray<WKWebsiteDataRecord>>)>,
);
#[cfg(all(feature = "WKWebsiteDataRecord", feature = "block2"))]
/// Removes website data of the given types for the given data records.
///
/// Parameter `dataTypes`: The website data types that should be removed.
///
/// Parameter `dataRecords`: The website data records to delete website data for.
///
/// Parameter `completionHandler`: A block to invoke when the website data for the records has been removed.
#[unsafe(method(removeDataOfTypes:forDataRecords:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn removeDataOfTypes_forDataRecords_completionHandler(
&self,
data_types: &NSSet<NSString>,
data_records: &NSArray<WKWebsiteDataRecord>,
completion_handler: &block2::Block<dyn Fn()>,
);
#[cfg(feature = "block2")]
/// Removes all website data of the given types that has been modified since the given date.
///
/// Parameter `dataTypes`: The website data types that should be removed.
///
/// Parameter `date`: A date. All website data modified after this date will be removed.
///
/// Parameter `completionHandler`: A block to invoke when the website data has been removed.
#[unsafe(method(removeDataOfTypes:modifiedSince:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn removeDataOfTypes_modifiedSince_completionHandler(
&self,
data_types: &NSSet<NSString>,
date: &NSDate,
completion_handler: &block2::Block<dyn Fn()>,
);
#[cfg(feature = "WKHTTPCookieStore")]
/// Returns the cookie store representing HTTP cookies in this website data store.
#[unsafe(method(httpCookieStore))]
#[unsafe(method_family = none)]
pub unsafe fn httpCookieStore(&self) -> Retained<WKHTTPCookieStore>;
/// Get identifier for a data store.
///
/// Returns nil for default and non-persistent data store .
#[unsafe(method(identifier))]
#[unsafe(method_family = none)]
pub unsafe fn identifier(&self) -> Option<Retained<NSUUID>>;
/// Get a persistent data store.
///
/// Parameter `identifier`: An identifier that is used to uniquely identify the data store.
///
/// If a data store with this identifier does not exist yet, it will be created. Throws exception if identifier
/// is 0.
#[unsafe(method(dataStoreForIdentifier:))]
#[unsafe(method_family = none)]
pub unsafe fn dataStoreForIdentifier(
identifier: &NSUUID,
mtm: MainThreadMarker,
) -> Retained<WKWebsiteDataStore>;
#[cfg(feature = "block2")]
/// Delete a persistent data store.
///
/// Parameter `identifier`: An identifier that is used to uniquely identify the data store.
///
/// Parameter `completionHandler`: A block to invoke with optional error when the operation completes.
///
/// This should be called when the data store is not used any more. Returns error if removal fails
/// to complete. WKWebView using the data store must be released before removal.
#[unsafe(method(removeDataStoreForIdentifier:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn removeDataStoreForIdentifier_completionHandler(
identifier: &NSUUID,
completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
mtm: MainThreadMarker,
);
#[cfg(feature = "block2")]
/// Fetch all data stores identifiers.
///
/// Parameter `completionHandler`: A block to invoke with an array of identifiers when the operation completes.
///
/// Default or non-persistent data store do not have an identifier.
#[unsafe(method(fetchAllDataStoreIdentifiers:))]
#[unsafe(method_family = none)]
pub unsafe fn fetchAllDataStoreIdentifiers(
completion_handler: &block2::Block<dyn Fn(NonNull<NSArray<NSUUID>>)>,
mtm: MainThreadMarker,
);
);
}
/// Methods declared on superclass `NSObject`.
impl WKWebsiteDataStore {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new_class(mtm: MainThreadMarker) -> Retained<Self>;
);
}