Trait 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ยง

Source

fn add_path_to_sandbox(&self, path: impl AsRef<Path>, read_only: bool)

Available on crate feature v2_26 only.
Source

fn allow_tls_certificate_for_host( &self, certificate: &impl IsA<TlsCertificate>, host: &str, )

Available on crate feature v2_6 only.
Source

fn clear_cache(&self)

Source

fn download_uri(&self, uri: &str) -> Option<Download>

Source

fn cache_model(&self) -> CacheModel

Source

fn cookie_manager(&self) -> Option<CookieManager>

Source

fn favicon_database(&self) -> Option<FaviconDatabase>

Source

fn favicon_database_directory(&self) -> Option<GString>

Source

fn geolocation_manager(&self) -> Option<GeolocationManager>

Available on crate feature v2_26 only.
Source

fn plugins<P: FnOnce(Result<Vec<Plugin>, Error>) + 'static>( &self, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )

๐Ÿ‘ŽDeprecated: Since 2.32
Source

fn plugins_future( &self, ) -> Pin<Box_<dyn Future<Output = Result<Vec<Plugin>, Error>> + 'static>>

๐Ÿ‘ŽDeprecated: Since 2.32
Source

fn process_model(&self) -> ProcessModel

๐Ÿ‘ŽDeprecated: Since 2.40
Available on crate feature v2_4 only.
Source

fn is_sandbox_enabled(&self) -> bool

Available on crate feature v2_26 only.
Source

fn security_manager(&self) -> Option<SecurityManager>

Source

fn is_spell_checking_enabled(&self) -> bool

Source

fn spell_checking_languages(&self) -> Vec<GString>

Source

fn time_zone_override(&self) -> Option<GString>

Available on crate feature v2_38 only.
Source

fn tls_errors_policy(&self) -> TLSErrorsPolicy

๐Ÿ‘ŽDeprecated: Since 2.32
Source

fn uses_system_appearance_for_scrollbars(&self) -> bool

Available on crate feature v2_30 only.
Source

fn web_process_count_limit(&self) -> u32

๐Ÿ‘ŽDeprecated: Since 2.26
Available on crate feature v2_10 only.
Source

fn website_data_manager(&self) -> Option<WebsiteDataManager>

Available on crate feature v2_10 only.
Source

fn initialize_notification_permissions( &self, allowed_origins: &[&SecurityOrigin], disallowed_origins: &[&SecurityOrigin], )

Available on crate feature v2_16 only.
Source

fn is_automation_allowed(&self) -> bool

Available on crate feature v2_18 only.
Source

fn is_ephemeral(&self) -> bool

Available on crate feature v2_16 only.
Source

fn prefetch_dns(&self, hostname: &str)

Source

fn register_uri_scheme<P: Fn(&URISchemeRequest) + 'static>( &self, scheme: &str, callback: P, )

Source

fn send_message_to_all_extensions(&self, message: &impl IsA<UserMessage>)

Available on crate feature v2_28 only.
Source

fn set_additional_plugins_directory(&self, directory: &str)

๐Ÿ‘ŽDeprecated: Since 2.32
Source

fn set_automation_allowed(&self, allowed: bool)

Available on crate feature v2_18 only.
Source

fn set_cache_model(&self, cache_model: CacheModel)

Source

fn set_disk_cache_directory(&self, directory: &str)

๐Ÿ‘ŽDeprecated: Since 2.10
Source

fn set_favicon_database_directory(&self, path: Option<&str>)

Source

fn set_preferred_languages(&self, languages: &[&str])

Source

fn set_process_model(&self, process_model: ProcessModel)

๐Ÿ‘ŽDeprecated: Since 2.40
Available on crate feature v2_4 only.
Source

fn set_sandbox_enabled(&self, enabled: bool)

Available on crate feature v2_26 only.
Source

fn set_spell_checking_enabled(&self, enabled: bool)

Source

fn set_spell_checking_languages(&self, languages: &[&str])

Source

fn set_tls_errors_policy(&self, policy: TLSErrorsPolicy)

๐Ÿ‘ŽDeprecated: Since 2.32
Source

fn set_use_system_appearance_for_scrollbars(&self, enabled: bool)

Available on crate feature v2_30 only.
Source

fn set_web_extensions_directory(&self, directory: &str)

