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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct WKUserInterfaceDirectionPolicy(pub NSInteger);
impl WKUserInterfaceDirectionPolicy {
    #[doc(alias = "WKUserInterfaceDirectionPolicyContent")]
    pub const Content: Self = Self(0);
    #[doc(alias = "WKUserInterfaceDirectionPolicySystem")]
    pub const System: Self = Self(1);
}

unsafe impl Encode for WKUserInterfaceDirectionPolicy {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for WKUserInterfaceDirectionPolicy {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct WKAudiovisualMediaTypes(pub NSUInteger);
bitflags::bitflags! {
    impl WKAudiovisualMediaTypes: NSUInteger {
        const WKAudiovisualMediaTypeNone = 0;
        const WKAudiovisualMediaTypeAudio = 1<<0;
        const WKAudiovisualMediaTypeVideo = 1<<1;
        const WKAudiovisualMediaTypeAll = NSUIntegerMax as _;
    }
}

unsafe impl Encode for WKAudiovisualMediaTypes {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for WKAudiovisualMediaTypes {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct WKWebViewConfiguration;

    unsafe impl ClassType for WKWebViewConfiguration {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

unsafe impl NSCoding for WKWebViewConfiguration {}

unsafe impl NSCopying for WKWebViewConfiguration {}

unsafe impl NSObjectProtocol for WKWebViewConfiguration {}

unsafe impl NSSecureCoding for WKWebViewConfiguration {}

extern_methods!(
    unsafe impl WKWebViewConfiguration {
        #[cfg(feature = "WKProcessPool")]
        #[method_id(@__retain_semantics Other processPool)]
        pub unsafe fn processPool(&self) -> Retained<WKProcessPool>;

        #[cfg(feature = "WKProcessPool")]
        #[method(setProcessPool:)]
        pub unsafe fn setProcessPool(&self, process_pool: &WKProcessPool);

        #[cfg(feature = "WKPreferences")]
        #[method_id(@__retain_semantics Other preferences)]
        pub unsafe fn preferences(&self) -> Retained<WKPreferences>;

        #[cfg(feature = "WKPreferences")]
        #[method(setPreferences:)]
        pub unsafe fn setPreferences(&self, preferences: &WKPreferences);

        #[cfg(feature = "WKUserContentController")]
        #[method_id(@__retain_semantics Other userContentController)]
        pub unsafe fn userContentController(&self) -> Retained<WKUserContentController>;

        #[cfg(feature = "WKUserContentController")]
        #[method(setUserContentController:)]
        pub unsafe fn setUserContentController(
            &self,
            user_content_controller: &WKUserContentController,
        );

        #[cfg(feature = "WKWebsiteDataStore")]
        #[method_id(@__retain_semantics Other websiteDataStore)]
        pub unsafe fn websiteDataStore(&self) -> Retained<WKWebsiteDataStore>;

        #[cfg(feature = "WKWebsiteDataStore")]
        #[method(setWebsiteDataStore:)]
        pub unsafe fn setWebsiteDataStore(&self, website_data_store: &WKWebsiteDataStore);

        #[method(suppressesIncrementalRendering)]
        pub unsafe fn suppressesIncrementalRendering(&self) -> bool;

        #[method(setSuppressesIncrementalRendering:)]
        pub unsafe fn setSuppressesIncrementalRendering(
            &self,
            suppresses_incremental_rendering: bool,
        );

        #[method_id(@__retain_semantics Other applicationNameForUserAgent)]
        pub unsafe fn applicationNameForUserAgent(&self) -> Option<Retained<NSString>>;

        #[method(setApplicationNameForUserAgent:)]
        pub unsafe fn setApplicationNameForUserAgent(
            &self,
            application_name_for_user_agent: Option<&NSString>,
        );

        #[method(allowsAirPlayForMediaPlayback)]
        pub unsafe fn allowsAirPlayForMediaPlayback(&self) -> bool;

        #[method(setAllowsAirPlayForMediaPlayback:)]
        pub unsafe fn setAllowsAirPlayForMediaPlayback(
            &self,
            allows_air_play_for_media_playback: bool,
        );

        #[method(upgradeKnownHostsToHTTPS)]
        pub unsafe fn upgradeKnownHostsToHTTPS(&self) -> bool;

        #[method(setUpgradeKnownHostsToHTTPS:)]
        pub unsafe fn setUpgradeKnownHostsToHTTPS(&self, upgrade_known_hosts_to_https: bool);

        #[method(mediaTypesRequiringUserActionForPlayback)]
        pub unsafe fn mediaTypesRequiringUserActionForPlayback(&self) -> WKAudiovisualMediaTypes;

        #[method(setMediaTypesRequiringUserActionForPlayback:)]
        pub unsafe fn setMediaTypesRequiringUserActionForPlayback(
            &self,
            media_types_requiring_user_action_for_playback: WKAudiovisualMediaTypes,
        );

        #[cfg(feature = "WKWebpagePreferences")]
        #[method_id(@__retain_semantics Other defaultWebpagePreferences)]
        pub unsafe fn defaultWebpagePreferences(&self) -> Retained<WKWebpagePreferences>;

        #[cfg(feature = "WKWebpagePreferences")]
        #[method(setDefaultWebpagePreferences:)]
        pub unsafe fn setDefaultWebpagePreferences(
            &self,
            default_webpage_preferences: Option<&WKWebpagePreferences>,
        );

        #[method(limitsNavigationsToAppBoundDomains)]
        pub unsafe fn limitsNavigationsToAppBoundDomains(&self) -> bool;

        #[method(setLimitsNavigationsToAppBoundDomains:)]
        pub unsafe fn setLimitsNavigationsToAppBoundDomains(
            &self,
            limits_navigations_to_app_bound_domains: bool,
        );

        #[method(allowsInlinePredictions)]
        pub unsafe fn allowsInlinePredictions(&self) -> bool;

        #[method(setAllowsInlinePredictions:)]
        pub unsafe fn setAllowsInlinePredictions(&self, allows_inline_predictions: bool);

        #[method(userInterfaceDirectionPolicy)]
        pub unsafe fn userInterfaceDirectionPolicy(&self) -> WKUserInterfaceDirectionPolicy;

        #[method(setUserInterfaceDirectionPolicy:)]
        pub unsafe fn setUserInterfaceDirectionPolicy(
            &self,
            user_interface_direction_policy: WKUserInterfaceDirectionPolicy,
        );

        #[cfg(feature = "WKURLSchemeHandler")]
        #[method(setURLSchemeHandler:forURLScheme:)]
        pub unsafe fn setURLSchemeHandler_forURLScheme(
            &self,
            url_scheme_handler: Option<&ProtocolObject<dyn WKURLSchemeHandler>>,
            url_scheme: &NSString,
        );

        #[cfg(feature = "WKURLSchemeHandler")]
        #[method_id(@__retain_semantics Other urlSchemeHandlerForURLScheme:)]
        pub unsafe fn urlSchemeHandlerForURLScheme(
            &self,
            url_scheme: &NSString,
        ) -> Option<Retained<ProtocolObject<dyn WKURLSchemeHandler>>>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl WKWebViewConfiguration {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Retained<Self>;
    }
);