mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
servoshell: Port desktop servoshell to use delegate API (#35284)
Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Delan Azabani <dazabani@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
This commit is contained in:
parent
6b12499077
commit
5f08e4fa76
15 changed files with 1109 additions and 1258 deletions
|
@ -1089,7 +1089,11 @@ impl Servo {
|
|||
webview.delegate().notify_ready_to_show(webview);
|
||||
}
|
||||
},
|
||||
EmbedderMsg::WebViewClosed(_) => {},
|
||||
EmbedderMsg::WebViewClosed(webview_id) => {
|
||||
if let Some(webview) = self.get_webview_handle(webview_id) {
|
||||
webview.delegate().notify_closed(webview);
|
||||
}
|
||||
},
|
||||
EmbedderMsg::WebViewFocused(webview_id) => {
|
||||
for id in self.webviews.borrow().keys() {
|
||||
if let Some(webview) = self.get_webview_handle(*id) {
|
||||
|
|
|
@ -117,6 +117,10 @@ pub trait WebViewDelegate {
|
|||
/// The history state has changed.
|
||||
// changed pattern; maybe wasteful if embedder doesn’t care?
|
||||
fn notify_history_changed(&self, _webview: WebView, _: Vec<Url>, _: usize) {}
|
||||
/// Page content has closed this [`WebView`] via `window.close()`. It's the embedder's
|
||||
/// responsibility to remove the [`WebView`] from the interface when this notification
|
||||
/// occurs.
|
||||
fn notify_closed(&self, _webview: WebView) {}
|
||||
|
||||
/// A keyboard event has been sent to Servo, but remains unprocessed. This allows the
|
||||
/// embedding application to handle key events while first letting the [`WebView`]
|
||||
|
@ -144,10 +148,6 @@ pub trait WebViewDelegate {
|
|||
fn request_open_auxiliary_webview(&self, _parent_webview: WebView) -> Option<WebView> {
|
||||
None
|
||||
}
|
||||
/// Page content has requested that this [`WebView`] be closed. It's the embedder's
|
||||
/// responsibility to either ignore this request or to remove the [`WebView`] from the
|
||||
/// interface.
|
||||
fn request_close(&self, _webview: WebView) {}
|
||||
/// Open interface to request permission specified by prompt.
|
||||
fn request_permission(
|
||||
&self,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue