/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Tizen.NUI.Binding;
namespace Tizen.NUI.BaseComponents
{
///
/// WebView allows presenting content with embedded web browser, both local files and remote websites.
///
/// 9
public partial class WebView : View
{
private Color contentBackgroundColor;
private bool tilesClearedWhenHidden;
private float tileCoverAreaMultiplier;
private bool cursorEnabledByClient;
private EventHandler pageLoadStartedEventHandler;
private WebViewPageLoadCallbackDelegate pageLoadStartedCallback;
private EventHandler pageLoadingEventHandler;
private WebViewPageLoadCallbackDelegate pageLoadingCallback;
private EventHandler pageLoadFinishedEventHandler;
private WebViewPageLoadCallbackDelegate pageLoadFinishedCallback;
private EventHandler pageLoadErrorEventHandler;
private WebViewPageLoadErrorCallbackDelegate pageLoadErrorCallback;
private EventHandler scrollEdgeReachedEventHandler;
private WebViewScrollEdgeReachedCallbackDelegate scrollEdgeReachedCallback;
private EventHandler urlChangedEventHandler;
private WebViewUrlChangedCallbackDelegate urlChangedCallback;
private EventHandler formRepostPolicyDecidedEventHandler;
private WebViewFormRepostPolicyDecidedCallbackDelegate formRepostPolicyDecidedCallback;
private EventHandler frameRenderedEventHandler;
private WebViewFrameRenderedCallbackDelegate frameRenderedCallback;
private ScreenshotAcquiredCallback screenshotAcquiredCallback;
private readonly WebViewScreenshotAcquiredProxyCallback screenshotAcquiredProxyCallback;
private HitTestFinishedCallback hitTestFinishedCallback;
private readonly WebViewHitTestFinishedProxyCallback hitTestFinishedProxyCallback;
private EventHandler responsePolicyDecidedEventHandler;
private WebViewResponsePolicyDecidedCallbackDelegate responsePolicyDecidedCallback;
private EventHandler certificateConfirmedEventHandler;
private WebViewCertificateReceivedCallbackDelegate certificateConfirmedCallback;
private EventHandler sslCertificateChangedEventHandler;
private WebViewCertificateReceivedCallbackDelegate sslCertificateChangedCallback;
private EventHandler httpAuthRequestedEventHandler;
private WebViewHttpAuthRequestedCallbackDelegate httpAuthRequestedCallback;
private EventHandler consoleMessageReceivedEventHandler;
private WebViewConsoleMessageReceivedCallbackDelegate consoleMessageReceivedCallback;
private EventHandler contextMenuShownEventHandler;
private WebViewContextMenuShownCallbackDelegate contextMenuShownCallback;
private EventHandler contextMenuHiddenEventHandler;
private WebViewContextMenuHiddenCallbackDelegate contextMenuHiddenCallback;
private PlainTextReceivedCallback plainTextReceivedCallback;
///
/// Creates a WebView.
///
/// 9
public WebView() : this(Interop.WebView.New(), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Creates a WebView with locale and time-zone.
///
/// The specified locale
/// The specified time-zone ID
[EditorBrowsable(EditorBrowsableState.Never)]
public WebView(string locale, string timezoneId) : this(Interop.WebView.New2(locale, timezoneId), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Creates a WebView with an args list.
///
/// Arguments passed into web engine. The first value of array must be program's name.
/// 9
public WebView(string[] args) : this(Interop.WebView.New3(args?.Length ?? 0, args), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Copy constructor.
///
/// WebView to copy. The copied WebView will point at the same implementation
/// 9
public WebView(WebView webView) : this(Interop.WebView.NewWebView(WebView.getCPtr(webView)), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal WebView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.WebView.Upcast(cPtr), cMemoryOwn)
{
screenshotAcquiredProxyCallback = OnScreenshotAcquired;
hitTestFinishedProxyCallback = OnHitTestFinished;
BackForwardList = new WebBackForwardList(Interop.WebView.GetWebBackForwardList(SwigCPtr), false);
Context = new WebContext(Interop.WebView.GetWebContext(SwigCPtr), false);
CookieManager = new WebCookieManager(Interop.WebView.GetWebCookieManager(SwigCPtr), false);
Settings = new WebSettings(Interop.WebView.GetWebSettings(SwigCPtr), false);
}
///
/// Dispose for IDisposable pattern
///
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void Dispose(DisposeTypes type)
{
if (Disposed)
{
return;
}
if (type == DisposeTypes.Explicit)
{
//Called by User
//Release your own managed resources here.
//You should release all of your own disposable objects here.
BackForwardList.Dispose();
Context.Dispose();
CookieManager.Dispose();
Settings.Dispose();
}
base.Dispose(type);
}
/// This will not be public opened.
///
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
{
Interop.WebView.DeleteWebView(swigCPtr);
}
///
/// The callback function that is invoked when the message is received from the script.
///
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
[EditorBrowsable(EditorBrowsableState.Never)]
public delegate void JavaScriptMessageHandler(string message);
///
/// The callback function that is invoked when the message is received from the script.
///
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
[EditorBrowsable(EditorBrowsableState.Never)]
public delegate void JavaScriptAlertCallback(string message);
///
/// The callback function that is invoked when the message is received from the script.
///
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
[EditorBrowsable(EditorBrowsableState.Never)]
public delegate void JavaScriptConfirmCallback(string message);
///
/// The callback function that is invoked when the message is received from the script.
///
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
[EditorBrowsable(EditorBrowsableState.Never)]
public delegate void JavaScriptPromptCallback(string message1, string message2);
///
/// The callback function that is invoked when screen shot is acquired asynchronously.
///
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
[EditorBrowsable(EditorBrowsableState.Never)]
public delegate void ScreenshotAcquiredCallback(ImageView image);
///
/// The callback function that is invoked when video playing is checked asynchronously.
///
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
[EditorBrowsable(EditorBrowsableState.Never)]
public delegate void VideoPlayingCallback(bool isPlaying);
///
/// The callback function that is invoked when geolocation permission is requested.
///
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
[EditorBrowsable(EditorBrowsableState.Never)]
public delegate void GeolocationPermissionCallback(string host, string protocol);
///
/// The callback function that is invoked when hit test is finished.
///
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
[EditorBrowsable(EditorBrowsableState.Never)]
public delegate void HitTestFinishedCallback(WebHitTestResult test);
///
/// The callback function that is invoked when the plain text of the current page is received.
///
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
[EditorBrowsable(EditorBrowsableState.Never)]
public delegate void PlainTextReceivedCallback(string plainText);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void WebViewPageLoadCallbackDelegate(string pageUrl);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void WebViewPageLoadErrorCallbackDelegate(IntPtr error);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void WebViewScrollEdgeReachedCallbackDelegate(int edge);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void WebViewUrlChangedCallbackDelegate(string pageUrl);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void WebViewFormRepostPolicyDecidedCallbackDelegate(IntPtr maker);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void WebViewFrameRenderedCallbackDelegate();
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void WebViewScreenshotAcquiredProxyCallback(IntPtr data);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void WebViewHitTestFinishedProxyCallback(IntPtr data);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void WebViewResponsePolicyDecidedCallbackDelegate(IntPtr maker);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void WebViewCertificateReceivedCallbackDelegate(IntPtr certificate);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void WebViewHttpAuthRequestedCallbackDelegate(IntPtr handler);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void WebViewConsoleMessageReceivedCallbackDelegate(IntPtr message);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void WebViewContextMenuShownCallbackDelegate(IntPtr menu);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void WebViewContextMenuHiddenCallbackDelegate(IntPtr menu);
///
/// Event for the PageLoadStarted signal which can be used to subscribe or unsubscribe the event handler.
/// This signal is emitted when page loading has started.
///
/// 9
public event EventHandler PageLoadStarted
{
add
{
if (pageLoadStartedEventHandler == null)
{
pageLoadStartedCallback = OnPageLoadStarted;
IntPtr ip = Marshal.GetFunctionPointerForDelegate(pageLoadStartedCallback);
Interop.WebView.RegisterPageLoadStartedCallback(SwigCPtr, new HandleRef(this, ip));
}
pageLoadStartedEventHandler += value;
}
remove
{
pageLoadStartedEventHandler -= value;
}
}
///
/// Event for the PageLoading signal which can be used to subscribe or unsubscribe the event handler.
/// This signal is emitted when page loading is in progress.
///
/// 9
public event EventHandler PageLoading
{
add
{
if (pageLoadingEventHandler == null)
{
pageLoadingCallback = OnPageLoading;
IntPtr ip = Marshal.GetFunctionPointerForDelegate(pageLoadingCallback);
Interop.WebView.RegisterPageLoadInProgressCallback(SwigCPtr, new HandleRef(this, ip));
}
pageLoadingEventHandler += value;
}
remove
{
pageLoadingEventHandler -= value;
}
}
///
/// Event for the PageLoadFinished signal which can be used to subscribe or unsubscribe the event handler.
/// This signal is emitted when page loading has finished.
///
/// 9
public event EventHandler PageLoadFinished
{
add
{
if (pageLoadFinishedEventHandler == null)
{
pageLoadFinishedCallback = (OnPageLoadFinished);
IntPtr ip = Marshal.GetFunctionPointerForDelegate(pageLoadFinishedCallback);
Interop.WebView.RegisterPageLoadFinishedCallback(SwigCPtr, new HandleRef(this, ip));
}
pageLoadFinishedEventHandler += value;
}
remove
{
pageLoadFinishedEventHandler -= value;
}
}
///
/// Event for the PageLoadError signal which can be used to subscribe or unsubscribe the event handler.
/// This signal is emitted when there's an error in page loading.
///
/// 9
public event EventHandler PageLoadError
{
add
{
if (pageLoadErrorEventHandler == null)
{
pageLoadErrorCallback = OnPageLoadError;
IntPtr ip = Marshal.GetFunctionPointerForDelegate(pageLoadErrorCallback);
Interop.WebView.RegisterPageLoadErrorCallback(SwigCPtr, new HandleRef(this, ip));
}
pageLoadErrorEventHandler += value;
}
remove
{
pageLoadErrorEventHandler -= value;
}
}
///
/// Event for the ScrollEdgeReached signal which can be used to subscribe or unsubscribe the event handler.
/// This signal is emitted when web view is scrolled to edge.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public event EventHandler ScrollEdgeReached
{
add
{
if (scrollEdgeReachedEventHandler == null)
{
scrollEdgeReachedCallback = OnScrollEdgeReached;
IntPtr ip = Marshal.GetFunctionPointerForDelegate(scrollEdgeReachedCallback);
Interop.WebView.RegisterScrollEdgeReachedCallback(SwigCPtr, new HandleRef(this, ip));
}
scrollEdgeReachedEventHandler += value;
}
remove
{
scrollEdgeReachedEventHandler -= value;
}
}
///
/// Event for the UrlChanged signal which can be used to subscribe or unsubscribe the event handler.
/// This signal is emitted when url is changed.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public event EventHandler UrlChanged
{
add
{
if (urlChangedEventHandler == null)
{
urlChangedCallback = OnUrlChanged;
IntPtr ip = Marshal.GetFunctionPointerForDelegate(urlChangedCallback);
Interop.WebView.RegisterUrlChangedCallback(SwigCPtr, new HandleRef(this, ip));
}
urlChangedEventHandler += value;
}
remove
{
urlChangedEventHandler -= value;
}
}
///
/// Event for the FormRepostDecided signal which can be used to subscribe or unsubscribe the event handler.
/// This signal is emitted when form repost policy would be decided.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public event EventHandler FormRepostPolicyDecided
{
add
{
if (formRepostPolicyDecidedEventHandler == null)
{
formRepostPolicyDecidedCallback = OnFormRepostPolicyDecided;
IntPtr ip = Marshal.GetFunctionPointerForDelegate(formRepostPolicyDecidedCallback);
Interop.WebView.RegisterFormRepostDecidedCallback(SwigCPtr, new HandleRef(this, ip));
}
formRepostPolicyDecidedEventHandler += value;
}
remove
{
formRepostPolicyDecidedEventHandler -= value;
}
}
///
/// Event for the FrameRendered signal which can be used to subscribe or unsubscribe the event handler.
/// This signal is emitted when frame is rendered off-screen.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public event EventHandler FrameRendered
{
add
{
if (frameRenderedEventHandler == null)
{
frameRenderedCallback = OnFrameRendered;
IntPtr ip = Marshal.GetFunctionPointerForDelegate(frameRenderedCallback);
Interop.WebView.RegisterFrameRenderedCallback(SwigCPtr, new HandleRef(this, ip));
}
frameRenderedEventHandler += value;
}
remove
{
frameRenderedEventHandler -= value;
}
}
///
/// Event for the ResponsePolicyDecided signal which can be used to subscribe or unsubscribe the event handler.
/// This signal is emitted when response policy would be decided.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public event EventHandler ResponsePolicyDecided
{
add
{
if (responsePolicyDecidedEventHandler == null)
{
responsePolicyDecidedCallback = OnResponsePolicyDecided;
IntPtr ip = Marshal.GetFunctionPointerForDelegate(responsePolicyDecidedCallback);
Interop.WebView.RegisterResponsePolicyDecidedCallback(SwigCPtr, new HandleRef(this, ip));
}
responsePolicyDecidedEventHandler += value;
}
remove
{
responsePolicyDecidedEventHandler -= value;
}
}
///
/// Event for the CertificateConfirmed signal which can be used to subscribe or unsubscribe the event handler.
/// This signal is emitted when certificate would be confirmed.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public event EventHandler CertificateConfirmed
{
add
{
if (certificateConfirmedEventHandler == null)
{
certificateConfirmedCallback = OnCertificateConfirmed;
IntPtr ip = Marshal.GetFunctionPointerForDelegate(certificateConfirmedCallback);
Interop.WebView.RegisterCertificateConfirmedCallback(SwigCPtr, new HandleRef(this, ip));
}
certificateConfirmedEventHandler += value;
}
remove
{
certificateConfirmedEventHandler -= value;
}
}
///
/// Event for the SslCertificateChanged signal which can be used to subscribe or unsubscribe the event handler.
/// This signal is emitted when SSL certificate is changed.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public event EventHandler SslCertificateChanged
{
add
{
if (sslCertificateChangedEventHandler == null)
{
sslCertificateChangedCallback = OnSslCertificateChanged;
IntPtr ip = Marshal.GetFunctionPointerForDelegate(sslCertificateChangedCallback);
Interop.WebView.RegisterSslCertificateChangedCallback(SwigCPtr, new HandleRef(this, ip));
}
sslCertificateChangedEventHandler += value;
}
remove
{
sslCertificateChangedEventHandler -= value;
}
}
///
/// Event for the HttpAuthRequested signal which can be used to subscribe or unsubscribe the event handler.
/// This signal is emitted when http authentication is requested.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public event EventHandler HttpAuthRequested
{
add
{
if (httpAuthRequestedEventHandler == null)
{
httpAuthRequestedCallback = OnHttpAuthRequested;
IntPtr ip = Marshal.GetFunctionPointerForDelegate(httpAuthRequestedCallback);
Interop.WebView.RegisterHttpAuthHandlerCallback(SwigCPtr, new HandleRef(this, ip));
}
httpAuthRequestedEventHandler += value;
}
remove
{
httpAuthRequestedEventHandler -= value;
}
}
///
/// Event for the ConsoleMessageReceived signal which can be used to subscribe or unsubscribe the event handler.
/// This signal is emitted when console message is received.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public event EventHandler ConsoleMessageReceived
{
add
{
if (consoleMessageReceivedEventHandler == null)
{
consoleMessageReceivedCallback = OnConsoleMessageReceived;
IntPtr ip = Marshal.GetFunctionPointerForDelegate(consoleMessageReceivedCallback);
Interop.WebView.RegisterConsoleMessageReceivedCallback(SwigCPtr, new HandleRef(this, ip));
}
consoleMessageReceivedEventHandler += value;
}
remove
{
consoleMessageReceivedEventHandler -= value;
}
}
///
/// Event for the ContextMenuShown signal which can be used to subscribe or unsubscribe the event handler.
/// This signal is emitted when context menu is shown.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public event EventHandler ContextMenuShown
{
add
{
if (contextMenuShownEventHandler == null)
{
contextMenuShownCallback = OnContextMenuShown;
IntPtr ip = Marshal.GetFunctionPointerForDelegate(contextMenuShownCallback);
Interop.WebView.RegisterContextMenuShownCallback(SwigCPtr, new HandleRef(this, ip));
}
contextMenuShownEventHandler += value;
}
remove
{
contextMenuShownEventHandler -= value;
}
}
///
/// Event for the ContextMenuHidden signal which can be used to subscribe or unsubscribe the event handler.
/// This signal is emitted when context menu item is hidden.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public event EventHandler ContextMenuHidden
{
add
{
if (contextMenuHiddenEventHandler == null)
{
contextMenuHiddenCallback = OnContextMenuHidden;
IntPtr ip = Marshal.GetFunctionPointerForDelegate(contextMenuHiddenCallback);
Interop.WebView.RegisterContextMenuHiddenCallback(SwigCPtr, new HandleRef(this, ip));
}
contextMenuHiddenEventHandler += value;
}
remove
{
contextMenuHiddenEventHandler -= value;
}
}
///
/// Options for searching texts.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public enum FindOption
{
///
/// No search flags
///
[EditorBrowsable(EditorBrowsableState.Never)]
None = 0,
///
/// Case insensitive search
///
[EditorBrowsable(EditorBrowsableState.Never)]
CaseInsensitive = 1 << 0,
///
/// Search text only at the beginning of the words
///
[EditorBrowsable(EditorBrowsableState.Never)]
AtWordStart = 1 << 1,
///
/// Treat capital letters in the middle of words as word start
///
[EditorBrowsable(EditorBrowsableState.Never)]
TreatMediaCapitalAsWordStart = 1 << 2,
///
/// Search backwards
///
[EditorBrowsable(EditorBrowsableState.Never)]
Backwards = 1 << 3,
///
/// If not present the search stops at the end of the document
///
[EditorBrowsable(EditorBrowsableState.Never)]
WrapAround = 1 << 4,
///
/// Show overlay
///
[EditorBrowsable(EditorBrowsableState.Never)]
ShowOverlay = 1 << 5,
///
/// Show indicator
///
[EditorBrowsable(EditorBrowsableState.Never)]
ShowFindIndiator = 1 << 6,
///
/// Show highlight
///
[EditorBrowsable(EditorBrowsableState.Never)]
ShowHighlight = 1 << 7,
}
///
/// Enumeration for mode of hit test.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public enum HitTestMode
{
///
/// Link data
///
[EditorBrowsable(EditorBrowsableState.Never)]
Default = 1 << 1,
///
/// Extra node data(tag name, node value, attribute infomation, etc).
///
[EditorBrowsable(EditorBrowsableState.Never)]
NodeData = 1 << 2,
///
/// Extra image data(image data, image data length, image file name exteionsion, etc).
///
[EditorBrowsable(EditorBrowsableState.Never)]
ImageData = 1 << 3,
///
/// All data
///
[EditorBrowsable(EditorBrowsableState.Never)]
All = Default | NodeData | ImageData,
}
///
/// BackForwardList.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public WebBackForwardList BackForwardList { get; }
///
/// Context.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public WebContext Context { get; }
///
/// CookieManager.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public WebCookieManager CookieManager { get; }
///
/// BackForwardList.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public WebSettings Settings { get; }
///
/// The URL to load.
///
/// 9
public string Url
{
get
{
return (string)GetValue(UrlProperty);
}
set
{
SetValue(UrlProperty, value);
NotifyPropertyChanged();
}
}
///
/// Deprecated. The cache model of the current WebView.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public CacheModel CacheModel
{
get
{
return (CacheModel)GetValue(CacheModelProperty);
}
set
{
SetValue(CacheModelProperty, value);
NotifyPropertyChanged();
}
}
private CacheModel InternalCacheModel
{
get
{
return (CacheModel)Context.CacheModel;
}
set
{
Context.CacheModel = (WebContext.CacheModelType)value;
}
}
///
/// Deprecated. The cookie acceptance policy.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public CookieAcceptPolicy CookieAcceptPolicy
{
get
{
return (CookieAcceptPolicy)GetValue(CookieAcceptPolicyProperty);
}
set
{
SetValue(CookieAcceptPolicyProperty, value);
NotifyPropertyChanged();
}
}
private CookieAcceptPolicy InternalCookieAcceptPolicy
{
get
{
return (CookieAcceptPolicy)CookieManager.CookieAcceptPolicy;
}
set
{
CookieManager.CookieAcceptPolicy = (WebCookieManager.CookieAcceptPolicyType)value;
}
}
///
/// The user agent string.
///
/// 9
public string UserAgent
{
get
{
return (string)GetValue(UserAgentProperty);
}
set
{
SetValue(UserAgentProperty, value);
NotifyPropertyChanged();
}
}
///
/// Deprecated. Whether JavaScript is enabled.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public bool EnableJavaScript
{
get
{
return (bool)GetValue(EnableJavaScriptProperty);
}
set
{
SetValue(EnableJavaScriptProperty, value);
NotifyPropertyChanged();
}
}
private bool InternalEnableJavaScript
{
get
{
return Settings.JavaScriptEnabled;
}
set
{
Settings.JavaScriptEnabled = value;
}
}
///
/// Deprecated. Whether images can be loaded automatically.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public bool LoadImagesAutomatically
{
get
{
return (bool)GetValue(LoadImagesAutomaticallyProperty);
}
set
{
SetValue(LoadImagesAutomaticallyProperty, value);
NotifyPropertyChanged();
}
}
private bool InternalLoadImagesAutomatically
{
get
{
return Settings.AutomaticImageLoadingAllowed;
}
set
{
Settings.AutomaticImageLoadingAllowed = value;
}
}
///
/// The default text encoding name.
/// e.g. "UTF-8"
///
[EditorBrowsable(EditorBrowsableState.Never)]
public string DefaultTextEncodingName
{
get
{
return GetValue(DefaultTextEncodingNameProperty) as string;
}
set
{
SetValue(DefaultTextEncodingNameProperty, value);
NotifyPropertyChanged();
}
}
private string InternalDefaultTextEncodingName
{
get
{
return Settings.DefaultTextEncodingName;
}
set
{
Settings.DefaultTextEncodingName = value;
}
}
///
/// The default font size in pixel.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public int DefaultFontSize
{
get
{
return (int)GetValue(DefaultFontSizeProperty);
}
set
{
SetValue(DefaultFontSizeProperty, value);
NotifyPropertyChanged();
}
}
private int InternalDefaultFontSize
{
get
{
return Settings.DefaultFontSize;
}
set
{
Settings.DefaultFontSize = value;
}
}
///
/// The position of scroll.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public Position ScrollPosition
{
get
{
return GetValue(ScrollPositionProperty) as Position;
}
set
{
SetValue(ScrollPositionProperty, value);
}
}
private Position InternalScrollPosition
{
get
{
Vector2 pv = (Vector2)GetValue(ScrollPositionProperty);
return new Position(pv.X, pv.Y);
}
set
{
if (value != null)
{
Position pv = value;
Vector2 vpv = new Vector2(pv.X, pv.Y);
SetValue(ScrollPositionProperty, vpv);
NotifyPropertyChanged();
}
}
}
///
/// The size of scroll, read-only.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public Size ScrollSize
{
get
{
Vector2 sv = (Vector2)GetValue(ScrollSizeProperty);
return new Size(sv.Width, sv.Height);
}
}
///
/// The size of content, read-only.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public Size ContentSize
{
get
{
Vector2 sv = (Vector2)GetValue(ContentSizeProperty);
return new Size(sv.Width, sv.Height);
}
}
///
/// Whether video hole is enabled or not.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public bool VideoHoleEnabled
{
get
{
return (bool)GetValue(VideoHoleEnabledProperty);
}
set
{
SetValue(VideoHoleEnabledProperty, value);
NotifyPropertyChanged();
}
}
///
/// Whether mouse events are enabled or not.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public bool MouseEventsEnabled
{
get
{
return (bool)GetValue(MouseEventsEnabledProperty);
}
set
{
SetValue(MouseEventsEnabledProperty, value);
NotifyPropertyChanged();
}
}
///
/// Whether key events are enabled or not.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public bool KeyEventsEnabled
{
get
{
return (bool)GetValue(KeyEventsEnabledProperty);
}
set
{
SetValue(KeyEventsEnabledProperty, value);
NotifyPropertyChanged();
}
}
///
/// Background color of web page.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public Color ContentBackgroundColor
{
get
{
return (Color)GetValue(ContentBackgroundColorProperty);
}
set
{
SetValue(ContentBackgroundColorProperty, value);
NotifyPropertyChanged();
}
}
///
/// Whether tiles are cleared or not when hidden.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public bool TilesClearedWhenHidden
{
get
{
return (bool)GetValue(TilesClearedWhenHiddenProperty);
}
set
{
SetValue(TilesClearedWhenHiddenProperty, value);
NotifyPropertyChanged();
}
}
///
/// Multiplier of cover area of tile when web page is rendered.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public float TileCoverAreaMultiplier
{
get
{
return (float)GetValue(TileCoverAreaMultiplierProperty);
}
set
{
SetValue(TileCoverAreaMultiplierProperty, value);
NotifyPropertyChanged();
}
}
///
/// Whether cursor is enabled or not by client.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public bool CursorEnabledByClient
{
get
{
return (bool)GetValue(CursorEnabledByClientProperty);
}
set
{
SetValue(CursorEnabledByClientProperty, value);
NotifyPropertyChanged();
}
}
///
/// Gets selected text in web page.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public string SelectedText
{
get
{
return (string)GetValue(SelectedTextProperty);
}
}
///
/// Gets title of web page.
///
/// 9
public string Title
{
get
{
return (string)GetValue(TitleProperty);
}
}
///
/// Gets favicon of web page.
///
/// 9
public ImageView Favicon
{
get
{
global::System.IntPtr imageView = Interop.WebView.GetFavicon(SwigCPtr);
if (imageView == IntPtr.Zero)
return null;
return new ImageView(imageView, false);
}
}
///
/// Zoom factor of web page.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public float PageZoomFactor
{
get
{
return (float)GetValue(PageZoomFactorProperty);
}
set
{
SetValue(PageZoomFactorProperty, value);
NotifyPropertyChanged();
}
}
///
/// Zoom factor of text in web page.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public float TextZoomFactor
{
get
{
return (float)GetValue(TextZoomFactorProperty);
}
set
{
SetValue(TextZoomFactorProperty, value);
NotifyPropertyChanged();
}
}
///
/// Gets percentage of loading progress.
///
/// 9
public float LoadProgressPercentage
{
get
{
return (float)GetValue(LoadProgressPercentageProperty);
}
}
internal static new class Property
{
internal static readonly int Url = Interop.WebView.UrlGet();
internal static readonly int UserAgent = Interop.WebView.UserAgentGet();
internal static readonly int ScrollPosition = Interop.WebView.ScrollPositionGet();
internal static readonly int ScrollSize = Interop.WebView.ScrollSizeGet();
internal static readonly int ContentSize = Interop.WebView.ContentSizeGet();
internal static readonly int Title = Interop.WebView.TitleGet();
internal static readonly int VideoHoleEnabled = Interop.WebView.VideoHoleEnabledGet();
internal static readonly int MouseEventsEnabled = Interop.WebView.MouseEventsEnabledGet();
internal static readonly int KeyEventsEnabled = Interop.WebView.KeyEventsEnabledGet();
internal static readonly int DocumentBackgroundColor = Interop.WebView.DocumentBackgroundColorGet();
internal static readonly int TilesClearedWhenHidden = Interop.WebView.TilesClearedWhenHiddenGet();
internal static readonly int TileCoverAreaMultiplier = Interop.WebView.TileCoverAreaMultiplierGet();
internal static readonly int CursorEnabledByClient = Interop.WebView.CursorEnabledByClientGet();
internal static readonly int SelectedText = Interop.WebView.SelectedTextGet();
internal static readonly int PageZoomFactor = Interop.WebView.PageZoomFactorGet();
internal static readonly int TextZoomFactor = Interop.WebView.TextZoomFactorGet();
internal static readonly int LoadProgressPercentage = Interop.WebView.LoadProgressPercentageGet();
}
private static readonly BindableProperty UrlProperty = BindableProperty.Create(nameof(Url), typeof(string), typeof(WebView), string.Empty, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) =>
{
var webview = (WebView)bindable;
if (newValue != null)
{
Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.Url, new Tizen.NUI.PropertyValue((string)newValue));
}
}),
defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
{
var webview = (WebView)bindable;
string temp;
Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.Url).Get(out temp);
return temp;
}));
private static readonly BindableProperty UserAgentProperty = BindableProperty.Create(nameof(UserAgent), typeof(string), typeof(WebView), string.Empty, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) =>
{
var webview = (WebView)bindable;
if (newValue != null)
{
Tizen.NUI.Object.SetProperty((HandleRef)webview.SwigCPtr, WebView.Property.UserAgent, new Tizen.NUI.PropertyValue((string)newValue));
}
}),
defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
{
var webview = (WebView)bindable;
string temp;
Tizen.NUI.Object.GetProperty((HandleRef)webview.SwigCPtr, WebView.Property.UserAgent).Get(out temp);
return temp;
}));
private static readonly BindableProperty ScrollPositionProperty = BindableProperty.Create(nameof(ScrollPosition), typeof(Vector2), typeof(WebView), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var webview = (WebView)bindable;
if (newValue != null)
{
Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.ScrollPosition, new Tizen.NUI.PropertyValue((Vector2)newValue));
}
},
defaultValueCreator: (bindable) =>
{
var webview = (WebView)bindable;
Vector2 temp = new Vector2(0.0f, 0.0f);
Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.ScrollPosition).Get(temp);
return temp;
});
private static readonly BindableProperty ScrollSizeProperty = BindableProperty.Create(nameof(ScrollSize), typeof(Vector2), typeof(WebView), null, defaultValueCreator: (bindable) =>
{
var webview = (WebView)bindable;
Vector2 temp = new Vector2(0.0f, 0.0f);
Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.ScrollSize).Get(temp);
return temp;
});
private static readonly BindableProperty ContentSizeProperty = BindableProperty.Create(nameof(ContentSize), typeof(Vector2), typeof(WebView), null, defaultValueCreator: (bindable) =>
{
var webview = (WebView)bindable;
Vector2 temp = new Vector2(0.0f, 0.0f);
Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.ContentSize).Get(temp);
return temp;
});
private static readonly BindableProperty TitleProperty = BindableProperty.Create(nameof(Title), typeof(string), typeof(WebView), string.Empty, defaultValueCreator: (bindable) =>
{
var webview = (WebView)bindable;
string title;
Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.Title).Get(out title);
return title;
});
private static readonly BindableProperty VideoHoleEnabledProperty = BindableProperty.Create(nameof(VideoHoleEnabled), typeof(bool), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
{
var webview = (WebView)bindable;
if (newValue != null)
{
Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.VideoHoleEnabled, new Tizen.NUI.PropertyValue((bool)newValue));
}
},
defaultValueCreator: (bindable) =>
{
var webview = (WebView)bindable;
bool temp;
Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.VideoHoleEnabled).Get(out temp);
return temp;
});
private static readonly BindableProperty MouseEventsEnabledProperty = BindableProperty.Create(nameof(MouseEventsEnabled), typeof(bool), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
{
var webview = (WebView)bindable;
if (newValue != null)
{
Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.MouseEventsEnabled, new Tizen.NUI.PropertyValue((bool)newValue));
}
},
defaultValueCreator: (bindable) =>
{
var webview = (WebView)bindable;
bool temp;
Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.MouseEventsEnabled).Get(out temp);
return temp;
});
private static readonly BindableProperty KeyEventsEnabledProperty = BindableProperty.Create(nameof(KeyEventsEnabled), typeof(bool), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
{
var webview = (WebView)bindable;
if (newValue != null)
{
Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.KeyEventsEnabled, new Tizen.NUI.PropertyValue((bool)newValue));
}
},
defaultValueCreator: (bindable) =>
{
var webview = (WebView)bindable;
bool temp;
Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.KeyEventsEnabled).Get(out temp);
return temp;
});
private static readonly BindableProperty ContentBackgroundColorProperty = BindableProperty.Create(nameof(ContentBackgroundColor), typeof(Color), typeof(WebView), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var webview = (WebView)bindable;
if (newValue != null)
{
webview.contentBackgroundColor = (Color)newValue;
Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.DocumentBackgroundColor, new Tizen.NUI.PropertyValue((Color)newValue));
}
},
defaultValueCreator: (bindable) =>
{
var webview = (WebView)bindable;
return webview.contentBackgroundColor;
});
private static readonly BindableProperty TilesClearedWhenHiddenProperty = BindableProperty.Create(nameof(TilesClearedWhenHidden), typeof(bool), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
{
var webview = (WebView)bindable;
if (newValue != null)
{
webview.tilesClearedWhenHidden = (bool)newValue;
Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.TilesClearedWhenHidden, new Tizen.NUI.PropertyValue((bool)newValue));
}
},
defaultValueCreator: (bindable) =>
{
var webview = (WebView)bindable;
return webview.tilesClearedWhenHidden;
});
private static readonly BindableProperty TileCoverAreaMultiplierProperty = BindableProperty.Create(nameof(TileCoverAreaMultiplier), typeof(float), typeof(WebView), 0.0f, propertyChanged: (bindable, oldValue, newValue) =>
{
var webview = (WebView)bindable;
if (newValue != null)
{
webview.tileCoverAreaMultiplier = (float)newValue;
Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.TileCoverAreaMultiplier, new Tizen.NUI.PropertyValue((float)newValue));
}
},
defaultValueCreator: (bindable) =>
{
var webview = (WebView)bindable;
return webview.tileCoverAreaMultiplier;
});
private static readonly BindableProperty CursorEnabledByClientProperty = BindableProperty.Create(nameof(CursorEnabledByClient), typeof(bool), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
{
var webview = (WebView)bindable;
if (newValue != null)
{
webview.cursorEnabledByClient = (bool)newValue;
Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.CursorEnabledByClient, new Tizen.NUI.PropertyValue((bool)newValue));
}
},
defaultValueCreator: (bindable) =>
{
var webview = (WebView)bindable;
return webview.cursorEnabledByClient;
});
private static readonly BindableProperty SelectedTextProperty = BindableProperty.Create(nameof(SelectedText), typeof(string), typeof(WebView), string.Empty, defaultValueCreator: (bindable) =>
{
var webview = (WebView)bindable;
string text;
Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.SelectedText).Get(out text);
return text;
});
private static readonly BindableProperty PageZoomFactorProperty = BindableProperty.Create(nameof(PageZoomFactor), typeof(float), typeof(WebView), 0.0f, propertyChanged: (bindable, oldValue, newValue) =>
{
var webview = (WebView)bindable;
if (newValue != null)
{
Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.PageZoomFactor, new Tizen.NUI.PropertyValue((float)newValue));
}
},
defaultValueCreator: (bindable) =>
{
var webview = (WebView)bindable;
float temp;
Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.PageZoomFactor).Get(out temp);
return temp;
});
private static readonly BindableProperty TextZoomFactorProperty = BindableProperty.Create(nameof(TextZoomFactor), typeof(float), typeof(WebView), 0.0f, propertyChanged: (bindable, oldValue, newValue) =>
{
var webview = (WebView)bindable;
if (newValue != null)
{
Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.TextZoomFactor, new Tizen.NUI.PropertyValue((float)newValue));
}
},
defaultValueCreator: (bindable) =>
{
var webview = (WebView)bindable;
float temp;
Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.TextZoomFactor).Get(out temp);
return temp;
});
private static readonly BindableProperty LoadProgressPercentageProperty = BindableProperty.Create(nameof(LoadProgressPercentage), typeof(float), typeof(WebView), 0.0f, defaultValueCreator: (bindable) =>
{
var webview = (WebView)bindable;
float percentage;
Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.LoadProgressPercentage).Get(out percentage);
return percentage;
});
// For rooting handlers
internal Dictionary handlerRootMap = new Dictionary();
///
/// Loads a html.
///
/// The path of Web
///
/// The following privileges are required:
/// http://tizen.org/privilege/internet for remote web pages of websites.
/// http://tizen.org/privilege/mediastorage for local files in media storage.
/// http://tizen.org/privilege/externalstorage for local files in external storage.
///
/// 9
public void LoadUrl(string url)
{
Interop.WebView.LoadUrl(SwigCPtr, url);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Deprecated. Loads a html by string.
///
/// The data of Web
[EditorBrowsable(EditorBrowsableState.Never)]
public void LoadHTMLString(string data)
{
Interop.WebView.LoadHtmlString(SwigCPtr, data);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Loads a html by string.
///
/// The data of Web
/// 9
public void LoadHtmlString(string data)
{
Interop.WebView.LoadHtmlString(SwigCPtr, data);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Loads the specified html as the content of the view to override current history entry.
///
/// The html to be loaded
/// Base URL used for relative paths to external objects
/// URL that could not be reached
[EditorBrowsable(EditorBrowsableState.Never)]
public bool LoadHtmlStringOverrideCurrentEntry(string html, string baseUri, string unreachableUri)
{
bool result = Interop.WebView.LoadHtmlStringOverrideCurrentEntry(SwigCPtr, html, baseUri, unreachableUri);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return result;
}
///
/// Requests to load the given contents by MIME type.
///
/// The contents to be loaded
/// The size of contents (in bytes)
/// The type of contents, "text/html" is assumed if null
/// The encoding for contents, "UTF-8" is assumed if null
/// The base URI to use for relative resources
[EditorBrowsable(EditorBrowsableState.Never)]
public bool LoadContents(string contents, uint contentSize, string mimeType, string encoding, string baseUri)
{
bool result = Interop.WebView.LoadContents(SwigCPtr, contents, contentSize, mimeType, encoding, baseUri);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return result;
}
///
/// Reloads the Web
///
[EditorBrowsable(EditorBrowsableState.Never)]
public void Reload()
{
Interop.WebView.Reload(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Reloads the current page's document without cache
///
[EditorBrowsable(EditorBrowsableState.Never)]
public bool ReloadWithoutCache()
{
bool result = Interop.WebView.ReloadWithoutCache(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return result;
}
///
/// Stops loading the Web
///
[EditorBrowsable(EditorBrowsableState.Never)]
public void StopLoading()
{
Interop.WebView.StopLoading(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Suspends the operation.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public void Suspend()
{
Interop.WebView.Suspend(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Resumes the operation after calling Suspend()
///
[EditorBrowsable(EditorBrowsableState.Never)]
public void Resume()
{
Interop.WebView.Resume(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Suspends all network loading.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public void SuspendNetworkLoading()
{
Interop.WebView.SuspendNetworkLoading(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Resumes all network loading.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public void ResumeNetworkLoading()
{
Interop.WebView.ResumeNetworkLoading(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Adds custom header.
///
/// The name of custom header
/// The value of custom header
[EditorBrowsable(EditorBrowsableState.Never)]
public bool AddCustomHeader(string name, string value)
{
bool result = Interop.WebView.AddCustomHeader(SwigCPtr, name, value);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return result;
}
///
/// Removes custom header.
///
/// The name of custom header
[EditorBrowsable(EditorBrowsableState.Never)]
public bool RemoveCustomHeader(string name)
{
bool result = Interop.WebView.RemoveCustomHeader(SwigCPtr, name);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return result;
}
///
/// Starts the inspector server.
///
/// The port number
[EditorBrowsable(EditorBrowsableState.Never)]
public uint StartInspectorServer(uint port)
{
uint result = Interop.WebView.StartInspectorServer(SwigCPtr, port);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return result;
}
///
/// Stops the inspector server.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public bool StopInspectorServer()
{
bool result = Interop.WebView.StopInspectorServer(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return result;
}
///
/// Scrolls page of web view by deltaX and detlaY.
///
/// The deltaX of scroll
/// The deltaY of scroll
[EditorBrowsable(EditorBrowsableState.Never)]
public void ScrollBy(int deltaX, int deltaY)
{
Interop.WebView.ScrollBy(SwigCPtr, deltaX, deltaY);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Scrolls edge of web view by deltaX and deltaY.
///
/// The deltaX of scroll
/// The deltaY of scroll
[EditorBrowsable(EditorBrowsableState.Never)]
public bool ScrollEdgeBy(int deltaX, int deltaY)
{
bool result = Interop.WebView.ScrollEdgeBy(SwigCPtr, deltaX, deltaY);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return result;
}
///
/// Goes to the back
///
[EditorBrowsable(EditorBrowsableState.Never)]
public void GoBack()
{
Interop.WebView.GoBack(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Goes to the forward
///
[EditorBrowsable(EditorBrowsableState.Never)]
public void GoForward()
{
Interop.WebView.GoForward(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Returns whether backward is possible.
///
/// True if backward is possible, false otherwise
[EditorBrowsable(EditorBrowsableState.Never)]
public bool CanGoBack()
{
bool ret = Interop.WebView.CanGoBack(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Returns whether forward is possible.
///
/// True if forward is possible, false otherwise
[EditorBrowsable(EditorBrowsableState.Never)]
public bool CanGoForward()
{
bool ret = Interop.WebView.CanGoForward(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Evaluates JavaScript code represented as a string.
///
/// The JavaScript code
[EditorBrowsable(EditorBrowsableState.Never)]
public void EvaluateJavaScript(string script)
{
Interop.WebView.EvaluateJavaScript(SwigCPtr, script, new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Add a message handler into the WebView.
///
/// The name of exposed object
/// The callback function
[EditorBrowsable(EditorBrowsableState.Never)]
public void AddJavaScriptMessageHandler(string objectName, JavaScriptMessageHandler handler)
{
if (handlerRootMap.ContainsKey(objectName))
{
return;
}
handlerRootMap.Add(objectName, handler);
System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(handler);
Interop.WebView.AddJavaScriptMessageHandler(SwigCPtr, objectName, new System.Runtime.InteropServices.HandleRef(this, ip));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Registers a callback for JS alert.
///
/// The callback function
[EditorBrowsable(EditorBrowsableState.Never)]
public void RegisterJavaScriptAlertCallback(JavaScriptAlertCallback callback)
{
System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(callback);
Interop.WebView.RegisterJavaScriptAlertCallback(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Reply for alert popup.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public void JavaScriptAlertReply()
{
Interop.WebView.JavaScriptAlertReply(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Registers a callback for JS confirm.
///
/// The callback function
[EditorBrowsable(EditorBrowsableState.Never)]
public void RegisterJavaScriptConfirmCallback(JavaScriptConfirmCallback callback)
{
System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(callback);
Interop.WebView.RegisterJavaScriptConfirmCallback(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Reply for confirm popup.
///
/// Confirmed or not
[EditorBrowsable(EditorBrowsableState.Never)]
public void JavaScriptConfirmReply(bool confirmed)
{
Interop.WebView.JavaScriptConfirmReply(SwigCPtr, confirmed);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Registers a callback for JS promt.
///
/// The callback function
[EditorBrowsable(EditorBrowsableState.Never)]
public void RegisterJavaScriptPromptCallback(JavaScriptPromptCallback callback)
{
System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(callback);
Interop.WebView.RegisterJavaScriptPromptCallback(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Reply for prompt popup.
///
/// Text in prompt input field.
[EditorBrowsable(EditorBrowsableState.Never)]
public void JavaScriptPromptReply(string result)
{
Interop.WebView.JavaScriptPromptReply(SwigCPtr, result);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Clears title resources of current WebView.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public void ClearAllTilesResources()
{
Interop.WebView.ClearAllTilesResources(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Clears the history of current WebView.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public void ClearHistory()
{
Interop.WebView.ClearHistory(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Scales the current page, centered at the given point.
///
/// The new factor to be scaled
/// The center coordinate
[EditorBrowsable(EditorBrowsableState.Never)]
public void SetScaleFactor(float scaleFactor, Vector2 point)
{
Interop.WebView.SetScaleFactor(SwigCPtr, scaleFactor, Vector2.getCPtr(point));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Gets the current scale factor of the page.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public float GetScaleFactor()
{
float result = Interop.WebView.GetScaleFactor(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return result;
}
///
/// Requests to activate/deactivate the accessibility usage set by web app.
///
/// The new factor to be scaled
[EditorBrowsable(EditorBrowsableState.Never)]
public void ActivateAccessibility(bool activated)
{
Interop.WebView.ActivateAccessibility(SwigCPtr, activated);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Searches and highlights the given string in the document.
///
/// The text to be searched
/// The options to search
/// The maximum match count to search
[EditorBrowsable(EditorBrowsableState.Never)]
public bool HighlightText(string text, FindOption options, uint maxMatchCount)
{
bool result = Interop.WebView.HighlightText(SwigCPtr, text, (int)options, maxMatchCount);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return result;
}
///
/// Adds dynamic certificate path.
///
/// Host that required client authentication
/// The file path stored certificate
[EditorBrowsable(EditorBrowsableState.Never)]
public void AddDynamicCertificatePath(string host, string certPath)
{
Interop.WebView.AddDynamicCertificatePath(SwigCPtr, host, certPath);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Get snapshot of the specified viewArea of page.
///
/// Host that required client authentication
/// The file path stored certificate
[EditorBrowsable(EditorBrowsableState.Never)]
public ImageView GetScreenshot(Rectangle viewArea, float scaleFactor)
{
IntPtr image = Interop.WebView.GetScreenshot(SwigCPtr, Rectangle.getCPtr(viewArea), scaleFactor);
ImageView imageView = new ImageView(image, true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return imageView;
}
///
/// Get snapshot of the specified viewArea of page.
///
/// Host that required client authentication
/// The file path stored certificate
/// The callback for getting screen shot
[EditorBrowsable(EditorBrowsableState.Never)]
public bool GetScreenshotAsynchronously(Rectangle viewArea, float scaleFactor, ScreenshotAcquiredCallback callback)
{
screenshotAcquiredCallback = callback;
System.IntPtr ip = Marshal.GetFunctionPointerForDelegate(screenshotAcquiredProxyCallback);
bool result = Interop.WebView.GetScreenshotAsynchronously(SwigCPtr, Rectangle.getCPtr(viewArea), scaleFactor, new HandleRef(this, ip));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return result;
}
///
/// Asynchronously requests to check if there is a video playing in the given view.
///
/// The callback called after checking if video is playing or not
[EditorBrowsable(EditorBrowsableState.Never)]
public bool CheckVideoPlayingAsynchronously(VideoPlayingCallback callback)
{
System.IntPtr ip = Marshal.GetFunctionPointerForDelegate(callback);
bool result = Interop.WebView.CheckVideoPlayingAsynchronously(SwigCPtr, new HandleRef(this, ip));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return result;
}
///
/// Registers callback which will be called upon geolocation permission request.
///
/// The callback for requesting geolocation permission
[EditorBrowsable(EditorBrowsableState.Never)]
public void RegisterGeolocationPermissionCallback(GeolocationPermissionCallback callback)
{
System.IntPtr ip = Marshal.GetFunctionPointerForDelegate(callback);
Interop.WebView.RegisterGeolocationPermissionCallback(SwigCPtr, new HandleRef(this, ip));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Does hit test synchronously.
///
/// the horizontal position to query
/// the vertical position to query
/// the mode of hit test
[EditorBrowsable(EditorBrowsableState.Never)]
public WebHitTestResult HitTest(int x, int y, HitTestMode mode)
{
System.IntPtr result = Interop.WebView.CreateHitTest(SwigCPtr, x, y, (int)mode);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return new WebHitTestResult(result, true);
}
///
/// Does hit test asynchronously.
///
/// the horizontal position to query
/// the vertical position to query
/// the mode of hit test
/// the callback that is called after hit test is finished.
[EditorBrowsable(EditorBrowsableState.Never)]
public bool HitTestAsynchronously(int x, int y, HitTestMode mode, HitTestFinishedCallback callback)
{
hitTestFinishedCallback = callback;
System.IntPtr ip = Marshal.GetFunctionPointerForDelegate(hitTestFinishedProxyCallback);
bool result = Interop.WebView.CreateHitTestAsynchronously(SwigCPtr, x, y, (int)mode, new HandleRef(this, ip));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return result;
}
///
/// Deprecated. Clears the cache of current WebView.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public void ClearCache()
{
Context.ClearCache();
}
///
/// Deprecated. Clears all the cookies of current WebView.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public void ClearCookies()
{
CookieManager.ClearCookies();
}
///
/// Sets the tts focus to the webview.
/// Please note that it only works when the webview does not have keyinput focus.
/// If the webview has a keyinput focus, it also has tts focus so calling SetTtsFocus(false) is ignored.
///
/// Focused or not
[EditorBrowsable(EditorBrowsableState.Never)]
public void SetTtsFocus(bool focused)
{
Interop.WebView.SetTtsFocus(SwigCPtr, focused);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Get a plain text of current web page asynchronously.
/// Please note that it gets plain text of currently loaded page so please call this method after page load finished.
///
/// The callback for getting plain text
[EditorBrowsable(EditorBrowsableState.Never)]
public void GetPlainTextAsynchronously(PlainTextReceivedCallback callback)
{
plainTextReceivedCallback = callback;
System.IntPtr ip = Marshal.GetFunctionPointerForDelegate(plainTextReceivedCallback);
Interop.WebView.GetPlainTextAsynchronously(SwigCPtr, new HandleRef(this, ip));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal static WebView DownCast(BaseHandle handle)
{
WebView ret = new WebView(Interop.WebView.DownCast(BaseHandle.getCPtr(handle)), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal WebView Assign(WebView webView)
{
WebView ret = new WebView(Interop.WebView.Assign(SwigCPtr, WebView.getCPtr(webView)), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
private void OnPageLoadStarted(string pageUrl)
{
WebViewPageLoadEventArgs e = new WebViewPageLoadEventArgs();
e.WebView = this;
e.PageUrl = pageUrl;
pageLoadStartedEventHandler?.Invoke(this, e);
}
private void OnPageLoading(string pageUrl)
{
pageLoadingEventHandler?.Invoke(this, new WebViewPageLoadEventArgs());
}
private void OnPageLoadFinished(string pageUrl)
{
WebViewPageLoadEventArgs e = new WebViewPageLoadEventArgs();
e.WebView = this;
e.PageUrl = pageUrl;
pageLoadFinishedEventHandler?.Invoke(this, e);
}
private void OnPageLoadError(IntPtr error)
{
pageLoadErrorEventHandler?.Invoke(this, new WebViewPageLoadErrorEventArgs(new WebPageLoadError(error, true)));
}
private void OnScrollEdgeReached(int edge)
{
scrollEdgeReachedEventHandler?.Invoke(this, new WebViewScrollEdgeReachedEventArgs((WebViewScrollEdgeReachedEventArgs.Edge)edge));
}
private void OnUrlChanged(string pageUrl)
{
urlChangedEventHandler?.Invoke(this, new WebViewUrlChangedEventArgs(pageUrl));
}
private void OnFormRepostPolicyDecided(IntPtr decision)
{
formRepostPolicyDecidedEventHandler?.Invoke(this, new WebViewFormRepostPolicyDecidedEventArgs(new WebFormRepostPolicyDecisionMaker(decision, true)));
}
private void OnFrameRendered()
{
frameRenderedEventHandler?.Invoke(this, new EventArgs());
}
private void OnScreenshotAcquired(IntPtr data)
{
#pragma warning disable CA2000 // Dispose objects before losing scope
screenshotAcquiredCallback?.Invoke(new ImageView(data, true));
#pragma warning restore CA2000 // Dispose objects before losing scope
}
private void OnResponsePolicyDecided(IntPtr maker)
{
responsePolicyDecidedEventHandler?.Invoke(this, new WebViewResponsePolicyDecidedEventArgs(new WebPolicyDecisionMaker(maker, true)));
}
private void OnCertificateConfirmed(IntPtr certificate)
{
certificateConfirmedEventHandler?.Invoke(this, new WebViewCertificateReceivedEventArgs(new WebCertificate(certificate, true)));
}
private void OnSslCertificateChanged(IntPtr certificate)
{
sslCertificateChangedEventHandler?.Invoke(this, new WebViewCertificateReceivedEventArgs(new WebCertificate(certificate, true)));
}
private void OnHttpAuthRequested(IntPtr handler)
{
httpAuthRequestedEventHandler?.Invoke(this, new WebViewHttpAuthRequestedEventArgs(new WebHttpAuthHandler(handler, true)));
}
private void OnConsoleMessageReceived(IntPtr message)
{
consoleMessageReceivedEventHandler?.Invoke(this, new WebViewConsoleMessageReceivedEventArgs(new WebConsoleMessage(message, true)));
}
private void OnContextMenuShown(IntPtr menu)
{
contextMenuShownEventHandler?.Invoke(this, new WebViewContextMenuShownEventArgs(new WebContextMenu(menu, true)));
}
private void OnContextMenuHidden(IntPtr menu)
{
contextMenuHiddenEventHandler?.Invoke(this, new WebViewContextMenuHiddenEventArgs(new WebContextMenu(menu, true)));
}
private void OnHitTestFinished(IntPtr test)
{
#pragma warning disable CA2000 // Dispose objects before losing scope
hitTestFinishedCallback?.Invoke(new WebHitTestResult(test, true));
#pragma warning restore CA2000 // Dispose objects before losing scope
}
}
}