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 WebViewFormRepostPolicyDecidedSignal 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;
73 private readonly WebViewNewWindowPolicyDecidedSignal newWindowPolicyDecidedSignal;
74 private EventHandler<WebViewNewWindowPolicyDecidedEventArgs> newWindowPolicyDecidedEventHandler;
75 private WebViewNewWindowPolicyDecidedCallbackDelegate newWindowPolicyDecidedCallback;
78 /// Creates a WebView.
80 [EditorBrowsable(EditorBrowsableState.Never)]
81 public WebView() : this(Interop.WebView.New(), true)
83 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
87 /// Creates a WebView with local language and time zone.
88 /// <param name="locale">The locale language of Web</param>
89 /// <param name="timezoneId">The time zone Id of Web</param>
91 [EditorBrowsable(EditorBrowsableState.Never)]
92 public WebView(string locale, string timezoneId) : this(Interop.WebView.New2(locale, timezoneId), true)
94 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
98 /// Creates a WebView with an args list.
99 /// <param name="args">args array. The first value of array must be program's name.</param>
101 [EditorBrowsable(EditorBrowsableState.Never)]
102 public WebView(string[] args) : this(Interop.WebView.New3(args?.Length ?? 0, args), true)
104 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
108 /// Copy constructor.
109 /// <param name="webView">WebView to copy. The copied WebView will point at the same implementation</param>
111 [EditorBrowsable(EditorBrowsableState.Never)]
112 public WebView(WebView webView) : this(Interop.WebView.NewWebView(WebView.getCPtr(webView)), true)
114 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
117 internal WebView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.WebView.Upcast(cPtr), cMemoryOwn)
119 pageLoadStartedSignal = new WebViewPageLoadSignal(Interop.WebView.NewWebViewPageLoadSignalPageLoadStarted(SwigCPtr));
120 pageLoadingSignal = new WebViewPageLoadSignal(Interop.WebView.NewWebViewPageLoadSignalPageLoadInProgress(SwigCPtr));
121 pageLoadFinishedSignal = new WebViewPageLoadSignal(Interop.WebView.NewWebViewPageLoadSignalPageLoadFinished(SwigCPtr));
122 pageLoadErrorSignal = new WebViewPageLoadErrorSignal(Interop.WebView.NewWebViewPageLoadErrorSignalPageLoadError(SwigCPtr));
123 scrollEdgeReachedSignal = new WebViewScrollEdgeReachedSignal(Interop.WebView.NewWebViewScrollEdgeReachedSignalScrollEdgeReached(SwigCPtr));
124 urlChangedSignal = new WebViewUrlChangedSignal(Interop.WebView.NewWebViewUrlChangedSignalUrlChanged(SwigCPtr));
125 formRepostPolicyDecidedSignal = new WebViewFormRepostPolicyDecidedSignal(Interop.WebView.NewWebViewFormRepostDecisionSignalFormRepostDecision(SwigCPtr));
126 frameRenderedSignal = new WebViewFrameRenderedSignal(Interop.WebView.WebViewFrameRenderedSignalFrameRenderedGet(SwigCPtr));
127 newWindowPolicyDecidedSignal = new WebViewNewWindowPolicyDecidedSignal(Interop.WebView.NewWebViewPolicyDecisionSignalPolicyDecision(SwigCPtr));
129 screenshotAcquiredProxyCallback = OnScreenshotAcquired;
131 BackForwardList = new WebBackForwardList(Interop.WebView.GetWebBackForwardList(SwigCPtr), false);
132 Context = new WebContext(Interop.WebView.GetWebContext(SwigCPtr), false);
133 CookieManager = new WebCookieManager(Interop.WebView.GetWebCookieManager(SwigCPtr), false);
134 Settings = new WebSettings(Interop.WebView.GetWebSettings(SwigCPtr), false);
138 /// Dispose for IDisposable pattern
140 [EditorBrowsable(EditorBrowsableState.Never)]
141 protected override void Dispose(DisposeTypes type)
148 if (type == DisposeTypes.Explicit)
151 //Release your own managed resources here.
152 //You should release all of your own disposable objects here.
153 pageLoadStartedSignal.Dispose();
154 pageLoadingSignal.Dispose();
155 pageLoadFinishedSignal.Dispose();
156 pageLoadErrorSignal.Dispose();
157 scrollEdgeReachedSignal.Dispose();
158 urlChangedSignal.Dispose();
159 formRepostPolicyDecidedSignal.Dispose();
160 frameRenderedSignal.Dispose();
161 newWindowPolicyDecidedSignal.Dispose();
163 BackForwardList.Dispose();
165 CookieManager.Dispose();
173 /// The callback function that is invoked when the message is received from the script.
175 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
176 [EditorBrowsable(EditorBrowsableState.Never)]
177 public delegate void JavaScriptMessageHandler(string message);
180 /// The callback function that is invoked when the message is received from the script.
182 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
183 [EditorBrowsable(EditorBrowsableState.Never)]
184 public delegate void JavaScriptAlertCallback(string message);
187 /// The callback function that is invoked when the message is received from the script.
189 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
190 [EditorBrowsable(EditorBrowsableState.Never)]
191 public delegate void JavaScriptConfirmCallback(string message);
194 /// The callback function that is invoked when the message is received from the script.
196 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
197 [EditorBrowsable(EditorBrowsableState.Never)]
198 public delegate void JavaScriptPromptCallback(string message1, string message2);
201 /// The callback function that is invoked when screen shot is acquired asynchronously.
203 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
204 [EditorBrowsable(EditorBrowsableState.Never)]
205 public delegate void ScreenshotAcquiredCallback(ImageView image);
208 /// The callback function that is invoked when video playing is checked asynchronously.
210 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
211 [EditorBrowsable(EditorBrowsableState.Never)]
212 public delegate void VideoPlayingCallback(bool isPlaying);
215 /// The callback function that is invoked when geolocation permission is requested.
217 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
218 [EditorBrowsable(EditorBrowsableState.Never)]
219 public delegate void GeolocationPermissionCallback(string host, string protocol);
221 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
222 private delegate void WebViewPageLoadCallbackDelegate(IntPtr data, string pageUrl);
224 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
225 private delegate void WebViewPageLoadErrorCallbackDelegate(IntPtr data, string pageUrl, int errorCode);
227 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
228 private delegate void WebViewScrollEdgeReachedCallbackDelegate(IntPtr data, int edge);
230 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
231 private delegate void WebViewUrlChangedCallbackDelegate(IntPtr data, string pageUrl);
233 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
234 private delegate void WebViewFormRepostPolicyDecidedCallbackDelegate(IntPtr data, IntPtr maker);
236 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
237 private delegate void WebViewFrameRenderedCallbackDelegate(IntPtr data);
239 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
240 private delegate void WebViewScreenshotAcquiredProxyCallback(IntPtr data);
242 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
243 private delegate void WebViewNewWindowPolicyDecidedCallbackDelegate(IntPtr data, IntPtr maker);
246 /// Event for the PageLoadStarted signal which can be used to subscribe or unsubscribe the event handler.<br />
247 /// This signal is emitted when page loading has started.<br />
249 [EditorBrowsable(EditorBrowsableState.Never)]
250 public event EventHandler<WebViewPageLoadEventArgs> PageLoadStarted
254 if (pageLoadStartedEventHandler == null)
256 pageLoadStartedCallback = (OnPageLoadStarted);
257 pageLoadStartedSignal.Connect(pageLoadStartedCallback);
259 pageLoadStartedEventHandler += value;
263 pageLoadStartedEventHandler -= value;
264 if (pageLoadStartedEventHandler == null && pageLoadStartedCallback != null)
266 pageLoadStartedSignal.Disconnect(pageLoadStartedCallback);
272 /// Event for the PageLoading signal which can be used to subscribe or unsubscribe the event handler.<br />
273 /// This signal is emitted when page loading is in progress.<br />
275 [EditorBrowsable(EditorBrowsableState.Never)]
276 public event EventHandler<WebViewPageLoadEventArgs> PageLoading
280 if (pageLoadingEventHandler == null)
282 pageLoadingCallback = OnPageLoading;
283 pageLoadingSignal.Connect(pageLoadingCallback);
285 pageLoadingEventHandler += value;
289 pageLoadingEventHandler -= value;
290 if (pageLoadingEventHandler == null && pageLoadingCallback != null)
292 pageLoadingSignal.Disconnect(pageLoadingCallback);
298 /// Event for the PageLoadFinished signal which can be used to subscribe or unsubscribe the event handler.<br />
299 /// This signal is emitted when page loading has finished.<br />
301 [EditorBrowsable(EditorBrowsableState.Never)]
302 public event EventHandler<WebViewPageLoadEventArgs> PageLoadFinished
306 if (pageLoadFinishedEventHandler == null)
308 pageLoadFinishedCallback = (OnPageLoadFinished);
309 pageLoadFinishedSignal.Connect(pageLoadFinishedCallback);
311 pageLoadFinishedEventHandler += value;
315 pageLoadFinishedEventHandler -= value;
316 if (pageLoadFinishedEventHandler == null && pageLoadFinishedCallback != null)
318 pageLoadFinishedSignal.Disconnect(pageLoadFinishedCallback);
324 /// Event for the PageLoadError signal which can be used to subscribe or unsubscribe the event handler.<br />
325 /// This signal is emitted when there's an error in page loading.<br />
327 [EditorBrowsable(EditorBrowsableState.Never)]
328 public event EventHandler<WebViewPageLoadErrorEventArgs> PageLoadError
332 if (pageLoadErrorEventHandler == null)
334 pageLoadErrorCallback = (OnPageLoadError);
335 pageLoadErrorSignal.Connect(pageLoadErrorCallback);
337 pageLoadErrorEventHandler += value;
341 pageLoadErrorEventHandler -= value;
342 if (pageLoadErrorEventHandler == null && pageLoadErrorCallback != null)
344 pageLoadErrorSignal.Disconnect(pageLoadErrorCallback);
350 /// Event for the ScrollEdgeReached signal which can be used to subscribe or unsubscribe the event handler.<br />
351 /// This signal is emitted when web view is scrolled to edge.<br />
353 [EditorBrowsable(EditorBrowsableState.Never)]
354 public event EventHandler<WebViewScrollEdgeReachedEventArgs> ScrollEdgeReached
358 if (scrollEdgeReachedEventHandler == null)
360 scrollEdgeReachedCallback = OnScrollEdgeReached;
361 scrollEdgeReachedSignal.Connect(scrollEdgeReachedCallback);
363 scrollEdgeReachedEventHandler += value;
367 scrollEdgeReachedEventHandler -= value;
368 if (scrollEdgeReachedEventHandler == null && scrollEdgeReachedCallback != null)
370 scrollEdgeReachedSignal.Disconnect(scrollEdgeReachedCallback);
376 /// Event for the UrlChanged signal which can be used to subscribe or unsubscribe the event handler.<br />
377 /// This signal is emitted when url is changed.<br />
379 [EditorBrowsable(EditorBrowsableState.Never)]
380 public event EventHandler<WebViewUrlChangedEventArgs> UrlChanged
384 if (urlChangedEventHandler == null)
386 urlChangedCallback = OnUrlChanged;
387 urlChangedSignal.Connect(urlChangedCallback);
389 urlChangedEventHandler += value;
393 urlChangedEventHandler -= value;
394 if (urlChangedEventHandler == null && urlChangedCallback != null)
396 urlChangedSignal.Disconnect(urlChangedCallback);
402 /// Event for the FormRepostDecided signal which can be used to subscribe or unsubscribe the event handler.<br />
403 /// This signal is emitted when form repost policy would be decided.<br />
405 [EditorBrowsable(EditorBrowsableState.Never)]
406 public event EventHandler<WebViewFormRepostPolicyDecidedEventArgs> FormRepostPolicyDecided
410 if (formRepostPolicyDecidedEventHandler == null)
412 formRepostPolicyDecidedCallback = OnFormRepostPolicyDecided;
413 formRepostPolicyDecidedSignal.Connect(formRepostPolicyDecidedCallback);
415 formRepostPolicyDecidedEventHandler += value;
419 formRepostPolicyDecidedEventHandler -= value;
420 if (formRepostPolicyDecidedEventHandler == null && formRepostPolicyDecidedCallback != null)
422 formRepostPolicyDecidedSignal.Disconnect(formRepostPolicyDecidedCallback);
428 /// Event for the FrameRendered signal which can be used to subscribe or unsubscribe the event handler.<br />
429 /// This signal is emitted when frame is rendered off-screen.<br />
431 [EditorBrowsable(EditorBrowsableState.Never)]
432 public event EventHandler<EventArgs> FrameRendered
436 if (frameRenderedEventHandler == null)
438 frameRenderedCallback = OnFrameRendered;
439 frameRenderedSignal.Connect(frameRenderedCallback);
441 frameRenderedEventHandler += value;
445 frameRenderedEventHandler -= value;
446 if (frameRenderedEventHandler == null && frameRenderedCallback != null)
448 frameRenderedSignal.Disconnect(frameRenderedCallback);
454 /// Event for the NewWindowPolicyDecided signal which can be used to subscribe or unsubscribe the event handler.<br />
455 /// This signal is emitted when new window policy would be decided.<br />
457 [EditorBrowsable(EditorBrowsableState.Never)]
458 public event EventHandler<WebViewNewWindowPolicyDecidedEventArgs> NewWindowPolicyDecided
462 if (newWindowPolicyDecidedEventHandler == null)
464 newWindowPolicyDecidedCallback = OnNewWindowPolicyDecided;
465 newWindowPolicyDecidedSignal.Connect(newWindowPolicyDecidedCallback);
467 newWindowPolicyDecidedEventHandler += value;
471 newWindowPolicyDecidedEventHandler -= value;
472 if (newWindowPolicyDecidedEventHandler == null && newWindowPolicyDecidedCallback != null)
474 newWindowPolicyDecidedSignal.Disconnect(newWindowPolicyDecidedCallback);
480 /// Options for searching texts.
482 [EditorBrowsable(EditorBrowsableState.Never)]
483 public enum FindOption
488 [EditorBrowsable(EditorBrowsableState.Never)]
492 /// Case insensitive search
494 [EditorBrowsable(EditorBrowsableState.Never)]
495 CaseInsensitive = 1 << 0,
498 /// Search text only at the beginning of the words
500 [EditorBrowsable(EditorBrowsableState.Never)]
501 AtWordStart = 1 << 1,
504 /// Treat capital letters in the middle of words as word start
506 [EditorBrowsable(EditorBrowsableState.Never)]
507 TreatMediaCapitalAsWordStart = 1 << 2,
512 [EditorBrowsable(EditorBrowsableState.Never)]
516 /// If not present the search stops at the end of the document
518 [EditorBrowsable(EditorBrowsableState.Never)]
524 [EditorBrowsable(EditorBrowsableState.Never)]
525 ShowOverlay = 1 << 5,
530 [EditorBrowsable(EditorBrowsableState.Never)]
531 ShowFindIndiator = 1 << 6,
536 [EditorBrowsable(EditorBrowsableState.Never)]
537 ShowHighlight = 1 << 7,
543 [EditorBrowsable(EditorBrowsableState.Never)]
544 public WebBackForwardList BackForwardList { get; }
549 [EditorBrowsable(EditorBrowsableState.Never)]
550 public WebContext Context { get; }
555 [EditorBrowsable(EditorBrowsableState.Never)]
556 public WebCookieManager CookieManager { get; }
561 [EditorBrowsable(EditorBrowsableState.Never)]
562 public WebSettings Settings { get; }
567 [EditorBrowsable(EditorBrowsableState.Never)]
572 return (string)GetValue(UrlProperty);
576 SetValue(UrlProperty, value);
577 NotifyPropertyChanged();
582 /// Deprecated. The cache model of the current WebView.
584 [EditorBrowsable(EditorBrowsableState.Never)]
585 public CacheModel CacheModel
589 return (CacheModel)Context.CacheModel;
593 Context.CacheModel = (WebContext.CacheModelType)value;
598 /// Deprecated. The cookie acceptance policy.
600 [EditorBrowsable(EditorBrowsableState.Never)]
601 public CookieAcceptPolicy CookieAcceptPolicy
605 return (CookieAcceptPolicy)CookieManager.CookieAcceptPolicy;
609 CookieManager.CookieAcceptPolicy = (WebCookieManager.CookieAcceptPolicyType)value;
614 /// The user agent string.
616 [EditorBrowsable(EditorBrowsableState.Never)]
617 public string UserAgent
621 return (string)GetValue(UserAgentProperty);
625 SetValue(UserAgentProperty, value);
626 NotifyPropertyChanged();
631 /// Deprecated. Whether JavaScript is enabled.
633 [EditorBrowsable(EditorBrowsableState.Never)]
634 public bool EnableJavaScript
638 return Settings.EnableJavaScript;
642 Settings.EnableJavaScript = value;
647 /// Deprecated. Whether images can be loaded automatically.
649 [EditorBrowsable(EditorBrowsableState.Never)]
650 public bool LoadImagesAutomatically
654 return Settings.AllowImagesLoadAutomatically;
658 Settings.AllowImagesLoadAutomatically = value;
663 /// The default text encoding name.<br />
664 /// e.g. "UTF-8"<br />
666 [EditorBrowsable(EditorBrowsableState.Never)]
667 public string DefaultTextEncodingName
671 return Settings.DefaultTextEncodingName;
675 Settings.DefaultTextEncodingName = value;
680 /// The default font size in pixel.
682 [EditorBrowsable(EditorBrowsableState.Never)]
683 public int DefaultFontSize
687 return Settings.DefaultFontSize;
691 Settings.DefaultFontSize = value;
696 /// The position of scroll.
698 [EditorBrowsable(EditorBrowsableState.Never)]
699 public Position ScrollPosition
703 Vector2 pv = (Vector2)GetValue(ScrollPositionProperty);
704 return new Position(pv.X, pv.Y);
711 Vector2 vpv = new Vector2(pv.X, pv.Y);
712 SetValue(ScrollPositionProperty, vpv);
713 NotifyPropertyChanged();
719 /// The size of scroll, read-only.
721 [EditorBrowsable(EditorBrowsableState.Never)]
722 public Size ScrollSize
726 Vector2 sv = (Vector2)GetValue(ScrollSizeProperty);
727 return new Size(sv.Width, sv.Height);
732 /// The size of content, read-only.
734 [EditorBrowsable(EditorBrowsableState.Never)]
735 public Size ContentSize
739 Vector2 sv = (Vector2)GetValue(ContentSizeProperty);
740 return new Size(sv.Width, sv.Height);
745 /// Whether video hole is enabled or not.
747 [EditorBrowsable(EditorBrowsableState.Never)]
748 public bool VideoHoleEnabled
752 return (bool)GetValue(VideoHoleEnabledProperty);
756 SetValue(VideoHoleEnabledProperty, value);
757 NotifyPropertyChanged();
762 /// Whether mouse events are enabled or not.
764 [EditorBrowsable(EditorBrowsableState.Never)]
765 public bool MouseEventsEnabled
769 return (bool)GetValue(MouseEventsEnabledProperty);
773 SetValue(MouseEventsEnabledProperty, value);
774 NotifyPropertyChanged();
779 /// Whether key events are enabled or not.
781 [EditorBrowsable(EditorBrowsableState.Never)]
782 public bool KeyEventsEnabled
786 return (bool)GetValue(KeyEventsEnabledProperty);
790 SetValue(KeyEventsEnabledProperty, value);
791 NotifyPropertyChanged();
796 /// Background color of web page.
798 [EditorBrowsable(EditorBrowsableState.Never)]
799 public Color ContentBackgroundColor
803 return (Color)GetValue(ContentBackgroundColorProperty);
807 SetValue(ContentBackgroundColorProperty, value);
808 NotifyPropertyChanged();
813 /// Whether tiles are cleared or not when hidden.
815 [EditorBrowsable(EditorBrowsableState.Never)]
816 public bool TilesClearedWhenHidden
820 return (bool)GetValue(TilesClearedWhenHiddenProperty);
824 SetValue(TilesClearedWhenHiddenProperty, value);
825 NotifyPropertyChanged();
830 /// Multiplier of cover area of tile when web page is rendered.
832 [EditorBrowsable(EditorBrowsableState.Never)]
833 public float TileCoverAreaMultiplier
837 return (float)GetValue(TileCoverAreaMultiplierProperty);
841 SetValue(TileCoverAreaMultiplierProperty, value);
842 NotifyPropertyChanged();
847 /// Whether cursor is enabled or not by client.
849 [EditorBrowsable(EditorBrowsableState.Never)]
850 public bool CursorEnabledByClient
854 return (bool)GetValue(CursorEnabledByClientProperty);
858 SetValue(CursorEnabledByClientProperty, value);
859 NotifyPropertyChanged();
864 /// Gets selected text in web page.
866 [EditorBrowsable(EditorBrowsableState.Never)]
867 public string SelectedText
871 return (string)GetValue(SelectedTextProperty);
876 /// Gets title of web page.
878 [EditorBrowsable(EditorBrowsableState.Never)]
883 return (string)GetValue(TitleProperty);
888 /// Gets favicon of web page.
890 [EditorBrowsable(EditorBrowsableState.Never)]
891 public ImageView Favicon
895 global::System.IntPtr imageView = Interop.WebView.GetFavicon(SwigCPtr);
896 if (NDalicPINVOKE.SWIGPendingException.Pending)
898 return new ImageView(imageView, false);
903 /// Zoom factor of web page.
905 [EditorBrowsable(EditorBrowsableState.Never)]
906 public float PageZoomFactor
910 return (float)GetValue(PageZoomFactorProperty);
914 SetValue(PageZoomFactorProperty, value);
915 NotifyPropertyChanged();
920 /// Zoom factor of text in web page.
922 [EditorBrowsable(EditorBrowsableState.Never)]
923 public float TextZoomFactor
927 return (float)GetValue(TextZoomFactorProperty);
931 SetValue(TextZoomFactorProperty, value);
932 NotifyPropertyChanged();
937 /// Gets percentage of loading progress.
939 [EditorBrowsable(EditorBrowsableState.Never)]
940 public float LoadProgressPercentage
944 return (float)GetValue(LoadProgressPercentageProperty);
948 internal static new class Property
950 internal static readonly int Url = Interop.WebView.UrlGet();
951 internal static readonly int UserAgent = Interop.WebView.UserAgentGet();
952 internal static readonly int ScrollPosition = Interop.WebView.ScrollPositionGet();
953 internal static readonly int ScrollSize = Interop.WebView.ScrollSizeGet();
954 internal static readonly int ContentSize = Interop.WebView.ContentSizeGet();
955 internal static readonly int Title = Interop.WebView.TitleGet();
956 internal static readonly int VideoHoleEnabled = Interop.WebView.VideoHoleEnabledGet();
957 internal static readonly int MouseEventsEnabled = Interop.WebView.MouseEventsEnabledGet();
958 internal static readonly int KeyEventsEnabled = Interop.WebView.KeyEventsEnabledGet();
959 internal static readonly int DocumentBackgroundColor = Interop.WebView.DocumentBackgroundColorGet();
960 internal static readonly int TilesClearedWhenHidden = Interop.WebView.TilesClearedWhenHiddenGet();
961 internal static readonly int TileCoverAreaMultiplier = Interop.WebView.TileCoverAreaMultiplierGet();
962 internal static readonly int CursorEnabledByClient = Interop.WebView.CursorEnabledByClientGet();
963 internal static readonly int SelectedText = Interop.WebView.SelectedTextGet();
964 internal static readonly int PageZoomFactor = Interop.WebView.PageZoomFactorGet();
965 internal static readonly int TextZoomFactor = Interop.WebView.TextZoomFactorGet();
966 internal static readonly int LoadProgressPercentage = Interop.WebView.LoadProgressPercentageGet();
969 private static readonly BindableProperty UrlProperty = BindableProperty.Create(nameof(Url), typeof(string), typeof(WebView), string.Empty, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) =>
971 var webview = (WebView)bindable;
972 if (newValue != null)
974 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.Url, new Tizen.NUI.PropertyValue((string)newValue));
977 defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
979 var webview = (WebView)bindable;
981 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.Url).Get(out temp);
985 private static readonly BindableProperty UserAgentProperty = BindableProperty.Create(nameof(UserAgent), typeof(string), typeof(WebView), string.Empty, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) =>
987 var webview = (WebView)bindable;
988 if (newValue != null)
990 Tizen.NUI.Object.SetProperty((HandleRef)webview.SwigCPtr, WebView.Property.UserAgent, new Tizen.NUI.PropertyValue((string)newValue));
993 defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
995 var webview = (WebView)bindable;
997 Tizen.NUI.Object.GetProperty((HandleRef)webview.SwigCPtr, WebView.Property.UserAgent).Get(out temp);
1001 private static readonly BindableProperty ScrollPositionProperty = BindableProperty.Create(nameof(ScrollPosition), typeof(Vector2), typeof(WebView), null, propertyChanged: (bindable, oldValue, newValue) =>
1003 var webview = (WebView)bindable;
1004 if (newValue != null)
1006 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.ScrollPosition, new Tizen.NUI.PropertyValue((Vector2)newValue));
1009 defaultValueCreator: (bindable) =>
1011 var webview = (WebView)bindable;
1012 Vector2 temp = new Vector2(0.0f, 0.0f);
1013 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.ScrollPosition).Get(temp);
1017 private static readonly BindableProperty ScrollSizeProperty = BindableProperty.Create(nameof(ScrollSize), typeof(Vector2), typeof(WebView), null, defaultValueCreator: (bindable) =>
1019 var webview = (WebView)bindable;
1020 Vector2 temp = new Vector2(0.0f, 0.0f);
1021 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.ScrollSize).Get(temp);
1025 private static readonly BindableProperty ContentSizeProperty = BindableProperty.Create(nameof(ContentSize), typeof(Vector2), typeof(WebView), null, defaultValueCreator: (bindable) =>
1027 var webview = (WebView)bindable;
1028 Vector2 temp = new Vector2(0.0f, 0.0f);
1029 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.ContentSize).Get(temp);
1033 private static readonly BindableProperty TitleProperty = BindableProperty.Create(nameof(Title), typeof(string), typeof(WebView), null, defaultValueCreator: (bindable) =>
1035 var webview = (WebView)bindable;
1037 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.Title).Get(out title);
1041 private static readonly BindableProperty VideoHoleEnabledProperty = BindableProperty.Create(nameof(VideoHoleEnabled), typeof(bool), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
1043 var webview = (WebView)bindable;
1044 if (newValue != null)
1046 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.VideoHoleEnabled, new Tizen.NUI.PropertyValue((bool)newValue));
1049 defaultValueCreator: (bindable) =>
1051 var webview = (WebView)bindable;
1053 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.VideoHoleEnabled).Get(out temp);
1057 private static readonly BindableProperty MouseEventsEnabledProperty = BindableProperty.Create(nameof(MouseEventsEnabled), typeof(bool), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
1059 var webview = (WebView)bindable;
1060 if (newValue != null)
1062 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.MouseEventsEnabled, new Tizen.NUI.PropertyValue((bool)newValue));
1065 defaultValueCreator: (bindable) =>
1067 var webview = (WebView)bindable;
1069 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.MouseEventsEnabled).Get(out temp);
1073 private static readonly BindableProperty KeyEventsEnabledProperty = BindableProperty.Create(nameof(KeyEventsEnabled), typeof(bool), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
1075 var webview = (WebView)bindable;
1076 if (newValue != null)
1078 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.KeyEventsEnabled, new Tizen.NUI.PropertyValue((bool)newValue));
1081 defaultValueCreator: (bindable) =>
1083 var webview = (WebView)bindable;
1085 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.KeyEventsEnabled).Get(out temp);
1089 private static readonly BindableProperty ContentBackgroundColorProperty = BindableProperty.Create(nameof(ContentBackgroundColor), typeof(Vector4), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
1091 var webview = (WebView)bindable;
1092 if (newValue != null)
1094 webview.contentBackgroundColor = (Vector4)newValue;
1095 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.DocumentBackgroundColor, new Tizen.NUI.PropertyValue((Vector4)newValue));
1098 defaultValueCreator: (bindable) =>
1100 var webview = (WebView)bindable;
1101 return webview.contentBackgroundColor;
1104 private static readonly BindableProperty TilesClearedWhenHiddenProperty = BindableProperty.Create(nameof(TilesClearedWhenHidden), typeof(bool), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
1106 var webview = (WebView)bindable;
1107 if (newValue != null)
1109 webview.tilesClearedWhenHidden = (bool)newValue;
1110 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.TilesClearedWhenHidden, new Tizen.NUI.PropertyValue((bool)newValue));
1113 defaultValueCreator: (bindable) =>
1115 var webview = (WebView)bindable;
1116 return webview.tilesClearedWhenHidden;
1119 private static readonly BindableProperty TileCoverAreaMultiplierProperty = BindableProperty.Create(nameof(TileCoverAreaMultiplier), typeof(float), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
1121 var webview = (WebView)bindable;
1122 if (newValue != null)
1124 webview.tileCoverAreaMultiplier = (float)newValue;
1125 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.TileCoverAreaMultiplier, new Tizen.NUI.PropertyValue((float)newValue));
1128 defaultValueCreator: (bindable) =>
1130 var webview = (WebView)bindable;
1131 return webview.tileCoverAreaMultiplier;
1134 private static readonly BindableProperty CursorEnabledByClientProperty = BindableProperty.Create(nameof(CursorEnabledByClient), typeof(bool), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
1136 var webview = (WebView)bindable;
1137 if (newValue != null)
1139 webview.cursorEnabledByClient = (bool)newValue;
1140 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.CursorEnabledByClient, new Tizen.NUI.PropertyValue((bool)newValue));
1143 defaultValueCreator: (bindable) =>
1145 var webview = (WebView)bindable;
1146 return webview.cursorEnabledByClient;
1149 private static readonly BindableProperty SelectedTextProperty = BindableProperty.Create(nameof(SelectedText), typeof(string), typeof(WebView), null, defaultValueCreator: (bindable) =>
1151 var webview = (WebView)bindable;
1153 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.SelectedText).Get(out text);
1157 private static readonly BindableProperty PageZoomFactorProperty = BindableProperty.Create(nameof(PageZoomFactor), typeof(float), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
1159 var webview = (WebView)bindable;
1160 if (newValue != null)
1162 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.PageZoomFactor, new Tizen.NUI.PropertyValue((float)newValue));
1165 defaultValueCreator: (bindable) =>
1167 var webview = (WebView)bindable;
1169 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.PageZoomFactor).Get(out temp);
1173 private static readonly BindableProperty TextZoomFactorProperty = BindableProperty.Create(nameof(TextZoomFactor), typeof(float), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
1175 var webview = (WebView)bindable;
1176 if (newValue != null)
1178 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.TextZoomFactor, new Tizen.NUI.PropertyValue((float)newValue));
1181 defaultValueCreator: (bindable) =>
1183 var webview = (WebView)bindable;
1185 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.TextZoomFactor).Get(out temp);
1189 private static readonly BindableProperty LoadProgressPercentageProperty = BindableProperty.Create(nameof(LoadProgressPercentage), typeof(float), typeof(WebView), null, defaultValueCreator: (bindable) =>
1191 var webview = (WebView)bindable;
1193 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.LoadProgressPercentage).Get(out percentage);
1197 // For rooting handlers
1198 internal Dictionary<string, JavaScriptMessageHandler> handlerRootMap = new Dictionary<string, JavaScriptMessageHandler>();
1202 /// <param name="url">The path of Web</param>
1204 [EditorBrowsable(EditorBrowsableState.Never)]
1205 public void LoadUrl(string url)
1207 Interop.WebView.LoadUrl(SwigCPtr, url);
1208 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1212 /// Deprecated. Loads a html by string.
1213 /// <param name="data">The data of Web</param>
1215 [EditorBrowsable(EditorBrowsableState.Never)]
1216 public void LoadHTMLString(string data)
1218 Interop.WebView.LoadHtmlString(SwigCPtr, data);
1219 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1223 /// Loads a html by string.
1224 /// <param name="data">The data of Web</param>
1226 [EditorBrowsable(EditorBrowsableState.Never)]
1227 public void LoadHtmlString(string data)
1229 Interop.WebView.LoadHtmlString(SwigCPtr, data);
1230 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1234 /// Loads the specified html as the content of the view to override current history entry.
1235 /// <param name="html">The html to be loaded</param>
1236 /// <param name="baseUri">Base URL used for relative paths to external objects</param>
1237 /// <param name="unreachableUri">URL that could not be reached</param>
1239 [EditorBrowsable(EditorBrowsableState.Never)]
1240 public bool LoadHtmlStringOverrideCurrentEntry(string html, string baseUri, string unreachableUri)
1242 bool result = Interop.WebView.LoadHtmlStringOverrideCurrentEntry(SwigCPtr, html, baseUri, unreachableUri);
1243 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1248 /// Requests to load the given contents by MIME type.
1249 /// <param name="contents">The contents to be loaded</param>
1250 /// <param name="contentSize">The size of contents (in bytes)</param>
1251 /// <param name="mimeType">The type of contents, "text/html" is assumed if null</param>
1252 /// <param name="encoding">The encoding for contents, "UTF-8" is assumed if null</param>
1253 /// <param name="baseUri">The base URI to use for relative resources</param>
1255 [EditorBrowsable(EditorBrowsableState.Never)]
1256 public bool LoadContents(string contents, uint contentSize, string mimeType, string encoding, string baseUri)
1258 bool result = Interop.WebView.LoadContents(SwigCPtr, contents, contentSize, mimeType, encoding, baseUri);
1259 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1266 [EditorBrowsable(EditorBrowsableState.Never)]
1267 public void Reload()
1269 Interop.WebView.Reload(SwigCPtr);
1270 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1274 /// Reloads the current page's document without cache
1276 [EditorBrowsable(EditorBrowsableState.Never)]
1277 public bool ReloadWithoutCache()
1279 bool result = Interop.WebView.ReloadWithoutCache(SwigCPtr);
1280 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1285 /// Stops loading the Web
1287 [EditorBrowsable(EditorBrowsableState.Never)]
1288 public void StopLoading()
1290 Interop.WebView.StopLoading(SwigCPtr);
1291 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1295 /// Suspends the operation.
1297 [EditorBrowsable(EditorBrowsableState.Never)]
1298 public void Suspend()
1300 Interop.WebView.Suspend(SwigCPtr);
1301 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1305 /// Resumes the operation after calling Suspend()
1307 [EditorBrowsable(EditorBrowsableState.Never)]
1308 public void Resume()
1310 Interop.WebView.Resume(SwigCPtr);
1311 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1315 /// Suspends all network loading.
1317 [EditorBrowsable(EditorBrowsableState.Never)]
1318 public void SuspendNetworkLoading()
1320 Interop.WebView.SuspendNetworkLoading(SwigCPtr);
1321 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1325 /// Resumes all network loading.
1327 [EditorBrowsable(EditorBrowsableState.Never)]
1328 public void ResumeNetworkLoading()
1330 Interop.WebView.ResumeNetworkLoading(SwigCPtr);
1331 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1335 /// Adds custom header.
1336 /// <param name="name">The name of custom header</param>
1337 /// <param name="value">The value of custom header</param>
1339 [EditorBrowsable(EditorBrowsableState.Never)]
1340 public bool AddCustomHeader(string name, string value)
1342 bool result = Interop.WebView.AddCustomHeader(SwigCPtr, name, value);
1343 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1348 /// Removes custom header.
1349 /// <param name="name">The name of custom header</param>
1351 [EditorBrowsable(EditorBrowsableState.Never)]
1352 public bool RemoveCustomHeader(string name)
1354 bool result = Interop.WebView.RemoveCustomHeader(SwigCPtr, name);
1355 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1360 /// Starts the inspector server.
1361 /// <param name="port">The port number</param>
1363 [EditorBrowsable(EditorBrowsableState.Never)]
1364 public uint StartInspectorServer(uint port)
1366 uint result = Interop.WebView.StartInspectorServer(SwigCPtr, port);
1367 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1372 /// Stops the inspector server.
1374 [EditorBrowsable(EditorBrowsableState.Never)]
1375 public bool StopInspectorServer()
1377 bool result = Interop.WebView.StopInspectorServer(SwigCPtr);
1378 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1383 /// Scrolls page of web view by deltaX and detlaY.
1384 /// <param name="deltaX">The deltaX of scroll</param>
1385 /// <param name="deltaY">The deltaY of scroll</param>
1387 [EditorBrowsable(EditorBrowsableState.Never)]
1388 public void ScrollBy(int deltaX, int deltaY)
1390 Interop.WebView.ScrollBy(SwigCPtr, deltaX, deltaY);
1391 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1395 /// Scrolls edge of web view by deltaX and deltaY.
1396 /// <param name="deltaX">The deltaX of scroll</param>
1397 /// <param name="deltaY">The deltaY of scroll</param>
1399 [EditorBrowsable(EditorBrowsableState.Never)]
1400 public bool ScrollEdgeBy(int deltaX, int deltaY)
1402 bool result = Interop.WebView.ScrollEdgeBy(SwigCPtr, deltaX, deltaY);
1403 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1408 /// Goes to the back
1410 [EditorBrowsable(EditorBrowsableState.Never)]
1411 public void GoBack()
1413 Interop.WebView.GoBack(SwigCPtr);
1414 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1418 /// Goes to the forward
1420 [EditorBrowsable(EditorBrowsableState.Never)]
1421 public void GoForward()
1423 Interop.WebView.GoForward(SwigCPtr);
1424 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1428 /// Returns whether backward is possible.
1429 /// <returns>True if backward is possible, false otherwise</returns>
1431 [EditorBrowsable(EditorBrowsableState.Never)]
1432 public bool CanGoBack()
1434 bool ret = Interop.WebView.CanGoBack(SwigCPtr);
1435 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1440 /// Returns whether forward is possible.
1441 /// <returns>True if forward is possible, false otherwise</returns>
1443 [EditorBrowsable(EditorBrowsableState.Never)]
1444 public bool CanGoForward()
1446 bool ret = Interop.WebView.CanGoForward(SwigCPtr);
1447 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1452 /// Evaluates JavaScript code represented as a string.
1453 /// <param name="script">The JavaScript code</param>
1455 [EditorBrowsable(EditorBrowsableState.Never)]
1456 public void EvaluateJavaScript(string script)
1458 Interop.WebView.EvaluateJavaScript(SwigCPtr, script, new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero));
1459 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1463 /// Add a message handler into the WebView.
1464 /// <param name="objectName">The name of exposed object</param>
1465 /// <param name="handler">The callback function</param>
1467 [EditorBrowsable(EditorBrowsableState.Never)]
1468 public void AddJavaScriptMessageHandler(string objectName, JavaScriptMessageHandler handler)
1470 if (handlerRootMap.ContainsKey(objectName))
1475 handlerRootMap.Add(objectName, handler);
1477 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(handler);
1478 Interop.WebView.AddJavaScriptMessageHandler(SwigCPtr, objectName, new System.Runtime.InteropServices.HandleRef(this, ip));
1480 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1484 /// Add a message handler into the WebView.
1485 /// <param name="callback">The callback function</param>
1487 [EditorBrowsable(EditorBrowsableState.Never)]
1488 public void RegisterJavaScriptAlertCallback(JavaScriptAlertCallback callback)
1490 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(callback);
1491 Interop.WebView.RegisterJavaScriptAlertCallback(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
1493 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1497 /// Reply for alert popup.
1499 [EditorBrowsable(EditorBrowsableState.Never)]
1500 public void JavaScriptAlertReply()
1502 Interop.WebView.JavaScriptAlertReply(SwigCPtr);
1503 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1507 /// Add a message handler into the WebView.
1508 /// <param name="callback">The callback function</param>
1510 [EditorBrowsable(EditorBrowsableState.Never)]
1511 public void RegisterJavaScriptConfirmCallback(JavaScriptConfirmCallback callback)
1513 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(callback);
1514 Interop.WebView.RegisterJavaScriptConfirmCallback(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
1516 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1520 /// Reply for confirm popup.
1521 /// <param name="confirmed">confirmed or not</param>
1523 [EditorBrowsable(EditorBrowsableState.Never)]
1524 public void JavaScriptConfirmReply(bool confirmed)
1526 Interop.WebView.JavaScriptConfirmReply(SwigCPtr, confirmed);
1527 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1531 /// Add a message handler into the WebView.
1532 /// <param name="callback">The callback function</param>
1534 [EditorBrowsable(EditorBrowsableState.Never)]
1535 public void RegisterJavaScriptPromptCallback(JavaScriptPromptCallback callback)
1537 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(callback);
1538 Interop.WebView.RegisterJavaScriptPromptCallback(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
1540 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1544 /// Reply for prompt popup.
1545 /// <param name="result">text in prompt input field.</param>
1547 [EditorBrowsable(EditorBrowsableState.Never)]
1548 public void JavaScriptPromptReply(string result)
1550 Interop.WebView.JavaScriptPromptReply(SwigCPtr, result);
1551 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1555 /// Clears title resources of current WebView.
1557 [EditorBrowsable(EditorBrowsableState.Never)]
1558 public void ClearAllTilesResources()
1560 Interop.WebView.ClearAllTilesResources(SwigCPtr);
1561 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1565 /// Clears the history of current WebView.
1567 [EditorBrowsable(EditorBrowsableState.Never)]
1568 public void ClearHistory()
1570 Interop.WebView.ClearHistory(SwigCPtr);
1571 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1575 /// Scales the current page, centered at the given point.
1576 /// <param name="scaleFactor">The new factor to be scaled</param>
1577 /// <param name="point">The center coordinate</param>
1579 [EditorBrowsable(EditorBrowsableState.Never)]
1580 public void SetScaleFactor(float scaleFactor, Vector2 point)
1582 Interop.WebView.SetScaleFactor(SwigCPtr, scaleFactor, Vector2.getCPtr(point));
1583 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1587 /// Gets the current scale factor of the page.
1589 [EditorBrowsable(EditorBrowsableState.Never)]
1590 public float GetScaleFactor()
1592 float result = Interop.WebView.GetScaleFactor(SwigCPtr);
1593 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1598 /// Requests to activate/deactivate the accessibility usage set by web app.
1599 /// <param name="activated">The new factor to be scaled</param>
1601 [EditorBrowsable(EditorBrowsableState.Never)]
1602 public void ActivateAccessibility(bool activated)
1604 Interop.WebView.ActivateAccessibility(SwigCPtr, activated);
1605 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1609 /// Searches and highlights the given string in the document.
1610 /// <param name="text">The text to be searched</param>
1611 /// <param name="options">The options to search</param>
1612 /// <param name="maxMatchCount">The maximum match count to search</param>
1614 [EditorBrowsable(EditorBrowsableState.Never)]
1615 public bool HighlightText(string text, FindOption options, uint maxMatchCount)
1617 bool result = Interop.WebView.HighlightText(SwigCPtr, text, (int)options, maxMatchCount);
1618 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1623 /// Adds dynamic certificate path.
1624 /// <param name="host">Host that required client authentication</param>
1625 /// <param name="certPath">The file path stored certificate</param>
1627 [EditorBrowsable(EditorBrowsableState.Never)]
1628 public void AddDynamicCertificatePath(string host, string certPath)
1630 Interop.WebView.AddDynamicCertificatePath(SwigCPtr, host, certPath);
1631 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1635 /// Get snapshot of the specified viewArea of page.
1636 /// <param name="viewArea">Host that required client authentication</param>
1637 /// <param name="scaleFactor">The file path stored certificate</param>
1639 [EditorBrowsable(EditorBrowsableState.Never)]
1640 public ImageView GetScreenshot(Rectangle viewArea, float scaleFactor)
1642 IntPtr image = Interop.WebView.GetScreenshot(SwigCPtr, Rectangle.getCPtr(viewArea), scaleFactor);
1643 ImageView imageView = new ImageView(image, true);
1644 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1649 /// Get snapshot of the specified viewArea of page.
1650 /// <param name="viewArea">Host that required client authentication</param>
1651 /// <param name="scaleFactor">The file path stored certificate</param>
1652 /// <param name="callback">The callback for getting screen shot</param>
1654 [EditorBrowsable(EditorBrowsableState.Never)]
1655 public bool GetScreenshotAsynchronously(Rectangle viewArea, float scaleFactor, ScreenshotAcquiredCallback callback)
1657 screenshotAcquiredCallback = callback;
1658 System.IntPtr ip = Marshal.GetFunctionPointerForDelegate(screenshotAcquiredProxyCallback);
1659 bool result = Interop.WebView.GetScreenshotAsynchronously(SwigCPtr, Rectangle.getCPtr(viewArea), scaleFactor, new HandleRef(this, ip));
1660 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1665 /// Asynchronous requests to check if there is a video playing in the given view.
1666 /// <param name="callback">The callback called after checking if video is playing or not</param>
1668 [EditorBrowsable(EditorBrowsableState.Never)]
1669 public bool CheckVideoPlayingAsynchronously(VideoPlayingCallback callback)
1671 System.IntPtr ip = Marshal.GetFunctionPointerForDelegate(callback);
1672 bool result = Interop.WebView.CheckVideoPlayingAsynchronously(SwigCPtr, new HandleRef(this, ip));
1673 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1678 /// Registers callback which will be called upon geolocation permission request.
1679 /// <param name="callback">The callback for requesting geolocation permission</param>
1681 [EditorBrowsable(EditorBrowsableState.Never)]
1682 public void RegisterGeolocationPermissionCallback(GeolocationPermissionCallback callback)
1684 System.IntPtr ip = Marshal.GetFunctionPointerForDelegate(callback);
1685 Interop.WebView.RegisterGeolocationPermissionCallback(SwigCPtr, new HandleRef(this, ip));
1686 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1690 /// Deprecated. Clears the cache of current WebView.
1692 [EditorBrowsable(EditorBrowsableState.Never)]
1693 public void ClearCache()
1695 Context.ClearCache();
1699 /// Deprecated. Clears all the cookies of current WebView.
1701 [EditorBrowsable(EditorBrowsableState.Never)]
1702 public void ClearCookies()
1704 CookieManager.ClearCookies();
1707 internal static WebView DownCast(BaseHandle handle)
1709 WebView ret = new WebView(Interop.WebView.DownCast(BaseHandle.getCPtr(handle)), true);
1710 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1714 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WebView obj)
1716 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
1719 internal WebView Assign(WebView webView)
1721 WebView ret = new WebView(Interop.WebView.Assign(SwigCPtr, WebView.getCPtr(webView)), false);
1722 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1726 /// This will not be public opened.
1727 /// <param name="swigCPtr"></param>
1728 [EditorBrowsable(EditorBrowsableState.Never)]
1729 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1731 Interop.WebView.DeleteWebView(swigCPtr);
1734 private void OnPageLoadStarted(IntPtr data, string pageUrl)
1736 WebViewPageLoadEventArgs e = new WebViewPageLoadEventArgs();
1738 e.WebView = Registry.GetManagedBaseHandleFromNativePtr(data) as WebView;
1739 e.PageUrl = pageUrl;
1741 pageLoadStartedEventHandler?.Invoke(this, e);
1744 private void OnPageLoading(IntPtr data, string pageUrl)
1746 pageLoadingEventHandler?.Invoke(this, new WebViewPageLoadEventArgs());
1749 private void OnPageLoadFinished(IntPtr data, string pageUrl)
1751 WebViewPageLoadEventArgs e = new WebViewPageLoadEventArgs();
1753 e.WebView = Registry.GetManagedBaseHandleFromNativePtr(data) as WebView;
1754 e.PageUrl = pageUrl;
1756 pageLoadFinishedEventHandler?.Invoke(this, e);
1759 private void OnPageLoadError(IntPtr data, string pageUrl, int errorCode)
1761 WebViewPageLoadErrorEventArgs e = new WebViewPageLoadErrorEventArgs();
1763 e.WebView = Registry.GetManagedBaseHandleFromNativePtr(data) as WebView;
1764 e.PageUrl = pageUrl;
1765 e.ErrorCode = (WebViewPageLoadErrorEventArgs.LoadErrorCode)errorCode;
1767 pageLoadErrorEventHandler?.Invoke(this, e);
1770 private void OnScrollEdgeReached(IntPtr data, int edge)
1772 WebViewScrollEdgeReachedEventArgs arg = new WebViewScrollEdgeReachedEventArgs((WebViewScrollEdgeReachedEventArgs.Edge)edge);
1773 scrollEdgeReachedEventHandler?.Invoke(this, arg);
1776 private void OnUrlChanged(IntPtr data, string pageUrl)
1778 urlChangedEventHandler?.Invoke(this, new WebViewUrlChangedEventArgs(pageUrl));
1781 private void OnFormRepostPolicyDecided(IntPtr data, IntPtr decision)
1783 WebFormRepostPolicyDecisionMaker repostDecision = new WebFormRepostPolicyDecisionMaker(decision, false);
1784 formRepostPolicyDecidedEventHandler?.Invoke(this, new WebViewFormRepostPolicyDecidedEventArgs(repostDecision));
1785 repostDecision.Dispose();
1788 private void OnFrameRendered(IntPtr data)
1790 frameRenderedEventHandler?.Invoke(this, new EventArgs());
1793 private void OnScreenshotAcquired(IntPtr data)
1795 ImageView image = new ImageView(data, true);
1796 screenshotAcquiredCallback?.Invoke(image);
1800 private void OnNewWindowPolicyDecided(IntPtr data, IntPtr maker)
1802 newWindowPolicyDecidedEventHandler?.Invoke(this, new WebViewNewWindowPolicyDecidedEventArgs(new WebNewWindowPolicyDecisionMaker(maker, false)));