use crate::webview::actions::{NavigationAction, NavigationResponse, OpenPanelParameters};
use crate::webview::enums::{NavigationPolicy, NavigationResponsePolicy};
use crate::webview::WebView;
pub trait WebViewDelegate {
fn did_load(&mut self, _webview: WebView) {}
fn will_appear(&self) {}
fn did_appear(&self) {}
fn will_disappear(&self) {}
fn did_disappear(&self) {}
fn on_message(&self, _name: &str, _body: &str) {}
fn on_custom_protocol_request(&self, _uri: &str) -> Option<Vec<u8>> {
None
}
fn policy_for_navigation_action<F: Fn(NavigationPolicy)>(&self, _action: NavigationAction, handler: F) {
handler(NavigationPolicy::Allow);
}
fn policy_for_navigation_response<F: Fn(NavigationResponsePolicy)>(&self, _response: NavigationResponse, handler: F) {
handler(NavigationResponsePolicy::Allow);
}
fn run_open_panel<F: Fn(Option<Vec<String>>) + 'static>(&self, _parameters: OpenPanelParameters, handler: F) {
handler(None);
}
fn run_save_panel<F: Fn(bool, Option<String>) + 'static>(&self, _suggested_filename: &str, handler: F) {
handler(false, None);
}
}