-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy pathWebView.InternalJsDialogHandler.cs
More file actions
42 lines (30 loc) · 1.4 KB
/
WebView.InternalJsDialogHandler.cs
File metadata and controls
42 lines (30 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using Xilium.CefGlue;
using Xilium.CefGlue.Common.Handlers;
namespace WebViewControl {
partial class WebView {
private class InternalJsDialogHandler : JSDialogHandler {
private WebView OwnerWebView { get; }
public InternalJsDialogHandler(WebView webView) {
OwnerWebView = webView;
}
protected override bool OnJSDialog(CefBrowser browser, string originUrl, CefJSDialogType dialogType, string message_text, string default_prompt_text, CefJSDialogCallback callback, out bool suppress_message) {
suppress_message = false;
var javacriptDialogShown = OwnerWebView.JavacriptDialogShown;
if (javacriptDialogShown == null) {
return false;
}
void Close() {
callback.Continue(true, "");
callback.Dispose();
}
javacriptDialogShown.Invoke(message_text, Close);
return true;
}
protected override bool OnBeforeUnloadDialog(CefBrowser browser, string messageText, bool isReload, CefJSDialogCallback callback) {
return false; // use default
}
protected override void OnResetDialogState(CefBrowser browser) { }
protected override void OnDialogClosed(CefBrowser browser) { }
}
}
}