webkit_web_process_extension6/auto/
frame.rs1use crate::{ffi, ScriptWorld};
7use glib::translate::*;
8
9glib::wrapper! {
10 #[doc(alias = "WebKitFrame")]
11 pub struct Frame(Object<ffi::WebKitFrame, ffi::WebKitFrameClass>);
12
13 match fn {
14 type_ => || ffi::webkit_frame_get_type(),
15 }
16}
17
18impl Frame {
19 #[doc(alias = "webkit_frame_get_id")]
20 #[doc(alias = "get_id")]
21 pub fn id(&self) -> u64 {
22 unsafe { ffi::webkit_frame_get_id(self.to_glib_none().0) }
23 }
24
25 #[doc(alias = "webkit_frame_get_js_context")]
26 #[doc(alias = "get_js_context")]
27 pub fn js_context(&self) -> Option<javascriptcore::Context> {
28 unsafe { from_glib_full(ffi::webkit_frame_get_js_context(self.to_glib_none().0)) }
29 }
30
31 #[doc(alias = "webkit_frame_get_js_context_for_script_world")]
32 #[doc(alias = "get_js_context_for_script_world")]
33 pub fn js_context_for_script_world(
34 &self,
35 world: &ScriptWorld,
36 ) -> Option<javascriptcore::Context> {
37 unsafe {
38 from_glib_full(ffi::webkit_frame_get_js_context_for_script_world(
39 self.to_glib_none().0,
40 world.to_glib_none().0,
41 ))
42 }
43 }
44
45 #[doc(alias = "webkit_frame_get_uri")]
46 #[doc(alias = "get_uri")]
47 pub fn uri(&self) -> Option<glib::GString> {
48 unsafe { from_glib_none(ffi::webkit_frame_get_uri(self.to_glib_none().0)) }
49 }
50
51 #[doc(alias = "webkit_frame_is_main_frame")]
52 pub fn is_main_frame(&self) -> bool {
53 unsafe { from_glib(ffi::webkit_frame_is_main_frame(self.to_glib_none().0)) }
54 }
55}