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
// 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, ScriptWorld};
use glib::translate::*;
glib::wrapper! {
/// A web page frame.
///
/// Each `WebKitWebPage` has at least one main frame, and can have any number
/// of subframes.
#[doc(alias = "WebKitFrame")]
pub struct Frame(Object<ffi::WebKitFrame, ffi::WebKitFrameClass>);
match fn {
type_ => || ffi::webkit_frame_get_type(),
}
}
impl Frame {
/// Gets the process-unique identifier of this #WebKitFrame. No other
/// frame in the same web process will have the same ID; however, frames
/// in other web processes may.
///
/// # Returns
///
/// the identifier of @self
#[doc(alias = "webkit_frame_get_id")]
#[doc(alias = "get_id")]
pub fn id(&self) -> u64 {
unsafe { ffi::webkit_frame_get_id(self.to_glib_none().0) }
}
/// Get the JavaScript execution context of @self. Use this function to bridge
/// between the WebKit and JavaScriptCore APIs.
///
/// # Returns
///
/// the #JSCContext for the JavaScript execution context of @self.
#[doc(alias = "webkit_frame_get_js_context")]
#[doc(alias = "get_js_context")]
pub fn js_context(&self) -> Option<javascriptcore::Context> {
unsafe { from_glib_full(ffi::webkit_frame_get_js_context(self.to_glib_none().0)) }
}
/// Get the JavaScript execution context of @self for the given #WebKitScriptWorld.
/// ## `world`
/// a #WebKitScriptWorld
///
/// # Returns
///
/// the #JSCContext for the JavaScript execution context of @self for @world.
#[doc(alias = "webkit_frame_get_js_context_for_script_world")]
#[doc(alias = "get_js_context_for_script_world")]
pub fn js_context_for_script_world(
&self,
world: &ScriptWorld,
) -> Option<javascriptcore::Context> {
unsafe {
from_glib_full(ffi::webkit_frame_get_js_context_for_script_world(
self.to_glib_none().0,
world.to_glib_none().0,
))
}
}
/// Gets the current active URI of @self.
///
/// # Returns
///
/// the current active URI of @self or [`None`] if nothing has been
/// loaded yet.
#[doc(alias = "webkit_frame_get_uri")]
#[doc(alias = "get_uri")]
pub fn uri(&self) -> Option<glib::GString> {
unsafe { from_glib_none(ffi::webkit_frame_get_uri(self.to_glib_none().0)) }
}
/// Gets whether @self is the main frame of a #WebKitWebPage
///
/// # Returns
///
/// [`true`] if @self is a main frame or [`false`] otherwise
#[doc(alias = "webkit_frame_is_main_frame")]
pub fn is_main_frame(&self) -> bool {
unsafe { from_glib(ffi::webkit_frame_is_main_frame(self.to_glib_none().0)) }
}
}