Examples found in repository?
examples/main.rs (line 41)
34fn main() {
35  gtk::init().unwrap();
36
37  let window = Window::new(WindowType::Toplevel);
38  let context = WebContext::default().unwrap();
39  #[cfg(feature = "v2_4")]
40  context.set_web_extensions_initialization_user_data(&"webkit".to_variant());
41  context.set_web_extensions_directory("../webkit2gtk-webextension-rs/example/target/debug/");
42  #[cfg(feature = "v2_6")]
43  let webview =
44    WebView::new_with_context_and_user_content_manager(&context, &UserContentManager::new());
45  #[cfg(not(feature = "v2_6"))]
46  let webview = WebView::with_context(&context);
47  webview.load_uri("https://crates.io/");
48  window.add(&webview);
49
50  let settings = WebViewExt::settings(&webview).unwrap();
51  settings.set_enable_developer_extras(true);
52
53  /*let inspector = webview.get_inspector().unwrap();
54  inspector.show();*/
55
56  window.show_all();
57
58  webview.run_javascript("alert('Hello');", None::<&gio::Cancellable>, |_result| {});
59  #[cfg(feature = "v2_22")]
60  webview.run_javascript("42", None::<&gio::Cancellable>, |result| match result {
61    Ok(result) => {
62      use java_script_core::ValueExt;
63      let value = result.js_value().unwrap();
64      println!("is_boolean: {}", value.is_boolean());
65      println!("is_number: {}", value.is_number());
66      println!("{:?}", value.to_int32());
67      println!("{:?}", value.to_boolean());
68    }
69    Err(error) => println!("{}", error),
70  });
71
72  window.connect_delete_event(|_, _| {
73    gtk::main_quit();
74    glib::Propagation::Proceed
75  });
76
77  gtk::main();
78}
Source

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)
34fn main() {
35  gtk::init().unwrap();
36
37  let window = Window::new(WindowType::Toplevel);
38  let context = WebContext::default().unwrap();
39  #[cfg(feature = "v2_4")]
40  context.set_web_extensions_initialization_user_data(&"webkit".to_variant());
41  context.set_web_extensions_directory("../webkit2gtk-webextension-rs/example/target/debug/");
42  #[cfg(feature = "v2_6")]
43  let webview =
44    WebView::new_with_context_and_user_content_manager(&context, &UserContentManager::new());
45  #[cfg(not(feature = "v2_6"))]
46  let webview = WebView::with_context(&context);
47  webview.load_uri("https://crates.io/");
48  window.add(&webview);
49
50  let settings = WebViewExt::settings(&webview).unwrap();
51  settings.set_enable_developer_extras(true);
52
53  /*let inspector = webview.get_inspector().unwrap();
54  inspector.show();*/
55
56  window.show_all();
57
58  webview.run_javascript("alert('Hello');", None::<&gio::Cancellable>, |_result| {});
59  #[cfg(feature = "v2_22")]
60  webview.run_javascript("42", None::<&gio::Cancellable>, |result| match result {
61    Ok(result) => {
62      use java_script_core::ValueExt;
63      let value = result.js_value().unwrap();
64      println!("is_boolean: {}", value.is_boolean());
65      println!("is_number: {}", value.is_number());
66      println!("{:?}", value.to_int32());
67      println!("{:?}", value.to_boolean());
68    }
69    Err(error) => println!("{}", error),
70  });
71
72  window.connect_delete_event(|_, _| {
73    gtk::main_quit();
74    glib::Propagation::Proceed
75  });
76
77  gtk::main();
78}
Source

fn set_web_process_count_limit(&self, limit: u32)

๐Ÿ‘ŽDeprecated: Since 2.26
Available on crate feature v2_10 only.
Source

fn local_storage_directory(&self) -> Option<GString>

๐Ÿ‘ŽDeprecated: Since 2.10
Available on crate feature v2_8 only.
Source

fn is_process_swap_on_cross_site_navigation_enabled(&self) -> bool

Available on crate feature v2_28 only.
Source

fn connect_automation_started<F: Fn(&Self, &AutomationSession) + 'static>( &self, f: F, ) -> SignalHandlerId

Available on crate feature v2_18 only.
Source

fn connect_download_started<F: Fn(&Self, &Download) + 'static>( &self, f: F, ) -> SignalHandlerId

Source

fn connect_initialize_notification_permissions<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Available on crate feature v2_16 only.
Source

fn connect_initialize_web_extensions<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Available on crate feature v2_4 only.
Source

fn connect_user_message_received<F: Fn(&Self, &UserMessage) -> bool + 'static>( &self, f: F, ) -> SignalHandlerId

Available on crate feature v2_28 only.
Source

fn connect_use_system_appearance_for_scrollbars_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Available on crate feature v2_30 only.

Dyn Compatibilityยง

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementorsยง