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
use glib::object::IsA;
use glib::translate::*;
use std::fmt;
use webkit2_sys;
glib_wrapper! {
pub struct PermissionRequest(Interface<webkit2_sys::WebKitPermissionRequest>);
match fn {
get_type => || webkit2_sys::webkit_permission_request_get_type(),
}
}
pub const NONE_PERMISSION_REQUEST: Option<&PermissionRequest> = None;
pub trait PermissionRequestExt: 'static {
fn allow(&self);
fn deny(&self);
}
impl<O: IsA<PermissionRequest>> PermissionRequestExt for O {
fn allow(&self) {
unsafe {
webkit2_sys::webkit_permission_request_allow(self.as_ref().to_glib_none().0);
}
}
fn deny(&self) {
unsafe {
webkit2_sys::webkit_permission_request_deny(self.as_ref().to_glib_none().0);
}
}
}
impl fmt::Display for PermissionRequest {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "PermissionRequest")
}
}