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
// 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, MediaKeySystemPermissionRequest, UserMediaPermissionRequest};
use glib::translate::*;

/// Returns the major version number of the WebKit library.
///
/// (e.g. in WebKit version 1.8.3 this is 1.)
///
/// This function is in the library, so it represents the WebKit library
/// your code is running against. Contrast with the #WEBKIT_MAJOR_VERSION
/// macro, which represents the major version of the WebKit headers you
/// have included when compiling your code.
///
/// # Returns
///
/// the major version number of the WebKit library
#[doc(alias = "webkit_get_major_version")]
#[doc(alias = "get_major_version")]
pub fn major_version() -> u32 {
    assert_initialized_main_thread!();
    unsafe { ffi::webkit_get_major_version() }
}

/// Returns the micro version number of the WebKit library.
///
/// (e.g. in WebKit version 1.8.3 this is 3.)
///
/// This function is in the library, so it represents the WebKit library
/// your code is running against. Contrast with the #WEBKIT_MICRO_VERSION
/// macro, which represents the micro version of the WebKit headers you
/// have included when compiling your code.
///
/// # Returns
///
/// the micro version number of the WebKit library
#[doc(alias = "webkit_get_micro_version")]
#[doc(alias = "get_micro_version")]
pub fn micro_version() -> u32 {
    assert_initialized_main_thread!();
    unsafe { ffi::webkit_get_micro_version() }
}

/// Returns the minor version number of the WebKit library.
///
/// (e.g. in WebKit version 1.8.3 this is 8.)
///
/// This function is in the library, so it represents the WebKit library
/// your code is running against. Contrast with the #WEBKIT_MINOR_VERSION
/// macro, which represents the minor version of the WebKit headers you
/// have included when compiling your code.
///
/// # Returns
///
/// the minor version number of the WebKit library
#[doc(alias = "webkit_get_minor_version")]
#[doc(alias = "get_minor_version")]
pub fn minor_version() -> u32 {
    assert_initialized_main_thread!();
    unsafe { ffi::webkit_get_minor_version() }
}

/// Get the key system for which access permission is being requested.
/// ## `request`
/// a #WebKitMediaKeySystemPermissionRequest
///
/// # Returns
///
/// the key system name for @request
#[doc(alias = "webkit_media_key_system_permission_get_name")]
pub fn media_key_system_permission_get_name(
    request: &MediaKeySystemPermissionRequest,
) -> Option<glib::GString> {
    skip_assert_initialized!();
    unsafe {
        from_glib_none(ffi::webkit_media_key_system_permission_get_name(
            request.to_glib_none().0,
        ))
    }
}

/// Use this function to format a URI for display.
///
/// The URIs used internally by
/// WebKit may contain percent-encoded characters or Punycode, which are not
/// generally suitable to display to users. This function provides protection
/// against IDN homograph attacks, so in some cases the host part of the returned
/// URI may be in Punycode if the safety check fails.
/// ## `uri`
/// the URI to be converted
///
/// # Returns
///
/// @uri suitable for display, or [`None`] in
///    case of error.
#[doc(alias = "webkit_uri_for_display")]
pub fn uri_for_display(uri: &str) -> Option<glib::GString> {
    assert_initialized_main_thread!();
    unsafe { from_glib_full(ffi::webkit_uri_for_display(uri.to_glib_none().0)) }
}

/// Check whether the permission request is for an audio device.
/// ## `request`
/// a #WebKitUserMediaPermissionRequest
///
/// # Returns
///
/// [`true`] if access to an audio device was requested.
#[doc(alias = "webkit_user_media_permission_is_for_audio_device")]
pub fn user_media_permission_is_for_audio_device(request: &UserMediaPermissionRequest) -> bool {
    skip_assert_initialized!();
    unsafe {
        from_glib(ffi::webkit_user_media_permission_is_for_audio_device(
            request.to_glib_none().0,
        ))
    }
}

/// Check whether the permission request is for a display device.
/// ## `request`
/// a #WebKitUserMediaPermissionRequest
///
/// # Returns
///
/// [`true`] if access to a display device was requested.
#[doc(alias = "webkit_user_media_permission_is_for_display_device")]
pub fn user_media_permission_is_for_display_device(request: &UserMediaPermissionRequest) -> bool {
    skip_assert_initialized!();
    unsafe {
        from_glib(ffi::webkit_user_media_permission_is_for_display_device(
            request.to_glib_none().0,
        ))
    }
}

/// Check whether the permission request is for a video device.
/// ## `request`
/// a #WebKitUserMediaPermissionRequest
///
/// # Returns
///
/// [`true`] if access to a video device was requested.
#[doc(alias = "webkit_user_media_permission_is_for_video_device")]
pub fn user_media_permission_is_for_video_device(request: &UserMediaPermissionRequest) -> bool {
    skip_assert_initialized!();
    unsafe {
        from_glib(ffi::webkit_user_media_permission_is_for_video_device(
            request.to_glib_none().0,
        ))
    }
}