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
// 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! {
    /// Describes a first party origin.
    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
    pub struct ITPFirstParty(Shared<ffi::WebKitITPFirstParty>);

    match fn {
        ref => |ptr| ffi::webkit_itp_first_party_ref(ptr),
        unref => |ptr| ffi::webkit_itp_first_party_unref(ptr),
        type_ => || ffi::webkit_itp_first_party_get_type(),
    }
}

impl ITPFirstParty {
    /// Get the domain name of @self.
    ///
    /// # Returns
    ///
    /// the domain name
    #[doc(alias = "webkit_itp_first_party_get_domain")]
    #[doc(alias = "get_domain")]
    pub fn domain(&self) -> Option<glib::GString> {
        unsafe {
            from_glib_none(ffi::webkit_itp_first_party_get_domain(
                self.to_glib_none().0,
            ))
        }
    }

    /// Get the last time a #WebKitITPThirdParty has been seen under @self.
    ///
    /// Each @WebKitITPFirstParty is created by webkit_itp_third_party_get_first_parties() and
    /// therefore corresponds to exactly one #WebKitITPThirdParty.
    ///
    /// # Returns
    ///
    /// the last update time as a #GDateTime
    #[doc(alias = "webkit_itp_first_party_get_last_update_time")]
    #[doc(alias = "get_last_update_time")]
    pub fn last_update_time(&self) -> Option<glib::DateTime> {
        unsafe {
            from_glib_none(ffi::webkit_itp_first_party_get_last_update_time(
                self.to_glib_none().0,
            ))
        }
    }

    /// Get whether @self has granted website data access to its #WebKitITPThirdParty.
    ///
    /// Each @WebKitITPFirstParty is created by webkit_itp_third_party_get_first_parties() and
    /// therefore corresponds to exactly one #WebKitITPThirdParty.
    ///
    /// # Returns
    ///
    /// [`true`] if website data access has been granted, or [`false`] otherwise
    #[doc(alias = "webkit_itp_first_party_get_website_data_access_allowed")]
    #[doc(alias = "get_website_data_access_allowed")]
    pub fn is_website_data_access_allowed(&self) -> bool {
        unsafe {
            from_glib(ffi::webkit_itp_first_party_get_website_data_access_allowed(
                self.to_glib_none().0,
            ))
        }
    }
}