/*
* 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.BaseComponents;
using Tizen.NUI.Binding;
namespace Tizen.NUI
{
///
/// WebView
///
[EditorBrowsable(EditorBrowsableState.Never)]
public class WebView : View
{
private Vector4 contentBackgroundColor;
private bool tilesClearedWhenHidden;
private float tileCoverAreaMultiplier;
private bool cursorEnabledByClient;
private readonly WebViewPageLoadSignal pageLoadStartedSignal;
private EventHandler pageLoadStartedEventHandler;
private WebViewPageLoadCallbackDelegate pageLoadStartedCallback;
private readonly WebViewPageLoadSignal pageLoadingSignal;
private EventHandler pageLoadingEventHandler;
private WebViewPageLoadCallbackDelegate pageLoadingCallback;
private readonly WebViewPageLoadSignal pageLoadFinishedSignal;
private EventHandler pageLoadFinishedEventHandler;
private WebViewPageLoadCallbackDelegate pageLoadFinishedCallback;
private readonly WebViewPageLoadErrorSignal pageLoadErrorSignal;
private EventHandler pageLoadErrorEventHandler;
private WebViewPageLoadErrorCallbackDelegate pageLoadErrorCallback;
private readonly WebViewScrollEdgeReachedSignal scrollEdgeReachedSignal;
private EventHandler scrollEdgeReachedEventHandler;
private WebViewScrollEdgeReachedCallbackDelegate scrollEdgeReachedCallback;
private readonly WebViewUrlChangedSignal urlChangedSignal;
private EventHandler urlChangedEventHandler;
private WebViewUrlChangedCallbackDelegate urlChangedCallback;
private readonly WebViewFormRepostDecidedSignal formRepostPolicyDecidedSignal;
private EventHandler formRepostPolicyDecidedEventHandler;
private WebViewFormRepostPolicyDecidedCallbackDelegate formRepostPolicyDecidedCallback;
private readonly WebViewFrameRenderedSignal frameRenderedSignal;
private EventHandler frameRenderedEventHandler;
private WebViewFrameRenderedCallbackDelegate frameRenderedCallback;
private ScreenshotAcquiredCallback screenshotAcquiredCallback;
private readonly WebViewScreenshotAcquiredProxyCallback screenshotAcquiredProxyCallback;
///
/// Creates a WebView.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public WebView() : this(Interop.WebView.New(), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Creates a WebView with local language and time zone.
/// The locale language of Web
/// The time zone Id of Web
///
[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.
/// args array. The first value of array must be program's name.
///
[EditorBrowsable(EditorBrowsableState.Never)]
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
///
[EditorBrowsable(EditorBrowsableState.Never)]
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)
{
pageLoadStartedSignal = new WebViewPageLoadSignal(Interop.WebView.NewWebViewPageLoadSignalPageLoadStarted(SwigCPtr));
pageLoadingSignal = new WebViewPageLoadSignal(Interop.WebView.NewWebViewPageLoadSignalPageLoadInProgress(SwigCPtr));
pageLoadFinishedSignal = new WebViewPageLoadSignal(Interop.WebView.NewWebViewPageLoadSignalPageLoadFinished(SwigCPtr));
pageLoadErrorSignal = new WebViewPageLoadErrorSignal(Interop.WebView.NewWebViewPageLoadErrorSignalPageLoadError(SwigCPtr));
scrollEdgeReachedSignal = new WebViewScrollEdgeReachedSignal(Interop.WebView.NewWebViewScrollEdgeReachedSignalScrollEdgeReached(SwigCPtr));
urlChangedSignal = new WebViewUrlChangedSignal(Interop.WebView.NewWebViewUrlChangedSignalUrlChanged(SwigCPtr));
formRepostPolicyDecidedSignal = new WebViewFormRepostDecidedSignal(Interop.WebView.NewWebViewFormRepostDecisionSignalFormRepostDecision(SwigCPtr));
frameRenderedSignal = new WebViewFrameRenderedSignal(Interop.WebView.WebViewFrameRenderedSignalFrameRenderedGet(SwigCPtr));
screenshotAcquiredProxyCallback = OnScreenshotAcquired;
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.
pageLoadStartedSignal.Dispose();
pageLoadingSignal.Dispose();
pageLoadFinishedSignal.Dispose();
pageLoadErrorSignal.Dispose();
scrollEdgeReachedSignal.Dispose();
urlChangedSignal.Dispose();
formRepostPolicyDecidedSignal.Dispose();
frameRenderedSignal.Dispose();
BackForwardList.Dispose();
Context.Dispose();
CookieManager.Dispose();
Settings.Dispose();
}
base.Dispose(type);
}
///
/// 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);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void WebViewPageLoadCallbackDelegate(IntPtr data, string pageUrl);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void WebViewPageLoadErrorCallbackDelegate(IntPtr data, string pageUrl, int errorCode);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void WebViewScrollEdgeReachedCallbackDelegate(IntPtr data, int edge);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void WebViewUrlChangedCallbackDelegate(IntPtr data, string pageUrl);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void WebViewFormRepostPolicyDecidedCallbackDelegate(IntPtr data, IntPtr decision);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void WebViewFrameRenderedCallbackDelegate(IntPtr data);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void WebViewScreenshotAcquiredProxyCallback(IntPtr data);
///
/// 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.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public event EventHandler PageLoadStarted
{
add
{
if (pageLoadStartedEventHandler == null)
{
pageLoadStartedCallback = (OnPageLoadStarted);
pageLoadStartedSignal.Connect(pageLoadStartedCallback);
}
pageLoadStartedEventHandler += value;
}
remove
{
pageLoadStartedEventHandler -= value;
if (pageLoadStartedEventHandler == null && pageLoadStartedCallback != null)
{
pageLoadStartedSignal.Disconnect(pageLoadStartedCallback);
}
}
}
///
/// 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.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public event EventHandler PageLoading
{
add
{
if (pageLoadingEventHandler == null)
{
pageLoadingCallback = OnPageLoading;
pageLoadingSignal.Connect(pageLoadingCallback);
}
pageLoadingEventHandler += value;
}
remove
{
pageLoadingEventHandler -= value;
if (pageLoadingEventHandler == null && pageLoadingCallback != null)
{
pageLoadingSignal.Disconnect(pageLoadingCallback);
}
}
}
///
/// 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.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public event EventHandler PageLoadFinished
{
add
{
if (pageLoadFinishedEventHandler == null)
{
pageLoadFinishedCallback = (OnPageLoadFinished);
pageLoadFinishedSignal.Connect(pageLoadFinishedCallback);
}
pageLoadFinishedEventHandler += value;
}
remove
{
pageLoadFinishedEventHandler -= value;
if (pageLoadFinishedEventHandler == null && pageLoadFinishedCallback != null)
{
pageLoadFinishedSignal.Disconnect(pageLoadFinishedCallback);
}
}
}
///
/// 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.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public event EventHandler PageLoadError
{
add
{
if (pageLoadErrorEventHandler == null)
{
pageLoadErrorCallback = (OnPageLoadError);
pageLoadErrorSignal.Connect(pageLoadErrorCallback);
}
pageLoadErrorEventHandler += value;
}
remove
{
pageLoadErrorEventHandler -= value;
if (pageLoadErrorEventHandler == null && pageLoadErrorCallback != null)
{
pageLoadErrorSignal.Disconnect(pageLoadErrorCallback);
}
}
}
///
/// 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;
scrollEdgeReachedSignal.Connect(scrollEdgeReachedCallback);
}
scrollEdgeReachedEventHandler += value;
}
remove
{
scrollEdgeReachedEventHandler -= value;
if (scrollEdgeReachedEventHandler == null && scrollEdgeReachedCallback != null)
{
scrollEdgeReachedSignal.Disconnect(scrollEdgeReachedCallback);
}
}
}
///
/// 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;
urlChangedSignal.Connect(urlChangedCallback);
}
urlChangedEventHandler += value;
}
remove
{
urlChangedEventHandler -= value;
if (urlChangedEventHandler == null && urlChangedCallback != null)
{
urlChangedSignal.Disconnect(urlChangedCallback);
}
}
}
///
/// 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;
formRepostPolicyDecidedSignal.Connect(formRepostPolicyDecidedCallback);
}
formRepostPolicyDecidedEventHandler += value;
}
remove
{
formRepostPolicyDecidedEventHandler -= value;
if (formRepostPolicyDecidedEventHandler == null && formRepostPolicyDecidedCallback != null)
{
formRepostPolicyDecidedSignal.Disconnect(formRepostPolicyDecidedCallback);
}
}
}
///
/// 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;
frameRenderedSignal.Connect(frameRenderedCallback);
}
frameRenderedEventHandler += value;
}
remove
{
frameRenderedEventHandler -= value;
if (frameRenderedEventHandler == null && frameRenderedCallback != null)
{
frameRenderedSignal.Disconnect(frameRenderedCallback);
}
}
}
///
/// 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,
}
///
/// 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.
///
[EditorBrowsable(EditorBrowsableState.Never)]
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)Context.CacheModel;
}
set
{
Context.CacheModel = (WebContext.CacheModelType)value;
}
}
///
/// Deprecated. The cookie acceptance policy.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public CookieAcceptPolicy CookieAcceptPolicy
{
get
{
return (CookieAcceptPolicy)CookieManager.CookieAcceptPolicy;
}
set
{
CookieManager.CookieAcceptPolicy = (WebCookieManager.CookieAcceptPolicyType)value;
}
}
///
/// The user agent string.
///
[EditorBrowsable(EditorBrowsableState.Never)]
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 Settings.EnableJavaScript;
}
set
{
Settings.EnableJavaScript = value;
}
}
///
/// Deprecated. Whether images can be loaded automatically.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public bool LoadImagesAutomatically
{
get
{
return Settings.AllowImagesLoadAutomatically;
}
set
{
Settings.AllowImagesLoadAutomatically = value;
}
}
///
/// The default text encoding name.
/// e.g. "UTF-8"
///
[EditorBrowsable(EditorBrowsableState.Never)]
public string DefaultTextEncodingName
{
get
{
return Settings.DefaultTextEncodingName;
}
set
{
Settings.DefaultTextEncodingName = value;
}
}
///
/// The default font size in pixel.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public int DefaultFontSize
{
get
{
return Settings.DefaultFontSize;
}
set
{
Settings.DefaultFontSize = value;
}
}
///
/// The position of scroll.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public Position ScrollPosition
{
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.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public string Title
{
get
{
return (string)GetValue(TitleProperty);
}
}
///
/// Gets favicon of web page.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public ImageView Favicon
{
get
{
global::System.IntPtr imageView = Interop.WebView.GetFavicon(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending)
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.
///
[EditorBrowsable(EditorBrowsableState.Never)]
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), null, 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(Vector4), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
{
var webview = (WebView)bindable;
if (newValue != null)
{
webview.contentBackgroundColor = (Vector4)newValue;
Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.DocumentBackgroundColor, new Tizen.NUI.PropertyValue((Vector4)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), true, 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), null, 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), true, 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), true, 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), null, 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
///
[EditorBrowsable(EditorBrowsableState.Never)]
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
///
[EditorBrowsable(EditorBrowsableState.Never)]
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();
}
///
/// Add a message handler into the WebView.
/// 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();
}
///
/// Add a message handler into the WebView.
/// 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();
}
///
/// Add a message handler into the WebView.
/// 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;
}
///
/// Asynchronous 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();
}
///
/// 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();
}
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 static global::System.Runtime.InteropServices.HandleRef getCPtr(WebView obj)
{
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
}
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;
}
/// This will not be public opened.
///
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
{
Interop.WebView.DeleteWebView(swigCPtr);
}
private void OnPageLoadStarted(IntPtr data, string pageUrl)
{
WebViewPageLoadEventArgs e = new WebViewPageLoadEventArgs();
e.WebView = Registry.GetManagedBaseHandleFromNativePtr(data) as WebView;
e.PageUrl = pageUrl;
pageLoadStartedEventHandler?.Invoke(this, e);
}
private void OnPageLoading(IntPtr data, string pageUrl)
{
pageLoadingEventHandler?.Invoke(this, new WebViewPageLoadEventArgs());
}
private void OnPageLoadFinished(IntPtr data, string pageUrl)
{
WebViewPageLoadEventArgs e = new WebViewPageLoadEventArgs();
e.WebView = Registry.GetManagedBaseHandleFromNativePtr(data) as WebView;
e.PageUrl = pageUrl;
pageLoadFinishedEventHandler?.Invoke(this, e);
}
private void OnPageLoadError(IntPtr data, string pageUrl, int errorCode)
{
WebViewPageLoadErrorEventArgs e = new WebViewPageLoadErrorEventArgs();
e.WebView = Registry.GetManagedBaseHandleFromNativePtr(data) as WebView;
e.PageUrl = pageUrl;
e.ErrorCode = (WebViewPageLoadErrorEventArgs.LoadErrorCode)errorCode;
pageLoadErrorEventHandler?.Invoke(this, e);
}
private void OnScrollEdgeReached(IntPtr data, int edge)
{
WebViewScrollEdgeReachedEventArgs arg = new WebViewScrollEdgeReachedEventArgs((WebViewScrollEdgeReachedEventArgs.Edge)edge);
scrollEdgeReachedEventHandler?.Invoke(this, arg);
}
private void OnUrlChanged(IntPtr data, string pageUrl)
{
urlChangedEventHandler?.Invoke(this, new WebViewUrlChangedEventArgs(pageUrl));
}
private void OnFormRepostPolicyDecided(IntPtr data, IntPtr decision)
{
WebFormRepostPolicyDecisionMaker repostDecision = new WebFormRepostPolicyDecisionMaker(decision, false);
formRepostPolicyDecidedEventHandler?.Invoke(this, new WebViewFormRepostPolicyDecidedEventArgs(repostDecision));
repostDecision.Dispose();
}
private void OnFrameRendered(IntPtr data)
{
frameRenderedEventHandler?.Invoke(this, new EventArgs());
}
private void OnScreenshotAcquired(IntPtr data)
{
ImageView image = new ImageView(data, true);
screenshotAcquiredCallback?.Invoke(image);
image.Dispose();
}
}
}