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 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
34 private delegate void WebViewPageLoadCallback(string pageUrl);
36 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
37 private delegate void WebViewPageLoadErrorCallback(string pageUrl, int errorCode);
39 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
40 private delegate void WebViewScrollEdgeReachedCallback(int edge);
42 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
43 private delegate void WebViewPolicyDecidedCallback(IntPtr maker);
45 private EventHandler<WebViewPageLoadEventArgs> pageLoadStartedEventHandler;
46 private WebViewPageLoadCallback pageLoadStartedCallback;
48 private EventHandler<WebViewPageLoadEventArgs> pageLoadFinishedEventHandler;
49 private WebViewPageLoadCallback pageLoadFinishedCallback;
51 private EventHandler<WebViewPageLoadErrorEventArgs> pageLoadErrorEventHandler;
52 private WebViewPageLoadErrorCallback pageLoadErrorCallback;
54 private EventHandler<WebViewScrollEdgeReachedEventArgs> scrollEdgeReachedEventHandler;
55 private WebViewScrollEdgeReachedCallback scrollEdgeReachedCallback;
57 private EventHandler<WebViewPolicyDecidedEventArgs> navigationPolicyDecidedEventHandler;
58 private WebViewPolicyDecidedCallback navigationPolicyDecidedCallback;
60 private PlainTextReceivedCallback plainTextReceivedCallback;
63 /// The callback function that is invoked when the plain text of the current page is received.
65 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
66 [EditorBrowsable(EditorBrowsableState.Never)]
67 public delegate void PlainTextReceivedCallback(string plainText);
69 internal WebView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.WebView.WebView_SWIGUpcast(cPtr), cMemoryOwn)
71 BackForwardList = new WebBackForwardList(Interop.WebView.GetWebBackForwardList(SwigCPtr), false);
72 Context = new WebContext(Interop.WebView.GetWebContext(SwigCPtr), false);
73 CookieManager = new WebCookieManager(Interop.WebView.GetWebCookieManager(SwigCPtr), false);
74 Settings = new WebSettings(Interop.WebView.GetWebSettings(SwigCPtr), false);
77 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WebView obj)
79 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
82 internal WebView Assign(WebView webView)
84 WebView ret = new WebView(Interop.WebView.WebView_Assign(swigCPtr, WebView.getCPtr(webView)), false);
85 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
89 internal static WebView DownCast(BaseHandle handle)
91 WebView ret = new WebView(Interop.WebView.WebView_DownCast(BaseHandle.getCPtr(handle)), true);
92 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
97 /// Dispose for IDisposable pattern
99 [EditorBrowsable(EditorBrowsableState.Never)]
100 protected override void Dispose(DisposeTypes type)
107 if (type == DisposeTypes.Explicit)
110 //Release your own managed resources here.
111 //You should release all of your own disposable objects here.
112 BackForwardList.Dispose();
114 CookieManager.Dispose();
121 /// This will not be public opened.
122 /// <param name="swigCPtr"></param>
123 [EditorBrowsable(EditorBrowsableState.Never)]
124 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
126 Interop.WebView.delete_WebView(swigCPtr);
129 private void OnPageLoadStarted(string pageUrl)
131 WebViewPageLoadEventArgs e = new WebViewPageLoadEventArgs();
136 pageLoadStartedEventHandler?.Invoke(this, e);
139 private void OnPageLoadFinished(string pageUrl)
141 WebViewPageLoadEventArgs e = new WebViewPageLoadEventArgs();
146 pageLoadFinishedEventHandler?.Invoke(this, e);
149 private void OnPageLoadError(string pageUrl, int errorCode)
151 WebViewPageLoadErrorEventArgs e = new WebViewPageLoadErrorEventArgs();
155 e.ErrorCode = (WebViewPageLoadErrorEventArgs.LoadErrorCode)errorCode;
157 pageLoadErrorEventHandler?.Invoke(this, e);
160 private void OnScrollEdgeReached(int edge)
162 scrollEdgeReachedEventHandler?.Invoke(this, new WebViewScrollEdgeReachedEventArgs((WebViewScrollEdgeReachedEventArgs.Edge)edge));
165 private void OnNavigationPolicyDecided(IntPtr maker)
167 navigationPolicyDecidedEventHandler?.Invoke(this, new WebViewPolicyDecidedEventArgs(new WebPolicyDecisionMaker(maker, true)));
170 internal static new class Property
172 internal static readonly int URL = Interop.WebView.WebView_Property_URL_get();
173 internal static readonly int USER_AGENT = Interop.WebView.WebView_Property_USER_AGENT_get();
174 internal static readonly int ScrollPosition = Interop.WebView.ScrollPositionGet();
175 internal static readonly int ScrollSize = Interop.WebView.ScrollSizeGet();
176 internal static readonly int ContentSize = Interop.WebView.ContentSizeGet();
177 internal static readonly int Title = Interop.WebView.TitleGet();
178 internal static readonly int VideoHoleEnabled = Interop.WebView.VideoHoleEnabledGet();
181 private static readonly BindableProperty UrlProperty = BindableProperty.Create(nameof(Url), typeof(string), typeof(WebView), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
183 var webview = (WebView)bindable;
184 if (newValue != null)
186 Tizen.NUI.Object.SetProperty(webview.swigCPtr, WebView.Property.URL, new Tizen.NUI.PropertyValue((string)newValue));
189 defaultValueCreator: (bindable) =>
191 var webview = (WebView)bindable;
193 Tizen.NUI.Object.GetProperty(webview.swigCPtr, WebView.Property.URL).Get(out temp);
197 private static readonly BindableProperty UserAgentProperty = BindableProperty.Create(nameof(UserAgent), typeof(string), typeof(WebView), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
199 var webview = (WebView)bindable;
200 if (newValue != null)
202 Tizen.NUI.Object.SetProperty(webview.swigCPtr, WebView.Property.USER_AGENT, new Tizen.NUI.PropertyValue((string)newValue));
205 defaultValueCreator: (bindable) =>
207 var webview = (WebView)bindable;
209 Tizen.NUI.Object.GetProperty(webview.swigCPtr, WebView.Property.USER_AGENT).Get(out temp);
213 private static readonly BindableProperty ScrollPositionProperty = BindableProperty.Create(nameof(ScrollPosition), typeof(Vector2), typeof(WebView), null, propertyChanged: (bindable, oldValue, newValue) =>
215 var webview = (WebView)bindable;
216 if (newValue != null)
218 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.ScrollPosition, new Tizen.NUI.PropertyValue((Vector2)newValue));
221 defaultValueCreator: (bindable) =>
223 var webview = (WebView)bindable;
224 Vector2 temp = new Vector2(0.0f, 0.0f);
225 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.ScrollPosition).Get(temp);
229 private static readonly BindableProperty ScrollSizeProperty = BindableProperty.Create(nameof(ScrollSize), typeof(Vector2), typeof(WebView), null, defaultValueCreator: (bindable) =>
231 var webview = (WebView)bindable;
232 Vector2 temp = new Vector2(0.0f, 0.0f);
233 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.ScrollSize).Get(temp);
237 private static readonly BindableProperty ContentSizeProperty = BindableProperty.Create(nameof(ContentSize), typeof(Vector2), typeof(WebView), null, defaultValueCreator: (bindable) =>
239 var webview = (WebView)bindable;
240 Vector2 temp = new Vector2(0.0f, 0.0f);
241 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.ContentSize).Get(temp);
245 private static readonly BindableProperty TitleProperty = BindableProperty.Create(nameof(Title), typeof(string), typeof(WebView), null, defaultValueCreator: (bindable) =>
247 var webview = (WebView)bindable;
249 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.Title).Get(out title);
253 private static readonly BindableProperty VideoHoleEnabledProperty = BindableProperty.Create(nameof(VideoHoleEnabled), typeof(bool), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
255 var webview = (WebView)bindable;
256 if (newValue != null)
258 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.VideoHoleEnabled, new Tizen.NUI.PropertyValue((bool)newValue));
261 defaultValueCreator: (bindable) =>
263 var webview = (WebView)bindable;
265 Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.VideoHoleEnabled).Get(out temp);
270 /// Creates a WebView.
272 [EditorBrowsable(EditorBrowsableState.Never)]
273 public WebView() : this(Interop.WebView.WebView_New(), true)
275 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
279 /// Creates a WebView with local language and time zone.
280 /// <param name="locale">The locale language of Web</param>
281 /// <param name="timezoneId">The time zone Id of Web</param>
283 [EditorBrowsable(EditorBrowsableState.Never)]
284 public WebView(string locale, string timezoneId) : this(Interop.WebView.WebView_New_2(locale, timezoneId), true)
286 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
290 /// Creates a WebView with an args list.
291 /// <param name="args">args array. The first value of array must be program's name.</param>
293 [EditorBrowsable(EditorBrowsableState.Never)]
294 public WebView(string[] args) : this(Interop.WebView.WebView_New_3(args?.Length ?? 0, args), true)
296 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
300 /// Copy constructor.
301 /// <param name="webView">WebView to copy. The copied WebView will point at the same implementation</param>
303 [EditorBrowsable(EditorBrowsableState.Never)]
304 public WebView(WebView webView) : this(Interop.WebView.new_WebView__SWIG_1(WebView.getCPtr(webView)), true)
306 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
312 [EditorBrowsable(EditorBrowsableState.Never)]
313 public WebBackForwardList BackForwardList { get; }
318 [EditorBrowsable(EditorBrowsableState.Never)]
319 public WebContext Context { get; }
324 [EditorBrowsable(EditorBrowsableState.Never)]
325 public WebCookieManager CookieManager { get; }
330 [EditorBrowsable(EditorBrowsableState.Never)]
331 public WebSettings Settings { get; }
336 [EditorBrowsable(EditorBrowsableState.Never)]
341 return (string)GetValue(UrlProperty);
345 SetValue(UrlProperty, value);
346 NotifyPropertyChanged();
351 /// Deprecated. The cache model of the current WebView.
353 [EditorBrowsable(EditorBrowsableState.Never)]
354 public CacheModel CacheModel
358 return (CacheModel)Context.CacheModel;
362 Context.CacheModel = (WebContext.CacheModelType)value;
367 /// Deprecated. The cookie acceptance policy.
369 [EditorBrowsable(EditorBrowsableState.Never)]
370 public CookieAcceptPolicy CookieAcceptPolicy
374 return (CookieAcceptPolicy)CookieManager.CookieAcceptPolicy;
378 CookieManager.CookieAcceptPolicy = (WebCookieManager.CookieAcceptPolicyType)value;
383 /// The user agent string.
385 [EditorBrowsable(EditorBrowsableState.Never)]
386 public string UserAgent
390 return (string)GetValue(UserAgentProperty);
394 SetValue(UserAgentProperty, value);
395 NotifyPropertyChanged();
400 /// Deprecated. Whether JavaScript is enabled.
402 [EditorBrowsable(EditorBrowsableState.Never)]
403 public bool EnableJavaScript
407 return Settings.EnableJavaScript;
411 Settings.EnableJavaScript = value;
416 /// Deprecated. Whether images can be loaded automatically.
418 [EditorBrowsable(EditorBrowsableState.Never)]
419 public bool LoadImagesAutomatically
423 return Settings.AllowImagesLoadAutomatically;
427 Settings.AllowImagesLoadAutomatically = value;
432 /// The default text encoding name.<br />
433 /// e.g. "UTF-8"<br />
435 [EditorBrowsable(EditorBrowsableState.Never)]
436 public string DefaultTextEncodingName
440 return Settings.DefaultTextEncodingName;
444 Settings.DefaultTextEncodingName = value;
449 /// The default font size in pixel.
451 [EditorBrowsable(EditorBrowsableState.Never)]
452 public int DefaultFontSize
456 return Settings.DefaultFontSize;
460 Settings.DefaultFontSize = value;
465 /// The postion of scroll.
467 [EditorBrowsable(EditorBrowsableState.Never)]
468 public Position ScrollPosition
472 Vector2 pv = (Vector2)GetValue(ScrollPositionProperty);
473 return new Position(pv.X, pv.Y);
480 Vector2 vpv = new Vector2(pv.X, pv.Y);
481 SetValue(ScrollPositionProperty, vpv);
482 NotifyPropertyChanged();
488 /// The size of scroll, read-only.
490 [EditorBrowsable(EditorBrowsableState.Never)]
491 public Size ScrollSize
495 Vector2 sv = (Vector2)GetValue(ScrollSizeProperty);
496 return new Size(sv.Width, sv.Height);
501 /// The size of content, read-only.
503 [EditorBrowsable(EditorBrowsableState.Never)]
504 public Size ContentSize
508 Vector2 sv = (Vector2)GetValue(ContentSizeProperty);
509 return new Size(sv.Width, sv.Height);
514 /// Whether video hole is enabled or not.
516 [EditorBrowsable(EditorBrowsableState.Never)]
517 public bool VideoHoleEnabled
521 return (bool)GetValue(VideoHoleEnabledProperty);
525 SetValue(VideoHoleEnabledProperty, value);
526 NotifyPropertyChanged();
531 /// Event for the PageLoadStarted signal which can be used to subscribe or unsubscribe the event handler.<br />
532 /// This signal is emitted when page loading has started.<br />
534 [EditorBrowsable(EditorBrowsableState.Never)]
535 public event EventHandler<WebViewPageLoadEventArgs> PageLoadStarted
539 if (pageLoadStartedEventHandler == null)
541 pageLoadStartedCallback = OnPageLoadStarted;
542 IntPtr ip = Marshal.GetFunctionPointerForDelegate(pageLoadStartedCallback);
543 Interop.WebView.RegisterPageLoadStartedCallback(SwigCPtr, new HandleRef(this, ip));
545 pageLoadStartedEventHandler += value;
549 pageLoadStartedEventHandler -= value;
554 /// Event for the PageLoadFinished signal which can be used to subscribe or unsubscribe the event handler.<br />
555 /// This signal is emitted when page loading has finished.<br />
557 [EditorBrowsable(EditorBrowsableState.Never)]
558 public event EventHandler<WebViewPageLoadEventArgs> PageLoadFinished
562 if (pageLoadFinishedEventHandler == null)
564 pageLoadFinishedCallback = OnPageLoadFinished;
565 IntPtr ip = Marshal.GetFunctionPointerForDelegate(pageLoadFinishedCallback);
566 Interop.WebView.RegisterPageLoadFinishedCallback(SwigCPtr, new HandleRef(this, ip));
568 pageLoadFinishedEventHandler += value;
572 pageLoadFinishedEventHandler -= value;
577 /// Event for the PageLoadError signal which can be used to subscribe or unsubscribe the event handler.<br />
578 /// This signal is emitted when there's an error in page loading.<br />
580 [EditorBrowsable(EditorBrowsableState.Never)]
581 public event EventHandler<WebViewPageLoadErrorEventArgs> PageLoadError
585 pageLoadErrorCallback = OnPageLoadError;
586 IntPtr ip = Marshal.GetFunctionPointerForDelegate(pageLoadErrorCallback);
587 Interop.WebView.RegisterPageLoadErrorCallback(SwigCPtr, new HandleRef(this, ip));
591 pageLoadErrorEventHandler -= value;
596 /// Event for the ScrollEdgeReached signal which can be used to subscribe or unsubscribe the event handler.<br />
597 /// This signal is emitted when web view is scrolled to edge.<br />
599 [EditorBrowsable(EditorBrowsableState.Never)]
600 public event EventHandler<WebViewScrollEdgeReachedEventArgs> ScrollEdgeReached
604 scrollEdgeReachedCallback = OnScrollEdgeReached;
605 IntPtr ip = Marshal.GetFunctionPointerForDelegate(scrollEdgeReachedCallback);
606 Interop.WebView.RegisterScrollEdgeReachedCallback(SwigCPtr, new HandleRef(this, ip));
610 scrollEdgeReachedEventHandler -= value;
615 /// Event for the NavigationPolicyDecided signal which can be used to subscribe or unsubscribe the event handler.<br />
616 /// This signal is emitted when response policy would be decided.<br />
618 [EditorBrowsable(EditorBrowsableState.Never)]
619 public event EventHandler<WebViewPolicyDecidedEventArgs> NavigationPolicyDecided
623 if (navigationPolicyDecidedEventHandler == null)
625 navigationPolicyDecidedCallback = OnNavigationPolicyDecided;
626 IntPtr ip = Marshal.GetFunctionPointerForDelegate(navigationPolicyDecidedCallback);
627 Interop.WebView.RegisterNavigationPolicyDecidedCallback(SwigCPtr, new HandleRef(this, ip));
629 navigationPolicyDecidedEventHandler += value;
633 navigationPolicyDecidedEventHandler -= value;
638 /// Gets title of web page.
640 [EditorBrowsable(EditorBrowsableState.Never)]
645 return (string)GetValue(TitleProperty);
652 [EditorBrowsable(EditorBrowsableState.Never)]
653 public ImageView Favicon
657 global::System.IntPtr imageView = Interop.WebView.WebView_GetFavicon(swigCPtr);
658 if (imageView == IntPtr.Zero)
660 return new ImageView(imageView, false);
666 /// <param name="url">The path of Web</param>
668 [EditorBrowsable(EditorBrowsableState.Never)]
669 public void LoadUrl(string url)
671 Interop.WebView.WebView_LoadUrl(swigCPtr, url);
672 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
676 /// Deprecated. Loads a html by string.
677 /// <param name="data">The data of Web</param>
679 [EditorBrowsable(EditorBrowsableState.Never)]
680 public void LoadHTMLString(string data)
682 Interop.WebView.LoadHtmlString(SwigCPtr, data);
683 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
687 /// Loads a html by string.
688 /// <param name="data">The data of Web</param>
690 [EditorBrowsable(EditorBrowsableState.Never)]
691 public void LoadHtmlString(string data)
693 Interop.WebView.LoadHtmlString(SwigCPtr, data);
694 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
700 [EditorBrowsable(EditorBrowsableState.Never)]
703 Interop.WebView.WebView_Reload(swigCPtr);
704 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
708 /// Stops loading the Web
710 [EditorBrowsable(EditorBrowsableState.Never)]
711 public void StopLoading()
713 Interop.WebView.WebView_StopLoading(swigCPtr);
714 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
718 /// Suspends the operation.
720 [EditorBrowsable(EditorBrowsableState.Never)]
721 public void Suspend()
723 Interop.WebView.WebView_Suspend(swigCPtr);
724 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
728 /// Resumes the operation after calling Suspend()
730 [EditorBrowsable(EditorBrowsableState.Never)]
733 Interop.WebView.WebView_Resume(swigCPtr);
734 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
738 /// Scroll web view by deltaX and detlaY.
739 /// <param name="deltaX">The deltaX of scroll</param>
740 /// <param name="deltaY">The deltaY of scroll</param>
742 [EditorBrowsable(EditorBrowsableState.Never)]
743 public void ScrollBy(int deltaX, int deltaY)
745 Interop.WebView.ScrollBy(SwigCPtr, deltaX, deltaY);
746 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
752 [EditorBrowsable(EditorBrowsableState.Never)]
755 Interop.WebView.WebView_GoBack(swigCPtr);
756 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
760 /// Goes to the forward
762 [EditorBrowsable(EditorBrowsableState.Never)]
763 public void GoForward()
765 Interop.WebView.WebView_GoForward(swigCPtr);
766 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
770 /// Returns whether backward is possible.
771 /// <returns>True if backward is possible, false otherwise</returns>
773 [EditorBrowsable(EditorBrowsableState.Never)]
774 public bool CanGoBack()
776 bool ret = Interop.WebView.WebView_CanGoBack(swigCPtr);
777 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
782 /// Returns whether forward is possible.
783 /// <returns>True if forward is possible, false otherwise</returns>
785 [EditorBrowsable(EditorBrowsableState.Never)]
786 public bool CanGoForward()
788 bool ret = Interop.WebView.WebView_CanGoForward(swigCPtr);
789 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
794 /// The callback function that is invoked when the message is received from the script.
796 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
797 [EditorBrowsable(EditorBrowsableState.Never)]
798 public delegate void JavaScriptMessageHandler(string message);
801 /// Evaluates JavaScript code represented as a string.
802 /// <param name="script">The JavaScript code</param>
804 [EditorBrowsable(EditorBrowsableState.Never)]
805 public void EvaluateJavaScript(string script)
807 Interop.WebView.WebView_EvaluateJavaScript(swigCPtr, script, new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero));
808 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
811 // For rooting handlers
812 internal Dictionary<string, JavaScriptMessageHandler> handlerRootMap = new Dictionary<string, JavaScriptMessageHandler>();
815 /// Add a message handler into the WebView.
816 /// <param name="objectName">The name of exposed object</param>
817 /// <param name="handler">The callback function</param>
819 [EditorBrowsable(EditorBrowsableState.Never)]
820 public void AddJavaScriptMessageHandler(string objectName, JavaScriptMessageHandler handler)
822 if (handlerRootMap.ContainsKey(objectName))
827 handlerRootMap.Add(objectName, handler);
829 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(handler);
830 Interop.WebView.WebView_AddJavaScriptMessageHandler(swigCPtr, objectName, new System.Runtime.InteropServices.HandleRef(this, ip));
832 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
836 /// Clears title resources of current WebView.
838 [EditorBrowsable(EditorBrowsableState.Never)]
839 public void ClearAllTilesResources()
841 Interop.WebView.WebView_ClearAllTilesResources(swigCPtr);
842 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
846 /// Clears the history of current WebView.
848 [EditorBrowsable(EditorBrowsableState.Never)]
849 public void ClearHistory()
851 Interop.WebView.WebView_ClearHistory(swigCPtr);
852 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
856 /// Deprecated. Clears the cache of current WebView.
858 [EditorBrowsable(EditorBrowsableState.Never)]
859 public void ClearCache()
861 Context.ClearCache();
865 /// Deprecated. Clears all the cookies of current WebView.
867 [EditorBrowsable(EditorBrowsableState.Never)]
868 public void ClearCookies()
870 CookieManager.ClearCookies();
874 /// Sets the tts focus to the webview.
875 /// Please note that it only works when the webview does not have keyinput focus.
876 /// If the webview has a keyinput focus, it also has tts focus so calling SetTtsFocus(false) is ignored.
878 [EditorBrowsable(EditorBrowsableState.Never)]
879 public void SetTtsFocus(bool focused)
881 Interop.WebView.SetTtsFocus(SwigCPtr, focused);
882 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
886 /// Get a plain text of current web page asynchronously.
887 /// Please note that it gets plain text of currently loaded page so please call this method after page load finished.
888 /// <param name="callback">The callback for getting plain text</param>
890 [EditorBrowsable(EditorBrowsableState.Never)]
891 public void GetPlainTextAsynchronously(PlainTextReceivedCallback callback)
893 plainTextReceivedCallback = callback;
894 System.IntPtr ip = Marshal.GetFunctionPointerForDelegate(plainTextReceivedCallback);
895 Interop.WebView.GetPlainTextAsynchronously(SwigCPtr, new HandleRef(this, ip));
896 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();