pub trait WebViewProvider:
Environment
+ Send
+ Sync {
// Required methods
fn CreateWebViewPanel<'life0, 'async_trait>(
&'life0 self,
ExtensionDataValue: Value,
ViewType: String,
Title: String,
ShowOptionsValue: Value,
PanelOptionsValue: Value,
ContentOptionsValue: Value,
) -> Pin<Box<dyn Future<Output = Result<String, CommonError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn DisposeWebViewPanel<'life0, 'async_trait>(
&'life0 self,
Handle: String,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn RevealWebViewPanel<'life0, 'async_trait>(
&'life0 self,
Handle: String,
ShowOptionsValue: Value,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn SetWebViewOptions<'life0, 'async_trait>(
&'life0 self,
Handle: String,
OptionsValue: Value,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn SetWebViewHTML<'life0, 'async_trait>(
&'life0 self,
Handle: String,
HTML: String,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn PostMessageToWebView<'life0, 'async_trait>(
&'life0 self,
Handle: String,
Message: Value,
) -> Pin<Box<dyn Future<Output = Result<bool, CommonError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
An abstract service contract for an environment component that can manage WebView panels.
This trait defines all the operations necessary for creating WebView-based UI, setting their content, and managing their lifecycle, abstracting away the specific UI framework (e.g., Tauri, Electron) being used by the host.
Required Methods§
Sourcefn CreateWebViewPanel<'life0, 'async_trait>(
&'life0 self,
ExtensionDataValue: Value,
ViewType: String,
Title: String,
ShowOptionsValue: Value,
PanelOptionsValue: Value,
ContentOptionsValue: Value,
) -> Pin<Box<dyn Future<Output = Result<String, CommonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn CreateWebViewPanel<'life0, 'async_trait>(
&'life0 self,
ExtensionDataValue: Value,
ViewType: String,
Title: String,
ShowOptionsValue: Value,
PanelOptionsValue: Value,
ContentOptionsValue: Value,
) -> Pin<Box<dyn Future<Output = Result<String, CommonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Creates a new WebView panel.
§Parameters
ExtensionDataValue: DTO containing information about the extension creating the panel.ViewType: A unique string identifying the type of the WebView.Title: The initial title for the WebView panel.ShowOptionsValue: DTO specifying the view column to show the panel in.PanelOptionsValue: DTO specifying behavior options for the panel (e.g., enable scripts).ContentOptionsValue: DTO specifying content options (e.g., local resource roots).
§Returns
A Result containing a unique handle (string) for the new WebView, or
a CommonError on failure.
Sourcefn DisposeWebViewPanel<'life0, 'async_trait>(
&'life0 self,
Handle: String,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn DisposeWebViewPanel<'life0, 'async_trait>(
&'life0 self,
Handle: String,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Disposes of a WebView panel, removing it from the UI.
§Parameters
Handle: The unique handle of the WebView panel to dispose.
Sourcefn RevealWebViewPanel<'life0, 'async_trait>(
&'life0 self,
Handle: String,
ShowOptionsValue: Value,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn RevealWebViewPanel<'life0, 'async_trait>(
&'life0 self,
Handle: String,
ShowOptionsValue: Value,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Reveals an existing WebView panel, bringing it to the front.
§Parameters
Handle: The unique handle of the WebView panel to reveal.ShowOptionsValue: DTO specifying the view column to show the panel in.
Sourcefn SetWebViewOptions<'life0, 'async_trait>(
&'life0 self,
Handle: String,
OptionsValue: Value,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn SetWebViewOptions<'life0, 'async_trait>(
&'life0 self,
Handle: String,
OptionsValue: Value,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sets various options for a WebView panel, such as its title and icon path.
§Parameters
Handle: The unique handle of the WebView panel to update.OptionsValue: A DTO (WebviewPanelOptionsUpdateDTO) containing the options to set.
Sourcefn SetWebViewHTML<'life0, 'async_trait>(
&'life0 self,
Handle: String,
HTML: String,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn SetWebViewHTML<'life0, 'async_trait>(
&'life0 self,
Handle: String,
HTML: String,
) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sets the HTML content of a WebView panel.
Handle: The unique handle of the WebView panel.HTML: The HTML string to set as the content.