Trait webkit2gtk::WebContextExt
source · pub trait WebContextExt: IsA<WebContext> + Sealed + 'static {
Show 50 methods
// Provided methods
fn add_path_to_sandbox(&self, path: impl AsRef<Path>, read_only: bool) { ... }
fn allow_tls_certificate_for_host(
&self,
certificate: &impl IsA<TlsCertificate>,
host: &str
) { ... }
fn clear_cache(&self) { ... }
fn download_uri(&self, uri: &str) -> Option<Download> { ... }
fn cache_model(&self) -> CacheModel { ... }
fn cookie_manager(&self) -> Option<CookieManager> { ... }
fn favicon_database(&self) -> Option<FaviconDatabase> { ... }
fn favicon_database_directory(&self) -> Option<GString> { ... }
fn geolocation_manager(&self) -> Option<GeolocationManager> { ... }
fn plugins<P: FnOnce(Result<Vec<Plugin>, Error>) + 'static>(
&self,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P
) { ... }
fn plugins_future(
&self
) -> Pin<Box_<dyn Future<Output = Result<Vec<Plugin>, Error>> + 'static>> { ... }
fn process_model(&self) -> ProcessModel { ... }
fn is_sandbox_enabled(&self) -> bool { ... }
fn security_manager(&self) -> Option<SecurityManager> { ... }
fn is_spell_checking_enabled(&self) -> bool { ... }
fn spell_checking_languages(&self) -> Vec<GString> { ... }
fn time_zone_override(&self) -> Option<GString> { ... }
fn tls_errors_policy(&self) -> TLSErrorsPolicy { ... }
fn uses_system_appearance_for_scrollbars(&self) -> bool { ... }
fn web_process_count_limit(&self) -> u32 { ... }
fn website_data_manager(&self) -> Option<WebsiteDataManager> { ... }
fn initialize_notification_permissions(
&self,
allowed_origins: &[&SecurityOrigin],
disallowed_origins: &[&SecurityOrigin]
) { ... }
fn is_automation_allowed(&self) -> bool { ... }
fn is_ephemeral(&self) -> bool { ... }
fn prefetch_dns(&self, hostname: &str) { ... }
fn register_uri_scheme<P: Fn(&URISchemeRequest) + 'static>(
&self,
scheme: &str,
callback: P
) { ... }
fn send_message_to_all_extensions(&self, message: &impl IsA<UserMessage>) { ... }
fn set_additional_plugins_directory(&self, directory: &str) { ... }
fn set_automation_allowed(&self, allowed: bool) { ... }
fn set_cache_model(&self, cache_model: CacheModel) { ... }
fn set_disk_cache_directory(&self, directory: &str) { ... }
fn set_favicon_database_directory(&self, path: Option<&str>) { ... }
fn set_preferred_languages(&self, languages: &[&str]) { ... }
fn set_process_model(&self, process_model: ProcessModel) { ... }
fn set_sandbox_enabled(&self, enabled: bool) { ... }
fn set_spell_checking_enabled(&self, enabled: bool) { ... }
fn set_spell_checking_languages(&self, languages: &[&str]) { ... }
fn set_tls_errors_policy(&self, policy: TLSErrorsPolicy) { ... }
fn set_use_system_appearance_for_scrollbars(&self, enabled: bool) { ... }
fn set_web_extensions_directory(&self, directory: &str) { ... }
fn set_web_extensions_initialization_user_data(&self, user_data: &Variant) { ... }
fn set_web_process_count_limit(&self, limit: u32) { ... }
fn local_storage_directory(&self) -> Option<GString> { ... }
fn is_process_swap_on_cross_site_navigation_enabled(&self) -> bool { ... }
fn connect_automation_started<F: Fn(&Self, &AutomationSession) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_download_started<F: Fn(&Self, &Download) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_initialize_notification_permissions<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_initialize_web_extensions<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_user_message_received<F: Fn(&Self, &UserMessage) -> bool + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_use_system_appearance_for_scrollbars_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
}
Provided Methods§
sourcefn add_path_to_sandbox(&self, path: impl AsRef<Path>, read_only: bool)
fn add_path_to_sandbox(&self, path: impl AsRef<Path>, read_only: bool)
Available on crate feature
v2_26
only.sourcefn allow_tls_certificate_for_host(
&self,
certificate: &impl IsA<TlsCertificate>,
host: &str
)
fn allow_tls_certificate_for_host( &self, certificate: &impl IsA<TlsCertificate>, host: &str )
Available on crate feature
v2_6
only.fn clear_cache(&self)
fn download_uri(&self, uri: &str) -> Option<Download>
fn cache_model(&self) -> CacheModel
fn favicon_database(&self) -> Option<FaviconDatabase>
fn favicon_database_directory(&self) -> Option<GString>
sourcefn geolocation_manager(&self) -> Option<GeolocationManager>
fn geolocation_manager(&self) -> Option<GeolocationManager>
Available on crate feature
v2_26
only.sourcefn plugins<P: FnOnce(Result<Vec<Plugin>, Error>) + 'static>(
&self,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P
)
fn plugins<P: FnOnce(Result<Vec<Plugin>, Error>) + 'static>( &self, cancellable: Option<&impl IsA<Cancellable>>, callback: P )
👎Deprecated: Since 2.32
sourcefn plugins_future(
&self
) -> Pin<Box_<dyn Future<Output = Result<Vec<Plugin>, Error>> + 'static>>
fn plugins_future( &self ) -> Pin<Box_<dyn Future<Output = Result<Vec<Plugin>, Error>> + 'static>>
👎Deprecated: Since 2.32
sourcefn process_model(&self) -> ProcessModel
fn process_model(&self) -> ProcessModel
👎Deprecated: Since 2.40
Available on crate feature
v2_4
only.sourcefn is_sandbox_enabled(&self) -> bool
fn is_sandbox_enabled(&self) -> bool
Available on crate feature
v2_26
only.fn security_manager(&self) -> Option<SecurityManager>
fn is_spell_checking_enabled(&self) -> bool
fn spell_checking_languages(&self) -> Vec<GString>
sourcefn time_zone_override(&self) -> Option<GString>
fn time_zone_override(&self) -> Option<GString>
Available on crate feature
v2_38
only.sourcefn tls_errors_policy(&self) -> TLSErrorsPolicy
fn tls_errors_policy(&self) -> TLSErrorsPolicy
👎Deprecated: Since 2.32
sourcefn uses_system_appearance_for_scrollbars(&self) -> bool
fn uses_system_appearance_for_scrollbars(&self) -> bool
Available on crate feature
v2_30
only.sourcefn web_process_count_limit(&self) -> u32
fn web_process_count_limit(&self) -> u32
👎Deprecated: Since 2.26
Available on crate feature
v2_10
only.sourcefn website_data_manager(&self) -> Option<WebsiteDataManager>
fn website_data_manager(&self) -> Option<WebsiteDataManager>
Available on crate feature
v2_10
only.sourcefn initialize_notification_permissions(
&self,
allowed_origins: &[&SecurityOrigin],
disallowed_origins: &[&SecurityOrigin]
)
fn initialize_notification_permissions( &self, allowed_origins: &[&SecurityOrigin], disallowed_origins: &[&SecurityOrigin] )
Available on crate feature
v2_16
only.sourcefn is_automation_allowed(&self) -> bool
fn is_automation_allowed(&self) -> bool
Available on crate feature
v2_18
only.sourcefn is_ephemeral(&self) -> bool
fn is_ephemeral(&self) -> bool
Available on crate feature
v2_16
only.fn prefetch_dns(&self, hostname: &str)
fn register_uri_scheme<P: Fn(&URISchemeRequest) + 'static>( &self, scheme: &str, callback: P )
sourcefn send_message_to_all_extensions(&self, message: &impl IsA<UserMessage>)
fn send_message_to_all_extensions(&self, message: &impl IsA<UserMessage>)
Available on crate feature
v2_28
only.sourcefn set_additional_plugins_directory(&self, directory: &str)
fn set_additional_plugins_directory(&self, directory: &str)
👎Deprecated: Since 2.32
sourcefn set_automation_allowed(&self, allowed: bool)
fn set_automation_allowed(&self, allowed: bool)
Available on crate feature
v2_18
only.fn set_cache_model(&self, cache_model: CacheModel)
sourcefn set_disk_cache_directory(&self, directory: &str)
fn set_disk_cache_directory(&self, directory: &str)
👎Deprecated: Since 2.10
fn set_favicon_database_directory(&self, path: Option<&str>)
fn set_preferred_languages(&self, languages: &[&str])
sourcefn set_process_model(&self, process_model: ProcessModel)
fn set_process_model(&self, process_model: ProcessModel)
👎Deprecated: Since 2.40
Available on crate feature
v2_4
only.sourcefn set_sandbox_enabled(&self, enabled: bool)
fn set_sandbox_enabled(&self, enabled: bool)
Available on crate feature
v2_26
only.fn set_spell_checking_enabled(&self, enabled: bool)
fn set_spell_checking_languages(&self, languages: &[&str])
sourcefn set_tls_errors_policy(&self, policy: TLSErrorsPolicy)
fn set_tls_errors_policy(&self, policy: TLSErrorsPolicy)
👎Deprecated: Since 2.32
sourcefn set_use_system_appearance_for_scrollbars(&self, enabled: bool)
fn set_use_system_appearance_for_scrollbars(&self, enabled: bool)
Available on crate feature
v2_30
only.sourcefn set_web_extensions_directory(&self, directory: &str)
fn set_web_extensions_directory(&self, directory: &str)
Examples found in repository?
examples/main.rs (line 41)
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
fn main() {
gtk::init().unwrap();
let window = Window::new(WindowType::Toplevel);
let context = WebContext::default().unwrap();
#[cfg(feature = "v2_4")]
context.set_web_extensions_initialization_user_data(&"webkit".to_variant());
context.set_web_extensions_directory("../webkit2gtk-webextension-rs/example/target/debug/");
#[cfg(feature = "v2_6")]
let webview =
WebView::new_with_context_and_user_content_manager(&context, &UserContentManager::new());
#[cfg(not(feature = "v2_6"))]
let webview = WebView::with_context(&context);
webview.load_uri("https://crates.io/");
window.add(&webview);
let settings = WebViewExt::settings(&webview).unwrap();
settings.set_enable_developer_extras(true);
/*let inspector = webview.get_inspector().unwrap();
inspector.show();*/
window.show_all();
webview.run_javascript("alert('Hello');", None::<&gio::Cancellable>, |_result| {});
#[cfg(feature = "v2_22")]
webview.run_javascript("42", None::<&gio::Cancellable>, |result| match result {
Ok(result) => {
use java_script_core::ValueExt;
let value = result.js_value().unwrap();
println!("is_boolean: {}", value.is_boolean());
println!("is_number: {}", value.is_number());
println!("{:?}", value.to_int32());
println!("{:?}", value.to_boolean());
}
Err(error) => println!("{}", error),
});
window.connect_delete_event(|_, _| {
gtk::main_quit();
glib::Propagation::Proceed
});
gtk::main();
}
sourcefn set_web_extensions_initialization_user_data(&self, user_data: &Variant)
fn set_web_extensions_initialization_user_data(&self, user_data: &Variant)
Available on crate feature
v2_4
only.Examples found in repository?
examples/main.rs (line 40)
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
fn main() {
gtk::init().unwrap();
let window = Window::new(WindowType::Toplevel);
let context = WebContext::default().unwrap();
#[cfg(feature = "v2_4")]
context.set_web_extensions_initialization_user_data(&"webkit".to_variant());
context.set_web_extensions_directory("../webkit2gtk-webextension-rs/example/target/debug/");
#[cfg(feature = "v2_6")]
let webview =
WebView::new_with_context_and_user_content_manager(&context, &UserContentManager::new());
#[cfg(not(feature = "v2_6"))]
let webview = WebView::with_context(&context);
webview.load_uri("https://crates.io/");
window.add(&webview);
let settings = WebViewExt::settings(&webview).unwrap();
settings.set_enable_developer_extras(true);
/*let inspector = webview.get_inspector().unwrap();
inspector.show();*/
window.show_all();
webview.run_javascript("alert('Hello');", None::<&gio::Cancellable>, |_result| {});
#[cfg(feature = "v2_22")]
webview.run_javascript("42", None::<&gio::Cancellable>, |result| match result {
Ok(result) => {
use java_script_core::ValueExt;
let value = result.js_value().unwrap();
println!("is_boolean: {}", value.is_boolean());
println!("is_number: {}", value.is_number());
println!("{:?}", value.to_int32());
println!("{:?}", value.to_boolean());
}
Err(error) => println!("{}", error),
});
window.connect_delete_event(|_, _| {
gtk::main_quit();
glib::Propagation::Proceed
});
gtk::main();
}
sourcefn set_web_process_count_limit(&self, limit: u32)
fn set_web_process_count_limit(&self, limit: u32)
👎Deprecated: Since 2.26
Available on crate feature
v2_10
only.sourcefn local_storage_directory(&self) -> Option<GString>
fn local_storage_directory(&self) -> Option<GString>
👎Deprecated: Since 2.10
Available on crate feature
v2_8
only.Available on crate feature
v2_28
only.sourcefn connect_automation_started<F: Fn(&Self, &AutomationSession) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_automation_started<F: Fn(&Self, &AutomationSession) + 'static>( &self, f: F ) -> SignalHandlerId
Available on crate feature
v2_18
only.fn connect_download_started<F: Fn(&Self, &Download) + 'static>( &self, f: F ) -> SignalHandlerId
sourcefn connect_initialize_notification_permissions<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_initialize_notification_permissions<F: Fn(&Self) + 'static>( &self, f: F ) -> SignalHandlerId
Available on crate feature
v2_16
only.sourcefn connect_initialize_web_extensions<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_initialize_web_extensions<F: Fn(&Self) + 'static>( &self, f: F ) -> SignalHandlerId
Available on crate feature
v2_4
only.sourcefn connect_user_message_received<F: Fn(&Self, &UserMessage) -> bool + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_user_message_received<F: Fn(&Self, &UserMessage) -> bool + 'static>( &self, f: F ) -> SignalHandlerId
Available on crate feature
v2_28
only.sourcefn connect_use_system_appearance_for_scrollbars_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_use_system_appearance_for_scrollbars_notify<F: Fn(&Self) + 'static>( &self, f: F ) -> SignalHandlerId
Available on crate feature
v2_30
only.Object Safety§
This trait is not object safe.