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)
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();
}
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)
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();
}
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.

Object Safety§

This trait is not object safe.

Implementors§