2 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 using System.ComponentModel;
20 using System.Collections.Generic;
21 using System.Runtime.InteropServices;
22 using Tizen.NUI.Binding;
24 namespace Tizen.NUI.BaseComponents
27 /// WebView allows presenting content with embedded web browser, both local files and remote websites.
29 /// <since_tizen> 9 </since_tizen>
30 public partial class WebView : View
32 private Color contentBackgroundColor;
33 private bool tilesClearedWhenHidden;
34 private float tileCoverAreaMultiplier;
35 private bool cursorEnabledByClient;
37 private EventHandler<WebViewPageLoadEventArgs> pageLoadStartedEventHandler;
38 private WebViewPageLoadCallbackDelegate pageLoadStartedCallback;
40 private EventHandler<WebViewPageLoadEventArgs> pageLoadingEventHandler;
41 private WebViewPageLoadCallbackDelegate pageLoadingCallback;
43 private EventHandler<WebViewPageLoadEventArgs> pageLoadFinishedEventHandler;
44 private WebViewPageLoadCallbackDelegate pageLoadFinishedCallback;
46 private EventHandler<WebViewPageLoadErrorEventArgs> pageLoadErrorEventHandler;
47 private WebViewPageLoadErrorCallbackDelegate pageLoadErrorCallback;
49 private EventHandler<WebViewScrollEdgeReachedEventArgs> scrollEdgeReachedEventHandler;
50 private WebViewScrollEdgeReachedCallbackDelegate scrollEdgeReachedCallback;
52 private EventHandler<WebViewUrlChangedEventArgs> urlChangedEventHandler;
53 private WebViewUrlChangedCallbackDelegate urlChangedCallback;
55 private EventHandler<WebViewFormRepostPolicyDecidedEventArgs> formRepostPolicyDecidedEventHandler;
56 private WebViewFormRepostPolicyDecidedCallbackDelegate formRepostPolicyDecidedCallback;
58 private EventHandler<EventArgs> frameRenderedEventHandler;
59 private WebViewFrameRenderedCallbackDelegate frameRenderedCallback;
61 private ScreenshotAcquiredCallback screenshotAcquiredCallback;
62 private readonly WebViewScreenshotAcquiredProxyCallback screenshotAcquiredProxyCallback;
64 private HitTestFinishedCallback hitTestFinishedCallback;
65 private readonly WebViewHitTestFinishedProxyCallback hitTestFinishedProxyCallback;
67 private EventHandler<WebViewResponsePolicyDecidedEventArgs> responsePolicyDecidedEventHandler;
68 private WebViewResponsePolicyDecidedCallbackDelegate responsePolicyDecidedCallback;
70 private EventHandler<WebViewCertificateReceivedEventArgs> certificateConfirmedEventHandler;
71 private WebViewCertificateReceivedCallbackDelegate certificateConfirmedCallback;
73 private EventHandler<WebViewCertificateReceivedEventArgs> sslCertificateChangedEventHandler;
74 private WebViewCertificateReceivedCallbackDelegate sslCertificateChangedCallback;
76 private EventHandler<WebViewHttpAuthRequestedEventArgs> httpAuthRequestedEventHandler;
77 private WebViewHttpAuthRequestedCallbackDelegate httpAuthRequestedCallback;
79 private EventHandler<WebViewConsoleMessageReceivedEventArgs> consoleMessageReceivedEventHandler;
80 private WebViewConsoleMessageReceivedCallbackDelegate consoleMessageReceivedCallback;
82 private EventHandler<WebViewContextMenuShownEventArgs> contextMenuShownEventHandler;
83 private WebViewContextMenuShownCallbackDelegate contextMenuShownCallback;
85 private EventHandler<WebViewContextMenuHiddenEventArgs> contextMenuHiddenEventHandler;
86 private WebViewContextMenuHiddenCallbackDelegate contextMenuHiddenCallback;
88 private PlainTextReceivedCallback plainTextReceivedCallback;
91 /// Creates a WebView.
93 /// <since_tizen> 9 </since_tizen>
94 public WebView() : this(Interop.WebView.New(), true)
96 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
100 /// Creates a WebView with locale and time-zone.
102 /// <param name="locale">The specified locale</param>
103 /// <param name="timezoneId">The specified time-zone ID</param>
104 [EditorBrowsable(EditorBrowsableState.Never)]
105 public WebView(string locale, string timezoneId) : this(Interop.WebView.New2(locale, timezoneId), true)
107 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
111 /// Creates a WebView with an args list.
113 /// <param name="args">Arguments passed into web engine. The first value of array must be program's name.</param>
114 /// <since_tizen> 9 </since_tizen>
115 public WebView(string[] args) : this(Interop.WebView.New3(args?.Length ?? 0, args), true)
117 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
121 /// Copy constructor.
123 /// <param name="webView">WebView to copy. The copied WebView will point at the same implementation</param>
124 /// <since_tizen> 9 </since_tizen>
125 public WebView(WebView webView) : this(Interop.WebView.NewWebView(WebView.getCPtr(webView)), true)
127 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
130 internal WebView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.WebView.Upcast(cPtr), cMemoryOwn)
132 screenshotAcquiredProxyCallback = OnScreenshotAcquired;
133 hitTestFinishedProxyCallback = OnHitTestFinished;
135 BackForwardList = new WebBackForwardList(Interop.WebView.GetWebBackForwardList(SwigCPtr), false);
136 Context = new WebContext(Interop.WebView.GetWebContext(SwigCPtr), false);
137 CookieManager = new WebCookieManager(Interop.WebView.GetWebCookieManager(SwigCPtr), false);
138 Settings = new WebSettings(Interop.WebView.GetWebSettings(SwigCPtr), false);
142 /// Dispose for IDisposable pattern
144 [EditorBrowsable(EditorBrowsableState.Never)]
145 protected override void Dispose(DisposeTypes type)
152 if (type == DisposeTypes.Explicit)
155 //Release your own managed resources here.
156 //You should release all of your own disposable objects here.
157 BackForwardList.Dispose();
159 CookieManager.Dispose();
166 /// This will not be public opened.
167 /// <param name="swigCPtr"></param>
168 [EditorBrowsable(EditorBrowsableState.Never)]
169 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
171 Interop.WebView.DeleteWebView(swigCPtr);
175 /// The callback function that is invoked when the message is received from the script.
177 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
178 [EditorBrowsable(EditorBrowsableState.Never)]
179 public delegate void JavaScriptMessageHandler(string message);
182 /// The callback function that is invoked when the message is received from the script.
184 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
185 [EditorBrowsable(EditorBrowsableState.Never)]
186 public delegate void JavaScriptAlertCallback(string message);
189 /// The callback function that is invoked when the message is received from the script.
191 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
192 [EditorBrowsable(EditorBrowsableState.Never)]
193 public delegate void JavaScriptConfirmCallback(string message);
196 /// The callback function that is invoked when the message is received from the script.
198 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
199 [EditorBrowsable(EditorBrowsableState.Never)]
200 public delegate void JavaScriptPromptCallback(string message1, string message2);
203 /// The callback function that is invoked when screen shot is acquired asynchronously.
205 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
206 [EditorBrowsable(EditorBrowsableState.Never)]
207 public delegate void ScreenshotAcquiredCallback(ImageView image);
210 /// The callback function that is invoked when video playing is checked asynchronously.
212 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
213 [EditorBrowsable(EditorBrowsableState.Never)]
214 public delegate void VideoPlayingCallback(bool isPlaying);
217 /// The callback function that is invoked when geolocation permission is requested.
219 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
220 [EditorBrowsable(EditorBrowsableState.Never)]
221 public delegate void GeolocationPermissionCallback(string host, string protocol);
224 /// The callback function that is invoked when hit test is finished.
226 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
227 [EditorBrowsable(EditorBrowsableState.Never)]
228 public delegate void HitTestFinishedCallback(WebHitTestResult test);
231 /// The callback function that is invoked when the plain text of the current page is received.
233 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
234 [EditorBrowsable(EditorBrowsableState.Never)]
235 public delegate void PlainTextReceivedCallback(string plainText);
237 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
238 private delegate void WebViewPageLoadCallbackDelegate(string pageUrl);
240 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
241 private delegate void WebViewPageLoadErrorCallbackDelegate(IntPtr error);
243 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
244 private delegate void WebViewScrollEdgeReachedCallbackDelegate(int edge);
246 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
247 private delegate void WebViewUrlChangedCallbackDelegate(string pageUrl);
249 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
250 private delegate void WebViewFormRepostPolicyDecidedCallbackDelegate(IntPtr maker);
252 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
253 private delegate void WebViewFrameRenderedCallbackDelegate();
255 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
256 private delegate void WebViewScreenshotAcquiredProxyCallback(IntPtr data);
258 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
259 private delegate void WebViewHitTestFinishedProxyCallback(IntPtr data);
261 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
262 private delegate void WebViewResponsePolicyDecidedCallbackDelegate(IntPtr maker);
264 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
265 private delegate void WebViewCertificateReceivedCallbackDelegate(IntPtr certificate);
267 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
268 private delegate void WebViewHttpAuthRequestedCallbackDelegate(IntPtr handler);
270 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
271 private delegate void WebViewConsoleMessageReceivedCallbackDelegate(IntPtr message);
273 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
274 private delegate void WebViewContextMenuShownCallbackDelegate(IntPtr menu);
276 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
277 private delegate void WebViewContextMenuHiddenCallbackDelegate(IntPtr menu);
280 /// Event for the PageLoadStarted signal which can be used to subscribe or unsubscribe the event handler.<br />
281 /// This signal is emitted when page loading has started.<br />
283 /// <since_tizen> 9 </since_tizen>
284 public event EventHandler<WebViewPageLoadEventArgs> PageLoadStarted
288 if (pageLoadStartedEventHandler == null)
290 pageLoadStartedCallback = OnPageLoadStarted;
291 IntPtr ip = Marshal.GetFunctionPointerForDelegate(pageLoadStartedCallback);
292 Interop.WebView.RegisterPageLoadStartedCallback(SwigCPtr, new HandleRef(this, ip));
294 pageLoadStartedEventHandler += value;
298 pageLoadStartedEventHandler -= value;
303 /// Event for the PageLoading signal which can be used to subscribe or unsubscribe the event handler.<br />
304 /// This signal is emitted when page loading is in progress.<br />
306 /// <since_tizen> 9 </since_tizen>
307 public event EventHandler<WebViewPageLoadEventArgs> PageLoading
311 if (pageLoadingEventHandler == null)
313 pageLoadingCallback = OnPageLoading;
314 IntPtr ip = Marshal.GetFunctionPointerForDelegate(pageLoadingCallback);
315 Interop.WebView.RegisterPageLoadInProgressCallback(SwigCPtr, new HandleRef(this, ip));
317 pageLoadingEventHandler += value;
321 pageLoadingEventHandler -= value;
326 /// Event for the PageLoadFinished signal which can be used to subscribe or unsubscribe the event handler.<br />
327 /// This signal is emitted when page loading has finished.<br />
329 /// <since_tizen> 9 </since_tizen>
330 public event EventHandler<WebViewPageLoadEventArgs> PageLoadFinished
334 if (pageLoadFinishedEventHandler == null)
336 pageLoadFinishedCallback = (OnPageLoadFinished);
337 IntPtr ip = Marshal.GetFunctionPointerForDelegate(pageLoadFinishedCallback);
338 Interop.WebView.RegisterPageLoadFinishedCallback(SwigCPtr, new HandleRef(this, ip));
340 pageLoadFinishedEventHandler += value;
344 pageLoadFinishedEventHandler -= value;
349 /// Event for the PageLoadError signal which can be used to subscribe or unsubscribe the event handler.<br />
350 /// This signal is emitted when there's an error in page loading.<br />
352 /// <since_tizen> 9 </since_tizen>
353 public event EventHandler<WebViewPageLoadErrorEventArgs> PageLoadError
357 if (pageLoadErrorEventHandler == null)
359 pageLoadErrorCallback = OnPageLoadError;
360 IntPtr ip = Marshal.GetFunctionPointerForDelegate(pageLoadErrorCallback);
361 Interop.WebView.RegisterPageLoadErrorCallback(SwigCPtr, new HandleRef(this, ip));
363 pageLoadErrorEventHandler += value;
367 pageLoadErrorEventHandler -= value;
372 /// Event for the ScrollEdgeReached signal which can be used to subscribe or unsubscribe the event handler.<br />
373 /// This signal is emitted when web view is scrolled to edge.<br />
375 [EditorBrowsable(EditorBrowsableState.Never)]
376 public event EventHandler<WebViewScrollEdgeReachedEventArgs> ScrollEdgeReached
380 if (scrollEdgeReachedEventHandler == null)
382 scrollEdgeReachedCallback = OnScrollEdgeReached;
383 IntPtr ip = Marshal.GetFunctionPointerForDelegate(scrollEdgeReachedCallback);
384 Interop.WebView.RegisterScrollEdgeReachedCallback(SwigCPtr, new HandleRef(this, ip));
386 scrollEdgeReachedEventHandler += value;
390 scrollEdgeReachedEventHandler -= value;
395 /// Event for the UrlChanged signal which can be used to subscribe or unsubscribe the event handler.<br />
396 /// This signal is emitted when url is changed.<br />
398 [EditorBrowsable(EditorBrowsableState.Never)]
399 public event EventHandler<WebViewUrlChangedEventArgs> UrlChanged
403 if (urlChangedEventHandler == null)
405 urlChangedCallback = OnUrlChanged;
406 IntPtr ip = Marshal.GetFunctionPointerForDelegate(urlChangedCallback);
407 Interop.WebView.RegisterUrlChangedCallback(SwigCPtr, new HandleRef(this, ip));
409 urlChangedEventHandler += value;
413 urlChangedEventHandler -= value;
418 /// Event for the FormRepostDecided signal which can be used to subscribe or unsubscribe the event handler.<br />
419 /// This signal is emitted when form repost policy would be decided.<br />
421 [EditorBrowsable(EditorBrowsableState.Never)]
422 public event EventHandler<WebViewFormRepostPolicyDecidedEventArgs> FormRepostPolicyDecided
426 if (formRepostPolicyDecidedEventHandler == null)
428 formRepostPolicyDecidedCallback = OnFormRepostPolicyDecided;
429 IntPtr ip = Marshal.GetFunctionPointerForDelegate(formRepostPolicyDecidedCallback);
430 Interop.WebView.RegisterFormRepostDecidedCallback(SwigCPtr, new HandleRef(this, ip));
432 formRepostPolicyDecidedEventHandler += value;
436 formRepostPolicyDecidedEventHandler -= value;
441 /// Event for the FrameRendered signal which can be used to subscribe or unsubscribe the event handler.<br />
442 /// This signal is emitted when frame is rendered off-screen.<br />
444 [EditorBrowsable(EditorBrowsableState.Never)]
445 public event EventHandler<EventArgs> FrameRendered
449 if (frameRenderedEventHandler == null)
451 frameRenderedCallback = OnFrameRendered;
452 IntPtr ip = Marshal.GetFunctionPointerForDelegate(frameRenderedCallback);
453 Interop.WebView.RegisterFrameRenderedCallback(SwigCPtr, new HandleRef(this, ip));
455 frameRenderedEventHandler += value;
459 frameRenderedEventHandler -= value;
464 /// Event for the ResponsePolicyDecided signal which can be used to subscribe or unsubscribe the event handler.<br />
465 /// This signal is emitted when response policy would be decided.<br />
467 [EditorBrowsable(EditorBrowsableState.Never)]
468 public event EventHandler<WebViewResponsePolicyDecidedEventArgs> ResponsePolicyDecided
472 if (responsePolicyDecidedEventHandler == null)
474 responsePolicyDecidedCallback = OnResponsePolicyDecided;
475 IntPtr ip = Marshal.GetFunctionPointerForDelegate(responsePolicyDecidedCallback);
476 Interop.WebView.RegisterResponsePolicyDecidedCallback(SwigCPtr, new HandleRef(this, ip));
478 responsePolicyDecidedEventHandler += value;
482 responsePolicyDecidedEventHandler -= value;
487 /// Event for the CertificateConfirmed signal which can be used to subscribe or unsubscribe the event handler.<br />
488 /// This signal is emitted when certificate would be confirmed.<br />
490 [EditorBrowsable(EditorBrowsableState.Never)]
491 public event EventHandler<WebViewCertificateReceivedEventArgs> CertificateConfirmed
495 if (certificateConfirmedEventHandler == null)
497 certificateConfirmedCallback = OnCertificateConfirmed;
498 IntPtr ip = Marshal.GetFunctionPointerForDelegate(certificateConfirmedCallback);
499 Interop.WebView.RegisterCertificateConfirmedCallback(SwigCPtr, new HandleRef(this, ip));
501 certificateConfirmedEventHandler += value;
505 certificateConfirmedEventHandler -= value;
510 /// Event for the SslCertificateChanged signal which can be used to subscribe or unsubscribe the event handler.<br />
511 /// This signal is emitted when SSL certificate is changed.<br />
513 [EditorBrowsable(EditorBrowsableState.Never)]
514 public event EventHandler<WebViewCertificateReceivedEventArgs> SslCertificateChanged
518 if (sslCertificateChangedEventHandler == null)
520 sslCertificateChangedCallback = OnSslCertificateChanged;
521 IntPtr ip = Marshal.GetFunctionPointerForDelegate(sslCertificateChangedCallback);
522 Interop.WebView.RegisterSslCertificateChangedCallback(SwigCPtr, new HandleRef(this, ip));
524 sslCertificateChangedEventHandler += value;
528 sslCertificateChangedEventHandler -= value;
533 /// Event for the HttpAuthRequested signal which can be used to subscribe or unsubscribe the event handler.<br />
534 /// This signal is emitted when http authentication is requested.<br />
536 [EditorBrowsable(EditorBrowsableState.Never)]
537 public event EventHandler<WebViewHttpAuthRequestedEventArgs> HttpAuthRequested
541 if (httpAuthRequestedEventHandler == null)
543 httpAuthRequestedCallback = OnHttpAuthRequested;
544 IntPtr ip = Marshal.GetFunctionPointerForDelegate(httpAuthRequestedCallback);
545 Interop.WebView.RegisterHttpAuthHandlerCallback(SwigCPtr, new HandleRef(this, ip));
547 httpAuthRequestedEventHandler += value;
551 httpAuthRequestedEventHandler -= value;
556 /// Event for the ConsoleMessageReceived signal which can be used to subscribe or unsubscribe the event handler.<br />
557 /// This signal is emitted when console message is received.<br />
559 [EditorBrowsable(EditorBrowsableState.Never)]
560 public event EventHandler<WebViewConsoleMessageReceivedEventArgs> ConsoleMessageReceived
564 if (consoleMessageReceivedEventHandler == null)
566 consoleMessageReceivedCallback = OnConsoleMessageReceived;
567 IntPtr ip = Marshal.GetFunctionPointerForDelegate(consoleMessageReceivedCallback);
568 Interop.WebView.RegisterConsoleMessageReceivedCallback(SwigCPtr, new HandleRef(this, ip));
570 consoleMessageReceivedEventHandler += value;
574 consoleMessageReceivedEventHandler -= value;
579 /// Event for the ContextMenuShown signal which can be used to subscribe or unsubscribe the event handler.<br />
580 /// This signal is emitted when context menu is shown.<br />
582 [EditorBrowsable(EditorBrowsableState.Never)]
583 public event EventHandler<WebViewContextMenuShownEventArgs> ContextMenuShown
587 if (contextMenuShownEventHandler == null)
589 contextMenuShownCallback = OnContextMenuShown;
590 IntPtr ip = Marshal.GetFunctionPointerForDelegate(contextMenuShownCallback);
591 Interop.WebView.RegisterContextMenuShownCallback(SwigCPtr, new HandleRef(this, ip));
593 contextMenuShownEventHandler += value;
597 contextMenuShownEventHandler -= value;
602 /// Event for the ContextMenuHidden signal which can be used to subscribe or unsubscribe the event handler.<br />
603 /// This signal is emitted when context menu item is hidden.<br />
605 [EditorBrowsable(EditorBrowsableState.Never)]
606 public event EventHandler<WebViewContextMenuHiddenEventArgs> ContextMenuHidden
610 if (contextMenuHiddenEventHandler == null)
612 contextMenuHiddenCallback = OnContextMenuHidden;
613 IntPtr ip = Marshal.GetFunctionPointerForDelegate(contextMenuHiddenCallback);
614 Interop.WebView.RegisterContextMenuHiddenCallback(SwigCPtr, new HandleRef(this, ip));
616 contextMenuHiddenEventHandler += value;
620 contextMenuHiddenEventHandler -= value;
625 /// Options for searching texts.
627 [EditorBrowsable(EditorBrowsableState.Never)]
628 public enum FindOption
633 [EditorBrowsable(EditorBrowsableState.Never)]
637 /// Case insensitive search
639 [EditorBrowsable(EditorBrowsableState.Never)]
640 CaseInsensitive = 1 << 0,
643 /// Search text only at the beginning of the words
645 [EditorBrowsable(EditorBrowsableState.Never)]
646 AtWordStart = 1 << 1,
649 /// Treat capital letters in the middle of words as word start
651 [EditorBrowsable(EditorBrowsableState.Never)]
652 TreatMediaCapitalAsWordStart = 1 << 2,
657 [EditorBrowsable(EditorBrowsableState.Never)]
661 /// If not present the search stops at the end of the document
663 [EditorBrowsable(EditorBrowsableState.Never)]
669 [EditorBrowsable(EditorBrowsableState.Never)]
670 ShowOverlay = 1 << 5,
675 [EditorBrowsable(EditorBrowsableState.Never)]
676 ShowFindIndiator = 1 << 6,
681 [EditorBrowsable(EditorBrowsableState.Never)]
682 ShowHighlight = 1 << 7,
686 /// Enumeration for mode of hit test.
688 [EditorBrowsable(EditorBrowsableState.Never)]
689 public enum HitTestMode
694 [EditorBrowsable(EditorBrowsableState.Never)]
698 /// Extra node data(tag name, node value, attribute infomation, etc).
700 [EditorBrowsable(EditorBrowsableState.Never)]
704 /// Extra image data(image data, image data length, image file name exteionsion, etc).
706 [EditorBrowsable(EditorBrowsableState.Never)]
712 [EditorBrowsable(EditorBrowsableState.Never)]
713 All = Default | NodeData | ImageData,
719 [EditorBrowsable(EditorBrowsableState.Never)]
720 public WebBackForwardList BackForwardList { get; }
725 [EditorBrowsable(EditorBrowsableState.Never)]
726 public WebContext Context { get; }
731 [EditorBrowsable(EditorBrowsableState.Never)]
732 public WebCookieManager CookieManager { get; }
737 [EditorBrowsable(EditorBrowsableState.Never)]
738 public WebSettings Settings { get; }
743 /// <since_tizen> 9 </since_tizen>
748 return (string)GetValue(UrlProperty);
752 SetValue(UrlProperty, value);
753 NotifyPropertyChanged();
758 /// Deprecated. The cache model of the current WebView.
760 [EditorBrowsable(EditorBrowsableState.Never)]
761 public CacheModel CacheModel
765 return (CacheModel)GetValue(CacheModelProperty);
769 SetValue(CacheModelProperty, value);
770 NotifyPropertyChanged();
774 private CacheModel InternalCacheModel
778 return (CacheModel)Context.CacheModel;
782 Context.CacheModel = (WebContext.CacheModelType)value;
787 /// Deprecated. The cookie acceptance policy.
789 [EditorBrowsable(EditorBrowsableState.Never)]
790 public CookieAcceptPolicy CookieAcceptPolicy
794 return (CookieAcceptPolicy)GetValue(CookieAcceptPolicyProperty);
798 SetValue(CookieAcceptPolicyProperty, value);
799 NotifyPropertyChanged();
803 private CookieAcceptPolicy InternalCookieAcceptPolicy
807 return (CookieAcceptPolicy)CookieManager.CookieAcceptPolicy;
811 CookieManager.CookieAcceptPolicy = (WebCookieManager.CookieAcceptPolicyType)value;
816 /// The user agent string.
818 /// <since_tizen> 9 </since_tizen>
819 public string UserAgent
823 return (string)GetValue(UserAgentProperty);
827 SetValue(UserAgentProperty, value);
828 NotifyPropertyChanged();
833 /// Deprecated. Whether JavaScript is enabled.
835 [EditorBrowsable(EditorBrowsableState.Never)]
836 public bool EnableJavaScript
840 return (bool)GetValue(EnableJavaScriptProperty);
844 SetValue(EnableJavaScriptProperty, value);
845 NotifyPropertyChanged();
849 private bool InternalEnableJavaScript
853 return Settings.JavaScriptEnabled;
857 Settings.JavaScriptEnabled = value;
862 /// Deprecated. Whether images can be loaded automatically.
864 [EditorBrowsable(EditorBrowsableState.Never)]
865 public bool LoadImagesAutomatically
869 return (bool)GetValue(LoadImagesAutomaticallyProperty);
873 SetValue(LoadImagesAutomaticallyProperty, value);
874 NotifyPropertyChanged();
878 private bool InternalLoadImagesAutomatically
882 return Settings.AutomaticImageLoadingAllowed;
886 Settings.AutomaticImageLoadingAllowed = value;
891 /// The default text encoding name.<br />
892 /// e.g. "UTF-8"<br />
894 [EditorBrowsable(EditorBrowsableState.Never)]
895 public string DefaultTextEncodingName
899 return GetValue(DefaultTextEncodingNameProperty) as string;
903 SetValue(DefaultTextEncodingNameProperty, value);
904 NotifyPropertyChanged();
908 private string InternalDefaultTextEncodingName
912 return Settings.DefaultTextEncodingName;
916 Settings.DefaultTextEncodingName = value;
921 /// The default font size in pixel.
923 [EditorBrowsable(EditorBrowsableState.Never)]
924 public int DefaultFontSize
928 return (int)GetValue(DefaultFontSizeProperty);
932 SetValue(DefaultFontSizeProperty, value);
933 NotifyPropertyChanged();
937 private int InternalDefaultFontSize
941 return Settings.DefaultFontSize;
945 Settings.DefaultFontSize = value;
950 /// The position of scroll.
952 [EditorBrowsable(EditorBrowsableState.Never)]
953 public Position ScrollPosition
957 return GetValue(ScrollPositionProperty) as Position;
961 SetValue(ScrollPositionProperty, value);
965 private Position InternalScrollPosition
969 Vector2 pv = (Vector2)GetValue(ScrollPositionProperty);
970 return new Position(pv.X, pv.Y);
977 Vector2 vpv = new Vector2(pv.X, pv.Y);
978 SetValue(ScrollPositionProperty, vpv);
979 NotifyPropertyChanged();
985 /// The size of scroll, read-only.
987 [EditorBrowsable(EditorBrowsableState.Never)]
988 public Size ScrollSize
992 Vector2 sv = (Vector2)GetValue(ScrollSizeProperty);
993 return new Size(sv.Width, sv.Height);
998 /// The size of content, read-only.
1000 [EditorBrowsable(EditorBrowsableState.Never)]
1001 public Size ContentSize
1005 Vector2 sv = (Vector2)GetValue(ContentSizeProperty);
1006 return new Size(sv.Width, sv.Height);
1011 /// Whether video hole is enabled or not.
1013 [EditorBrowsable(EditorBrowsableState.Never)]
1014 public bool VideoHoleEnabled
1018 return (bool)GetValue(VideoHoleEnabledProperty);
1022 SetValue(VideoHoleEnabledProperty, value);
1023 NotifyPropertyChanged();
1028 /// Whether mouse events are enabled or not.
1030 [EditorBrowsable(EditorBrowsableState.Never)]
1031 public bool MouseEventsEnabled
1035 return (bool)GetValue(MouseEventsEnabledProperty);
1039 SetValue(MouseEventsEnabledProperty, value);
1040 NotifyPropertyChanged();
1045 /// Whether key events are enabled or not.
1047 [EditorBrowsable(EditorBrowsableState.Never)]
1048 public bool KeyEventsEnabled
1052 return (bool)GetValue(KeyEventsEnabledProperty);
1056 SetValue(KeyEventsEnabledProperty, value);
1057 NotifyPropertyChanged();
1062 /// Background color of web page.
1064 [EditorBrowsable(EditorBrowsableState.Never)]
1065 public Color ContentBackgroundColor
1069 return (Color)GetValue(ContentBackgroundColorProperty);
1073 SetValue(ContentBackgroundColorProperty, value);
1074 NotifyPropertyChanged();
1079 /// Whether tiles are cleared or not when hidden.
1081 [EditorBrowsable(EditorBrowsableState.Never)]
1082 public bool TilesClearedWhenHidden
1086 return (bool)GetValue(TilesClearedWhenHiddenProperty);
1090 SetValue(TilesClearedWhenHiddenProperty, value);
1091 NotifyPropertyChanged();
1096 /// Multiplier of cover area of tile when web page is rendered.
1098 [EditorBrowsable(EditorBrowsableState.Never)]
1099 public float TileCoverAreaMultiplier
1103 return (float)GetValue(TileCoverAreaMultiplierProperty);
1107 SetValue(TileCoverAreaMultiplierProperty, value);
1108 NotifyPropertyChanged();
1113 /// Whether cursor is enabled or not by client.
1115 [EditorBrowsable(EditorBrowsableState.Never)]
1116 public bool CursorEnabledByClient
1120 return (bool)GetValue(CursorEnabledByClientProperty);
1124 SetValue(CursorEnabledByClientProperty, value);
1125 NotifyPropertyChanged();
1130 /// Gets selected text in web page.
1132 [EditorBrowsable(EditorBrowsableState.Never)]
1133 public string SelectedText
1137 return (string)GetValue(SelectedTextProperty);
1142 /// Gets title of web page.
1144 /// <since_tizen> 9 </since_tizen>
1149 return (string)GetValue(TitleProperty);
1154 /// Gets favicon of web page.
1156 /// <since_tizen> 9 </since_tizen>
1157 public ImageView Favicon
1161 global::System.IntPtr imageView = Interop.WebView.GetFavicon(SwigCPtr);
1162 if (imageView == IntPtr.Zero)
1164 return new ImageView(imageView, false);
1169 /// Zoom factor of web page.
1171 [EditorBrowsable(EditorBrowsableState.Never)]
1172 public float PageZoomFactor
1176 return (float)GetValue(PageZoomFactorProperty);
1180 SetValue(PageZoomFactorProperty, value);
1181 NotifyPropertyChanged();
1186 /// Zoom factor of text in web page.
1188 [EditorBrowsable(EditorBrowsableState.Never)]
1189 public float TextZoomFactor
1193 return (float)GetValue(TextZoomFactorProperty);
1197 SetValue(TextZoomFactorProperty, value);
1198 NotifyPropertyChanged();
1203 /// Gets percentage of loading progress.
1205 /// <since_tizen> 9 </since_tizen>
1206 public float LoadProgressPercentage
1210 return (float)GetValue(LoadProgressPercentageProperty);
1214 internal static new class Property
1216 internal static readonly int Url = Interop.WebView.UrlGet();
1217 internal static readonly int UserAgent = Interop.WebView.UserAgentGet();
1218 internal static readonly int ScrollPosition = Interop.WebView.ScrollPositionGet();
1219 internal static readonly int ScrollSize = Interop.WebView.ScrollSizeGet();
1220 internal static readonly int ContentSize = Interop.WebView.ContentSizeGet();
1221 internal static readonly int Title = Interop.WebView.TitleGet();
1222 internal static readonly int VideoHoleEnabled = Interop.WebView.VideoHoleEnabledGet();
1223 internal static readonly int MouseEventsEnabled = Interop.WebView.MouseEventsEnabledGet();
1224 internal static readonly int KeyEventsEnabled = Interop.WebView.KeyEventsEnabledGet();
1225 internal static readonly int DocumentBackgroundColor = Interop.WebView.DocumentBackgroundColorGet();
1226 internal static readonly int TilesClearedWhenHidden = Interop.WebView.TilesClearedWhenHiddenGet();
1227 internal static readonly int TileCoverAreaMultiplier = Interop.WebView.TileCoverAreaMultiplierGet();
1228 internal static readonly int CursorEnabledByClient = Interop.WebView.CursorEnabledByClientGet();
1229 internal static readonly int SelectedText = Interop.WebView.SelectedTextGet();
1230 internal static readonly int PageZoomFactor = Interop.WebView.PageZoomFactorGet();
1231 internal static readonly int TextZoomFactor = Interop.WebView.TextZoomFactorGet();
1232 internal static readonly int LoadProgressPercentage = Interop.WebView.LoadProgressPercentageGet();
1235 private static readonly BindableProperty UrlProperty = BindableProperty.Create(nameof(Url), typeof(string), typeof(WebView), string.Empty, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) =>
1237 var webview = (WebView)bindable;
1238 if (newValue != null)
1240 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.Url, new Tizen.NUI.PropertyValue((string)newValue));
1243 defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
1245 var webview = (WebView)bindable;
1247 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.Url).Get(out temp);
1251 private static readonly BindableProperty UserAgentProperty = BindableProperty.Create(nameof(UserAgent), typeof(string), typeof(WebView), string.Empty, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) =>
1253 var webview = (WebView)bindable;
1254 if (newValue != null)
1256 Tizen.NUI.Object.SetProperty((HandleRef)webview.SwigCPtr, WebView.Property.UserAgent, new Tizen.NUI.PropertyValue((string)newValue));
1259 defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
1261 var webview = (WebView)bindable;
1263 Tizen.NUI.Object.GetProperty((HandleRef)webview.SwigCPtr, WebView.Property.UserAgent).Get(out temp);
1267 private static readonly BindableProperty ScrollPositionProperty = BindableProperty.Create(nameof(ScrollPosition), typeof(Vector2), typeof(WebView), null, propertyChanged: (bindable, oldValue, newValue) =>
1269 var webview = (WebView)bindable;
1270 if (newValue != null)
1272 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.ScrollPosition, new Tizen.NUI.PropertyValue((Vector2)newValue));
1275 defaultValueCreator: (bindable) =>
1277 var webview = (WebView)bindable;
1278 Vector2 temp = new Vector2(0.0f, 0.0f);
1279 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.ScrollPosition).Get(temp);
1283 private static readonly BindableProperty ScrollSizeProperty = BindableProperty.Create(nameof(ScrollSize), typeof(Vector2), typeof(WebView), null, defaultValueCreator: (bindable) =>
1285 var webview = (WebView)bindable;
1286 Vector2 temp = new Vector2(0.0f, 0.0f);
1287 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.ScrollSize).Get(temp);
1291 private static readonly BindableProperty ContentSizeProperty = BindableProperty.Create(nameof(ContentSize), typeof(Vector2), typeof(WebView), null, defaultValueCreator: (bindable) =>
1293 var webview = (WebView)bindable;
1294 Vector2 temp = new Vector2(0.0f, 0.0f);
1295 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.ContentSize).Get(temp);
1299 private static readonly BindableProperty TitleProperty = BindableProperty.Create(nameof(Title), typeof(string), typeof(WebView), string.Empty, defaultValueCreator: (bindable) =>
1301 var webview = (WebView)bindable;
1303 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.Title).Get(out title);
1307 private static readonly BindableProperty VideoHoleEnabledProperty = BindableProperty.Create(nameof(VideoHoleEnabled), typeof(bool), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
1309 var webview = (WebView)bindable;
1310 if (newValue != null)
1312 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.VideoHoleEnabled, new Tizen.NUI.PropertyValue((bool)newValue));
1315 defaultValueCreator: (bindable) =>
1317 var webview = (WebView)bindable;
1319 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.VideoHoleEnabled).Get(out temp);
1323 private static readonly BindableProperty MouseEventsEnabledProperty = BindableProperty.Create(nameof(MouseEventsEnabled), typeof(bool), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
1325 var webview = (WebView)bindable;
1326 if (newValue != null)
1328 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.MouseEventsEnabled, new Tizen.NUI.PropertyValue((bool)newValue));
1331 defaultValueCreator: (bindable) =>
1333 var webview = (WebView)bindable;
1335 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.MouseEventsEnabled).Get(out temp);
1339 private static readonly BindableProperty KeyEventsEnabledProperty = BindableProperty.Create(nameof(KeyEventsEnabled), typeof(bool), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
1341 var webview = (WebView)bindable;
1342 if (newValue != null)
1344 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.KeyEventsEnabled, new Tizen.NUI.PropertyValue((bool)newValue));
1347 defaultValueCreator: (bindable) =>
1349 var webview = (WebView)bindable;
1351 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.KeyEventsEnabled).Get(out temp);
1355 private static readonly BindableProperty ContentBackgroundColorProperty = BindableProperty.Create(nameof(ContentBackgroundColor), typeof(Color), typeof(WebView), null, propertyChanged: (bindable, oldValue, newValue) =>
1357 var webview = (WebView)bindable;
1358 if (newValue != null)
1360 webview.contentBackgroundColor = (Color)newValue;
1361 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.DocumentBackgroundColor, new Tizen.NUI.PropertyValue((Color)newValue));
1364 defaultValueCreator: (bindable) =>
1366 var webview = (WebView)bindable;
1367 return webview.contentBackgroundColor;
1370 private static readonly BindableProperty TilesClearedWhenHiddenProperty = BindableProperty.Create(nameof(TilesClearedWhenHidden), typeof(bool), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
1372 var webview = (WebView)bindable;
1373 if (newValue != null)
1375 webview.tilesClearedWhenHidden = (bool)newValue;
1376 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.TilesClearedWhenHidden, new Tizen.NUI.PropertyValue((bool)newValue));
1379 defaultValueCreator: (bindable) =>
1381 var webview = (WebView)bindable;
1382 return webview.tilesClearedWhenHidden;
1385 private static readonly BindableProperty TileCoverAreaMultiplierProperty = BindableProperty.Create(nameof(TileCoverAreaMultiplier), typeof(float), typeof(WebView), 0.0f, propertyChanged: (bindable, oldValue, newValue) =>
1387 var webview = (WebView)bindable;
1388 if (newValue != null)
1390 webview.tileCoverAreaMultiplier = (float)newValue;
1391 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.TileCoverAreaMultiplier, new Tizen.NUI.PropertyValue((float)newValue));
1394 defaultValueCreator: (bindable) =>
1396 var webview = (WebView)bindable;
1397 return webview.tileCoverAreaMultiplier;
1400 private static readonly BindableProperty CursorEnabledByClientProperty = BindableProperty.Create(nameof(CursorEnabledByClient), typeof(bool), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
1402 var webview = (WebView)bindable;
1403 if (newValue != null)
1405 webview.cursorEnabledByClient = (bool)newValue;
1406 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.CursorEnabledByClient, new Tizen.NUI.PropertyValue((bool)newValue));
1409 defaultValueCreator: (bindable) =>
1411 var webview = (WebView)bindable;
1412 return webview.cursorEnabledByClient;
1415 private static readonly BindableProperty SelectedTextProperty = BindableProperty.Create(nameof(SelectedText), typeof(string), typeof(WebView), string.Empty, defaultValueCreator: (bindable) =>
1417 var webview = (WebView)bindable;
1419 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.SelectedText).Get(out text);
1423 private static readonly BindableProperty PageZoomFactorProperty = BindableProperty.Create(nameof(PageZoomFactor), typeof(float), typeof(WebView), 0.0f, propertyChanged: (bindable, oldValue, newValue) =>
1425 var webview = (WebView)bindable;
1426 if (newValue != null)
1428 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.PageZoomFactor, new Tizen.NUI.PropertyValue((float)newValue));
1431 defaultValueCreator: (bindable) =>
1433 var webview = (WebView)bindable;
1435 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.PageZoomFactor).Get(out temp);
1439 private static readonly BindableProperty TextZoomFactorProperty = BindableProperty.Create(nameof(TextZoomFactor), typeof(float), typeof(WebView), 0.0f, propertyChanged: (bindable, oldValue, newValue) =>
1441 var webview = (WebView)bindable;
1442 if (newValue != null)
1444 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.TextZoomFactor, new Tizen.NUI.PropertyValue((float)newValue));
1447 defaultValueCreator: (bindable) =>
1449 var webview = (WebView)bindable;
1451 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.TextZoomFactor).Get(out temp);
1455 private static readonly BindableProperty LoadProgressPercentageProperty = BindableProperty.Create(nameof(LoadProgressPercentage), typeof(float), typeof(WebView), 0.0f, defaultValueCreator: (bindable) =>
1457 var webview = (WebView)bindable;
1459 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.LoadProgressPercentage).Get(out percentage);
1463 // For rooting handlers
1464 internal Dictionary<string, JavaScriptMessageHandler> handlerRootMap = new Dictionary<string, JavaScriptMessageHandler>();
1469 /// <param name="url">The path of Web</param>
1471 /// The following privileges are required:
1472 /// http://tizen.org/privilege/internet for remote web pages of websites.
1473 /// http://tizen.org/privilege/mediastorage for local files in media storage.
1474 /// http://tizen.org/privilege/externalstorage for local files in external storage.
1476 /// <since_tizen> 9 </since_tizen>
1477 public void LoadUrl(string url)
1479 Interop.WebView.LoadUrl(SwigCPtr, url);
1480 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1484 /// Deprecated. Loads a html by string.
1486 /// <param name="data">The data of Web</param>
1487 [EditorBrowsable(EditorBrowsableState.Never)]
1488 public void LoadHTMLString(string data)
1490 Interop.WebView.LoadHtmlString(SwigCPtr, data);
1491 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1495 /// Loads a html by string.
1497 /// <param name="data">The data of Web</param>
1498 /// <since_tizen> 9 </since_tizen>
1499 public void LoadHtmlString(string data)
1501 Interop.WebView.LoadHtmlString(SwigCPtr, data);
1502 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1506 /// Loads the specified html as the content of the view to override current history entry.
1508 /// <param name="html">The html to be loaded</param>
1509 /// <param name="baseUri">Base URL used for relative paths to external objects</param>
1510 /// <param name="unreachableUri">URL that could not be reached</param>
1511 [EditorBrowsable(EditorBrowsableState.Never)]
1512 public bool LoadHtmlStringOverrideCurrentEntry(string html, string baseUri, string unreachableUri)
1514 bool result = Interop.WebView.LoadHtmlStringOverrideCurrentEntry(SwigCPtr, html, baseUri, unreachableUri);
1515 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1520 /// Requests to load the given contents by MIME type.
1522 /// <param name="contents">The contents to be loaded</param>
1523 /// <param name="contentSize">The size of contents (in bytes)</param>
1524 /// <param name="mimeType">The type of contents, "text/html" is assumed if null</param>
1525 /// <param name="encoding">The encoding for contents, "UTF-8" is assumed if null</param>
1526 /// <param name="baseUri">The base URI to use for relative resources</param>
1527 [EditorBrowsable(EditorBrowsableState.Never)]
1528 public bool LoadContents(string contents, uint contentSize, string mimeType, string encoding, string baseUri)
1530 bool result = Interop.WebView.LoadContents(SwigCPtr, contents, contentSize, mimeType, encoding, baseUri);
1531 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1538 [EditorBrowsable(EditorBrowsableState.Never)]
1539 public void Reload()
1541 Interop.WebView.Reload(SwigCPtr);
1542 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1546 /// Reloads the current page's document without cache
1548 [EditorBrowsable(EditorBrowsableState.Never)]
1549 public bool ReloadWithoutCache()
1551 bool result = Interop.WebView.ReloadWithoutCache(SwigCPtr);
1552 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1557 /// Stops loading the Web
1559 [EditorBrowsable(EditorBrowsableState.Never)]
1560 public void StopLoading()
1562 Interop.WebView.StopLoading(SwigCPtr);
1563 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1567 /// Suspends the operation.
1569 [EditorBrowsable(EditorBrowsableState.Never)]
1570 public void Suspend()
1572 Interop.WebView.Suspend(SwigCPtr);
1573 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1577 /// Resumes the operation after calling Suspend()
1579 [EditorBrowsable(EditorBrowsableState.Never)]
1580 public void Resume()
1582 Interop.WebView.Resume(SwigCPtr);
1583 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1587 /// Suspends all network loading.
1589 [EditorBrowsable(EditorBrowsableState.Never)]
1590 public void SuspendNetworkLoading()
1592 Interop.WebView.SuspendNetworkLoading(SwigCPtr);
1593 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1597 /// Resumes all network loading.
1599 [EditorBrowsable(EditorBrowsableState.Never)]
1600 public void ResumeNetworkLoading()
1602 Interop.WebView.ResumeNetworkLoading(SwigCPtr);
1603 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1607 /// Adds custom header.
1609 /// <param name="name">The name of custom header</param>
1610 /// <param name="value">The value of custom header</param>
1611 [EditorBrowsable(EditorBrowsableState.Never)]
1612 public bool AddCustomHeader(string name, string value)
1614 bool result = Interop.WebView.AddCustomHeader(SwigCPtr, name, value);
1615 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1620 /// Removes custom header.
1622 /// <param name="name">The name of custom header</param>
1623 [EditorBrowsable(EditorBrowsableState.Never)]
1624 public bool RemoveCustomHeader(string name)
1626 bool result = Interop.WebView.RemoveCustomHeader(SwigCPtr, name);
1627 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1632 /// Starts the inspector server.
1634 /// <param name="port">The port number</param>
1635 [EditorBrowsable(EditorBrowsableState.Never)]
1636 public uint StartInspectorServer(uint port)
1638 uint result = Interop.WebView.StartInspectorServer(SwigCPtr, port);
1639 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1644 /// Stops the inspector server.
1646 [EditorBrowsable(EditorBrowsableState.Never)]
1647 public bool StopInspectorServer()
1649 bool result = Interop.WebView.StopInspectorServer(SwigCPtr);
1650 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1655 /// Scrolls page of web view by deltaX and detlaY.
1657 /// <param name="deltaX">The deltaX of scroll</param>
1658 /// <param name="deltaY">The deltaY of scroll</param>
1659 [EditorBrowsable(EditorBrowsableState.Never)]
1660 public void ScrollBy(int deltaX, int deltaY)
1662 Interop.WebView.ScrollBy(SwigCPtr, deltaX, deltaY);
1663 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1667 /// Scrolls edge of web view by deltaX and deltaY.
1669 /// <param name="deltaX">The deltaX of scroll</param>
1670 /// <param name="deltaY">The deltaY of scroll</param>
1671 [EditorBrowsable(EditorBrowsableState.Never)]
1672 public bool ScrollEdgeBy(int deltaX, int deltaY)
1674 bool result = Interop.WebView.ScrollEdgeBy(SwigCPtr, deltaX, deltaY);
1675 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1680 /// Goes to the back
1682 [EditorBrowsable(EditorBrowsableState.Never)]
1683 public void GoBack()
1685 Interop.WebView.GoBack(SwigCPtr);
1686 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1690 /// Goes to the forward
1692 [EditorBrowsable(EditorBrowsableState.Never)]
1693 public void GoForward()
1695 Interop.WebView.GoForward(SwigCPtr);
1696 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1700 /// Returns whether backward is possible.
1702 /// <returns>True if backward is possible, false otherwise</returns>
1703 [EditorBrowsable(EditorBrowsableState.Never)]
1704 public bool CanGoBack()
1706 bool ret = Interop.WebView.CanGoBack(SwigCPtr);
1707 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1712 /// Returns whether forward is possible.
1714 /// <returns>True if forward is possible, false otherwise</returns>
1715 [EditorBrowsable(EditorBrowsableState.Never)]
1716 public bool CanGoForward()
1718 bool ret = Interop.WebView.CanGoForward(SwigCPtr);
1719 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1724 /// Evaluates JavaScript code represented as a string.
1726 /// <param name="script">The JavaScript code</param>
1727 [EditorBrowsable(EditorBrowsableState.Never)]
1728 public void EvaluateJavaScript(string script)
1730 Interop.WebView.EvaluateJavaScript(SwigCPtr, script, new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero));
1731 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1735 /// Add a message handler into the WebView.
1737 /// <param name="objectName">The name of exposed object</param>
1738 /// <param name="handler">The callback function</param>
1739 [EditorBrowsable(EditorBrowsableState.Never)]
1740 public void AddJavaScriptMessageHandler(string objectName, JavaScriptMessageHandler handler)
1742 if (handlerRootMap.ContainsKey(objectName))
1747 handlerRootMap.Add(objectName, handler);
1749 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(handler);
1750 Interop.WebView.AddJavaScriptMessageHandler(SwigCPtr, objectName, new System.Runtime.InteropServices.HandleRef(this, ip));
1752 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1756 /// Registers a callback for JS alert.
1758 /// <param name="callback">The callback function</param>
1759 [EditorBrowsable(EditorBrowsableState.Never)]
1760 public void RegisterJavaScriptAlertCallback(JavaScriptAlertCallback callback)
1762 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(callback);
1763 Interop.WebView.RegisterJavaScriptAlertCallback(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
1765 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1769 /// Reply for alert popup.
1771 [EditorBrowsable(EditorBrowsableState.Never)]
1772 public void JavaScriptAlertReply()
1774 Interop.WebView.JavaScriptAlertReply(SwigCPtr);
1775 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1779 /// Registers a callback for JS confirm.
1781 /// <param name="callback">The callback function</param>
1782 [EditorBrowsable(EditorBrowsableState.Never)]
1783 public void RegisterJavaScriptConfirmCallback(JavaScriptConfirmCallback callback)
1785 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(callback);
1786 Interop.WebView.RegisterJavaScriptConfirmCallback(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
1788 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1792 /// Reply for confirm popup.
1794 /// <param name="confirmed">Confirmed or not</param>
1795 [EditorBrowsable(EditorBrowsableState.Never)]
1796 public void JavaScriptConfirmReply(bool confirmed)
1798 Interop.WebView.JavaScriptConfirmReply(SwigCPtr, confirmed);
1799 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1803 /// Registers a callback for JS promt.
1805 /// <param name="callback">The callback function</param>
1806 [EditorBrowsable(EditorBrowsableState.Never)]
1807 public void RegisterJavaScriptPromptCallback(JavaScriptPromptCallback callback)
1809 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(callback);
1810 Interop.WebView.RegisterJavaScriptPromptCallback(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
1812 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1816 /// Reply for prompt popup.
1818 /// <param name="result">Text in prompt input field.</param>
1819 [EditorBrowsable(EditorBrowsableState.Never)]
1820 public void JavaScriptPromptReply(string result)
1822 Interop.WebView.JavaScriptPromptReply(SwigCPtr, result);
1823 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1827 /// Clears title resources of current WebView.
1829 [EditorBrowsable(EditorBrowsableState.Never)]
1830 public void ClearAllTilesResources()
1832 Interop.WebView.ClearAllTilesResources(SwigCPtr);
1833 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1837 /// Clears the history of current WebView.
1839 [EditorBrowsable(EditorBrowsableState.Never)]
1840 public void ClearHistory()
1842 Interop.WebView.ClearHistory(SwigCPtr);
1843 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1847 /// Scales the current page, centered at the given point.
1849 /// <param name="scaleFactor">The new factor to be scaled</param>
1850 /// <param name="point">The center coordinate</param>
1851 [EditorBrowsable(EditorBrowsableState.Never)]
1852 public void SetScaleFactor(float scaleFactor, Vector2 point)
1854 Interop.WebView.SetScaleFactor(SwigCPtr, scaleFactor, Vector2.getCPtr(point));
1855 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1859 /// Gets the current scale factor of the page.
1861 [EditorBrowsable(EditorBrowsableState.Never)]
1862 public float GetScaleFactor()
1864 float result = Interop.WebView.GetScaleFactor(SwigCPtr);
1865 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1870 /// Requests to activate/deactivate the accessibility usage set by web app.
1872 /// <param name="activated">The new factor to be scaled</param>
1873 [EditorBrowsable(EditorBrowsableState.Never)]
1874 public void ActivateAccessibility(bool activated)
1876 Interop.WebView.ActivateAccessibility(SwigCPtr, activated);
1877 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1881 /// Searches and highlights the given string in the document.
1883 /// <param name="text">The text to be searched</param>
1884 /// <param name="options">The options to search</param>
1885 /// <param name="maxMatchCount">The maximum match count to search</param>
1886 [EditorBrowsable(EditorBrowsableState.Never)]
1887 public bool HighlightText(string text, FindOption options, uint maxMatchCount)
1889 bool result = Interop.WebView.HighlightText(SwigCPtr, text, (int)options, maxMatchCount);
1890 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1895 /// Adds dynamic certificate path.
1897 /// <param name="host">Host that required client authentication</param>
1898 /// <param name="certPath">The file path stored certificate</param>
1899 [EditorBrowsable(EditorBrowsableState.Never)]
1900 public void AddDynamicCertificatePath(string host, string certPath)
1902 Interop.WebView.AddDynamicCertificatePath(SwigCPtr, host, certPath);
1903 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1907 /// Get snapshot of the specified viewArea of page.
1909 /// <param name="viewArea">Host that required client authentication</param>
1910 /// <param name="scaleFactor">The file path stored certificate</param>
1911 [EditorBrowsable(EditorBrowsableState.Never)]
1912 public ImageView GetScreenshot(Rectangle viewArea, float scaleFactor)
1914 IntPtr image = Interop.WebView.GetScreenshot(SwigCPtr, Rectangle.getCPtr(viewArea), scaleFactor);
1915 ImageView imageView = new ImageView(image, true);
1916 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1921 /// Get snapshot of the specified viewArea of page.
1923 /// <param name="viewArea">Host that required client authentication</param>
1924 /// <param name="scaleFactor">The file path stored certificate</param>
1925 /// <param name="callback">The callback for getting screen shot</param>
1926 [EditorBrowsable(EditorBrowsableState.Never)]
1927 public bool GetScreenshotAsynchronously(Rectangle viewArea, float scaleFactor, ScreenshotAcquiredCallback callback)
1929 screenshotAcquiredCallback = callback;
1930 System.IntPtr ip = Marshal.GetFunctionPointerForDelegate(screenshotAcquiredProxyCallback);
1931 bool result = Interop.WebView.GetScreenshotAsynchronously(SwigCPtr, Rectangle.getCPtr(viewArea), scaleFactor, new HandleRef(this, ip));
1932 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1937 /// Asynchronously requests to check if there is a video playing in the given view.
1939 /// <param name="callback">The callback called after checking if video is playing or not</param>
1940 [EditorBrowsable(EditorBrowsableState.Never)]
1941 public bool CheckVideoPlayingAsynchronously(VideoPlayingCallback callback)
1943 System.IntPtr ip = Marshal.GetFunctionPointerForDelegate(callback);
1944 bool result = Interop.WebView.CheckVideoPlayingAsynchronously(SwigCPtr, new HandleRef(this, ip));
1945 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1950 /// Registers callback which will be called upon geolocation permission request.
1952 /// <param name="callback">The callback for requesting geolocation permission</param>
1953 [EditorBrowsable(EditorBrowsableState.Never)]
1954 public void RegisterGeolocationPermissionCallback(GeolocationPermissionCallback callback)
1956 System.IntPtr ip = Marshal.GetFunctionPointerForDelegate(callback);
1957 Interop.WebView.RegisterGeolocationPermissionCallback(SwigCPtr, new HandleRef(this, ip));
1958 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1962 /// Does hit test synchronously.
1964 /// <param name="x">the horizontal position to query</param>
1965 /// <param name="y">the vertical position to query</param>
1966 /// <param name="mode">the mode of hit test</param>
1967 [EditorBrowsable(EditorBrowsableState.Never)]
1968 public WebHitTestResult HitTest(int x, int y, HitTestMode mode)
1970 System.IntPtr result = Interop.WebView.CreateHitTest(SwigCPtr, x, y, (int)mode);
1971 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1972 return new WebHitTestResult(result, true);
1976 /// Does hit test asynchronously.
1978 /// <param name="x">the horizontal position to query</param>
1979 /// <param name="y">the vertical position to query</param>
1980 /// <param name="mode">the mode of hit test</param>
1981 /// <param name="callback">the callback that is called after hit test is finished.</param>
1982 [EditorBrowsable(EditorBrowsableState.Never)]
1983 public bool HitTestAsynchronously(int x, int y, HitTestMode mode, HitTestFinishedCallback callback)
1985 hitTestFinishedCallback = callback;
1986 System.IntPtr ip = Marshal.GetFunctionPointerForDelegate(hitTestFinishedProxyCallback);
1987 bool result = Interop.WebView.CreateHitTestAsynchronously(SwigCPtr, x, y, (int)mode, new HandleRef(this, ip));
1988 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1993 /// Deprecated. Clears the cache of current WebView.
1995 [EditorBrowsable(EditorBrowsableState.Never)]
1996 public void ClearCache()
1998 Context.ClearCache();
2002 /// Deprecated. Clears all the cookies of current WebView.
2004 [EditorBrowsable(EditorBrowsableState.Never)]
2005 public void ClearCookies()
2007 CookieManager.ClearCookies();
2011 /// Sets the tts focus to the webview.
2012 /// Please note that it only works when the webview does not have keyinput focus.
2013 /// If the webview has a keyinput focus, it also has tts focus so calling SetTtsFocus(false) is ignored.
2015 /// <param name="focused">Focused or not</param>
2016 [EditorBrowsable(EditorBrowsableState.Never)]
2017 public void SetTtsFocus(bool focused)
2019 Interop.WebView.SetTtsFocus(SwigCPtr, focused);
2020 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2024 /// Get a plain text of current web page asynchronously.
2025 /// Please note that it gets plain text of currently loaded page so please call this method after page load finished.
2027 /// <param name="callback">The callback for getting plain text</param>
2028 [EditorBrowsable(EditorBrowsableState.Never)]
2029 public void GetPlainTextAsynchronously(PlainTextReceivedCallback callback)
2031 plainTextReceivedCallback = callback;
2032 System.IntPtr ip = Marshal.GetFunctionPointerForDelegate(plainTextReceivedCallback);
2033 Interop.WebView.GetPlainTextAsynchronously(SwigCPtr, new HandleRef(this, ip));
2034 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2037 internal static WebView DownCast(BaseHandle handle)
2039 WebView ret = new WebView(Interop.WebView.DownCast(BaseHandle.getCPtr(handle)), true);
2040 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2044 internal WebView Assign(WebView webView)
2046 WebView ret = new WebView(Interop.WebView.Assign(SwigCPtr, WebView.getCPtr(webView)), false);
2047 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2051 private void OnPageLoadStarted(string pageUrl)
2053 WebViewPageLoadEventArgs e = new WebViewPageLoadEventArgs();
2056 e.PageUrl = pageUrl;
2058 pageLoadStartedEventHandler?.Invoke(this, e);
2061 private void OnPageLoading(string pageUrl)
2063 pageLoadingEventHandler?.Invoke(this, new WebViewPageLoadEventArgs());
2066 private void OnPageLoadFinished(string pageUrl)
2068 WebViewPageLoadEventArgs e = new WebViewPageLoadEventArgs();
2071 e.PageUrl = pageUrl;
2073 pageLoadFinishedEventHandler?.Invoke(this, e);
2076 private void OnPageLoadError(IntPtr error)
2078 pageLoadErrorEventHandler?.Invoke(this, new WebViewPageLoadErrorEventArgs(new WebPageLoadError(error, true)));
2081 private void OnScrollEdgeReached(int edge)
2083 scrollEdgeReachedEventHandler?.Invoke(this, new WebViewScrollEdgeReachedEventArgs((WebViewScrollEdgeReachedEventArgs.Edge)edge));
2086 private void OnUrlChanged(string pageUrl)
2088 urlChangedEventHandler?.Invoke(this, new WebViewUrlChangedEventArgs(pageUrl));
2091 private void OnFormRepostPolicyDecided(IntPtr decision)
2093 formRepostPolicyDecidedEventHandler?.Invoke(this, new WebViewFormRepostPolicyDecidedEventArgs(new WebFormRepostPolicyDecisionMaker(decision, true)));
2096 private void OnFrameRendered()
2098 frameRenderedEventHandler?.Invoke(this, new EventArgs());
2101 private void OnScreenshotAcquired(IntPtr data)
2103 #pragma warning disable CA2000 // Dispose objects before losing scope
2104 screenshotAcquiredCallback?.Invoke(new ImageView(data, true));
2105 #pragma warning restore CA2000 // Dispose objects before losing scope
2108 private void OnResponsePolicyDecided(IntPtr maker)
2110 responsePolicyDecidedEventHandler?.Invoke(this, new WebViewResponsePolicyDecidedEventArgs(new WebPolicyDecisionMaker(maker, true)));
2113 private void OnCertificateConfirmed(IntPtr certificate)
2115 certificateConfirmedEventHandler?.Invoke(this, new WebViewCertificateReceivedEventArgs(new WebCertificate(certificate, true)));
2118 private void OnSslCertificateChanged(IntPtr certificate)
2120 sslCertificateChangedEventHandler?.Invoke(this, new WebViewCertificateReceivedEventArgs(new WebCertificate(certificate, true)));
2123 private void OnHttpAuthRequested(IntPtr handler)
2125 httpAuthRequestedEventHandler?.Invoke(this, new WebViewHttpAuthRequestedEventArgs(new WebHttpAuthHandler(handler, true)));
2128 private void OnConsoleMessageReceived(IntPtr message)
2130 consoleMessageReceivedEventHandler?.Invoke(this, new WebViewConsoleMessageReceivedEventArgs(new WebConsoleMessage(message, true)));
2133 private void OnContextMenuShown(IntPtr menu)
2135 contextMenuShownEventHandler?.Invoke(this, new WebViewContextMenuShownEventArgs(new WebContextMenu(menu, true)));
2138 private void OnContextMenuHidden(IntPtr menu)
2140 contextMenuHiddenEventHandler?.Invoke(this, new WebViewContextMenuHiddenEventArgs(new WebContextMenu(menu, true)));
2143 private void OnHitTestFinished(IntPtr test)
2145 #pragma warning disable CA2000 // Dispose objects before losing scope
2146 hitTestFinishedCallback?.Invoke(new WebHitTestResult(test, true));
2147 #pragma warning restore CA2000 // Dispose objects before losing scope