2021-02-01 14:55:27 +00:00
import ' dart:collection ' ;
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
import ' dart:typed_data ' ;
2020-06-21 23:17:35 +00:00
import ' context_menu.dart ' ;
2020-05-21 01:34:39 +00:00
2020-05-11 00:48:41 +00:00
import ' types.dart ' ;
import ' in_app_webview_controller.dart ' ;
2020-05-29 12:51:26 +00:00
import ' webview_options.dart ' ;
import ' headless_in_app_webview.dart ' ;
2020-05-11 00:48:41 +00:00
2021-01-28 16:18:02 +00:00
///Abstract class that represents a WebView. Used by [InAppWebView] and [HeadlessInAppWebView].
2020-05-11 00:48:41 +00:00
abstract class WebView {
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
///The window id of a [CreateWindowRequest.windowId].
2021-01-28 16:10:15 +00:00
final int ? windowId ;
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
2020-05-11 00:48:41 +00:00
///Event fired when the [WebView] is created.
2021-01-28 16:10:15 +00:00
final void Function ( InAppWebViewController controller ) ? onWebViewCreated ;
2020-05-11 00:48:41 +00:00
///Event fired when the [WebView] starts to load an [url].
2020-05-28 23:03:45 +00:00
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onPageStarted(android.webkit.WebView,%20java.lang.String,%20android.graphics.Bitmap)
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
///
2020-05-28 23:03:45 +00:00
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455621-webview
2021-01-28 16:10:15 +00:00
final void Function ( InAppWebViewController controller , String ? url ) ?
2020-05-29 17:56:03 +00:00
onLoadStart ;
2020-05-11 00:48:41 +00:00
///Event fired when the [WebView] finishes loading an [url].
2020-05-28 23:03:45 +00:00
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onPageFinished(android.webkit.WebView,%20java.lang.String)
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
///
2020-05-28 23:03:45 +00:00
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455629-webview
2021-01-28 16:10:15 +00:00
final void Function ( InAppWebViewController controller , String ? url ) ? onLoadStop ;
2020-05-11 00:48:41 +00:00
///Event fired when the [WebView] encounters an error loading an [url].
2020-05-28 23:03:45 +00:00
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedError(android.webkit.WebView,%20int,%20java.lang.String,%20java.lang.String)
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
///
2020-05-28 23:03:45 +00:00
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455623-webview
2021-01-28 16:10:15 +00:00
final void Function ( InAppWebViewController controller , String ? url , int code ,
String message ) ? onLoadError ;
2020-05-11 00:48:41 +00:00
///Event fired when the [WebView] main page receives an HTTP error.
///
///[url] represents the url of the main page that received the HTTP error.
///
///[statusCode] represents the status code of the response. HTTP errors have status codes >= 400.
///
///[description] represents the description of the HTTP error. On iOS, it is always an empty string.
///
///**NOTE**: available on Android 23+.
2020-05-28 23:03:45 +00:00
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedHttpError(android.webkit.WebView,%20android.webkit.WebResourceRequest,%20android.webkit.WebResourceResponse)
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
///
2020-05-28 23:03:45 +00:00
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview
2021-01-28 16:10:15 +00:00
final void Function ( InAppWebViewController controller , String ? url ,
int statusCode , String description ) ? onLoadHttpError ;
2020-05-11 00:48:41 +00:00
///Event fired when the current [progress] of loading a page is changed.
2020-05-28 23:03:45 +00:00
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onProgressChanged(android.webkit.WebView,%20int)
2021-01-28 16:10:15 +00:00
final void Function ( InAppWebViewController controller , int progress ) ?
2020-05-29 17:56:03 +00:00
onProgressChanged ;
2020-05-11 00:48:41 +00:00
///Event fired when the [WebView] receives a [ConsoleMessage].
2020-05-28 23:03:45 +00:00
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onConsoleMessage(android.webkit.ConsoleMessage)
2020-05-11 00:48:41 +00:00
final void Function (
2021-01-28 16:10:15 +00:00
InAppWebViewController controller , ConsoleMessage consoleMessage ) ?
2020-05-29 17:56:03 +00:00
onConsoleMessage ;
2020-05-11 00:48:41 +00:00
///Give the host application a chance to take control when a URL is about to be loaded in the current WebView. This event is not called on the initial load of the WebView.
///
///Note that on Android there isn't any way to load an URL for a frame that is not the main frame, so if the request is not for the main frame, the navigation is allowed by default.
///However, if you want to cancel requests for subframes, you can use the [AndroidInAppWebViewOptions.regexToCancelSubFramesLoading] option
///to write a Regular Expression that, if the url request of a subframe matches, then the request of that subframe is canceled.
///
///Also, on Android, this method is not called for POST requests.
///
///[shouldOverrideUrlLoadingRequest] represents the navigation request.
///
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useShouldOverrideUrlLoading] option to `true`.
2020-05-28 23:03:45 +00:00
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#shouldOverrideUrlLoading(android.webkit.WebView,%20java.lang.String)
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
///
2020-05-28 23:03:45 +00:00
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455641-webview
2021-01-28 16:10:15 +00:00
final Future < ShouldOverrideUrlLoadingAction ? > Function (
2020-05-29 17:56:03 +00:00
InAppWebViewController controller ,
2021-01-28 16:10:15 +00:00
ShouldOverrideUrlLoadingRequest shouldOverrideUrlLoadingRequest ) ?
2020-05-29 17:56:03 +00:00
shouldOverrideUrlLoading ;
2020-05-11 00:48:41 +00:00
///Event fired when the [WebView] loads a resource.
///
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useOnLoadResource] and [InAppWebViewOptions.javaScriptEnabled] options to `true`.
final void Function (
2021-01-28 16:10:15 +00:00
InAppWebViewController controller , LoadedResource resource ) ?
2020-05-29 17:56:03 +00:00
onLoadResource ;
2020-05-11 00:48:41 +00:00
///Event fired when the [WebView] scrolls.
///
///[x] represents the current horizontal scroll origin in pixels.
///
///[y] represents the current vertical scroll origin in pixels.
2020-05-28 23:03:45 +00:00
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#onScrollChanged(int,%20int,%20int,%20int)
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
///
2020-05-28 23:03:45 +00:00
///**Official iOS API**: https://developer.apple.com/documentation/uikit/uiscrollviewdelegate/1619392-scrollviewdidscroll
2021-01-28 16:10:15 +00:00
final void Function ( InAppWebViewController controller , int x , int y ) ?
2020-05-29 17:56:03 +00:00
onScrollChanged ;
2020-05-11 00:48:41 +00:00
2020-05-29 08:49:08 +00:00
///Event fired when [WebView] recognizes a downloadable file.
///To download the file, you can use the [flutter_downloader](https://pub.dev/packages/flutter_downloader) plugin.
2020-05-11 00:48:41 +00:00
///
///[url] represents the url of the file.
///
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useOnDownloadStart] option to `true`.
2020-05-28 23:03:45 +00:00
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#setDownloadListener(android.webkit.DownloadListener)
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
///
2020-05-28 23:03:45 +00:00
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview
2021-01-28 16:10:15 +00:00
final void Function ( InAppWebViewController controller , String url ) ?
2020-05-29 17:56:03 +00:00
onDownloadStart ;
2020-05-11 00:48:41 +00:00
///Event fired when the [WebView] finds the `custom-scheme` while loading a resource. Here you can handle the url request and return a [CustomSchemeResponse] to load a specific resource encoded to `base64`.
///
///[scheme] represents the scheme of the url.
///
///[url] represents the url of the request.
2020-05-28 23:03:45 +00:00
///
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkurlschemehandler
2021-01-28 16:10:15 +00:00
final Future < CustomSchemeResponse ? > Function (
InAppWebViewController controller , String scheme , String url ) ?
2020-05-29 17:56:03 +00:00
onLoadResourceCustomScheme ;
2020-05-11 00:48:41 +00:00
///Event fired when the [WebView] requests the host application to create a new window,
///for example when trying to open a link with `target="_blank"` or when `window.open()` is called by JavaScript side.
2020-06-30 08:58:59 +00:00
///If the host application chooses to honor this request, it should return `true` from this method, create a new WebView to host the window.
///If the host application chooses not to honor the request, it should return `false` from this method.
///The default implementation of this method does nothing and hence returns `false`.
2020-05-11 00:48:41 +00:00
///
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
///[createWindowRequest] represents the request.
2020-05-11 00:48:41 +00:00
///
2020-07-02 15:30:55 +00:00
///**NOTE**: to allow JavaScript to open windows, you need to set [InAppWebViewOptions.javaScriptCanOpenWindowsAutomatically] option to `true`.
///
2020-05-11 00:48:41 +00:00
///**NOTE**: on Android you need to set [AndroidInAppWebViewOptions.supportMultipleWindows] option to `true`.
2020-05-28 23:03:45 +00:00
///
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
///**NOTE**: on iOS, setting these initial options: [InAppWebViewOptions.supportZoom], [InAppWebViewOptions.useOnLoadResource], [InAppWebViewOptions.useShouldInterceptAjaxRequest],
///[InAppWebViewOptions.useShouldInterceptFetchRequest], [InAppWebViewOptions.applicationNameForUserAgent], [InAppWebViewOptions.javaScriptCanOpenWindowsAutomatically],
///[InAppWebViewOptions.javaScriptEnabled], [InAppWebViewOptions.minimumFontSize], [InAppWebViewOptions.preferredContentMode], [InAppWebViewOptions.incognito],
///[InAppWebViewOptions.cacheEnabled], [InAppWebViewOptions.mediaPlaybackRequiresUserGesture],
///[InAppWebViewOptions.resourceCustomSchemes], [IOSInAppWebViewOptions.sharedCookiesEnabled],
///[IOSInAppWebViewOptions.enableViewportScale], [IOSInAppWebViewOptions.allowsAirPlayForMediaPlayback],
///[IOSInAppWebViewOptions.allowsPictureInPictureMediaPlayback], [IOSInAppWebViewOptions.isFraudulentWebsiteWarningEnabled],
///[IOSInAppWebViewOptions.allowsInlineMediaPlayback], [IOSInAppWebViewOptions.suppressesIncrementalRendering], [IOSInAppWebViewOptions.selectionGranularity],
///[IOSInAppWebViewOptions.ignoresViewportScaleLimits],
2020-06-30 08:58:59 +00:00
///will have no effect due to a `WKWebView` limitation when creating the new window WebView: it's impossible to return the new `WKWebView`
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
///with a different `WKWebViewConfiguration` instance (see https://developer.apple.com/documentation/webkit/wkuidelegate/1536907-webview).
///So, these options will be inherited from the caller WebView.
///Also, note that calling [InAppWebViewController.setOptions] method using the controller of the new created WebView,
///it will update also the WebView options of the caller WebView.
///
2020-05-28 23:03:45 +00:00
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onCreateWindow(android.webkit.WebView,%20boolean,%20boolean,%20android.os.Message)
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
///
2020-05-28 23:03:45 +00:00
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkuidelegate/1536907-webview
2021-01-28 16:10:15 +00:00
final Future < bool ? > Function ( InAppWebViewController controller ,
CreateWindowRequest createWindowRequest ) ? onCreateWindow ;
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
///Event fired when the host application should close the given WebView and remove it from the view system if necessary.
///At this point, WebCore has stopped any loading in this window and has removed any cross-scripting ability in javascript.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onCloseWindow(android.webkit.WebView)
///
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkuidelegate/1537390-webviewdidclose
2021-01-28 16:10:15 +00:00
final void Function ( InAppWebViewController controller ) ? onCloseWindow ;
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
///Event fired when the JavaScript `window` object of the WebView has received focus.
///This is the result of the `focus` JavaScript event applied to the `window` object.
2021-01-28 16:10:15 +00:00
final void Function ( InAppWebViewController controller ) ? onWindowFocus ;
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
///Event fired when the JavaScript `window` object of the WebView has lost focus.
///This is the result of the `blur` JavaScript event applied to the `window` object.
2021-01-28 16:10:15 +00:00
final void Function ( InAppWebViewController controller ) ? onWindowBlur ;
2020-05-11 00:48:41 +00:00
///Event fired when javascript calls the `alert()` method to display an alert dialog.
///If [JsAlertResponse.handledByClient] is `true`, the webview will assume that the client will handle the dialog.
///
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
///[jsAlertRequest] contains the message to be displayed in the alert dialog and the of the page requesting the dialog.
2020-05-28 23:03:45 +00:00
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onJsAlert(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20android.webkit.JsResult)
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
///
2020-05-28 23:03:45 +00:00
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkuidelegate/1537406-webview
2021-01-28 16:10:15 +00:00
final Future < JsAlertResponse ? > Function (
InAppWebViewController controller , JsAlertRequest jsAlertRequest ) ?
2020-06-29 14:37:36 +00:00
onJsAlert ;
2020-05-11 00:48:41 +00:00
///Event fired when javascript calls the `confirm()` method to display a confirm dialog.
///If [JsConfirmResponse.handledByClient] is `true`, the webview will assume that the client will handle the dialog.
///
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
///[jsConfirmRequest] contains the message to be displayed in the confirm dialog and the of the page requesting the dialog.
2020-05-28 23:03:45 +00:00
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onJsConfirm(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20android.webkit.JsResult)
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
///
2020-05-28 23:03:45 +00:00
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkuidelegate/1536489-webview
2021-01-28 16:10:15 +00:00
final Future < JsConfirmResponse ? > Function (
InAppWebViewController controller , JsConfirmRequest jsConfirmRequest ) ?
2020-06-29 14:37:36 +00:00
onJsConfirm ;
2020-05-11 00:48:41 +00:00
///Event fired when javascript calls the `prompt()` method to display a prompt dialog.
///If [JsPromptResponse.handledByClient] is `true`, the webview will assume that the client will handle the dialog.
///
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
///[jsPromptRequest] contains the message to be displayed in the prompt dialog, the default value displayed in the prompt dialog, and the of the page requesting the dialog.
2020-05-28 23:03:45 +00:00
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onJsPrompt(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20java.lang.String,%20android.webkit.JsPromptResult)
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
///
2020-05-28 23:03:45 +00:00
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkuidelegate/1538086-webview
2021-01-28 16:10:15 +00:00
final Future < JsPromptResponse ? > Function (
InAppWebViewController controller , JsPromptRequest jsPromptRequest ) ?
2020-06-29 14:37:36 +00:00
onJsPrompt ;
2020-05-11 00:48:41 +00:00
///Event fired when the WebView received an HTTP authentication request. The default behavior is to cancel the request.
///
///[challenge] contains data about host, port, protocol, realm, etc. as specified in the [HttpAuthChallenge].
2020-05-28 23:03:45 +00:00
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedHttpAuthRequest(android.webkit.WebView,%20android.webkit.HttpAuthHandler,%20java.lang.String,%20java.lang.String)
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
///
2020-05-28 23:03:45 +00:00
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview
2021-01-28 16:10:15 +00:00
final Future < HttpAuthResponse ? > Function (
InAppWebViewController controller , HttpAuthChallenge challenge ) ?
2020-05-29 17:56:03 +00:00
onReceivedHttpAuthRequest ;
2020-05-11 00:48:41 +00:00
///Event fired when the WebView need to perform server trust authentication (certificate validation).
///The host application must return either [ServerTrustAuthResponse] instance with [ServerTrustAuthResponseAction.CANCEL] or [ServerTrustAuthResponseAction.PROCEED].
///
///[challenge] contains data about host, port, protocol, realm, etc. as specified in the [ServerTrustChallenge].
2020-05-28 23:03:45 +00:00
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedSslError(android.webkit.WebView,%20android.webkit.SslErrorHandler,%20android.net.http.SslError)
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
///
2020-05-28 23:03:45 +00:00
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview
2021-01-28 16:10:15 +00:00
final Future < ServerTrustAuthResponse ? > Function (
InAppWebViewController controller , ServerTrustChallenge challenge ) ?
2020-05-29 17:56:03 +00:00
onReceivedServerTrustAuthRequest ;
2020-05-11 00:48:41 +00:00
///Notify the host application to handle an SSL client certificate request.
///Webview stores the response in memory (for the life of the application) if [ClientCertResponseAction.PROCEED] or [ClientCertResponseAction.CANCEL]
///is called and does not call [onReceivedClientCertRequest] again for the same host and port pair.
///Note that, multiple layers in chromium network stack might be caching the responses.
///
///[challenge] contains data about host, port, protocol, realm, etc. as specified in the [ClientCertChallenge].
2020-05-28 23:03:45 +00:00
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedClientCertRequest(android.webkit.WebView,%20android.webkit.ClientCertRequest)
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
///
2020-05-28 23:03:45 +00:00
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview
2021-01-28 16:10:15 +00:00
final Future < ClientCertResponse ? > Function (
InAppWebViewController controller , ClientCertChallenge challenge ) ?
2020-05-29 17:56:03 +00:00
onReceivedClientCertRequest ;
2020-05-11 00:48:41 +00:00
///Event fired as find-on-page operations progress.
///The listener may be notified multiple times while the operation is underway, and the numberOfMatches value should not be considered final unless [isDoneCounting] is true.
///
///[activeMatchOrdinal] represents the zero-based ordinal of the currently selected match.
///
///[numberOfMatches] represents how many matches have been found.
///
///[isDoneCounting] whether the find operation has actually completed.
2020-05-28 23:03:45 +00:00
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#setFindListener(android.webkit.WebView.FindListener)
2020-05-11 00:48:41 +00:00
final void Function ( InAppWebViewController controller , int activeMatchOrdinal ,
2021-01-28 16:10:15 +00:00
int numberOfMatches , bool isDoneCounting ) ? onFindResultReceived ;
2020-05-11 00:48:41 +00:00
///Event fired when an `XMLHttpRequest` is sent to a server.
///It gives the host application a chance to take control over the request before sending it.
///
///[ajaxRequest] represents the `XMLHttpRequest`.
///
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useShouldInterceptAjaxRequest] option to `true`.
///Also, unlike iOS that has [WKUserScript](https://developer.apple.com/documentation/webkit/wkuserscript) that
///can inject javascript code right after the document element is created but before any other content is loaded, in Android the javascript code
///used to intercept ajax requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms).
///Inside the `window.addEventListener("flutterInAppWebViewPlatformReady")` event, the ajax requests will be intercept for sure.
2021-01-28 16:10:15 +00:00
final Future < AjaxRequest ? > Function (
InAppWebViewController controller , AjaxRequest ajaxRequest ) ?
2020-05-29 17:56:03 +00:00
shouldInterceptAjaxRequest ;
2020-05-11 00:48:41 +00:00
///Event fired whenever the `readyState` attribute of an `XMLHttpRequest` changes.
///It gives the host application a chance to abort the request.
///
///[ajaxRequest] represents the [XMLHttpRequest].
///
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useShouldInterceptAjaxRequest] option to `true`.
///Also, unlike iOS that has [WKUserScript](https://developer.apple.com/documentation/webkit/wkuserscript) that
///can inject javascript code right after the document element is created but before any other content is loaded, in Android the javascript code
///used to intercept ajax requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms).
///Inside the `window.addEventListener("flutterInAppWebViewPlatformReady")` event, the ajax requests will be intercept for sure.
2021-01-28 16:10:15 +00:00
final Future < AjaxRequestAction ? > Function (
InAppWebViewController controller , AjaxRequest ajaxRequest ) ?
2020-05-29 17:56:03 +00:00
onAjaxReadyStateChange ;
2020-05-11 00:48:41 +00:00
///Event fired as an `XMLHttpRequest` progress.
///It gives the host application a chance to abort the request.
///
///[ajaxRequest] represents the [XMLHttpRequest].
///
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useShouldInterceptAjaxRequest] option to `true`.
///Also, unlike iOS that has [WKUserScript](https://developer.apple.com/documentation/webkit/wkuserscript) that
///can inject javascript code right after the document element is created but before any other content is loaded, in Android the javascript code
///used to intercept ajax requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms).
///Inside the `window.addEventListener("flutterInAppWebViewPlatformReady")` event, the ajax requests will be intercept for sure.
2021-01-28 16:10:15 +00:00
final Future < AjaxRequestAction ? > Function (
InAppWebViewController controller , AjaxRequest ajaxRequest ) ?
2020-05-29 17:56:03 +00:00
onAjaxProgress ;
2020-05-11 00:48:41 +00:00
///Event fired when a request is sent to a server through [Fetch API](https://developer.mozilla.org/it/docs/Web/API/Fetch_API).
///It gives the host application a chance to take control over the request before sending it.
///
///[fetchRequest] represents a resource request.
///
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useShouldInterceptFetchRequest] option to `true`.
///Also, unlike iOS that has [WKUserScript](https://developer.apple.com/documentation/webkit/wkuserscript) that
///can inject javascript code right after the document element is created but before any other content is loaded, in Android the javascript code
///used to intercept fetch requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms).
///Inside the `window.addEventListener("flutterInAppWebViewPlatformReady")` event, the fetch requests will be intercept for sure.
2021-01-28 16:10:15 +00:00
final Future < FetchRequest ? > Function (
InAppWebViewController controller , FetchRequest fetchRequest ) ?
2020-05-29 17:56:03 +00:00
shouldInterceptFetchRequest ;
2020-05-11 00:48:41 +00:00
///Event fired when the host application updates its visited links database.
///This event is also fired when the navigation state of the [WebView] changes through the usage of
///javascript **[History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API)** functions (`pushState()`, `replaceState()`) and `onpopstate` event
///or, also, when the javascript `window.location` changes without reloading the webview (for example appending or modifying an hash to the url).
///
///[url] represents the url being visited.
///
///[androidIsReload] indicates if this url is being reloaded. Available only on Android.
2020-05-28 23:03:45 +00:00
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#doUpdateVisitedHistory(android.webkit.WebView,%20java.lang.String,%20boolean)
2020-05-11 00:48:41 +00:00
final void Function (
2021-01-28 16:10:15 +00:00
InAppWebViewController controller , String ? url , bool ? androidIsReload ) ?
2020-05-29 17:56:03 +00:00
onUpdateVisitedHistory ;
2020-05-11 00:48:41 +00:00
///Event fired when `window.print()` is called from JavaScript side.
///
///[url] represents the url on which is called.
///
///**NOTE**: available on Android 21+.
2021-01-28 16:10:15 +00:00
final void Function ( InAppWebViewController controller , String ? url ) ? onPrint ;
2020-05-11 00:48:41 +00:00
///Event fired when an HTML element of the webview has been clicked and held.
///
///[hitTestResult] represents the hit result for hitting an HTML elements.
2020-05-28 23:03:45 +00:00
///
///**Official Android API**: https://developer.android.com/reference/android/view/View#setOnLongClickListener(android.view.View.OnLongClickListener)
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
///
2020-05-28 23:03:45 +00:00
///**Official iOS API**: https://developer.apple.com/documentation/uikit/uilongpressgesturerecognizer
2020-05-11 00:48:41 +00:00
final void Function ( InAppWebViewController controller ,
2021-01-28 16:10:15 +00:00
InAppWebViewHitTestResult hitTestResult ) ? onLongPressHitTestResult ;
2020-05-11 00:48:41 +00:00
2020-05-23 17:33:54 +00:00
///Event fired when the current page has entered full screen mode.
2020-05-28 23:03:45 +00:00
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onShowCustomView(android.view.View,%20android.webkit.WebChromeClient.CustomViewCallback)
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
///
2020-05-28 23:03:45 +00:00
///**Official iOS API**: https://developer.apple.com/documentation/uikit/uiwindow/1621621-didbecomevisiblenotification
2021-01-28 16:10:15 +00:00
final void Function ( InAppWebViewController controller ) ? onEnterFullscreen ;
2020-05-23 17:33:54 +00:00
///Event fired when the current page has exited full screen mode.
2020-05-28 23:03:45 +00:00
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onHideCustomView()
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
///
2020-05-28 23:03:45 +00:00
///**Official iOS API**: https://developer.apple.com/documentation/uikit/uiwindow/1621617-didbecomehiddennotification
2021-01-28 16:10:15 +00:00
final void Function ( InAppWebViewController controller ) ? onExitFullscreen ;
2020-05-23 17:33:54 +00:00
2020-05-28 23:03:45 +00:00
///Called when the web view begins to receive web content.
///
///This event occurs early in the document loading process, and as such
///you should expect that linked resources (for example, CSS and images) may not be available.
///
///[url] represents the URL corresponding to the page navigation that triggered this callback.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onPageCommitVisible(android.webkit.WebView,%20java.lang.String)
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
///
2020-05-28 23:03:45 +00:00
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455635-webview
2021-01-28 16:10:15 +00:00
final void Function ( InAppWebViewController controller , String ? url ) ?
2020-05-29 17:56:03 +00:00
onPageCommitVisible ;
2020-05-28 23:03:45 +00:00
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
///Event fired when a change in the document title occurred.
///
///[title] represents the string containing the new title of the document.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onReceivedTitle(android.webkit.WebView,%20java.lang.String)
2021-01-28 16:10:15 +00:00
final void Function ( InAppWebViewController controller , String ? title ) ?
2020-06-29 14:37:36 +00:00
onTitleChanged ;
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
2020-05-11 00:48:41 +00:00
///Event fired when the webview notifies that a loading URL has been flagged by Safe Browsing.
///The default behavior is to show an interstitial to the user, with the reporting checkbox visible.
///
///[url] represents the url of the request.
///
///[threatType] represents the reason the resource was caught by Safe Browsing, corresponding to a [SafeBrowsingThreat].
///
///**NOTE**: available only on Android 27+.
2020-05-28 23:03:45 +00:00
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onSafeBrowsingHit(android.webkit.WebView,%20android.webkit.WebResourceRequest,%20int,%20android.webkit.SafeBrowsingResponse)
2021-01-28 16:10:15 +00:00
final Future < SafeBrowsingResponse ? > Function ( InAppWebViewController controller ,
String url , SafeBrowsingThreat ? threatType ) ? androidOnSafeBrowsingHit ;
2020-05-11 00:48:41 +00:00
///Event fired when the WebView is requesting permission to access the specified resources and the permission currently isn't granted or denied.
///
///[origin] represents the origin of the web page which is trying to access the restricted resources.
///
///[resources] represents the array of resources the web content wants to access.
///
///**NOTE**: available only on Android 23+.
2020-05-28 23:03:45 +00:00
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onPermissionRequest(android.webkit.PermissionRequest)
2021-01-28 16:10:15 +00:00
final Future < PermissionRequestResponse ? > Function (
2020-05-11 00:48:41 +00:00
InAppWebViewController controller ,
String origin ,
2021-01-28 16:10:15 +00:00
List < String > resources ) ? androidOnPermissionRequest ;
2020-05-11 00:48:41 +00:00
///Event that notifies the host application that web content from the specified origin is attempting to use the Geolocation API, but no permission state is currently set for that origin.
///Note that for applications targeting Android N and later SDKs (API level > `Build.VERSION_CODES.M`) this method is only called for requests originating from secure origins such as https.
///On non-secure origins geolocation requests are automatically denied.
///
///[origin] represents the origin of the web content attempting to use the Geolocation API.
///
///**NOTE**: available only on Android.
2020-05-28 23:03:45 +00:00
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onGeolocationPermissionsShowPrompt(java.lang.String,%20android.webkit.GeolocationPermissions.Callback)
2021-01-28 16:10:15 +00:00
final Future < GeolocationPermissionShowPromptResponse ? > Function (
InAppWebViewController controller , String origin ) ?
2020-05-29 17:56:03 +00:00
androidOnGeolocationPermissionsShowPrompt ;
2020-05-11 00:48:41 +00:00
///Notify the host application that a request for Geolocation permissions, made with a previous call to [androidOnGeolocationPermissionsShowPrompt] has been canceled.
///Any related UI should therefore be hidden.
///
///**NOTE**: available only on Android.
2020-05-28 23:03:45 +00:00
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onGeolocationPermissionsHidePrompt()
2021-01-28 16:10:15 +00:00
final void Function ( InAppWebViewController controller ) ?
2020-05-29 17:56:03 +00:00
androidOnGeolocationPermissionsHidePrompt ;
2020-05-11 00:48:41 +00:00
2020-05-28 23:03:45 +00:00
///Notify the host application of a resource request and allow the application to return the data.
///If the return value is `null`, the WebView will continue to load the resource as usual.
///Otherwise, the return response and data will be used.
///
///This callback is invoked for a variety of URL schemes (e.g., `http(s):`, `data:`, `file:`, etc.),
///not only those schemes which send requests over the network.
///This is not called for `javascript:` URLs, `blob:` URLs, or for assets accessed via `file:///android_asset/` or `file:///android_res/` URLs.
///
///In the case of redirects, this is only called for the initial resource URL, not any subsequent redirect URLs.
///
///[request] Object containing the details of the request.
///
2020-06-12 02:04:41 +00:00
///**NOTE**: available only on Android. In order to be able to listen this event, you need to set [AndroidInAppWebViewOptions.useShouldInterceptRequest] option to `true`.
2020-05-28 23:03:45 +00:00
///
///**Official Android API**:
///- https://developer.android.com/reference/android/webkit/WebViewClient#shouldInterceptRequest(android.webkit.WebView,%20android.webkit.WebResourceRequest)
///- https://developer.android.com/reference/android/webkit/WebViewClient#shouldInterceptRequest(android.webkit.WebView,%20java.lang.String)
2021-01-28 16:10:15 +00:00
final Future < WebResourceResponse ? > Function (
InAppWebViewController controller , WebResourceRequest request ) ?
2020-05-29 17:56:03 +00:00
androidShouldInterceptRequest ;
2020-05-28 23:03:45 +00:00
///Event called when the renderer currently associated with the WebView becomes unresponsive as a result of a long running blocking task such as the execution of JavaScript.
///
///If a WebView fails to process an input event, or successfully navigate to a new URL within a reasonable time frame, the renderer is considered to be unresponsive, and this callback will be called.
///
///This callback will continue to be called at regular intervals as long as the renderer remains unresponsive.
///If the renderer becomes responsive again, [androidOnRenderProcessResponsive] will be called once,
///and this method will not subsequently be called unless another period of unresponsiveness is detected.
///
///The minimum interval between successive calls to `androidOnRenderProcessUnresponsive` is 5 seconds.
///
///No action is taken by WebView as a result of this method call.
///Applications may choose to terminate the associated renderer via the object that is passed to this callback,
///if in multiprocess mode, however this must be accompanied by correctly handling [androidOnRenderProcessGone] for this WebView,
///and all other WebViews associated with the same renderer. Failure to do so will result in application termination.
///
///**NOTE**: available only on Android 29+.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewRenderProcessClient#onRenderProcessUnresponsive(android.webkit.WebView,%20android.webkit.WebViewRenderProcess)
2021-01-28 16:10:15 +00:00
final Future < WebViewRenderProcessAction ? > Function (
InAppWebViewController controller , String ? url ) ?
2020-05-29 17:56:03 +00:00
androidOnRenderProcessUnresponsive ;
2020-05-28 23:03:45 +00:00
///Event called once when an unresponsive renderer currently associated with the WebView becomes responsive.
///
///After a WebView renderer becomes unresponsive, which is notified to the application by [androidOnRenderProcessUnresponsive],
///it is possible for the blocking renderer task to complete, returning the renderer to a responsive state.
///In that case, this method is called once to indicate responsiveness.
///
///No action is taken by WebView as a result of this method call.
///
///**NOTE**: available only on Android 29+.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewRenderProcessClient#onRenderProcessResponsive(android.webkit.WebView,%20android.webkit.WebViewRenderProcess)
2021-01-28 16:10:15 +00:00
final Future < WebViewRenderProcessAction ? > Function (
InAppWebViewController controller , String ? url ) ?
2020-05-29 17:56:03 +00:00
androidOnRenderProcessResponsive ;
2020-05-28 23:03:45 +00:00
///Event fired when the given WebView's render process has exited.
///The application's implementation of this callback should only attempt to clean up the WebView.
///The WebView should be removed from the view hierarchy, all references to it should be cleaned up.
///
///[detail] the reason why it exited.
///
///**NOTE**: available only on Android 26+.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onRenderProcessGone(android.webkit.WebView,%20android.webkit.RenderProcessGoneDetail)
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
final void Function (
2021-01-28 16:10:15 +00:00
InAppWebViewController controller , RenderProcessGoneDetail detail ) ?
2020-05-29 17:56:03 +00:00
androidOnRenderProcessGone ;
2020-05-28 23:03:45 +00:00
///As the host application if the browser should resend data as the requested page was a result of a POST. The default is to not resend the data.
///
///**NOTE**: available only on Android.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onFormResubmission(android.webkit.WebView,%20android.os.Message,%20android.os.Message)
2021-01-28 16:10:15 +00:00
final Future < FormResubmissionAction ? > Function (
InAppWebViewController controller , String ? url ) ? androidOnFormResubmission ;
2020-05-28 23:03:45 +00:00
///Event fired when the scale applied to the WebView has changed.
///
///[oldScale] The old scale factor.
///
///[newScale] The new scale factor.
///
///**NOTE**: available only on Android.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onScaleChanged(android.webkit.WebView,%20float,%20float)
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
final void Function (
2021-01-28 16:10:15 +00:00
InAppWebViewController controller , double oldScale , double newScale ) ?
2020-05-29 17:56:03 +00:00
androidOnScaleChanged ;
2020-05-28 23:03:45 +00:00
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
///Event fired when there is a request to display and focus for this WebView.
///This may happen due to another WebView opening a link in this WebView and requesting that this WebView be displayed.
///
///**NOTE**: available only on Android.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onRequestFocus(android.webkit.WebView)
2021-01-28 16:10:15 +00:00
final void Function ( InAppWebViewController controller ) ? androidOnRequestFocus ;
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
///Event fired when there is new favicon for the current page.
///
///[icon] represents the favicon for the current page.
///
///**NOTE**: available only on Android.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onReceivedIcon(android.webkit.WebView,%20android.graphics.Bitmap)
2021-01-28 16:10:15 +00:00
final void Function ( InAppWebViewController controller , Uint8List icon ) ?
2020-06-29 14:37:36 +00:00
androidOnReceivedIcon ;
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
///Event fired when there is an url for an apple-touch-icon.
///
///[url] represents the icon url.
///
///[precomposed] is `true` if the url is for a precomposed touch icon.
///
///**NOTE**: available only on Android.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onReceivedTouchIconUrl(android.webkit.WebView,%20java.lang.String,%20boolean)
2020-06-29 14:37:36 +00:00
final void Function (
2021-01-28 16:10:15 +00:00
InAppWebViewController controller , String url , bool precomposed ) ?
2020-06-29 14:37:36 +00:00
androidOnReceivedTouchIconUrl ;
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
///Event fired when the client should display a dialog to confirm navigation away from the current page.
///This is the result of the `onbeforeunload` javascript event.
///If [JsBeforeUnloadResponse.handledByClient] is `true`, WebView will assume that the client will handle the confirm dialog.
///If [JsBeforeUnloadResponse.handledByClient] is `false`, a default value of `true` will be returned to javascript to accept navigation away from the current page.
///The default behavior is to return `false`.
///Setting the [JsBeforeUnloadResponse.action] to [JsBeforeUnloadResponseAction.CONFIRM] will navigate away from the current page,
///[JsBeforeUnloadResponseAction.CANCEL] will cancel the navigation.
///
///[jsBeforeUnloadRequest] contains the message to be displayed in the alert dialog and the of the page requesting the dialog.
///
///**NOTE**: available only on Android.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onJsBeforeUnload(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20android.webkit.JsResult)
2021-01-28 16:10:15 +00:00
final Future < JsBeforeUnloadResponse ? > Function (
2020-06-29 14:37:36 +00:00
InAppWebViewController controller ,
2021-01-28 16:10:15 +00:00
JsBeforeUnloadRequest jsBeforeUnloadRequest ) ? androidOnJsBeforeUnload ;
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
///Event fired when a request to automatically log in the user has been processed.
///
///[loginRequest] contains the realm, account and args of the login request.
///
///**NOTE**: available only on Android.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedLoginRequest(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20java.lang.String)
2020-06-29 14:37:36 +00:00
final void Function (
2021-01-28 16:10:15 +00:00
InAppWebViewController controller , LoginRequest loginRequest ) ?
2020-06-29 14:37:36 +00:00
androidOnReceivedLoginRequest ;
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
2020-05-11 00:48:41 +00:00
///Invoked when the web view's web content process is terminated.
///
///**NOTE**: available only on iOS.
2020-05-28 23:03:45 +00:00
///
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455639-webviewwebcontentprocessdidtermi
2021-01-28 16:10:15 +00:00
final void Function ( InAppWebViewController controller ) ?
2020-05-29 17:56:03 +00:00
iosOnWebContentProcessDidTerminate ;
2020-05-11 00:48:41 +00:00
///Called when a web view receives a server redirect.
///
///**NOTE**: available only on iOS.
2020-05-28 23:03:45 +00:00
///
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455627-webview
2021-01-28 16:10:15 +00:00
final void Function ( InAppWebViewController controller ) ?
2020-05-29 17:56:03 +00:00
iosOnDidReceiveServerRedirectForProvisionalNavigation ;
2020-05-11 00:48:41 +00:00
2021-02-09 23:15:10 +00:00
///Called when a web view asks for permission to navigate to new content after the response to the navigation request is known.
///
///[navigationResponse] represents the navigation response.
///
///**NOTE**: available only on iOS.
///
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview
final Future < IOSNavigationResponseAction ? > Function ( InAppWebViewController controller ,
IOSNavigationResponse navigationResponse ) ?
iosOnNavigationResponse ;
2020-05-11 00:48:41 +00:00
///Initial url that will be loaded.
2021-01-28 16:10:15 +00:00
final String ? initialUrl ;
2020-05-11 00:48:41 +00:00
///Initial asset file that will be loaded. See [InAppWebViewController.loadFile] for explanation.
2021-01-28 16:10:15 +00:00
final String ? initialFile ;
2020-05-11 00:48:41 +00:00
///Initial [InAppWebViewInitialData] that will be loaded.
2021-01-28 16:10:15 +00:00
final InAppWebViewInitialData ? initialData ;
2020-05-11 00:48:41 +00:00
///Initial headers that will be used.
2021-01-28 16:10:15 +00:00
final Map < String , String > ? initialHeaders ;
2020-05-11 00:48:41 +00:00
///Initial options that will be used.
2021-01-28 16:10:15 +00:00
final InAppWebViewGroupOptions ? initialOptions ;
2020-05-11 00:48:41 +00:00
2020-05-21 01:34:39 +00:00
///Context menu which contains custom menu items to be shown when [ContextMenu] is presented.
2021-01-28 16:10:15 +00:00
final ContextMenu ? contextMenu ;
2020-05-21 01:34:39 +00:00
2021-02-01 14:55:27 +00:00
///Initial list of user scripts to be loaded at start or end of a page loading.
///To add or remove user scripts, you have to use the [InAppWebViewController]'s methods such as [InAppWebViewController.addUserScript],
///[InAppWebViewController.removeUserScript], [InAppWebViewController.removeAllUserScripts], etc.
final UnmodifiableListView < UserScript > ? initialUserScripts ;
2020-05-29 17:56:03 +00:00
WebView (
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
{ this . windowId ,
this . onWebViewCreated ,
2020-05-29 17:56:03 +00:00
this . onLoadStart ,
this . onLoadStop ,
this . onLoadError ,
this . onLoadHttpError ,
this . onProgressChanged ,
this . onConsoleMessage ,
this . shouldOverrideUrlLoading ,
this . onLoadResource ,
this . onScrollChanged ,
this . onDownloadStart ,
this . onLoadResourceCustomScheme ,
this . onCreateWindow ,
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
this . onCloseWindow ,
2020-05-29 17:56:03 +00:00
this . onJsAlert ,
this . onJsConfirm ,
this . onJsPrompt ,
this . onReceivedHttpAuthRequest ,
this . onReceivedServerTrustAuthRequest ,
this . onReceivedClientCertRequest ,
this . onFindResultReceived ,
this . shouldInterceptAjaxRequest ,
this . onAjaxReadyStateChange ,
this . onAjaxProgress ,
this . shouldInterceptFetchRequest ,
this . onUpdateVisitedHistory ,
this . onPrint ,
this . onLongPressHitTestResult ,
this . onEnterFullscreen ,
this . onExitFullscreen ,
this . onPageCommitVisible ,
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
this . onTitleChanged ,
this . onWindowFocus ,
this . onWindowBlur ,
2020-05-29 17:56:03 +00:00
this . androidOnSafeBrowsingHit ,
this . androidOnPermissionRequest ,
this . androidOnGeolocationPermissionsShowPrompt ,
this . androidOnGeolocationPermissionsHidePrompt ,
this . androidShouldInterceptRequest ,
this . androidOnRenderProcessGone ,
this . androidOnRenderProcessResponsive ,
this . androidOnRenderProcessUnresponsive ,
this . androidOnFormResubmission ,
this . androidOnScaleChanged ,
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
this . androidOnRequestFocus ,
this . androidOnReceivedIcon ,
this . androidOnReceivedTouchIconUrl ,
this . androidOnJsBeforeUnload ,
this . androidOnReceivedLoginRequest ,
2020-05-29 17:56:03 +00:00
this . iosOnWebContentProcessDidTerminate ,
this . iosOnDidReceiveServerRedirectForProvisionalNavigation ,
2021-02-09 23:15:10 +00:00
this . iosOnNavigationResponse ,
2020-05-29 17:56:03 +00:00
this . initialUrl ,
this . initialFile ,
this . initialData ,
this . initialHeaders ,
this . initialOptions ,
2021-02-01 14:55:27 +00:00
this . contextMenu ,
this . initialUserScripts } ) ;
2020-05-29 17:56:03 +00:00
}