|
| 1 | +// Copyright (c) .NET Foundation. All rights reserved. |
| 2 | +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. |
| 3 | + |
| 4 | +namespace Microsoft.AspNetCore.Components.WebView.WebView2 |
| 5 | +{ |
| 6 | + /// <summary> |
| 7 | + /// Types in the Microsoft.AspNetCore.Components.WebView.WebView2 are not recommended for use outside |
| 8 | + /// of the Blazor framework. These types will change in a future release. |
| 9 | + /// |
| 10 | + /// Defines properties that enable, disable, or modify WebView features. |
| 11 | + /// </summary> |
| 12 | + /// <remarks> |
| 13 | + /// Setting changes made after <see cref="E:Microsoft.Web.WebView2.Core.CoreWebView2.NavigationStarting" /> event do not apply until the next top-level navigation. |
| 14 | + /// </remarks> |
| 15 | + public interface ICoreWebView2SettingsWrapper |
| 16 | + { |
| 17 | + /// <summary> |
| 18 | + /// Determines whether running JavaScript is enabled in all future navigations in the WebView. |
| 19 | + /// </summary> |
| 20 | + /// <remarks> |
| 21 | + /// This only affects scripts in the document. Scripts injected with <see cref="M:Microsoft.Web.WebView2.Core.CoreWebView2.ExecuteScriptAsync(System.String)" /> runs even if script is disabled. The default value is <c>true</c>. |
| 22 | + /// </remarks> |
| 23 | + public bool IsScriptEnabled { get; set; } |
| 24 | + |
| 25 | + /// <summary> |
| 26 | + /// Determines whether communication from the host to the top-level HTML document of the WebView is allowed. |
| 27 | + /// </summary> |
| 28 | + /// <remarks> |
| 29 | + /// This is used when loading a new HTML document. If set to <c>true</c>, communication from the host to the top-level HTML document of the WebView is allowed using <see cref="M:Microsoft.Web.WebView2.Core.CoreWebView2.PostWebMessageAsJson(System.String)" />, <see cref="M:Microsoft.Web.WebView2.Core.CoreWebView2.PostWebMessageAsString(System.String)" />, and message event of <c>window.chrome.webview</c>. Communication from the top-level HTML document of the WebView to the host is allowed using <c>window.chrome.webview.postMessage</c> function and the <see cref="E:Microsoft.Web.WebView2.Core.CoreWebView2.WebMessageReceived" /> event. If set to <c>false</c>, then communication is disallowed. <see cref="M:Microsoft.Web.WebView2.Core.CoreWebView2.PostWebMessageAsJson(System.String)" /> and <see cref="M:Microsoft.Web.WebView2.Core.CoreWebView2.PostWebMessageAsString(System.String)" /> fail and <c>window.chrome.webview.postMessage</c> fails by throwing an instance of an Error object. The default value is <c>true</c>. |
| 30 | + /// </remarks> |
| 31 | + /// <seealso cref="M:Microsoft.Web.WebView2.Core.CoreWebView2.PostWebMessageAsJson(System.String)" /> |
| 32 | + /// <seealso cref="M:Microsoft.Web.WebView2.Core.CoreWebView2.PostWebMessageAsString(System.String)" /> |
| 33 | + /// <seealso cref="E:Microsoft.Web.WebView2.Core.CoreWebView2.WebMessageReceived" /> |
| 34 | + public bool IsWebMessageEnabled { get; set; } |
| 35 | + |
| 36 | + /// <summary> |
| 37 | + /// Determines whether WebView renders the default Javascript dialog box. |
| 38 | + /// </summary> |
| 39 | + /// <remarks> |
| 40 | + /// This is used when loading a new HTML document. If set to <c>false</c>, WebView does not render the default JavaScript dialog box (specifically those displayed by the JavaScript alert, confirm, prompt functions and <c>beforeunload</c> event). Instead, WebView raises <see cref="E:Microsoft.Web.WebView2.Core.CoreWebView2.ScriptDialogOpening" /> event that contains all of the information for the dialog and allow the host app to show a custom UI. The default value is <c>true</c>. |
| 41 | + /// </remarks> |
| 42 | + /// <seealso cref="E:Microsoft.Web.WebView2.Core.CoreWebView2.ScriptDialogOpening" /> |
| 43 | + public bool AreDefaultScriptDialogsEnabled { get; set; } |
| 44 | + |
| 45 | + /// <summary> |
| 46 | + /// Determines whether the status bar is displayed. |
| 47 | + /// </summary> |
| 48 | + /// <remarks> |
| 49 | + /// The status bar is usually displayed in the lower left of the WebView and shows things such as the URI of a link when the user hovers over it and other information. The default value is <c>true</c>. |
| 50 | + /// </remarks> |
| 51 | + public bool IsStatusBarEnabled { get; set; } |
| 52 | + |
| 53 | + /// <summary> |
| 54 | + /// Determines whether the user is able to use the context menu or keyboard shortcuts to open the DevTools window. |
| 55 | + /// </summary> |
| 56 | + /// <remarks> |
| 57 | + /// The default value is <c>true</c>. |
| 58 | + /// </remarks> |
| 59 | + public bool AreDevToolsEnabled { get; set; } |
| 60 | + |
| 61 | + /// <summary> |
| 62 | + /// Determines whether the default context menus are shown to the user in WebView. |
| 63 | + /// </summary> |
| 64 | + /// <remarks> |
| 65 | + /// The default value is <c>true</c>. |
| 66 | + /// </remarks> |
| 67 | + public bool AreDefaultContextMenusEnabled { get; set; } |
| 68 | + |
| 69 | + /// <summary> |
| 70 | + /// Determines whether host objects are accessible from the page in WebView. |
| 71 | + /// </summary> |
| 72 | + /// <remarks> |
| 73 | + /// The default value is <c>true</c>. |
| 74 | + /// </remarks> |
| 75 | + public bool AreHostObjectsAllowed { get; set; } |
| 76 | + |
| 77 | + /// <summary> |
| 78 | + /// Determines whether the user is able to impact the zoom of the WebView. |
| 79 | + /// </summary> |
| 80 | + /// <remarks> |
| 81 | + /// When disabled, the user is not able to zoom using Ctrl++, Ctr+-, or Ctrl+mouse wheel, but the zoom is set using <see cref="P:Microsoft.Web.WebView2.Core.CoreWebView2Controller.ZoomFactor" /> property. The default value is <c>true</c>. |
| 82 | + /// </remarks> |
| 83 | + public bool IsZoomControlEnabled { get; set; } |
| 84 | + |
| 85 | + /// <summary> |
| 86 | + /// Determines whether to disable built in error page for navigation failure and render process failure. |
| 87 | + /// </summary> |
| 88 | + /// <remarks> |
| 89 | + /// When disabled, blank page is displayed when related error happens. The default value is <c>true</c>. |
| 90 | + /// </remarks> |
| 91 | + public bool IsBuiltInErrorPageEnabled { get; set; } |
| 92 | + } |
| 93 | +} |
0 commit comments