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.