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.BaseComponents;
23 using Tizen.NUI.Binding;
30 [EditorBrowsable(EditorBrowsableState.Never)]
31 public class WebView : View
33 private Vector4 contentBackgroundColor;
34 private bool tilesClearedWhenHidden;
35 private float tileCoverAreaMultiplier;
36 private bool cursorEnabledByClient;
38 private readonly WebViewPageLoadSignal pageLoadStartedSignal;
39 private EventHandler<WebViewPageLoadEventArgs> pageLoadStartedEventHandler;
40 private WebViewPageLoadCallbackDelegate pageLoadStartedCallback;
42 private readonly WebViewPageLoadSignal pageLoadingSignal;
43 private EventHandler<WebViewPageLoadEventArgs> pageLoadingEventHandler;
44 private WebViewPageLoadCallbackDelegate pageLoadingCallback;
46 private readonly WebViewPageLoadSignal pageLoadFinishedSignal;
47 private EventHandler<WebViewPageLoadEventArgs> pageLoadFinishedEventHandler;
48 private WebViewPageLoadCallbackDelegate pageLoadFinishedCallback;
50 private readonly WebViewPageLoadErrorSignal pageLoadErrorSignal;
51 private EventHandler<WebViewPageLoadErrorEventArgs> pageLoadErrorEventHandler;
52 private WebViewPageLoadErrorCallbackDelegate pageLoadErrorCallback;
54 private readonly WebViewScrollEdgeReachedSignal scrollEdgeReachedSignal;
55 private EventHandler<WebViewScrollEdgeReachedEventArgs> scrollEdgeReachedEventHandler;
56 private WebViewScrollEdgeReachedCallbackDelegate scrollEdgeReachedCallback;
58 private readonly WebViewUrlChangedSignal urlChangedSignal;
59 private EventHandler<WebViewUrlChangedEventArgs> urlChangedEventHandler;
60 private WebViewUrlChangedCallbackDelegate urlChangedCallback;
62 private readonly WebViewFormRepostDecidedSignal formRepostPolicyDecidedSignal;
63 private EventHandler<WebViewFormRepostPolicyDecidedEventArgs> formRepostPolicyDecidedEventHandler;
64 private WebViewFormRepostPolicyDecidedCallbackDelegate formRepostPolicyDecidedCallback;
66 private readonly WebViewFrameRenderedSignal frameRenderedSignal;
67 private EventHandler<EventArgs> frameRenderedEventHandler;
68 private WebViewFrameRenderedCallbackDelegate frameRenderedCallback;
70 private ScreenshotAcquiredCallback screenshotAcquiredCallback;
71 private readonly WebViewScreenshotAcquiredProxyCallback screenshotAcquiredProxyCallback;
74 /// Creates a WebView.
76 [EditorBrowsable(EditorBrowsableState.Never)]
77 public WebView() : this(Interop.WebView.New(), true)
79 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
83 /// Creates a WebView with local language and time zone.
84 /// <param name="locale">The locale language of Web</param>
85 /// <param name="timezoneId">The time zone Id of Web</param>
87 [EditorBrowsable(EditorBrowsableState.Never)]
88 public WebView(string locale, string timezoneId) : this(Interop.WebView.New2(locale, timezoneId), true)
90 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
94 /// Creates a WebView with an args list.
95 /// <param name="args">args array. The first value of array must be program's name.</param>
97 [EditorBrowsable(EditorBrowsableState.Never)]
98 public WebView(string[] args) : this(Interop.WebView.New3(args?.Length ?? 0, args), true)
100 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
104 /// Copy constructor.
105 /// <param name="webView">WebView to copy. The copied WebView will point at the same implementation</param>
107 [EditorBrowsable(EditorBrowsableState.Never)]
108 public WebView(WebView webView) : this(Interop.WebView.NewWebView(WebView.getCPtr(webView)), true)
110 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
113 internal WebView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.WebView.Upcast(cPtr), cMemoryOwn)
115 pageLoadStartedSignal = new WebViewPageLoadSignal(Interop.WebView.NewWebViewPageLoadSignalPageLoadStarted(SwigCPtr));
116 pageLoadingSignal = new WebViewPageLoadSignal(Interop.WebView.NewWebViewPageLoadSignalPageLoadInProgress(SwigCPtr));
117 pageLoadFinishedSignal = new WebViewPageLoadSignal(Interop.WebView.NewWebViewPageLoadSignalPageLoadFinished(SwigCPtr));
118 pageLoadErrorSignal = new WebViewPageLoadErrorSignal(Interop.WebView.NewWebViewPageLoadErrorSignalPageLoadError(SwigCPtr));
119 scrollEdgeReachedSignal = new WebViewScrollEdgeReachedSignal(Interop.WebView.NewWebViewScrollEdgeReachedSignalScrollEdgeReached(SwigCPtr));
120 urlChangedSignal = new WebViewUrlChangedSignal(Interop.WebView.NewWebViewUrlChangedSignalUrlChanged(SwigCPtr));
121 formRepostPolicyDecidedSignal = new WebViewFormRepostDecidedSignal(Interop.WebView.NewWebViewFormRepostDecisionSignalFormRepostDecision(SwigCPtr));
122 frameRenderedSignal = new WebViewFrameRenderedSignal(Interop.WebView.WebViewFrameRenderedSignalFrameRenderedGet(SwigCPtr));
124 screenshotAcquiredProxyCallback = OnScreenshotAcquired;
126 BackForwardList = new WebBackForwardList(Interop.WebView.GetWebBackForwardList(SwigCPtr), false);
127 Context = new WebContext(Interop.WebView.GetWebContext(SwigCPtr), false);
128 CookieManager = new WebCookieManager(Interop.WebView.GetWebCookieManager(SwigCPtr), false);
129 Settings = new WebSettings(Interop.WebView.GetWebSettings(SwigCPtr), false);
133 /// Dispose for IDisposable pattern
135 [EditorBrowsable(EditorBrowsableState.Never)]
136 protected override void Dispose(DisposeTypes type)
143 if (type == DisposeTypes.Explicit)
146 //Release your own managed resources here.
147 //You should release all of your own disposable objects here.
148 pageLoadStartedSignal.Dispose();
149 pageLoadingSignal.Dispose();
150 pageLoadFinishedSignal.Dispose();
151 pageLoadErrorSignal.Dispose();
152 scrollEdgeReachedSignal.Dispose();
153 urlChangedSignal.Dispose();
154 formRepostPolicyDecidedSignal.Dispose();
155 frameRenderedSignal.Dispose();
157 BackForwardList.Dispose();
159 CookieManager.Dispose();
167 /// The callback function that is invoked when the message is received from the script.
169 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
170 [EditorBrowsable(EditorBrowsableState.Never)]
171 public delegate void JavaScriptMessageHandler(string message);
174 /// The callback function that is invoked when the message is received from the script.
176 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
177 [EditorBrowsable(EditorBrowsableState.Never)]
178 public delegate void JavaScriptAlertCallback(string message);
181 /// The callback function that is invoked when the message is received from the script.
183 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
184 [EditorBrowsable(EditorBrowsableState.Never)]
185 public delegate void JavaScriptConfirmCallback(string message);
188 /// The callback function that is invoked when the message is received from the script.
190 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
191 [EditorBrowsable(EditorBrowsableState.Never)]
192 public delegate void JavaScriptPromptCallback(string message1, string message2);
195 /// The callback function that is invoked when screen shot is acquired asynchronously.
197 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
198 [EditorBrowsable(EditorBrowsableState.Never)]
199 public delegate void ScreenshotAcquiredCallback(ImageView image);
202 /// The callback function that is invoked when video playing is checked asynchronously.
204 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
205 [EditorBrowsable(EditorBrowsableState.Never)]
206 public delegate void VideoPlayingCallback(bool isPlaying);
209 /// The callback function that is invoked when geolocation permission is requested.
211 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
212 [EditorBrowsable(EditorBrowsableState.Never)]
213 public delegate void GeolocationPermissionCallback(string host, string protocol);
215 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
216 private delegate void WebViewPageLoadCallbackDelegate(IntPtr data, string pageUrl);
218 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
219 private delegate void WebViewPageLoadErrorCallbackDelegate(IntPtr data, string pageUrl, int errorCode);
221 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
222 private delegate void WebViewScrollEdgeReachedCallbackDelegate(IntPtr data, int edge);
224 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
225 private delegate void WebViewUrlChangedCallbackDelegate(IntPtr data, string pageUrl);
227 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
228 private delegate void WebViewFormRepostPolicyDecidedCallbackDelegate(IntPtr data, IntPtr decision);
230 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
231 private delegate void WebViewFrameRenderedCallbackDelegate(IntPtr data);
233 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
234 private delegate void WebViewScreenshotAcquiredProxyCallback(IntPtr data);
237 /// Event for the PageLoadStarted signal which can be used to subscribe or unsubscribe the event handler.<br />
238 /// This signal is emitted when page loading has started.<br />
240 [EditorBrowsable(EditorBrowsableState.Never)]
241 public event EventHandler<WebViewPageLoadEventArgs> PageLoadStarted
245 if (pageLoadStartedEventHandler == null)
247 pageLoadStartedCallback = (OnPageLoadStarted);
248 pageLoadStartedSignal.Connect(pageLoadStartedCallback);
250 pageLoadStartedEventHandler += value;
254 pageLoadStartedEventHandler -= value;
255 if (pageLoadStartedEventHandler == null && pageLoadStartedCallback != null)
257 pageLoadStartedSignal.Disconnect(pageLoadStartedCallback);
263 /// Event for the PageLoading signal which can be used to subscribe or unsubscribe the event handler.<br />
264 /// This signal is emitted when page loading is in progress.<br />
266 [EditorBrowsable(EditorBrowsableState.Never)]
267 public event EventHandler<WebViewPageLoadEventArgs> PageLoading
271 if (pageLoadingEventHandler == null)
273 pageLoadingCallback = OnPageLoading;
274 pageLoadingSignal.Connect(pageLoadingCallback);
276 pageLoadingEventHandler += value;
280 pageLoadingEventHandler -= value;
281 if (pageLoadingEventHandler == null && pageLoadingCallback != null)
283 pageLoadingSignal.Disconnect(pageLoadingCallback);
289 /// Event for the PageLoadFinished signal which can be used to subscribe or unsubscribe the event handler.<br />
290 /// This signal is emitted when page loading has finished.<br />
292 [EditorBrowsable(EditorBrowsableState.Never)]
293 public event EventHandler<WebViewPageLoadEventArgs> PageLoadFinished
297 if (pageLoadFinishedEventHandler == null)
299 pageLoadFinishedCallback = (OnPageLoadFinished);
300 pageLoadFinishedSignal.Connect(pageLoadFinishedCallback);
302 pageLoadFinishedEventHandler += value;
306 pageLoadFinishedEventHandler -= value;
307 if (pageLoadFinishedEventHandler == null && pageLoadFinishedCallback != null)
309 pageLoadFinishedSignal.Disconnect(pageLoadFinishedCallback);
315 /// Event for the PageLoadError signal which can be used to subscribe or unsubscribe the event handler.<br />
316 /// This signal is emitted when there's an error in page loading.<br />
318 [EditorBrowsable(EditorBrowsableState.Never)]
319 public event EventHandler<WebViewPageLoadErrorEventArgs> PageLoadError
323 if (pageLoadErrorEventHandler == null)
325 pageLoadErrorCallback = (OnPageLoadError);
326 pageLoadErrorSignal.Connect(pageLoadErrorCallback);
328 pageLoadErrorEventHandler += value;
332 pageLoadErrorEventHandler -= value;
333 if (pageLoadErrorEventHandler == null && pageLoadErrorCallback != null)
335 pageLoadErrorSignal.Disconnect(pageLoadErrorCallback);
341 /// Event for the ScrollEdgeReached signal which can be used to subscribe or unsubscribe the event handler.<br />
342 /// This signal is emitted when web view is scrolled to edge.<br />
344 [EditorBrowsable(EditorBrowsableState.Never)]
345 public event EventHandler<WebViewScrollEdgeReachedEventArgs> ScrollEdgeReached
349 if (scrollEdgeReachedEventHandler == null)
351 scrollEdgeReachedCallback = OnScrollEdgeReached;
352 scrollEdgeReachedSignal.Connect(scrollEdgeReachedCallback);
354 scrollEdgeReachedEventHandler += value;
358 scrollEdgeReachedEventHandler -= value;
359 if (scrollEdgeReachedEventHandler == null && scrollEdgeReachedCallback != null)
361 scrollEdgeReachedSignal.Disconnect(scrollEdgeReachedCallback);
367 /// Event for the UrlChanged signal which can be used to subscribe or unsubscribe the event handler.<br />
368 /// This signal is emitted when url is changed.<br />
370 [EditorBrowsable(EditorBrowsableState.Never)]
371 public event EventHandler<WebViewUrlChangedEventArgs> UrlChanged
375 if (urlChangedEventHandler == null)
377 urlChangedCallback = OnUrlChanged;
378 urlChangedSignal.Connect(urlChangedCallback);
380 urlChangedEventHandler += value;
384 urlChangedEventHandler -= value;
385 if (urlChangedEventHandler == null && urlChangedCallback != null)
387 urlChangedSignal.Disconnect(urlChangedCallback);
393 /// Event for the FormRepostDecided signal which can be used to subscribe or unsubscribe the event handler.<br />
394 /// This signal is emitted when form repost policy would be decided.<br />
396 [EditorBrowsable(EditorBrowsableState.Never)]
397 public event EventHandler<WebViewFormRepostPolicyDecidedEventArgs> FormRepostPolicyDecided
401 if (formRepostPolicyDecidedEventHandler == null)
403 formRepostPolicyDecidedCallback = OnFormRepostPolicyDecided;
404 formRepostPolicyDecidedSignal.Connect(formRepostPolicyDecidedCallback);
406 formRepostPolicyDecidedEventHandler += value;
410 formRepostPolicyDecidedEventHandler -= value;
411 if (formRepostPolicyDecidedEventHandler == null && formRepostPolicyDecidedCallback != null)
413 formRepostPolicyDecidedSignal.Disconnect(formRepostPolicyDecidedCallback);
419 /// Event for the FrameRendered signal which can be used to subscribe or unsubscribe the event handler.<br />
420 /// This signal is emitted when frame is rendered off-screen.<br />
422 [EditorBrowsable(EditorBrowsableState.Never)]
423 public event EventHandler<EventArgs> FrameRendered
427 if (frameRenderedEventHandler == null)
429 frameRenderedCallback = OnFrameRendered;
430 frameRenderedSignal.Connect(frameRenderedCallback);
432 frameRenderedEventHandler += value;
436 frameRenderedEventHandler -= value;
437 if (frameRenderedEventHandler == null && frameRenderedCallback != null)
439 frameRenderedSignal.Disconnect(frameRenderedCallback);
445 /// Options for searching texts.
447 [EditorBrowsable(EditorBrowsableState.Never)]
448 public enum FindOption
453 [EditorBrowsable(EditorBrowsableState.Never)]
457 /// Case insensitive search
459 [EditorBrowsable(EditorBrowsableState.Never)]
460 CaseInsensitive = 1 << 0,
463 /// Search text only at the beginning of the words
465 [EditorBrowsable(EditorBrowsableState.Never)]
466 AtWordStart = 1 << 1,
469 /// Treat capital letters in the middle of words as word start
471 [EditorBrowsable(EditorBrowsableState.Never)]
472 TreatMediaCapitalAsWordStart = 1 << 2,
477 [EditorBrowsable(EditorBrowsableState.Never)]
481 /// If not present the search stops at the end of the document
483 [EditorBrowsable(EditorBrowsableState.Never)]
489 [EditorBrowsable(EditorBrowsableState.Never)]
490 ShowOverlay = 1 << 5,
495 [EditorBrowsable(EditorBrowsableState.Never)]
496 ShowFindIndiator = 1 << 6,
501 [EditorBrowsable(EditorBrowsableState.Never)]
502 ShowHighlight = 1 << 7,
508 [EditorBrowsable(EditorBrowsableState.Never)]
509 public WebBackForwardList BackForwardList { get; }
514 [EditorBrowsable(EditorBrowsableState.Never)]
515 public WebContext Context { get; }
520 [EditorBrowsable(EditorBrowsableState.Never)]
521 public WebCookieManager CookieManager { get; }
526 [EditorBrowsable(EditorBrowsableState.Never)]
527 public WebSettings Settings { get; }
532 [EditorBrowsable(EditorBrowsableState.Never)]
537 return (string)GetValue(UrlProperty);
541 SetValue(UrlProperty, value);
542 NotifyPropertyChanged();
547 /// Deprecated. The cache model of the current WebView.
549 [EditorBrowsable(EditorBrowsableState.Never)]
550 public CacheModel CacheModel
554 return (CacheModel)Context.CacheModel;
558 Context.CacheModel = (WebContext.CacheModelType)value;
563 /// Deprecated. The cookie acceptance policy.
565 [EditorBrowsable(EditorBrowsableState.Never)]
566 public CookieAcceptPolicy CookieAcceptPolicy
570 return (CookieAcceptPolicy)CookieManager.CookieAcceptPolicy;
574 CookieManager.CookieAcceptPolicy = (WebCookieManager.CookieAcceptPolicyType)value;
579 /// The user agent string.
581 [EditorBrowsable(EditorBrowsableState.Never)]
582 public string UserAgent
586 return (string)GetValue(UserAgentProperty);
590 SetValue(UserAgentProperty, value);
591 NotifyPropertyChanged();
596 /// Deprecated. Whether JavaScript is enabled.
598 [EditorBrowsable(EditorBrowsableState.Never)]
599 public bool EnableJavaScript
603 return Settings.EnableJavaScript;
607 Settings.EnableJavaScript = value;
612 /// Deprecated. Whether images can be loaded automatically.
614 [EditorBrowsable(EditorBrowsableState.Never)]
615 public bool LoadImagesAutomatically
619 return Settings.AllowImagesLoadAutomatically;
623 Settings.AllowImagesLoadAutomatically = value;
628 /// The default text encoding name.<br />
629 /// e.g. "UTF-8"<br />
631 [EditorBrowsable(EditorBrowsableState.Never)]
632 public string DefaultTextEncodingName
636 return Settings.DefaultTextEncodingName;
640 Settings.DefaultTextEncodingName = value;
645 /// The default font size in pixel.
647 [EditorBrowsable(EditorBrowsableState.Never)]
648 public int DefaultFontSize
652 return Settings.DefaultFontSize;
656 Settings.DefaultFontSize = value;
661 /// The position of scroll.
663 [EditorBrowsable(EditorBrowsableState.Never)]
664 public Position ScrollPosition
668 Vector2 pv = (Vector2)GetValue(ScrollPositionProperty);
669 return new Position(pv.X, pv.Y);
676 Vector2 vpv = new Vector2(pv.X, pv.Y);
677 SetValue(ScrollPositionProperty, vpv);
678 NotifyPropertyChanged();
684 /// The size of scroll, read-only.
686 [EditorBrowsable(EditorBrowsableState.Never)]
687 public Size ScrollSize
691 Vector2 sv = (Vector2)GetValue(ScrollSizeProperty);
692 return new Size(sv.Width, sv.Height);
697 /// The size of content, read-only.
699 [EditorBrowsable(EditorBrowsableState.Never)]
700 public Size ContentSize
704 Vector2 sv = (Vector2)GetValue(ContentSizeProperty);
705 return new Size(sv.Width, sv.Height);
710 /// Whether video hole is enabled or not.
712 [EditorBrowsable(EditorBrowsableState.Never)]
713 public bool VideoHoleEnabled
717 return (bool)GetValue(VideoHoleEnabledProperty);
721 SetValue(VideoHoleEnabledProperty, value);
722 NotifyPropertyChanged();
727 /// Whether mouse events are enabled or not.
729 [EditorBrowsable(EditorBrowsableState.Never)]
730 public bool MouseEventsEnabled
734 return (bool)GetValue(MouseEventsEnabledProperty);
738 SetValue(MouseEventsEnabledProperty, value);
739 NotifyPropertyChanged();
744 /// Whether key events are enabled or not.
746 [EditorBrowsable(EditorBrowsableState.Never)]
747 public bool KeyEventsEnabled
751 return (bool)GetValue(KeyEventsEnabledProperty);
755 SetValue(KeyEventsEnabledProperty, value);
756 NotifyPropertyChanged();
761 /// Background color of web page.
763 [EditorBrowsable(EditorBrowsableState.Never)]
764 public Color ContentBackgroundColor
768 return (Color)GetValue(ContentBackgroundColorProperty);
772 SetValue(ContentBackgroundColorProperty, value);
773 NotifyPropertyChanged();
778 /// Whether tiles are cleared or not when hidden.
780 [EditorBrowsable(EditorBrowsableState.Never)]
781 public bool TilesClearedWhenHidden
785 return (bool)GetValue(TilesClearedWhenHiddenProperty);
789 SetValue(TilesClearedWhenHiddenProperty, value);
790 NotifyPropertyChanged();
795 /// Multiplier of cover area of tile when web page is rendered.
797 [EditorBrowsable(EditorBrowsableState.Never)]
798 public float TileCoverAreaMultiplier
802 return (float)GetValue(TileCoverAreaMultiplierProperty);
806 SetValue(TileCoverAreaMultiplierProperty, value);
807 NotifyPropertyChanged();
812 /// Whether cursor is enabled or not by client.
814 [EditorBrowsable(EditorBrowsableState.Never)]
815 public bool CursorEnabledByClient
819 return (bool)GetValue(CursorEnabledByClientProperty);
823 SetValue(CursorEnabledByClientProperty, value);
824 NotifyPropertyChanged();
829 /// Gets selected text in web page.
831 [EditorBrowsable(EditorBrowsableState.Never)]
832 public string SelectedText
836 return (string)GetValue(SelectedTextProperty);
841 /// Gets title of web page.
843 [EditorBrowsable(EditorBrowsableState.Never)]
848 return (string)GetValue(TitleProperty);
853 /// Gets favicon of web page.
855 [EditorBrowsable(EditorBrowsableState.Never)]
856 public ImageView Favicon
860 global::System.IntPtr imageView = Interop.WebView.GetFavicon(SwigCPtr);
861 if (NDalicPINVOKE.SWIGPendingException.Pending)
863 return new ImageView(imageView, false);
868 /// Zoom factor of web page.
870 [EditorBrowsable(EditorBrowsableState.Never)]
871 public float PageZoomFactor
875 return (float)GetValue(PageZoomFactorProperty);
879 SetValue(PageZoomFactorProperty, value);
880 NotifyPropertyChanged();
885 /// Zoom factor of text in web page.
887 [EditorBrowsable(EditorBrowsableState.Never)]
888 public float TextZoomFactor
892 return (float)GetValue(TextZoomFactorProperty);
896 SetValue(TextZoomFactorProperty, value);
897 NotifyPropertyChanged();
902 /// Gets percentage of loading progress.
904 [EditorBrowsable(EditorBrowsableState.Never)]
905 public float LoadProgressPercentage
909 return (float)GetValue(LoadProgressPercentageProperty);
913 internal static new class Property
915 internal static readonly int Url = Interop.WebView.UrlGet();
916 internal static readonly int UserAgent = Interop.WebView.UserAgentGet();
917 internal static readonly int ScrollPosition = Interop.WebView.ScrollPositionGet();
918 internal static readonly int ScrollSize = Interop.WebView.ScrollSizeGet();
919 internal static readonly int ContentSize = Interop.WebView.ContentSizeGet();
920 internal static readonly int Title = Interop.WebView.TitleGet();
921 internal static readonly int VideoHoleEnabled = Interop.WebView.VideoHoleEnabledGet();
922 internal static readonly int MouseEventsEnabled = Interop.WebView.MouseEventsEnabledGet();
923 internal static readonly int KeyEventsEnabled = Interop.WebView.KeyEventsEnabledGet();
924 internal static readonly int DocumentBackgroundColor = Interop.WebView.DocumentBackgroundColorGet();
925 internal static readonly int TilesClearedWhenHidden = Interop.WebView.TilesClearedWhenHiddenGet();
926 internal static readonly int TileCoverAreaMultiplier = Interop.WebView.TileCoverAreaMultiplierGet();
927 internal static readonly int CursorEnabledByClient = Interop.WebView.CursorEnabledByClientGet();
928 internal static readonly int SelectedText = Interop.WebView.SelectedTextGet();
929 internal static readonly int PageZoomFactor = Interop.WebView.PageZoomFactorGet();
930 internal static readonly int TextZoomFactor = Interop.WebView.TextZoomFactorGet();
931 internal static readonly int LoadProgressPercentage = Interop.WebView.LoadProgressPercentageGet();
934 private static readonly BindableProperty UrlProperty = BindableProperty.Create(nameof(Url), typeof(string), typeof(WebView), string.Empty, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) =>
936 var webview = (WebView)bindable;
937 if (newValue != null)
939 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.Url, new Tizen.NUI.PropertyValue((string)newValue));
942 defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
944 var webview = (WebView)bindable;
946 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.Url).Get(out temp);
950 private static readonly BindableProperty UserAgentProperty = BindableProperty.Create(nameof(UserAgent), typeof(string), typeof(WebView), string.Empty, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) =>
952 var webview = (WebView)bindable;
953 if (newValue != null)
955 Tizen.NUI.Object.SetProperty((HandleRef)webview.SwigCPtr, WebView.Property.UserAgent, new Tizen.NUI.PropertyValue((string)newValue));
958 defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
960 var webview = (WebView)bindable;
962 Tizen.NUI.Object.GetProperty((HandleRef)webview.SwigCPtr, WebView.Property.UserAgent).Get(out temp);
966 private static readonly BindableProperty ScrollPositionProperty = BindableProperty.Create(nameof(ScrollPosition), typeof(Vector2), typeof(WebView), null, propertyChanged: (bindable, oldValue, newValue) =>
968 var webview = (WebView)bindable;
969 if (newValue != null)
971 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.ScrollPosition, new Tizen.NUI.PropertyValue((Vector2)newValue));
974 defaultValueCreator: (bindable) =>
976 var webview = (WebView)bindable;
977 Vector2 temp = new Vector2(0.0f, 0.0f);
978 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.ScrollPosition).Get(temp);
982 private static readonly BindableProperty ScrollSizeProperty = BindableProperty.Create(nameof(ScrollSize), typeof(Vector2), typeof(WebView), null, defaultValueCreator: (bindable) =>
984 var webview = (WebView)bindable;
985 Vector2 temp = new Vector2(0.0f, 0.0f);
986 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.ScrollSize).Get(temp);
990 private static readonly BindableProperty ContentSizeProperty = BindableProperty.Create(nameof(ContentSize), typeof(Vector2), typeof(WebView), null, defaultValueCreator: (bindable) =>
992 var webview = (WebView)bindable;
993 Vector2 temp = new Vector2(0.0f, 0.0f);
994 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.ContentSize).Get(temp);
998 private static readonly BindableProperty TitleProperty = BindableProperty.Create(nameof(Title), typeof(string), typeof(WebView), null, defaultValueCreator: (bindable) =>
1000 var webview = (WebView)bindable;
1002 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.Title).Get(out title);
1006 private static readonly BindableProperty VideoHoleEnabledProperty = BindableProperty.Create(nameof(VideoHoleEnabled), typeof(bool), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
1008 var webview = (WebView)bindable;
1009 if (newValue != null)
1011 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.VideoHoleEnabled, new Tizen.NUI.PropertyValue((bool)newValue));
1014 defaultValueCreator: (bindable) =>
1016 var webview = (WebView)bindable;
1018 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.VideoHoleEnabled).Get(out temp);
1022 private static readonly BindableProperty MouseEventsEnabledProperty = BindableProperty.Create(nameof(MouseEventsEnabled), typeof(bool), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
1024 var webview = (WebView)bindable;
1025 if (newValue != null)
1027 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.MouseEventsEnabled, new Tizen.NUI.PropertyValue((bool)newValue));
1030 defaultValueCreator: (bindable) =>
1032 var webview = (WebView)bindable;
1034 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.MouseEventsEnabled).Get(out temp);
1038 private static readonly BindableProperty KeyEventsEnabledProperty = BindableProperty.Create(nameof(KeyEventsEnabled), typeof(bool), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
1040 var webview = (WebView)bindable;
1041 if (newValue != null)
1043 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.KeyEventsEnabled, new Tizen.NUI.PropertyValue((bool)newValue));
1046 defaultValueCreator: (bindable) =>
1048 var webview = (WebView)bindable;
1050 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.KeyEventsEnabled).Get(out temp);
1054 private static readonly BindableProperty ContentBackgroundColorProperty = BindableProperty.Create(nameof(ContentBackgroundColor), typeof(Vector4), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
1056 var webview = (WebView)bindable;
1057 if (newValue != null)
1059 webview.contentBackgroundColor = (Vector4)newValue;
1060 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.DocumentBackgroundColor, new Tizen.NUI.PropertyValue((Vector4)newValue));
1063 defaultValueCreator: (bindable) =>
1065 var webview = (WebView)bindable;
1066 return webview.contentBackgroundColor;
1069 private static readonly BindableProperty TilesClearedWhenHiddenProperty = BindableProperty.Create(nameof(TilesClearedWhenHidden), typeof(bool), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
1071 var webview = (WebView)bindable;
1072 if (newValue != null)
1074 webview.tilesClearedWhenHidden = (bool)newValue;
1075 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.TilesClearedWhenHidden, new Tizen.NUI.PropertyValue((bool)newValue));
1078 defaultValueCreator: (bindable) =>
1080 var webview = (WebView)bindable;
1081 return webview.tilesClearedWhenHidden;
1084 private static readonly BindableProperty TileCoverAreaMultiplierProperty = BindableProperty.Create(nameof(TileCoverAreaMultiplier), typeof(float), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
1086 var webview = (WebView)bindable;
1087 if (newValue != null)
1089 webview.tileCoverAreaMultiplier = (float)newValue;
1090 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.TileCoverAreaMultiplier, new Tizen.NUI.PropertyValue((float)newValue));
1093 defaultValueCreator: (bindable) =>
1095 var webview = (WebView)bindable;
1096 return webview.tileCoverAreaMultiplier;
1099 private static readonly BindableProperty CursorEnabledByClientProperty = BindableProperty.Create(nameof(CursorEnabledByClient), typeof(bool), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
1101 var webview = (WebView)bindable;
1102 if (newValue != null)
1104 webview.cursorEnabledByClient = (bool)newValue;
1105 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.CursorEnabledByClient, new Tizen.NUI.PropertyValue((bool)newValue));
1108 defaultValueCreator: (bindable) =>
1110 var webview = (WebView)bindable;
1111 return webview.cursorEnabledByClient;
1114 private static readonly BindableProperty SelectedTextProperty = BindableProperty.Create(nameof(SelectedText), typeof(string), typeof(WebView), null, defaultValueCreator: (bindable) =>
1116 var webview = (WebView)bindable;
1118 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.SelectedText).Get(out text);
1122 private static readonly BindableProperty PageZoomFactorProperty = BindableProperty.Create(nameof(PageZoomFactor), typeof(float), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
1124 var webview = (WebView)bindable;
1125 if (newValue != null)
1127 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.PageZoomFactor, new Tizen.NUI.PropertyValue((float)newValue));
1130 defaultValueCreator: (bindable) =>
1132 var webview = (WebView)bindable;
1134 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.PageZoomFactor).Get(out temp);
1138 private static readonly BindableProperty TextZoomFactorProperty = BindableProperty.Create(nameof(TextZoomFactor), typeof(float), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
1140 var webview = (WebView)bindable;
1141 if (newValue != null)
1143 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.TextZoomFactor, new Tizen.NUI.PropertyValue((float)newValue));
1146 defaultValueCreator: (bindable) =>
1148 var webview = (WebView)bindable;
1150 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.TextZoomFactor).Get(out temp);
1154 private static readonly BindableProperty LoadProgressPercentageProperty = BindableProperty.Create(nameof(LoadProgressPercentage), typeof(float), typeof(WebView), null, defaultValueCreator: (bindable) =>
1156 var webview = (WebView)bindable;
1158 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.LoadProgressPercentage).Get(out percentage);
1162 // For rooting handlers
1163 internal Dictionary<string, JavaScriptMessageHandler> handlerRootMap = new Dictionary<string, JavaScriptMessageHandler>();
1167 /// <param name="url">The path of Web</param>
1169 [EditorBrowsable(EditorBrowsableState.Never)]
1170 public void LoadUrl(string url)
1172 Interop.WebView.LoadUrl(SwigCPtr, url);
1173 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1177 /// Deprecated. Loads a html by string.
1178 /// <param name="data">The data of Web</param>
1180 [EditorBrowsable(EditorBrowsableState.Never)]
1181 public void LoadHTMLString(string data)
1183 Interop.WebView.LoadHtmlString(SwigCPtr, data);
1184 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1188 /// Loads a html by string.
1189 /// <param name="data">The data of Web</param>
1191 [EditorBrowsable(EditorBrowsableState.Never)]
1192 public void LoadHtmlString(string data)
1194 Interop.WebView.LoadHtmlString(SwigCPtr, data);
1195 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1199 /// Loads the specified html as the content of the view to override current history entry.
1200 /// <param name="html">The html to be loaded</param>
1201 /// <param name="baseUri">Base URL used for relative paths to external objects</param>
1202 /// <param name="unreachableUri">URL that could not be reached</param>
1204 [EditorBrowsable(EditorBrowsableState.Never)]
1205 public bool LoadHtmlStringOverrideCurrentEntry(string html, string baseUri, string unreachableUri)
1207 bool result = Interop.WebView.LoadHtmlStringOverrideCurrentEntry(SwigCPtr, html, baseUri, unreachableUri);
1208 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1213 /// Requests to load the given contents by MIME type.
1214 /// <param name="contents">The contents to be loaded</param>
1215 /// <param name="contentSize">The size of contents (in bytes)</param>
1216 /// <param name="mimeType">The type of contents, "text/html" is assumed if null</param>
1217 /// <param name="encoding">The encoding for contents, "UTF-8" is assumed if null</param>
1218 /// <param name="baseUri">The base URI to use for relative resources</param>
1220 [EditorBrowsable(EditorBrowsableState.Never)]
1221 public bool LoadContents(string contents, uint contentSize, string mimeType, string encoding, string baseUri)
1223 bool result = Interop.WebView.LoadContents(SwigCPtr, contents, contentSize, mimeType, encoding, baseUri);
1224 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1231 [EditorBrowsable(EditorBrowsableState.Never)]
1232 public void Reload()
1234 Interop.WebView.Reload(SwigCPtr);
1235 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1239 /// Reloads the current page's document without cache
1241 [EditorBrowsable(EditorBrowsableState.Never)]
1242 public bool ReloadWithoutCache()
1244 bool result = Interop.WebView.ReloadWithoutCache(SwigCPtr);
1245 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1250 /// Stops loading the Web
1252 [EditorBrowsable(EditorBrowsableState.Never)]
1253 public void StopLoading()
1255 Interop.WebView.StopLoading(SwigCPtr);
1256 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1260 /// Suspends the operation.
1262 [EditorBrowsable(EditorBrowsableState.Never)]
1263 public void Suspend()
1265 Interop.WebView.Suspend(SwigCPtr);
1266 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1270 /// Resumes the operation after calling Suspend()
1272 [EditorBrowsable(EditorBrowsableState.Never)]
1273 public void Resume()
1275 Interop.WebView.Resume(SwigCPtr);
1276 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1280 /// Suspends all network loading.
1282 [EditorBrowsable(EditorBrowsableState.Never)]
1283 public void SuspendNetworkLoading()
1285 Interop.WebView.SuspendNetworkLoading(SwigCPtr);
1286 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1290 /// Resumes all network loading.
1292 [EditorBrowsable(EditorBrowsableState.Never)]
1293 public void ResumeNetworkLoading()
1295 Interop.WebView.ResumeNetworkLoading(SwigCPtr);
1296 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1300 /// Adds custom header.
1301 /// <param name="name">The name of custom header</param>
1302 /// <param name="value">The value of custom header</param>
1304 [EditorBrowsable(EditorBrowsableState.Never)]
1305 public bool AddCustomHeader(string name, string value)
1307 bool result = Interop.WebView.AddCustomHeader(SwigCPtr, name, value);
1308 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1313 /// Removes custom header.
1314 /// <param name="name">The name of custom header</param>
1316 [EditorBrowsable(EditorBrowsableState.Never)]
1317 public bool RemoveCustomHeader(string name)
1319 bool result = Interop.WebView.RemoveCustomHeader(SwigCPtr, name);
1320 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1325 /// Starts the inspector server.
1326 /// <param name="port">The port number</param>
1328 [EditorBrowsable(EditorBrowsableState.Never)]
1329 public uint StartInspectorServer(uint port)
1331 uint result = Interop.WebView.StartInspectorServer(SwigCPtr, port);
1332 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1337 /// Stops the inspector server.
1339 [EditorBrowsable(EditorBrowsableState.Never)]
1340 public bool StopInspectorServer()
1342 bool result = Interop.WebView.StopInspectorServer(SwigCPtr);
1343 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1348 /// Scrolls page of web view by deltaX and detlaY.
1349 /// <param name="deltaX">The deltaX of scroll</param>
1350 /// <param name="deltaY">The deltaY of scroll</param>
1352 [EditorBrowsable(EditorBrowsableState.Never)]
1353 public void ScrollBy(int deltaX, int deltaY)
1355 Interop.WebView.ScrollBy(SwigCPtr, deltaX, deltaY);
1356 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1360 /// Scrolls edge of web view by deltaX and deltaY.
1361 /// <param name="deltaX">The deltaX of scroll</param>
1362 /// <param name="deltaY">The deltaY of scroll</param>
1364 [EditorBrowsable(EditorBrowsableState.Never)]
1365 public bool ScrollEdgeBy(int deltaX, int deltaY)
1367 bool result = Interop.WebView.ScrollEdgeBy(SwigCPtr, deltaX, deltaY);
1368 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1373 /// Goes to the back
1375 [EditorBrowsable(EditorBrowsableState.Never)]
1376 public void GoBack()
1378 Interop.WebView.GoBack(SwigCPtr);
1379 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1383 /// Goes to the forward
1385 [EditorBrowsable(EditorBrowsableState.Never)]
1386 public void GoForward()
1388 Interop.WebView.GoForward(SwigCPtr);
1389 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1393 /// Returns whether backward is possible.
1394 /// <returns>True if backward is possible, false otherwise</returns>
1396 [EditorBrowsable(EditorBrowsableState.Never)]
1397 public bool CanGoBack()
1399 bool ret = Interop.WebView.CanGoBack(SwigCPtr);
1400 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1405 /// Returns whether forward is possible.
1406 /// <returns>True if forward is possible, false otherwise</returns>
1408 [EditorBrowsable(EditorBrowsableState.Never)]
1409 public bool CanGoForward()
1411 bool ret = Interop.WebView.CanGoForward(SwigCPtr);
1412 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1417 /// Evaluates JavaScript code represented as a string.
1418 /// <param name="script">The JavaScript code</param>
1420 [EditorBrowsable(EditorBrowsableState.Never)]
1421 public void EvaluateJavaScript(string script)
1423 Interop.WebView.EvaluateJavaScript(SwigCPtr, script, new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero));
1424 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1428 /// Add a message handler into the WebView.
1429 /// <param name="objectName">The name of exposed object</param>
1430 /// <param name="handler">The callback function</param>
1432 [EditorBrowsable(EditorBrowsableState.Never)]
1433 public void AddJavaScriptMessageHandler(string objectName, JavaScriptMessageHandler handler)
1435 if (handlerRootMap.ContainsKey(objectName))
1440 handlerRootMap.Add(objectName, handler);
1442 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(handler);
1443 Interop.WebView.AddJavaScriptMessageHandler(SwigCPtr, objectName, new System.Runtime.InteropServices.HandleRef(this, ip));
1445 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1449 /// Add a message handler into the WebView.
1450 /// <param name="callback">The callback function</param>
1452 [EditorBrowsable(EditorBrowsableState.Never)]
1453 public void RegisterJavaScriptAlertCallback(JavaScriptAlertCallback callback)
1455 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(callback);
1456 Interop.WebView.RegisterJavaScriptAlertCallback(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
1458 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1462 /// Reply for alert popup.
1464 [EditorBrowsable(EditorBrowsableState.Never)]
1465 public void JavaScriptAlertReply()
1467 Interop.WebView.JavaScriptAlertReply(SwigCPtr);
1468 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1472 /// Add a message handler into the WebView.
1473 /// <param name="callback">The callback function</param>
1475 [EditorBrowsable(EditorBrowsableState.Never)]
1476 public void RegisterJavaScriptConfirmCallback(JavaScriptConfirmCallback callback)
1478 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(callback);
1479 Interop.WebView.RegisterJavaScriptConfirmCallback(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
1481 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1485 /// Reply for confirm popup.
1486 /// <param name="confirmed">confirmed or not</param>
1488 [EditorBrowsable(EditorBrowsableState.Never)]
1489 public void JavaScriptConfirmReply(bool confirmed)
1491 Interop.WebView.JavaScriptConfirmReply(SwigCPtr, confirmed);
1492 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1496 /// Add a message handler into the WebView.
1497 /// <param name="callback">The callback function</param>
1499 [EditorBrowsable(EditorBrowsableState.Never)]
1500 public void RegisterJavaScriptPromptCallback(JavaScriptPromptCallback callback)
1502 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(callback);
1503 Interop.WebView.RegisterJavaScriptPromptCallback(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
1505 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1509 /// Reply for prompt popup.
1510 /// <param name="result">text in prompt input field.</param>
1512 [EditorBrowsable(EditorBrowsableState.Never)]
1513 public void JavaScriptPromptReply(string result)
1515 Interop.WebView.JavaScriptPromptReply(SwigCPtr, result);
1516 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1520 /// Clears title resources of current WebView.
1522 [EditorBrowsable(EditorBrowsableState.Never)]
1523 public void ClearAllTilesResources()
1525 Interop.WebView.ClearAllTilesResources(SwigCPtr);
1526 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1530 /// Clears the history of current WebView.
1532 [EditorBrowsable(EditorBrowsableState.Never)]
1533 public void ClearHistory()
1535 Interop.WebView.ClearHistory(SwigCPtr);
1536 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1540 /// Scales the current page, centered at the given point.
1541 /// <param name="scaleFactor">The new factor to be scaled</param>
1542 /// <param name="point">The center coordinate</param>
1544 [EditorBrowsable(EditorBrowsableState.Never)]
1545 public void SetScaleFactor(float scaleFactor, Vector2 point)
1547 Interop.WebView.SetScaleFactor(SwigCPtr, scaleFactor, Vector2.getCPtr(point));
1548 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1552 /// Gets the current scale factor of the page.
1554 [EditorBrowsable(EditorBrowsableState.Never)]
1555 public float GetScaleFactor()
1557 float result = Interop.WebView.GetScaleFactor(SwigCPtr);
1558 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1563 /// Requests to activate/deactivate the accessibility usage set by web app.
1564 /// <param name="activated">The new factor to be scaled</param>
1566 [EditorBrowsable(EditorBrowsableState.Never)]
1567 public void ActivateAccessibility(bool activated)
1569 Interop.WebView.ActivateAccessibility(SwigCPtr, activated);
1570 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1574 /// Searches and highlights the given string in the document.
1575 /// <param name="text">The text to be searched</param>
1576 /// <param name="options">The options to search</param>
1577 /// <param name="maxMatchCount">The maximum match count to search</param>
1579 [EditorBrowsable(EditorBrowsableState.Never)]
1580 public bool HighlightText(string text, FindOption options, uint maxMatchCount)
1582 bool result = Interop.WebView.HighlightText(SwigCPtr, text, (int)options, maxMatchCount);
1583 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1588 /// Adds dynamic certificate path.
1589 /// <param name="host">Host that required client authentication</param>
1590 /// <param name="certPath">The file path stored certificate</param>
1592 [EditorBrowsable(EditorBrowsableState.Never)]
1593 public void AddDynamicCertificatePath(string host, string certPath)
1595 Interop.WebView.AddDynamicCertificatePath(SwigCPtr, host, certPath);
1596 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1600 /// Get snapshot of the specified viewArea of page.
1601 /// <param name="viewArea">Host that required client authentication</param>
1602 /// <param name="scaleFactor">The file path stored certificate</param>
1604 [EditorBrowsable(EditorBrowsableState.Never)]
1605 public ImageView GetScreenshot(Rectangle viewArea, float scaleFactor)
1607 IntPtr image = Interop.WebView.GetScreenshot(SwigCPtr, Rectangle.getCPtr(viewArea), scaleFactor);
1608 ImageView imageView = new ImageView(image, true);
1609 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1614 /// Get snapshot of the specified viewArea of page.
1615 /// <param name="viewArea">Host that required client authentication</param>
1616 /// <param name="scaleFactor">The file path stored certificate</param>
1617 /// <param name="callback">The callback for getting screen shot</param>
1619 [EditorBrowsable(EditorBrowsableState.Never)]
1620 public bool GetScreenshotAsynchronously(Rectangle viewArea, float scaleFactor, ScreenshotAcquiredCallback callback)
1622 screenshotAcquiredCallback = callback;
1623 System.IntPtr ip = Marshal.GetFunctionPointerForDelegate(screenshotAcquiredProxyCallback);
1624 bool result = Interop.WebView.GetScreenshotAsynchronously(SwigCPtr, Rectangle.getCPtr(viewArea), scaleFactor, new HandleRef(this, ip));
1625 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1630 /// Asynchronous requests to check if there is a video playing in the given view.
1631 /// <param name="callback">The callback called after checking if video is playing or not</param>
1633 [EditorBrowsable(EditorBrowsableState.Never)]
1634 public bool CheckVideoPlayingAsynchronously(VideoPlayingCallback callback)
1636 System.IntPtr ip = Marshal.GetFunctionPointerForDelegate(callback);
1637 bool result = Interop.WebView.CheckVideoPlayingAsynchronously(SwigCPtr, new HandleRef(this, ip));
1638 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1643 /// Registers callback which will be called upon geolocation permission request.
1644 /// <param name="callback">The callback for requesting geolocation permission</param>
1646 [EditorBrowsable(EditorBrowsableState.Never)]
1647 public void RegisterGeolocationPermissionCallback(GeolocationPermissionCallback callback)
1649 System.IntPtr ip = Marshal.GetFunctionPointerForDelegate(callback);
1650 Interop.WebView.RegisterGeolocationPermissionCallback(SwigCPtr, new HandleRef(this, ip));
1651 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1655 /// Deprecated. Clears the cache of current WebView.
1657 [EditorBrowsable(EditorBrowsableState.Never)]
1658 public void ClearCache()
1660 Context.ClearCache();
1664 /// Deprecated. Clears all the cookies of current WebView.
1666 [EditorBrowsable(EditorBrowsableState.Never)]
1667 public void ClearCookies()
1669 CookieManager.ClearCookies();
1672 internal static WebView DownCast(BaseHandle handle)
1674 WebView ret = new WebView(Interop.WebView.DownCast(BaseHandle.getCPtr(handle)), true);
1675 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1679 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WebView obj)
1681 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
1684 internal WebView Assign(WebView webView)
1686 WebView ret = new WebView(Interop.WebView.Assign(SwigCPtr, WebView.getCPtr(webView)), false);
1687 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1691 /// This will not be public opened.
1692 /// <param name="swigCPtr"></param>
1693 [EditorBrowsable(EditorBrowsableState.Never)]
1694 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1696 Interop.WebView.DeleteWebView(swigCPtr);
1699 private void OnPageLoadStarted(IntPtr data, string pageUrl)
1701 WebViewPageLoadEventArgs e = new WebViewPageLoadEventArgs();
1703 e.WebView = Registry.GetManagedBaseHandleFromNativePtr(data) as WebView;
1704 e.PageUrl = pageUrl;
1706 pageLoadStartedEventHandler?.Invoke(this, e);
1709 private void OnPageLoading(IntPtr data, string pageUrl)
1711 pageLoadingEventHandler?.Invoke(this, new WebViewPageLoadEventArgs());
1714 private void OnPageLoadFinished(IntPtr data, string pageUrl)
1716 WebViewPageLoadEventArgs e = new WebViewPageLoadEventArgs();
1718 e.WebView = Registry.GetManagedBaseHandleFromNativePtr(data) as WebView;
1719 e.PageUrl = pageUrl;
1721 pageLoadFinishedEventHandler?.Invoke(this, e);
1724 private void OnPageLoadError(IntPtr data, string pageUrl, int errorCode)
1726 WebViewPageLoadErrorEventArgs e = new WebViewPageLoadErrorEventArgs();
1728 e.WebView = Registry.GetManagedBaseHandleFromNativePtr(data) as WebView;
1729 e.PageUrl = pageUrl;
1730 e.ErrorCode = (WebViewPageLoadErrorEventArgs.LoadErrorCode)errorCode;
1732 pageLoadErrorEventHandler?.Invoke(this, e);
1735 private void OnScrollEdgeReached(IntPtr data, int edge)
1737 WebViewScrollEdgeReachedEventArgs arg = new WebViewScrollEdgeReachedEventArgs((WebViewScrollEdgeReachedEventArgs.Edge)edge);
1738 scrollEdgeReachedEventHandler?.Invoke(this, arg);
1741 private void OnUrlChanged(IntPtr data, string pageUrl)
1743 urlChangedEventHandler?.Invoke(this, new WebViewUrlChangedEventArgs(pageUrl));
1746 private void OnFormRepostPolicyDecided(IntPtr data, IntPtr decision)
1748 WebFormRepostPolicyDecisionMaker repostDecision = new WebFormRepostPolicyDecisionMaker(decision, false);
1749 formRepostPolicyDecidedEventHandler?.Invoke(this, new WebViewFormRepostPolicyDecidedEventArgs(repostDecision));
1750 repostDecision.Dispose();
1753 private void OnFrameRendered(IntPtr data)
1755 frameRenderedEventHandler?.Invoke(this, new EventArgs());
1758 private void OnScreenshotAcquired(IntPtr data)
1760 ImageView image = new ImageView(data, true);
1761 screenshotAcquiredCallback?.Invoke(image);