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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from webkit-gir-files
// DO NOT EDIT

use crate::ffi;
use glib::translate::*;

glib::wrapper! {
    /// Controls security settings in a #WebKitWebContext.
    ///
    /// The #WebKitSecurityManager defines security settings for URI
    /// schemes in a #WebKitWebContext. Get it from the context with
    /// webkit_web_context_get_security_manager(), and use it to register a
    /// URI scheme with a certain security level, or to check if it already
    /// has it.
    #[doc(alias = "WebKitSecurityManager")]
    pub struct SecurityManager(Object<ffi::WebKitSecurityManager, ffi::WebKitSecurityManagerClass>);

    match fn {
        type_ => || ffi::webkit_security_manager_get_type(),
    }
}

impl SecurityManager {
    /// Register @scheme as a CORS (Cross-origin resource sharing) enabled scheme.
    ///
    /// This means that CORS requests are allowed. See W3C CORS specification
    /// http://www.w3.org/TR/cors/.
    /// ## `scheme`
    /// a URI scheme
    #[doc(alias = "webkit_security_manager_register_uri_scheme_as_cors_enabled")]
    pub fn register_uri_scheme_as_cors_enabled(&self, scheme: &str) {
        unsafe {
            ffi::webkit_security_manager_register_uri_scheme_as_cors_enabled(
                self.to_glib_none().0,
                scheme.to_glib_none().0,
            );
        }
    }

    /// Register @scheme as a display isolated scheme.
    ///
    /// This means that pages cannot
    /// display these URIs unless they are from the same scheme.
    /// ## `scheme`
    /// a URI scheme
    #[doc(alias = "webkit_security_manager_register_uri_scheme_as_display_isolated")]
    pub fn register_uri_scheme_as_display_isolated(&self, scheme: &str) {
        unsafe {
            ffi::webkit_security_manager_register_uri_scheme_as_display_isolated(
                self.to_glib_none().0,
                scheme.to_glib_none().0,
            );
        }
    }

    /// Register @scheme as an empty document scheme.
    ///
    /// This means that
    /// they are allowed to commit synchronously.
    /// ## `scheme`
    /// a URI scheme
    #[doc(alias = "webkit_security_manager_register_uri_scheme_as_empty_document")]
    pub fn register_uri_scheme_as_empty_document(&self, scheme: &str) {
        unsafe {
            ffi::webkit_security_manager_register_uri_scheme_as_empty_document(
                self.to_glib_none().0,
                scheme.to_glib_none().0,
            );
        }
    }

    /// Register @scheme as a local scheme.
    ///
    /// This means that other non-local pages
    /// cannot link to or access URIs of this scheme.
    /// ## `scheme`
    /// a URI scheme
    #[doc(alias = "webkit_security_manager_register_uri_scheme_as_local")]
    pub fn register_uri_scheme_as_local(&self, scheme: &str) {
        unsafe {
            ffi::webkit_security_manager_register_uri_scheme_as_local(
                self.to_glib_none().0,
                scheme.to_glib_none().0,
            );
        }
    }

    /// Register @scheme as a no-access scheme.
    ///
    /// This means that pages loaded
    /// with this URI scheme cannot access pages loaded with any other URI scheme.
    /// ## `scheme`
    /// a URI scheme
    #[doc(alias = "webkit_security_manager_register_uri_scheme_as_no_access")]
    pub fn register_uri_scheme_as_no_access(&self, scheme: &str) {
        unsafe {
            ffi::webkit_security_manager_register_uri_scheme_as_no_access(
                self.to_glib_none().0,
                scheme.to_glib_none().0,
            );
        }
    }

    /// Register @scheme as a secure scheme.
    ///
    /// This means that mixed
    /// content warnings won't be generated for this scheme when
    /// included by an HTTPS page.
    /// ## `scheme`
    /// a URI scheme
    #[doc(alias = "webkit_security_manager_register_uri_scheme_as_secure")]
    pub fn register_uri_scheme_as_secure(&self, scheme: &str) {
        unsafe {
            ffi::webkit_security_manager_register_uri_scheme_as_secure(
                self.to_glib_none().0,
                scheme.to_glib_none().0,
            );
        }
    }

