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 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)Context.CacheModel;
769 Context.CacheModel = (WebContext.CacheModelType)value;
774 /// Deprecated. The cookie acceptance policy.
776 [EditorBrowsable(EditorBrowsableState.Never)]
777 public CookieAcceptPolicy CookieAcceptPolicy
781 return (CookieAcceptPolicy)CookieManager.CookieAcceptPolicy;
785 CookieManager.CookieAcceptPolicy = (WebCookieManager.CookieAcceptPolicyType)value;
790 /// The user agent string.
792 /// <since_tizen> 9 </since_tizen>
793 public string UserAgent
797 return (string)GetValue(UserAgentProperty);
801 SetValue(UserAgentProperty, value);
802 NotifyPropertyChanged();
807 /// Deprecated. Whether JavaScript is enabled.
809 [EditorBrowsable(EditorBrowsableState.Never)]
810 public bool EnableJavaScript
814 return Settings.JavaScriptEnabled;
818 Settings.JavaScriptEnabled = value;
823 /// Deprecated. Whether images can be loaded automatically.
825 [EditorBrowsable(EditorBrowsableState.Never)]
826 public bool LoadImagesAutomatically
830 return Settings.AutomaticImageLoadingAllowed;
834 Settings.AutomaticImageLoadingAllowed = value;
839 /// The default text encoding name.<br />
840 /// e.g. "UTF-8"<br />
842 [EditorBrowsable(EditorBrowsableState.Never)]
843 public string DefaultTextEncodingName
847 return Settings.DefaultTextEncodingName;
851 Settings.DefaultTextEncodingName = value;
856 /// The default font size in pixel.
858 [EditorBrowsable(EditorBrowsableState.Never)]
859 public int DefaultFontSize
863 return Settings.DefaultFontSize;
867 Settings.DefaultFontSize = value;
872 /// The position of scroll.
874 [EditorBrowsable(EditorBrowsableState.Never)]
875 public Position ScrollPosition
879 Vector2 pv = (Vector2)GetValue(ScrollPositionProperty);
880 return new Position(pv.X, pv.Y);
887 Vector2 vpv = new Vector2(pv.X, pv.Y);
888 SetValue(ScrollPositionProperty, vpv);
889 NotifyPropertyChanged();
895 /// The size of scroll, read-only.
897 [EditorBrowsable(EditorBrowsableState.Never)]
898 public Size ScrollSize
902 Vector2 sv = (Vector2)GetValue(ScrollSizeProperty);
903 return new Size(sv.Width, sv.Height);
908 /// The size of content, read-only.
910 [EditorBrowsable(EditorBrowsableState.Never)]
911 public Size ContentSize
915 Vector2 sv = (Vector2)GetValue(ContentSizeProperty);
916 return new Size(sv.Width, sv.Height);
921 /// Whether video hole is enabled or not.
923 [EditorBrowsable(EditorBrowsableState.Never)]
924 public bool VideoHoleEnabled
928 return (bool)GetValue(VideoHoleEnabledProperty);
932 SetValue(VideoHoleEnabledProperty, value);
933 NotifyPropertyChanged();
938 /// Whether mouse events are enabled or not.
940 [EditorBrowsable(EditorBrowsableState.Never)]
941 public bool MouseEventsEnabled
945 return (bool)GetValue(MouseEventsEnabledProperty);
949 SetValue(MouseEventsEnabledProperty, value);
950 NotifyPropertyChanged();
955 /// Whether key events are enabled or not.
957 [EditorBrowsable(EditorBrowsableState.Never)]
958 public bool KeyEventsEnabled
962 return (bool)GetValue(KeyEventsEnabledProperty);
966 SetValue(KeyEventsEnabledProperty, value);
967 NotifyPropertyChanged();
972 /// Background color of web page.
974 [EditorBrowsable(EditorBrowsableState.Never)]
975 public Color ContentBackgroundColor
979 return (Color)GetValue(ContentBackgroundColorProperty);
983 SetValue(ContentBackgroundColorProperty, value);
984 NotifyPropertyChanged();
989 /// Whether tiles are cleared or not when hidden.
991 [EditorBrowsable(EditorBrowsableState.Never)]
992 public bool TilesClearedWhenHidden
996 return (bool)GetValue(TilesClearedWhenHiddenProperty);
1000 SetValue(TilesClearedWhenHiddenProperty, value);
1001 NotifyPropertyChanged();
1006 /// Multiplier of cover area of tile when web page is rendered.
1008 [EditorBrowsable(EditorBrowsableState.Never)]
1009 public float TileCoverAreaMultiplier
1013 return (float)GetValue(TileCoverAreaMultiplierProperty);
1017 SetValue(TileCoverAreaMultiplierProperty, value);
1018 NotifyPropertyChanged();
1023 /// Whether cursor is enabled or not by client.
1025 [EditorBrowsable(EditorBrowsableState.Never)]
1026 public bool CursorEnabledByClient
1030 return (bool)GetValue(CursorEnabledByClientProperty);
1034 SetValue(CursorEnabledByClientProperty, value);
1035 NotifyPropertyChanged();
1040 /// Gets selected text in web page.
1042 [EditorBrowsable(EditorBrowsableState.Never)]
1043 public string SelectedText
1047 return (string)GetValue(SelectedTextProperty);
1052 /// Gets title of web page.
1054 /// <since_tizen> 9 </since_tizen>
1059 return (string)GetValue(TitleProperty);
1064 /// Gets favicon of web page.
1066 /// <since_tizen> 9 </since_tizen>
1067 public ImageView Favicon
1071 global::System.IntPtr imageView = Interop.WebView.GetFavicon(SwigCPtr);
1072 if (imageView == IntPtr.Zero)
1074 return new ImageView(imageView, false);
1079 /// Zoom factor of web page.
1081 [EditorBrowsable(EditorBrowsableState.Never)]
1082 public float PageZoomFactor
1086 return (float)GetValue(PageZoomFactorProperty);
1090 SetValue(PageZoomFactorProperty, value);
1091 NotifyPropertyChanged();
1096 /// Zoom factor of text in web page.
1098 [EditorBrowsable(EditorBrowsableState.Never)]
1099 public float TextZoomFactor
1103 return (float)GetValue(TextZoomFactorProperty);
1107 SetValue(TextZoomFactorProperty, value);
1108 NotifyPropertyChanged();
1113 /// Gets percentage of loading progress.
1115 /// <since_tizen> 9 </since_tizen>
1116 public float LoadProgressPercentage
1120 return (float)GetValue(LoadProgressPercentageProperty);
1124 internal static new class Property
1126 internal static readonly int Url = Interop.WebView.UrlGet();
1127 internal static readonly int UserAgent = Interop.WebView.UserAgentGet();
1128 internal static readonly int ScrollPosition = Interop.WebView.ScrollPositionGet();
1129 internal static readonly int ScrollSize = Interop.WebView.ScrollSizeGet();
1130 internal static readonly int ContentSize = Interop.WebView.ContentSizeGet();
1131 internal static readonly int Title = Interop.WebView.TitleGet();
1132 internal static readonly int VideoHoleEnabled = Interop.WebView.VideoHoleEnabledGet();
1133 internal static readonly int MouseEventsEnabled = Interop.WebView.MouseEventsEnabledGet();
1134 internal static readonly int KeyEventsEnabled = Interop.WebView.KeyEventsEnabledGet();
1135 internal static readonly int DocumentBackgroundColor = Interop.WebView.DocumentBackgroundColorGet();
1136 internal static readonly int TilesClearedWhenHidden = Interop.WebView.TilesClearedWhenHiddenGet();
1137 internal static readonly int TileCoverAreaMultiplier = Interop.WebView.TileCoverAreaMultiplierGet();
1138 internal static readonly int CursorEnabledByClient = Interop.WebView.CursorEnabledByClientGet();
1139 internal static readonly int SelectedText = Interop.WebView.SelectedTextGet();
1140 internal static readonly int PageZoomFactor = Interop.WebView.PageZoomFactorGet();
1141 internal static readonly int TextZoomFactor = Interop.WebView.TextZoomFactorGet();
1142 internal static readonly int LoadProgressPercentage = Interop.WebView.LoadProgressPercentageGet();
1145 private static readonly BindableProperty UrlProperty = BindableProperty.Create(nameof(Url), typeof(string), typeof(WebView), string.Empty, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) =>
1147 var webview = (WebView)bindable;
1148 if (newValue != null)
1150 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.Url, new Tizen.NUI.PropertyValue((string)newValue));
1153 defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
1155 var webview = (WebView)bindable;
1157 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.Url).Get(out temp);
1161 private static readonly BindableProperty UserAgentProperty = BindableProperty.Create(nameof(UserAgent), typeof(string), typeof(WebView), string.Empty, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) =>
1163 var webview = (WebView)bindable;
1164 if (newValue != null)
1166 Tizen.NUI.Object.SetProperty((HandleRef)webview.SwigCPtr, WebView.Property.UserAgent, new Tizen.NUI.PropertyValue((string)newValue));
1169 defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
1171 var webview = (WebView)bindable;
1173 Tizen.NUI.Object.GetProperty((HandleRef)webview.SwigCPtr, WebView.Property.UserAgent).Get(out temp);
1177 private static readonly BindableProperty ScrollPositionProperty = BindableProperty.Create(nameof(ScrollPosition), typeof(Vector2), typeof(WebView), null, propertyChanged: (bindable, oldValue, newValue) =>
1179 var webview = (WebView)bindable;
1180 if (newValue != null)
1182 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.ScrollPosition, new Tizen.NUI.PropertyValue((Vector2)newValue));
1185 defaultValueCreator: (bindable) =>
1187 var webview = (WebView)bindable;
1188 Vector2 temp = new Vector2(0.0f, 0.0f);
1189 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.ScrollPosition).Get(temp);
1193 private static readonly BindableProperty ScrollSizeProperty = BindableProperty.Create(nameof(ScrollSize), typeof(Vector2), typeof(WebView), null, defaultValueCreator: (bindable) =>
1195 var webview = (WebView)bindable;
1196 Vector2 temp = new Vector2(0.0f, 0.0f);
1197 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.ScrollSize).Get(temp);
1201 private static readonly BindableProperty ContentSizeProperty = BindableProperty.Create(nameof(ContentSize), typeof(Vector2), typeof(WebView), null, defaultValueCreator: (bindable) =>
1203 var webview = (WebView)bindable;
1204 Vector2 temp = new Vector2(0.0f, 0.0f);
1205 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.ContentSize).Get(temp);
1209 private static readonly BindableProperty TitleProperty = BindableProperty.Create(nameof(Title), typeof(string), typeof(WebView), string.Empty, defaultValueCreator: (bindable) =>
1211 var webview = (WebView)bindable;
1213 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.Title).Get(out title);
1217 private static readonly BindableProperty VideoHoleEnabledProperty = BindableProperty.Create(nameof(VideoHoleEnabled), typeof(bool), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
1219 var webview = (WebView)bindable;
1220 if (newValue != null)
1222 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.VideoHoleEnabled, new Tizen.NUI.PropertyValue((bool)newValue));
1225 defaultValueCreator: (bindable) =>
1227 var webview = (WebView)bindable;
1229 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.VideoHoleEnabled).Get(out temp);
1233 private static readonly BindableProperty MouseEventsEnabledProperty = BindableProperty.Create(nameof(MouseEventsEnabled), typeof(bool), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
1235 var webview = (WebView)bindable;
1236 if (newValue != null)
1238 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.MouseEventsEnabled, new Tizen.NUI.PropertyValue((bool)newValue));
1241 defaultValueCreator: (bindable) =>
1243 var webview = (WebView)bindable;
1245 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.MouseEventsEnabled).Get(out temp);
1249 private static readonly BindableProperty KeyEventsEnabledProperty = BindableProperty.Create(nameof(KeyEventsEnabled), typeof(bool), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
1251 var webview = (WebView)bindable;
1252 if (newValue != null)
1254 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.KeyEventsEnabled, new Tizen.NUI.PropertyValue((bool)newValue));
1257 defaultValueCreator: (bindable) =>
1259 var webview = (WebView)bindable;
1261 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.KeyEventsEnabled).Get(out temp);
1265 private static readonly BindableProperty ContentBackgroundColorProperty = BindableProperty.Create(nameof(ContentBackgroundColor), typeof(Color), typeof(WebView), null, propertyChanged: (bindable, oldValue, newValue) =>
1267 var webview = (WebView)bindable;
1268 if (newValue != null)
1270 webview.contentBackgroundColor = (Color)newValue;
1271 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.DocumentBackgroundColor, new Tizen.NUI.PropertyValue((Color)newValue));
1274 defaultValueCreator: (bindable) =>
1276 var webview = (WebView)bindable;
1277 return webview.contentBackgroundColor;
1280 private static readonly BindableProperty TilesClearedWhenHiddenProperty = BindableProperty.Create(nameof(TilesClearedWhenHidden), typeof(bool), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
1282 var webview = (WebView)bindable;
1283 if (newValue != null)
1285 webview.tilesClearedWhenHidden = (bool)newValue;
1286 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.TilesClearedWhenHidden, new Tizen.NUI.PropertyValue((bool)newValue));
1289 defaultValueCreator: (bindable) =>
1291 var webview = (WebView)bindable;
1292 return webview.tilesClearedWhenHidden;
1295 private static readonly BindableProperty TileCoverAreaMultiplierProperty = BindableProperty.Create(nameof(TileCoverAreaMultiplier), typeof(float), typeof(WebView), 0.0f, propertyChanged: (bindable, oldValue, newValue) =>
1297 var webview = (WebView)bindable;
1298 if (newValue != null)
1300 webview.tileCoverAreaMultiplier = (float)newValue;
1301 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.TileCoverAreaMultiplier, new Tizen.NUI.PropertyValue((float)newValue));
1304 defaultValueCreator: (bindable) =>
1306 var webview = (WebView)bindable;
1307 return webview.tileCoverAreaMultiplier;
1310 private static readonly BindableProperty CursorEnabledByClientProperty = BindableProperty.Create(nameof(CursorEnabledByClient), typeof(bool), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
1312 var webview = (WebView)bindable;
1313 if (newValue != null)
1315 webview.cursorEnabledByClient = (bool)newValue;
1316 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.CursorEnabledByClient, new Tizen.NUI.PropertyValue((bool)newValue));
1319 defaultValueCreator: (bindable) =>
1321 var webview = (WebView)bindable;
1322 return webview.cursorEnabledByClient;
1325 private static readonly BindableProperty SelectedTextProperty = BindableProperty.Create(nameof(SelectedText), typeof(string), typeof(WebView), string.Empty, defaultValueCreator: (bindable) =>
1327 var webview = (WebView)bindable;
1329 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.SelectedText).Get(out text);
1333 private static readonly BindableProperty PageZoomFactorProperty = BindableProperty.Create(nameof(PageZoomFactor), typeof(float), typeof(WebView), 0.0f, propertyChanged: (bindable, oldValue, newValue) =>
1335 var webview = (WebView)bindable;
1336 if (newValue != null)
1338 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.PageZoomFactor, new Tizen.NUI.PropertyValue((float)newValue));
1341 defaultValueCreator: (bindable) =>
1343 var webview = (WebView)bindable;
1345 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.PageZoomFactor).Get(out temp);
1349 private static readonly BindableProperty TextZoomFactorProperty = BindableProperty.Create(nameof(TextZoomFactor), typeof(float), typeof(WebView), 0.0f, propertyChanged: (bindable, oldValue, newValue) =>
1351 var webview = (WebView)bindable;
1352 if (newValue != null)
1354 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.TextZoomFactor, new Tizen.NUI.PropertyValue((float)newValue));
1357 defaultValueCreator: (bindable) =>
1359 var webview = (WebView)bindable;
1361 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.TextZoomFactor).Get(out temp);
1365 private static readonly BindableProperty LoadProgressPercentageProperty = BindableProperty.Create(nameof(LoadProgressPercentage), typeof(float), typeof(WebView), 0.0f, defaultValueCreator: (bindable) =>
1367 var webview = (WebView)bindable;
1369 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.LoadProgressPercentage).Get(out percentage);
1373 // For rooting handlers
1374 internal Dictionary<string, JavaScriptMessageHandler> handlerRootMap = new Dictionary<string, JavaScriptMessageHandler>();
1379 /// <param name="url">The path of Web</param>
1381 /// The following privileges are required:
1382 /// http://tizen.org/privilege/internet for remote web pages of websites.
1383 /// http://tizen.org/privilege/mediastorage for local files in media storage.
1384 /// http://tizen.org/privilege/externalstorage for local files in external storage.
1386 /// <since_tizen> 9 </since_tizen>
1387 public void LoadUrl(string url)
1389 Interop.WebView.LoadUrl(SwigCPtr, url);
1390 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1394 /// Deprecated. Loads a html by string.
1395 /// <param name="data">The data of Web</param>
1397 [EditorBrowsable(EditorBrowsableState.Never)]
1398 public void LoadHTMLString(string data)
1400 Interop.WebView.LoadHtmlString(SwigCPtr, data);
1401 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1405 /// Loads a html by string.
1407 /// <param name="data">The data of Web</param>
1408 /// <since_tizen> 9 </since_tizen>
1409 public void LoadHtmlString(string data)
1411 Interop.WebView.LoadHtmlString(SwigCPtr, data);
1412 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1416 /// Loads the specified html as the content of the view to override current history entry.
1417 /// <param name="html">The html to be loaded</param>
1418 /// <param name="baseUri">Base URL used for relative paths to external objects</param>
1419 /// <param name="unreachableUri">URL that could not be reached</param>
1421 [EditorBrowsable(EditorBrowsableState.Never)]
1422 public bool LoadHtmlStringOverrideCurrentEntry(string html, string baseUri, string unreachableUri)
1424 bool result = Interop.WebView.LoadHtmlStringOverrideCurrentEntry(SwigCPtr, html, baseUri, unreachableUri);
1425 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1430 /// Requests to load the given contents by MIME type.
1431 /// <param name="contents">The contents to be loaded</param>
1432 /// <param name="contentSize">The size of contents (in bytes)</param>
1433 /// <param name="mimeType">The type of contents, "text/html" is assumed if null</param>
1434 /// <param name="encoding">The encoding for contents, "UTF-8" is assumed if null</param>
1435 /// <param name="baseUri">The base URI to use for relative resources</param>
1437 [EditorBrowsable(EditorBrowsableState.Never)]
1438 public bool LoadContents(string contents, uint contentSize, string mimeType, string encoding, string baseUri)
1440 bool result = Interop.WebView.LoadContents(SwigCPtr, contents, contentSize, mimeType, encoding, baseUri);
1441 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1448 [EditorBrowsable(EditorBrowsableState.Never)]
1449 public void Reload()
1451 Interop.WebView.Reload(SwigCPtr);
1452 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1456 /// Reloads the current page's document without cache
1458 [EditorBrowsable(EditorBrowsableState.Never)]
1459 public bool ReloadWithoutCache()
1461 bool result = Interop.WebView.ReloadWithoutCache(SwigCPtr);
1462 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1467 /// Stops loading the Web
1469 [EditorBrowsable(EditorBrowsableState.Never)]
1470 public void StopLoading()
1472 Interop.WebView.StopLoading(SwigCPtr);
1473 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1477 /// Suspends the operation.
1479 [EditorBrowsable(EditorBrowsableState.Never)]
1480 public void Suspend()
1482 Interop.WebView.Suspend(SwigCPtr);
1483 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1487 /// Resumes the operation after calling Suspend()
1489 [EditorBrowsable(EditorBrowsableState.Never)]
1490 public void Resume()
1492 Interop.WebView.Resume(SwigCPtr);
1493 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1497 /// Suspends all network loading.
1499 [EditorBrowsable(EditorBrowsableState.Never)]
1500 public void SuspendNetworkLoading()
1502 Interop.WebView.SuspendNetworkLoading(SwigCPtr);
1503 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1507 /// Resumes all network loading.
1509 [EditorBrowsable(EditorBrowsableState.Never)]
1510 public void ResumeNetworkLoading()
1512 Interop.WebView.ResumeNetworkLoading(SwigCPtr);
1513 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1517 /// Adds custom header.
1518 /// <param name="name">The name of custom header</param>
1519 /// <param name="value">The value of custom header</param>
1521 [EditorBrowsable(EditorBrowsableState.Never)]
1522 public bool AddCustomHeader(string name, string value)
1524 bool result = Interop.WebView.AddCustomHeader(SwigCPtr, name, value);
1525 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1530 /// Removes custom header.
1531 /// <param name="name">The name of custom header</param>
1533 [EditorBrowsable(EditorBrowsableState.Never)]
1534 public bool RemoveCustomHeader(string name)
1536 bool result = Interop.WebView.RemoveCustomHeader(SwigCPtr, name);
1537 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1542 /// Starts the inspector server.
1543 /// <param name="port">The port number</param>
1545 [EditorBrowsable(EditorBrowsableState.Never)]
1546 public uint StartInspectorServer(uint port)
1548 uint result = Interop.WebView.StartInspectorServer(SwigCPtr, port);
1549 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1554 /// Stops the inspector server.
1556 [EditorBrowsable(EditorBrowsableState.Never)]
1557 public bool StopInspectorServer()
1559 bool result = Interop.WebView.StopInspectorServer(SwigCPtr);
1560 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1565 /// Scrolls page of web view by deltaX and detlaY.
1566 /// <param name="deltaX">The deltaX of scroll</param>
1567 /// <param name="deltaY">The deltaY of scroll</param>
1569 [EditorBrowsable(EditorBrowsableState.Never)]
1570 public void ScrollBy(int deltaX, int deltaY)
1572 Interop.WebView.ScrollBy(SwigCPtr, deltaX, deltaY);
1573 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1577 /// Scrolls edge of web view by deltaX and deltaY.
1578 /// <param name="deltaX">The deltaX of scroll</param>
1579 /// <param name="deltaY">The deltaY of scroll</param>
1581 [EditorBrowsable(EditorBrowsableState.Never)]
1582 public bool ScrollEdgeBy(int deltaX, int deltaY)
1584 bool result = Interop.WebView.ScrollEdgeBy(SwigCPtr, deltaX, deltaY);
1585 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1590 /// Goes to the back
1592 [EditorBrowsable(EditorBrowsableState.Never)]
1593 public void GoBack()
1595 Interop.WebView.GoBack(SwigCPtr);
1596 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1600 /// Goes to the forward
1602 [EditorBrowsable(EditorBrowsableState.Never)]
1603 public void GoForward()
1605 Interop.WebView.GoForward(SwigCPtr);
1606 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1610 /// Returns whether backward is possible.
1611 /// <returns>True if backward is possible, false otherwise</returns>
1613 [EditorBrowsable(EditorBrowsableState.Never)]
1614 public bool CanGoBack()
1616 bool ret = Interop.WebView.CanGoBack(SwigCPtr);
1617 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1622 /// Returns whether forward is possible.
1623 /// <returns>True if forward is possible, false otherwise</returns>
1625 [EditorBrowsable(EditorBrowsableState.Never)]
1626 public bool CanGoForward()
1628 bool ret = Interop.WebView.CanGoForward(SwigCPtr);
1629 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1634 /// Evaluates JavaScript code represented as a string.
1635 /// <param name="script">The JavaScript code</param>
1637 [EditorBrowsable(EditorBrowsableState.Never)]
1638 public void EvaluateJavaScript(string script)
1640 Interop.WebView.EvaluateJavaScript(SwigCPtr, script, new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero));
1641 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1645 /// Add a message handler into the WebView.
1646 /// <param name="objectName">The name of exposed object</param>
1647 /// <param name="handler">The callback function</param>
1649 [EditorBrowsable(EditorBrowsableState.Never)]
1650 public void AddJavaScriptMessageHandler(string objectName, JavaScriptMessageHandler handler)
1652 if (handlerRootMap.ContainsKey(objectName))
1657 handlerRootMap.Add(objectName, handler);
1659 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(handler);
1660 Interop.WebView.AddJavaScriptMessageHandler(SwigCPtr, objectName, new System.Runtime.InteropServices.HandleRef(this, ip));
1662 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1666 /// Add a message handler into the WebView.
1667 /// <param name="callback">The callback function</param>
1669 [EditorBrowsable(EditorBrowsableState.Never)]
1670 public void RegisterJavaScriptAlertCallback(JavaScriptAlertCallback callback)
1672 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(callback);
1673 Interop.WebView.RegisterJavaScriptAlertCallback(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
1675 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1679 /// Reply for alert popup.
1681 [EditorBrowsable(EditorBrowsableState.Never)]
1682 public void JavaScriptAlertReply()
1684 Interop.WebView.JavaScriptAlertReply(SwigCPtr);
1685 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1689 /// Add a message handler into the WebView.
1690 /// <param name="callback">The callback function</param>
1692 [EditorBrowsable(EditorBrowsableState.Never)]
1693 public void RegisterJavaScriptConfirmCallback(JavaScriptConfirmCallback callback)
1695 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(callback);
1696 Interop.WebView.RegisterJavaScriptConfirmCallback(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
1698 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1702 /// Reply for confirm popup.
1703 /// <param name="confirmed">confirmed or not</param>
1705 [EditorBrowsable(EditorBrowsableState.Never)]
1706 public void JavaScriptConfirmReply(bool confirmed)
1708 Interop.WebView.JavaScriptConfirmReply(SwigCPtr, confirmed);
1709 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1713 /// Add a message handler into the WebView.
1714 /// <param name="callback">The callback function</param>
1716 [EditorBrowsable(EditorBrowsableState.Never)]
1717 public void RegisterJavaScriptPromptCallback(JavaScriptPromptCallback callback)
1719 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(callback);
1720 Interop.WebView.RegisterJavaScriptPromptCallback(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
1722 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1726 /// Reply for prompt popup.
1727 /// <param name="result">text in prompt input field.</param>
1729 [EditorBrowsable(EditorBrowsableState.Never)]
1730 public void JavaScriptPromptReply(string result)
1732 Interop.WebView.JavaScriptPromptReply(SwigCPtr, result);
1733 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1737 /// Clears title resources of current WebView.
1739 [EditorBrowsable(EditorBrowsableState.Never)]
1740 public void ClearAllTilesResources()
1742 Interop.WebView.ClearAllTilesResources(SwigCPtr);
1743 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1747 /// Clears the history of current WebView.
1749 [EditorBrowsable(EditorBrowsableState.Never)]
1750 public void ClearHistory()
1752 Interop.WebView.ClearHistory(SwigCPtr);
1753 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1757 /// Scales the current page, centered at the given point.
1758 /// <param name="scaleFactor">The new factor to be scaled</param>
1759 /// <param name="point">The center coordinate</param>
1761 [EditorBrowsable(EditorBrowsableState.Never)]
1762 public void SetScaleFactor(float scaleFactor, Vector2 point)
1764 Interop.WebView.SetScaleFactor(SwigCPtr, scaleFactor, Vector2.getCPtr(point));
1765 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1769 /// Gets the current scale factor of the page.
1771 [EditorBrowsable(EditorBrowsableState.Never)]
1772 public float GetScaleFactor()
1774 float result = Interop.WebView.GetScaleFactor(SwigCPtr);
1775 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1780 /// Requests to activate/deactivate the accessibility usage set by web app.
1781 /// <param name="activated">The new factor to be scaled</param>
1783 [EditorBrowsable(EditorBrowsableState.Never)]
1784 public void ActivateAccessibility(bool activated)
1786 Interop.WebView.ActivateAccessibility(SwigCPtr, activated);
1787 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1791 /// Searches and highlights the given string in the document.
1792 /// <param name="text">The text to be searched</param>
1793 /// <param name="options">The options to search</param>
1794 /// <param name="maxMatchCount">The maximum match count to search</param>
1796 [EditorBrowsable(EditorBrowsableState.Never)]
1797 public bool HighlightText(string text, FindOption options, uint maxMatchCount)
1799 bool result = Interop.WebView.HighlightText(SwigCPtr, text, (int)options, maxMatchCount);
1800 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1805 /// Adds dynamic certificate path.
1806 /// <param name="host">Host that required client authentication</param>
1807 /// <param name="certPath">The file path stored certificate</param>
1809 [EditorBrowsable(EditorBrowsableState.Never)]
1810 public void AddDynamicCertificatePath(string host, string certPath)
1812 Interop.WebView.AddDynamicCertificatePath(SwigCPtr, host, certPath);
1813 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1817 /// Get snapshot of the specified viewArea of page.
1818 /// <param name="viewArea">Host that required client authentication</param>
1819 /// <param name="scaleFactor">The file path stored certificate</param>
1821 [EditorBrowsable(EditorBrowsableState.Never)]
1822 public ImageView GetScreenshot(Rectangle viewArea, float scaleFactor)
1824 IntPtr image = Interop.WebView.GetScreenshot(SwigCPtr, Rectangle.getCPtr(viewArea), scaleFactor);
1825 ImageView imageView = new ImageView(image, true);
1826 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1831 /// Get snapshot of the specified viewArea of page.
1832 /// <param name="viewArea">Host that required client authentication</param>
1833 /// <param name="scaleFactor">The file path stored certificate</param>
1834 /// <param name="callback">The callback for getting screen shot</param>
1836 [EditorBrowsable(EditorBrowsableState.Never)]
1837 public bool GetScreenshotAsynchronously(Rectangle viewArea, float scaleFactor, ScreenshotAcquiredCallback callback)
1839 screenshotAcquiredCallback = callback;
1840 System.IntPtr ip = Marshal.GetFunctionPointerForDelegate(screenshotAcquiredProxyCallback);
1841 bool result = Interop.WebView.GetScreenshotAsynchronously(SwigCPtr, Rectangle.getCPtr(viewArea), scaleFactor, new HandleRef(this, ip));
1842 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1847 /// Asynchronous requests to check if there is a video playing in the given view.
1848 /// <param name="callback">The callback called after checking if video is playing or not</param>
1850 [EditorBrowsable(EditorBrowsableState.Never)]
1851 public bool CheckVideoPlayingAsynchronously(VideoPlayingCallback callback)
1853 System.IntPtr ip = Marshal.GetFunctionPointerForDelegate(callback);
1854 bool result = Interop.WebView.CheckVideoPlayingAsynchronously(SwigCPtr, new HandleRef(this, ip));
1855 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1860 /// Registers callback which will be called upon geolocation permission request.
1861 /// <param name="callback">The callback for requesting geolocation permission</param>
1863 [EditorBrowsable(EditorBrowsableState.Never)]
1864 public void RegisterGeolocationPermissionCallback(GeolocationPermissionCallback callback)
1866 System.IntPtr ip = Marshal.GetFunctionPointerForDelegate(callback);
1867 Interop.WebView.RegisterGeolocationPermissionCallback(SwigCPtr, new HandleRef(this, ip));
1868 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1872 /// Does hit test synchronously.
1873 /// <param name="x">the horizontal position to query</param>
1874 /// <param name="y">the vertical position to query</param>
1875 /// <param name="mode">the mode of hit test</param>
1877 [EditorBrowsable(EditorBrowsableState.Never)]
1878 public WebHitTestResult HitTest(int x, int y, HitTestMode mode)
1880 System.IntPtr result = Interop.WebView.CreateHitTest(SwigCPtr, x, y, (int)mode);
1881 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1882 return new WebHitTestResult(result, true);
1886 /// Does hit test asynchronously.
1887 /// <param name="x">the horizontal position to query</param>
1888 /// <param name="y">the vertical position to query</param>
1889 /// <param name="mode">the mode of hit test</param>
1890 /// <param name="callback">the callback that is called after hit test is finished.</param>
1892 [EditorBrowsable(EditorBrowsableState.Never)]
1893 public bool HitTestAsynchronously(int x, int y, HitTestMode mode, HitTestFinishedCallback callback)
1895 hitTestFinishedCallback = callback;
1896 System.IntPtr ip = Marshal.GetFunctionPointerForDelegate(hitTestFinishedProxyCallback);
1897 bool result = Interop.WebView.CreateHitTestAsynchronously(SwigCPtr, x, y, (int)mode, new HandleRef(this, ip));
1898 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1903 /// Deprecated. Clears the cache of current WebView.
1905 [EditorBrowsable(EditorBrowsableState.Never)]
1906 public void ClearCache()
1908 Context.ClearCache();
1912 /// Deprecated. Clears all the cookies of current WebView.
1914 [EditorBrowsable(EditorBrowsableState.Never)]
1915 public void ClearCookies()
1917 CookieManager.ClearCookies();
1921 /// Sets the tts focus to the webview.
1922 /// Please note that it only works when the webview does not have keyinput focus.
1923 /// If the webview has a keyinput focus, it also has tts focus so calling SetTtsFocus(false) is ignored.
1925 [EditorBrowsable(EditorBrowsableState.Never)]
1926 public void SetTtsFocus(bool focused)
1928 Interop.WebView.SetTtsFocus(SwigCPtr, focused);
1929 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1933 /// Get a plain text of current web page asynchronously.
1934 /// Please note that it gets plain text of currently loaded page so please call this method after page load finished.
1935 /// <param name="callback">The callback for getting plain text</param>
1937 [EditorBrowsable(EditorBrowsableState.Never)]
1938 public void GetPlainTextAsynchronously(PlainTextReceivedCallback callback)
1940 plainTextReceivedCallback = callback;
1941 System.IntPtr ip = Marshal.GetFunctionPointerForDelegate(plainTextReceivedCallback);
1942 Interop.WebView.GetPlainTextAsynchronously(SwigCPtr, new HandleRef(this, ip));
1943 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1946 internal static WebView DownCast(BaseHandle handle)
1948 WebView ret = new WebView(Interop.WebView.DownCast(BaseHandle.getCPtr(handle)), true);
1949 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1953 internal WebView Assign(WebView webView)
1955 WebView ret = new WebView(Interop.WebView.Assign(SwigCPtr, WebView.getCPtr(webView)), false);
1956 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1960 private void OnPageLoadStarted(string pageUrl)
1962 WebViewPageLoadEventArgs e = new WebViewPageLoadEventArgs();
1965 e.PageUrl = pageUrl;
1967 pageLoadStartedEventHandler?.Invoke(this, e);
1970 private void OnPageLoading(string pageUrl)
1972 pageLoadingEventHandler?.Invoke(this, new WebViewPageLoadEventArgs());
1975 private void OnPageLoadFinished(string pageUrl)
1977 WebViewPageLoadEventArgs e = new WebViewPageLoadEventArgs();
1980 e.PageUrl = pageUrl;
1982 pageLoadFinishedEventHandler?.Invoke(this, e);
1985 private void OnPageLoadError(IntPtr error)
1987 pageLoadErrorEventHandler?.Invoke(this, new WebViewPageLoadErrorEventArgs(new WebPageLoadError(error, true)));
1990 private void OnScrollEdgeReached(int edge)
1992 scrollEdgeReachedEventHandler?.Invoke(this, new WebViewScrollEdgeReachedEventArgs((WebViewScrollEdgeReachedEventArgs.Edge)edge));
1995 private void OnUrlChanged(string pageUrl)
1997 urlChangedEventHandler?.Invoke(this, new WebViewUrlChangedEventArgs(pageUrl));
2000 private void OnFormRepostPolicyDecided(IntPtr decision)
2002 formRepostPolicyDecidedEventHandler?.Invoke(this, new WebViewFormRepostPolicyDecidedEventArgs(new WebFormRepostPolicyDecisionMaker(decision, true)));
2005 private void OnFrameRendered()
2007 frameRenderedEventHandler?.Invoke(this, new EventArgs());
2010 private void OnScreenshotAcquired(IntPtr data)
2012 #pragma warning disable CA2000 // Dispose objects before losing scope
2013 screenshotAcquiredCallback?.Invoke(new ImageView(data, true));
2014 #pragma warning restore CA2000 // Dispose objects before losing scope
2017 private void OnResponsePolicyDecided(IntPtr maker)
2019 responsePolicyDecidedEventHandler?.Invoke(this, new WebViewResponsePolicyDecidedEventArgs(new WebPolicyDecisionMaker(maker, true)));
2022 private void OnCertificateConfirmed(IntPtr certificate)
2024 certificateConfirmedEventHandler?.Invoke(this, new WebViewCertificateReceivedEventArgs(new WebCertificate(certificate, true)));
2027 private void OnSslCertificateChanged(IntPtr certificate)
2029 sslCertificateChangedEventHandler?.Invoke(this, new WebViewCertificateReceivedEventArgs(new WebCertificate(certificate, true)));
2032 private void OnHttpAuthRequested(IntPtr handler)
2034 httpAuthRequestedEventHandler?.Invoke(this, new WebViewHttpAuthRequestedEventArgs(new WebHttpAuthHandler(handler, true)));
2037 private void OnConsoleMessageReceived(IntPtr message)
2039 consoleMessageReceivedEventHandler?.Invoke(this, new WebViewConsoleMessageReceivedEventArgs(new WebConsoleMessage(message, true)));
2042 private void OnContextMenuShown(IntPtr menu)
2044 contextMenuShownEventHandler?.Invoke(this, new WebViewContextMenuShownEventArgs(new WebContextMenu(menu, true)));
2047 private void OnContextMenuHidden(IntPtr menu)
2049 contextMenuHiddenEventHandler?.Invoke(this, new WebViewContextMenuHiddenEventArgs(new WebContextMenu(menu, true)));
2052 private void OnHitTestFinished(IntPtr test)
2054 #pragma warning disable CA2000 // Dispose objects before losing scope
2055 hitTestFinishedCallback?.Invoke(new WebHitTestResult(test, true));
2056 #pragma warning restore CA2000 // Dispose objects before losing scope