    /// Whether @scheme is considered as a CORS enabled scheme.
    ///
    /// See also webkit_security_manager_register_uri_scheme_as_cors_enabled().
    /// ## `scheme`
    /// a URI scheme
    ///
    /// # Returns
    ///
    /// [`true`] if @scheme is a CORS enabled scheme or [`false`] otherwise.
    #[doc(alias = "webkit_security_manager_uri_scheme_is_cors_enabled")]
    pub fn uri_scheme_is_cors_enabled(&self, scheme: &str) -> bool {
        unsafe {
            from_glib(ffi::webkit_security_manager_uri_scheme_is_cors_enabled(
                self.to_glib_none().0,
                scheme.to_glib_none().0,
            ))
        }
    }

    /// Whether @scheme is considered as a display isolated scheme.
    ///
    /// See also webkit_security_manager_register_uri_scheme_as_display_isolated().
    /// ## `scheme`
    /// a URI scheme
    ///
    /// # Returns
    ///
    /// [`true`] if @scheme is a display isolated scheme or [`false`] otherwise.
    #[doc(alias = "webkit_security_manager_uri_scheme_is_display_isolated")]
    pub fn uri_scheme_is_display_isolated(&self, scheme: &str) -> bool {
        unsafe {
            from_glib(ffi::webkit_security_manager_uri_scheme_is_display_isolated(
                self.to_glib_none().0,
                scheme.to_glib_none().0,
            ))
        }
    }

    /// Whether @scheme is considered as an empty document scheme.
    ///
    /// See also webkit_security_manager_register_uri_scheme_as_empty_document().
    /// ## `scheme`
    /// a URI scheme
    ///
    /// # Returns
    ///
    /// [`true`] if @scheme is an empty document scheme or [`false`] otherwise.
    #[doc(alias = "webkit_security_manager_uri_scheme_is_empty_document")]
    pub fn uri_scheme_is_empty_document(&self, scheme: &str) -> bool {
        unsafe {
            from_glib(ffi::webkit_security_manager_uri_scheme_is_empty_document(
                self.to_glib_none().0,
                scheme.to_glib_none().0,
            ))
        }
    }

    /// Whether @scheme is considered as a local scheme.
    ///
    /// See also webkit_security_manager_register_uri_scheme_as_local().
    /// ## `scheme`
    /// a URI scheme
    ///
    /// # Returns
    ///
    /// [`true`] if @scheme is a local scheme or [`false`] otherwise.
    #[doc(alias = "webkit_security_manager_uri_scheme_is_local")]
    pub fn uri_scheme_is_local(&self, scheme: &str) -> bool {
        unsafe {
            from_glib(ffi::webkit_security_manager_uri_scheme_is_local(
                self.to_glib_none().0,
                scheme.to_glib_none().0,
            ))
        }
    }

    /// Whether @scheme is considered as a no-access scheme.
    ///
    /// See also webkit_security_manager_register_uri_scheme_as_no_access().
    /// ## `scheme`
    /// a URI scheme
    ///
    /// # Returns
    ///
    /// [`true`] if @scheme is a no-access scheme or [`false`] otherwise.
    #[doc(alias = "webkit_security_manager_uri_scheme_is_no_access")]
    pub fn uri_scheme_is_no_access(&self, scheme: &str) -> bool {
        unsafe {
            from_glib(ffi::webkit_security_manager_uri_scheme_is_no_access(
                self.to_glib_none().0,
                scheme.to_glib_none().0,
            ))
        }
    }

    /// Whether @scheme is considered as a secure scheme.
    ///
    /// See also webkit_security_manager_register_uri_scheme_as_secure().
    /// ## `scheme`
    /// a URI scheme
    ///
    /// # Returns
    ///
    /// [`true`] if @scheme is a secure scheme or [`false`] otherwise.
    #[doc(alias = "webkit_security_manager_uri_scheme_is_secure")]
    pub fn uri_scheme_is_secure(&self, scheme: &str) -> bool {
        unsafe {
            from_glib(ffi::webkit_security_manager_uri_scheme_is_secure(
                self.to_glib_none().0,
                scheme.to_glib_none().0,
            ))
        }
    }
}