de7c33a38cd41826b076eb6cf102728c5c9914cf
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / WebView / WebView.cs
1 /*
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 using System;
19 using System.ComponentModel;
20 using System.Collections.Generic;
21 using System.Runtime.InteropServices;
22 using Tizen.NUI.BaseComponents;
23 using Tizen.NUI.Binding;
24
25 namespace Tizen.NUI
26 {
27     /// <summary>
28     /// WebView
29     /// </summary>
30     [EditorBrowsable(EditorBrowsableState.Never)]
31     public class WebView : View
32     {
33         private Vector4 backgroundColor;
34         private bool tilesClearedWhenHidden;
35         private float tileCoverAreaMultiplier;
36         private bool cursorEnabledByClient;
37
38         private readonly WebViewPageLoadSignal pageLoadStartedSignal;
39         private EventHandler<WebViewPageLoadEventArgs> pageLoadStartedEventHandler;
40         private WebViewPageLoadCallbackDelegate pageLoadStartedCallback;
41
42         private readonly WebViewPageLoadSignal pageLoadingSignal;
43         private EventHandler<WebViewPageLoadEventArgs> pageLoadingEventHandler;
44         private WebViewPageLoadCallbackDelegate pageLoadingCallback;
45
46         private readonly WebViewPageLoadSignal pageLoadFinishedSignal;
47         private EventHandler<WebViewPageLoadEventArgs> pageLoadFinishedEventHandler;
48         private WebViewPageLoadCallbackDelegate pageLoadFinishedCallback;
49
50         private readonly WebViewPageLoadErrorSignal pageLoadErrorSignal;
51         private EventHandler<WebViewPageLoadErrorEventArgs> pageLoadErrorEventHandler;
52         private WebViewPageLoadErrorCallbackDelegate pageLoadErrorCallback;
53
54         private readonly WebViewScrollEdgeReachedSignal scrollEdgeReachedSignal;
55         private EventHandler<WebViewScrollEdgeReachedEventArgs> scrollEdgeReachedEventHandler;
56         private WebViewScrollEdgeReachedCallbackDelegate scrollEdgeReachedCallback;
57
58         private readonly WebViewUrlChangedSignal urlChangedSignal;
59         private EventHandler<WebViewUrlChangedEventArgs> urlChangedEventHandler;
60         private WebViewUrlChangedCallbackDelegate urlChangedCallback;
61
62         private readonly WebViewFormRepostDecidedSignal formRepostPolicyDecidedSignal;
63         private EventHandler<WebViewFormRepostPolicyDecidedEventArgs> formRepostPolicyDecidedEventHandler;
64         private WebViewFormRepostPolicyDecidedCallbackDelegate formRepostPolicyDecidedCallback;
65
66         private readonly WebViewFrameRenderedSignal frameRenderedSignal;
67         private EventHandler<EventArgs> frameRenderedEventHandler;
68         private WebViewFrameRenderedCallbackDelegate frameRenderedCallback;
69
70         /// <summary>
71         /// Creates a WebView.
72         /// </summary>
73         [EditorBrowsable(EditorBrowsableState.Never)]
74         public WebView() : this(Interop.WebView.New(), true)
75         {
76             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
77         }
78
79         /// <summary>
80         /// Creates a WebView with local language and time zone.
81         /// <param name="locale">The locale language of Web</param>
82         /// <param name="timezoneId">The time zone Id of Web</param>
83         /// </summary>
84         [EditorBrowsable(EditorBrowsableState.Never)]
85         public WebView(string locale, string timezoneId) : this(Interop.WebView.New2(locale, timezoneId), true)
86         {
87             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
88         }
89
90         /// <summary>
91         /// Creates a WebView with an args list.
92         /// <param name="args">args array. The first value of array must be program's name.</param>
93         /// </summary>
94         [EditorBrowsable(EditorBrowsableState.Never)]
95         public WebView(string[] args) : this(Interop.WebView.New3(args?.Length ?? 0, args), true)
96         {
97             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
98         }
99
100         /// <summary>
101         /// Copy constructor.
102         /// <param name="webView">WebView to copy. The copied WebView will point at the same implementation</param>
103         /// </summary>
104         [EditorBrowsable(EditorBrowsableState.Never)]
105         public WebView(WebView webView) : this(Interop.WebView.NewWebView(WebView.getCPtr(webView)), true)
106         {
107             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
108         }
109
110         internal WebView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.WebView.Upcast(cPtr), cMemoryOwn)
111         {
112             pageLoadStartedSignal = new WebViewPageLoadSignal(Interop.WebView.NewWebViewPageLoadSignalPageLoadStarted(SwigCPtr));
113             pageLoadingSignal = new WebViewPageLoadSignal(Interop.WebView.NewWebViewPageLoadSignalPageLoadInProgress(SwigCPtr));
114             pageLoadFinishedSignal = new WebViewPageLoadSignal(Interop.WebView.NewWebViewPageLoadSignalPageLoadFinished(SwigCPtr));
115             pageLoadErrorSignal = new WebViewPageLoadErrorSignal(Interop.WebView.NewWebViewPageLoadErrorSignalPageLoadError(SwigCPtr));
116             scrollEdgeReachedSignal = new WebViewScrollEdgeReachedSignal(Interop.WebView.NewWebViewScrollEdgeReachedSignalScrollEdgeReached(SwigCPtr));
117             urlChangedSignal = new WebViewUrlChangedSignal(Interop.WebView.NewWebViewUrlChangedSignalUrlChanged(SwigCPtr));
118             formRepostPolicyDecidedSignal = new WebViewFormRepostDecidedSignal(Interop.WebView.NewWebViewFormRepostDecisionSignalFormRepostDecision(SwigCPtr));
119             frameRenderedSignal = new WebViewFrameRenderedSignal(Interop.WebView.WebViewFrameRenderedSignalFrameRenderedGet(SwigCPtr));
120
121             BackForwardList = new WebBackForwardList(Interop.WebView.GetWebBackForwardList(SwigCPtr), false);
122             Context = new WebContext(Interop.WebView.GetWebContext(SwigCPtr), false);
123             CookieManager = new WebCookieManager(Interop.WebView.GetWebCookieManager(SwigCPtr), false);
124             Settings = new WebSettings(Interop.WebView.GetWebSettings(SwigCPtr), false);
125         }
126
127         /// <summary>
128         /// Dispose for IDisposable pattern
129         /// </summary>
130         [EditorBrowsable(EditorBrowsableState.Never)]
131         protected override void Dispose(DisposeTypes type)
132         {
133             if (disposed)
134             {
135                 return;
136             }
137
138             if (type == DisposeTypes.Explicit)
139             {
140                 //Called by User
141                 //Release your own managed resources here.
142                 //You should release all of your own disposable objects here.
143                 pageLoadStartedSignal.Dispose();
144                 pageLoadingSignal.Dispose();
145                 pageLoadFinishedSignal.Dispose();
146                 pageLoadErrorSignal.Dispose();
147                 scrollEdgeReachedSignal.Dispose();
148                 urlChangedSignal.Dispose();
149                 formRepostPolicyDecidedSignal.Dispose();
150                 frameRenderedSignal.Dispose();
151
152                 BackForwardList.Dispose();
153                 Context.Dispose();
154                 CookieManager.Dispose();
155                 Settings.Dispose();
156             }
157
158             base.Dispose(type);
159         }
160
161         /// <summary>
162         /// The callback function that is invoked when the message is received from the script.
163         /// </summary>
164         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
165         [EditorBrowsable(EditorBrowsableState.Never)]
166         public delegate void JavaScriptMessageHandler(string message);
167
168         /// <summary>
169         /// The callback function that is invoked when the message is received from the script.
170         /// </summary>
171         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
172         [EditorBrowsable(EditorBrowsableState.Never)]
173         public delegate void JavaScriptAlertCallback(string message);
174
175         /// <summary>
176         /// The callback function that is invoked when the message is received from the script.
177         /// </summary>
178         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
179         [EditorBrowsable(EditorBrowsableState.Never)]
180         public delegate void JavaScriptConfirmCallback(string message);
181
182         /// <summary>
183         /// The callback function that is invoked when the message is received from the script.
184         /// </summary>
185         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
186         [EditorBrowsable(EditorBrowsableState.Never)]
187         public delegate void JavaScriptPromptCallback(string message1, string message2);
188
189         /// <summary>
190         /// The callback function that is invoked when screen shot is acquired asynchronously.
191         /// </summary>
192         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
193         [EditorBrowsable(EditorBrowsableState.Never)]
194         public delegate void ScreenshotAcquiredCallback(ImageView image);
195
196         /// <summary>
197         /// The callback function that is invoked when video playing is checked asynchronously.
198         /// </summary>
199         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
200         [EditorBrowsable(EditorBrowsableState.Never)]
201         public delegate void VideoPlayingCallback(bool isPlaying);
202
203         /// <summary>
204         /// The callback function that is invoked when geolocation permission is requested.
205         /// </summary>
206         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
207         [EditorBrowsable(EditorBrowsableState.Never)]
208         public delegate void GeolocationPermissionCallback(string host, string protocol);
209
210         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
211         private delegate void WebViewPageLoadCallbackDelegate(IntPtr data, string pageUrl);
212
213         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
214         private delegate void WebViewPageLoadErrorCallbackDelegate(IntPtr data, string pageUrl, int errorCode);
215
216         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
217         private delegate void WebViewScrollEdgeReachedCallbackDelegate(IntPtr data, int edge);
218
219         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
220         private delegate void WebViewUrlChangedCallbackDelegate(IntPtr data, string pageUrl);
221
222         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
223         private delegate void WebViewFormRepostPolicyDecidedCallbackDelegate(IntPtr data, IntPtr decision);
224
225         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
226         private delegate void WebViewFrameRenderedCallbackDelegate(IntPtr data);
227
228         /// <summary>
229         /// Event for the PageLoadStarted signal which can be used to subscribe or unsubscribe the event handler.<br />
230         /// This signal is emitted when page loading has started.<br />
231         /// </summary>
232         [EditorBrowsable(EditorBrowsableState.Never)]
233         public event EventHandler<WebViewPageLoadEventArgs> PageLoadStarted
234         {
235             add
236             {
237                 if (pageLoadStartedEventHandler == null)
238                 {
239                     pageLoadStartedCallback = (OnPageLoadStarted);
240                     pageLoadStartedSignal.Connect(pageLoadStartedCallback);
241                 }
242                 pageLoadStartedEventHandler += value;
243             }
244             remove
245             {
246                 pageLoadStartedEventHandler -= value;
247                 if (pageLoadStartedEventHandler == null && pageLoadStartedCallback != null)
248                 {
249                     pageLoadStartedSignal.Disconnect(pageLoadStartedCallback);
250                 }
251             }
252         }
253
254         /// <summary>
255         /// Event for the PageLoading signal which can be used to subscribe or unsubscribe the event handler.<br />
256         /// This signal is emitted when page loading is in progress.<br />
257         /// </summary>
258         [EditorBrowsable(EditorBrowsableState.Never)]
259         public event EventHandler<WebViewPageLoadEventArgs> PageLoading
260         {
261             add
262             {
263                 if (pageLoadingEventHandler == null)
264                 {
265                     pageLoadingCallback = OnPageLoading;
266                     pageLoadingSignal.Connect(pageLoadingCallback);
267                 }
268                 pageLoadingEventHandler += value;
269             }
270             remove
271             {
272                 pageLoadingEventHandler -= value;
273                 if (pageLoadingEventHandler == null && pageLoadingCallback != null)
274                 {
275                     pageLoadingSignal.Disconnect(pageLoadingCallback);
276                 }
277             }
278         }
279
280         /// <summary>
281         /// Event for the PageLoadFinished signal which can be used to subscribe or unsubscribe the event handler.<br />
282         /// This signal is emitted when page loading has finished.<br />
283         /// </summary>
284         [EditorBrowsable(EditorBrowsableState.Never)]
285         public event EventHandler<WebViewPageLoadEventArgs> PageLoadFinished
286         {
287             add
288             {
289                 if (pageLoadFinishedEventHandler == null)
290                 {
291                     pageLoadFinishedCallback = (OnPageLoadFinished);
292                     pageLoadFinishedSignal.Connect(pageLoadFinishedCallback);
293                 }
294                 pageLoadFinishedEventHandler += value;
295             }
296             remove
297             {
298                 pageLoadFinishedEventHandler -= value;
299                 if (pageLoadFinishedEventHandler == null && pageLoadFinishedCallback != null)
300                 {
301                     pageLoadFinishedSignal.Disconnect(pageLoadFinishedCallback);
302                 }
303             }
304         }
305
306         /// <summary>
307         /// Event for the PageLoadError signal which can be used to subscribe or unsubscribe the event handler.<br />
308         /// This signal is emitted when there's an error in page loading.<br />
309         /// </summary>
310         [EditorBrowsable(EditorBrowsableState.Never)]
311         public event EventHandler<WebViewPageLoadErrorEventArgs> PageLoadError
312         {
313             add
314             {
315                 if (pageLoadErrorEventHandler == null)
316                 {
317                     pageLoadErrorCallback = (OnPageLoadError);
318                     pageLoadErrorSignal.Connect(pageLoadErrorCallback);
319                 }
320                 pageLoadErrorEventHandler += value;
321             }
322             remove
323             {
324                 pageLoadErrorEventHandler -= value;
325                 if (pageLoadErrorEventHandler == null && pageLoadErrorCallback != null)
326                 {
327                     pageLoadErrorSignal.Disconnect(pageLoadErrorCallback);
328                 }
329             }
330         }
331
332         /// <summary>
333         /// Event for the ScrollEdgeReached signal which can be used to subscribe or unsubscribe the event handler.<br />
334         /// This signal is emitted when web view is scrolled to edge.<br />
335         /// </summary>
336         [EditorBrowsable(EditorBrowsableState.Never)]
337         public event EventHandler<WebViewScrollEdgeReachedEventArgs> ScrollEdgeReached
338         {
339             add
340             {
341                 if (scrollEdgeReachedEventHandler == null)
342                 {
343                     scrollEdgeReachedCallback = OnScrollEdgeReached;
344                     scrollEdgeReachedSignal.Connect(scrollEdgeReachedCallback);
345                 }
346                 scrollEdgeReachedEventHandler += value;
347             }
348             remove
349             {
350                 scrollEdgeReachedEventHandler -= value;
351                 if (scrollEdgeReachedEventHandler == null && scrollEdgeReachedCallback != null)
352                 {
353                     scrollEdgeReachedSignal.Disconnect(scrollEdgeReachedCallback);
354                 }
355             }
356         }
357
358         /// <summary>
359         /// Event for the UrlChanged signal which can be used to subscribe or unsubscribe the event handler.<br />
360         /// This signal is emitted when url is changed.<br />
361         /// </summary>
362         [EditorBrowsable(EditorBrowsableState.Never)]
363         public event EventHandler<WebViewUrlChangedEventArgs> UrlChanged
364         {
365             add
366             {
367                 if (urlChangedEventHandler == null)
368                 {
369                     urlChangedCallback = OnUrlChanged;
370                     urlChangedSignal.Connect(urlChangedCallback);
371                 }
372                 urlChangedEventHandler += value;
373             }
374             remove
375             {
376                 urlChangedEventHandler -= value;
377                 if (urlChangedEventHandler == null && urlChangedCallback != null)
378                 {
379                     urlChangedSignal.Disconnect(urlChangedCallback);
380                 }
381             }
382         }
383
384         /// <summary>
385         /// Event for the FormRepostDecided signal which can be used to subscribe or unsubscribe the event handler.<br />
386         /// This signal is emitted when form repost policy would be decided.<br />
387         /// </summary>
388         [EditorBrowsable(EditorBrowsableState.Never)]
389         public event EventHandler<WebViewFormRepostPolicyDecidedEventArgs> FormRepostPolicyDecided
390         {
391             add
392             {
393                 if (formRepostPolicyDecidedEventHandler == null)
394                 {
395                     formRepostPolicyDecidedCallback = OnFormRepostPolicyDecided;
396                     formRepostPolicyDecidedSignal.Connect(formRepostPolicyDecidedCallback);
397                 }
398                 formRepostPolicyDecidedEventHandler += value;
399             }
400             remove
401             {
402                 formRepostPolicyDecidedEventHandler -= value;
403                 if (formRepostPolicyDecidedEventHandler == null && formRepostPolicyDecidedCallback != null)
404                 {
405                     formRepostPolicyDecidedSignal.Disconnect(formRepostPolicyDecidedCallback);
406                 }
407             }
408         }
409
410         /// <summary>
411         /// Event for the FrameRendered signal which can be used to subscribe or unsubscribe the event handler.<br />
412         /// This signal is emitted when frame is rendered off-screen.<br />
413         /// </summary>
414         [EditorBrowsable(EditorBrowsableState.Never)]
415         public event EventHandler<EventArgs> FrameRendered
416         {
417             add
418             {
419                 if (frameRenderedEventHandler == null)
420                 {
421                     frameRenderedCallback = OnFrameRendered;
422                     frameRenderedSignal.Connect(frameRenderedCallback);
423                 }
424                 frameRenderedEventHandler += value;
425             }
426             remove
427             {
428                 frameRenderedEventHandler -= value;
429                 if (frameRenderedEventHandler == null && frameRenderedCallback != null)
430                 {
431                     frameRenderedSignal.Disconnect(frameRenderedCallback);
432                 }
433             }
434         }
435
436         /// <summary>
437         /// Options for searching texts.
438         /// </summary>
439         [EditorBrowsable(EditorBrowsableState.Never)]
440         public enum FindOption
441         {
442             /// <summary>
443             /// No search flags
444             /// </summary>
445             [EditorBrowsable(EditorBrowsableState.Never)]
446             None = 0,
447
448             /// <summary>
449             /// Case insensitive search
450             /// </summary>
451             [EditorBrowsable(EditorBrowsableState.Never)]
452             CaseInsensitive = 1 << 0,
453
454             /// <summary>
455             /// Search text only at the beginning of the words
456             /// </summary>
457             [EditorBrowsable(EditorBrowsableState.Never)]
458             AtWordStarts = 1 << 1,
459
460             /// <summary>
461             /// Treat capital letters in the middle of words as word start
462             /// </summary>
463             [EditorBrowsable(EditorBrowsableState.Never)]
464             TreatMediaCapitalAsWordStart = 1 << 2,
465
466             /// <summary>
467             /// Search backwards
468             /// </summary>
469             [EditorBrowsable(EditorBrowsableState.Never)]
470             Backwards = 1 << 3,
471
472             /// <summary>
473             /// If not present the search stops at the end of the document
474             /// </summary>
475             [EditorBrowsable(EditorBrowsableState.Never)]
476             WrapAround = 1 << 4,
477
478             /// <summary>
479             /// Show overlay
480             /// </summary>
481             [EditorBrowsable(EditorBrowsableState.Never)]
482             ShowOverlay = 1 << 5,
483
484             /// <summary>
485             /// Show indicator
486             /// </summary>
487             [EditorBrowsable(EditorBrowsableState.Never)]
488             ShowFindIndiator = 1 << 6,
489
490             /// <summary>
491             /// Show highlight
492             /// </summary>
493             [EditorBrowsable(EditorBrowsableState.Never)]
494             ShowHighlight = 1 << 7,
495         }
496
497         /// <summary>
498         /// BackForwardList.
499         /// </summary>
500         [EditorBrowsable(EditorBrowsableState.Never)]
501         public WebBackForwardList BackForwardList { get; }
502
503         /// <summary>
504         /// Context.
505         /// </summary>
506         [EditorBrowsable(EditorBrowsableState.Never)]
507         public WebContext Context { get; }
508
509         /// <summary>
510         /// CookieManager.
511         /// </summary>
512         [EditorBrowsable(EditorBrowsableState.Never)]
513         public WebCookieManager CookieManager { get; }
514
515         /// <summary>
516         /// BackForwardList.
517         /// </summary>
518         [EditorBrowsable(EditorBrowsableState.Never)]
519         public WebSettings Settings { get; }
520
521         /// <summary>
522         /// The url to load.
523         /// </summary>
524         [EditorBrowsable(EditorBrowsableState.Never)]
525         public string Url
526         {
527             get
528             {
529                 return (string)GetValue(UrlProperty);
530             }
531             set
532             {
533                 SetValue(UrlProperty, value);
534                 NotifyPropertyChanged();
535             }
536         }
537
538         /// <summary>
539         /// Deprecated. The cache model of the current WebView.
540         /// </summary>
541         [EditorBrowsable(EditorBrowsableState.Never)]
542         public CacheModel CacheModel
543         {
544             get
545             {
546                 return (CacheModel)Context.CacheModel;
547             }
548             set
549             {
550                 Context.CacheModel = (WebContext.CacheModelType)value;
551             }
552         }
553
554         /// <summary>
555         /// Deprecated. The cookie acceptance policy.
556         /// </summary>
557         [EditorBrowsable(EditorBrowsableState.Never)]
558         public CookieAcceptPolicy CookieAcceptPolicy
559         {
560             get
561             {
562                 return (CookieAcceptPolicy)CookieManager.CookieAcceptPolicy;
563             }
564             set
565             {
566                 CookieManager.CookieAcceptPolicy = (WebCookieManager.CookieAcceptPolicyType)value;
567             }
568         }
569
570         /// <summary>
571         /// The user agent string.
572         /// </summary>
573         [EditorBrowsable(EditorBrowsableState.Never)]
574         public string UserAgent
575         {
576             get
577             {
578                 return (string)GetValue(UserAgentProperty);
579             }
580             set
581             {
582                 SetValue(UserAgentProperty, value);
583                 NotifyPropertyChanged();
584             }
585         }
586
587         /// <summary>
588         /// Deprecated. Whether JavaScript is enabled.
589         /// </summary>
590         [EditorBrowsable(EditorBrowsableState.Never)]
591         public bool EnableJavaScript
592         {
593             get
594             {
595                 return Settings.EnableJavaScript;
596             }
597             set
598             {
599                 Settings.EnableJavaScript = value;
600             }
601         }
602
603         /// <summary>
604         /// Deprecated. Whether images can be loaded automatically.
605         /// </summary>
606         [EditorBrowsable(EditorBrowsableState.Never)]
607         public bool LoadImagesAutomatically
608         {
609             get
610             {
611                 return Settings.AllowImagesLoadAutomatically;
612             }
613             set
614             {
615                 Settings.AllowImagesLoadAutomatically = value;
616             }
617         }
618
619         /// <summary>
620         /// The default text encoding name.<br />
621         /// e.g. "UTF-8"<br />
622         /// </summary>
623         [EditorBrowsable(EditorBrowsableState.Never)]
624         public string DefaultTextEncodingName
625         {
626             get
627             {
628                 return Settings.DefaultTextEncodingName;
629             }
630             set
631             {
632                 Settings.DefaultTextEncodingName = value;
633             }
634         }
635
636         /// <summary>
637         /// The default font size in pixel.
638         /// </summary>
639         [EditorBrowsable(EditorBrowsableState.Never)]
640         public int DefaultFontSize
641         {
642             get
643             {
644                 return Settings.DefaultFontSize;
645             }
646             set
647             {
648                 Settings.DefaultFontSize = value;
649             }
650         }
651
652         /// <summary>
653         /// The position of scroll.
654         /// </summary>
655         [EditorBrowsable(EditorBrowsableState.Never)]
656         public Position ScrollPosition
657         {
658             get
659             {
660                 Vector2 pv = (Vector2)GetValue(ScrollPositionProperty);
661                 return new Position(pv.X, pv.Y);
662             }
663             set
664             {
665                 if (value != null)
666                 {
667                     Position pv = value;
668                     Vector2 vpv = new Vector2(pv.X, pv.Y);
669                     SetValue(ScrollPositionProperty, vpv);
670                     NotifyPropertyChanged();
671                 }
672             }
673         }
674
675         /// <summary>
676         /// The size of scroll, read-only.
677         /// </summary>
678         [EditorBrowsable(EditorBrowsableState.Never)]
679         public Size ScrollSize
680         {
681             get
682             {
683                 Vector2 sv = (Vector2)GetValue(ScrollSizeProperty);
684                 return new Size(sv.Width, sv.Height);
685             }
686         }
687
688         /// <summary>
689         /// The size of content, read-only.
690         /// </summary>
691         [EditorBrowsable(EditorBrowsableState.Never)]
692         public Size ContentSize
693         {
694             get
695             {
696                 Vector2 sv = (Vector2)GetValue(ContentSizeProperty);
697                 return new Size(sv.Width, sv.Height);
698             }
699         }
700
701         /// <summary>
702         /// Whether video hole is enabled or not.
703         /// </summary>
704         [EditorBrowsable(EditorBrowsableState.Never)]
705         public bool VideoHoleEnabled
706         {
707             get
708             {
709                 return (bool)GetValue(VideoHoleEnabledProperty);
710             }
711             set
712             {
713                 SetValue(VideoHoleEnabledProperty, value);
714                 NotifyPropertyChanged();
715             }
716         }
717
718         /// <summary>
719         /// Whether mouse events are enabled or not.
720         /// </summary>
721         [EditorBrowsable(EditorBrowsableState.Never)]
722         public bool MouseEventsEnabled
723         {
724             get
725             {
726                 return (bool)GetValue(MouseEventsEnabledProperty);
727             }
728             set
729             {
730                 SetValue(MouseEventsEnabledProperty, value);
731                 NotifyPropertyChanged();
732             }
733         }
734
735         /// <summary>
736         /// Whether key events are enabled or not.
737         /// </summary>
738         [EditorBrowsable(EditorBrowsableState.Never)]
739         public bool KeyEventsEnabled
740         {
741             get
742             {
743                 return (bool)GetValue(KeyEventsEnabledProperty);
744             }
745             set
746             {
747                 SetValue(KeyEventsEnabledProperty, value);
748                 NotifyPropertyChanged();
749             }
750         }
751
752         /// <summary>
753         /// Background color of document of web page.
754         /// </summary>
755         [EditorBrowsable(EditorBrowsableState.Never)]
756         public Color DocumentBackgroundColor
757         {
758             get
759             {
760                 return (Color)GetValue(DocumentBackgroundColorProperty);
761             }
762             set
763             {
764                 SetValue(DocumentBackgroundColorProperty, value);
765                 NotifyPropertyChanged();
766             }
767         }
768
769         /// <summary>
770         /// Whether tiles are cleared or not when hidden.
771         /// </summary>
772         [EditorBrowsable(EditorBrowsableState.Never)]
773         public bool TilesClearedWhenHidden
774         {
775             get
776             {
777                 return (bool)GetValue(TilesClearedWhenHiddenProperty);
778             }
779             set
780             {
781                 SetValue(TilesClearedWhenHiddenProperty, value);
782                 NotifyPropertyChanged();
783             }
784         }
785
786         /// <summary>
787         /// Multiplier of cover area of tile when web page is rendered.
788         /// </summary>
789         [EditorBrowsable(EditorBrowsableState.Never)]
790         public float TileCoverAreaMultiplier
791         {
792             get
793             {
794                 return (float)GetValue(TileCoverAreaMultiplierProperty);
795             }
796             set
797             {
798                 SetValue(TileCoverAreaMultiplierProperty, value);
799                 NotifyPropertyChanged();
800             }
801         }
802
803         /// <summary>
804         /// Whether cursor is enabled or not by client.
805         /// </summary>
806         [EditorBrowsable(EditorBrowsableState.Never)]
807         public bool CursorEnabledByClient
808         {
809             get
810             {
811                 return (bool)GetValue(CursorEnabledByClientProperty);
812             }
813             set
814             {
815                 SetValue(CursorEnabledByClientProperty, value);
816                 NotifyPropertyChanged();
817             }
818         }
819
820         /// <summary>
821         /// Gets selected text in web page.
822         /// </summary>
823         [EditorBrowsable(EditorBrowsableState.Never)]
824         public string SelectedText
825         {
826             get
827             {
828                 return (string)GetValue(SelectedTextProperty);
829             }
830         }
831
832         /// <summary>
833         /// Gets title of web page.
834         /// </summary>
835         [EditorBrowsable(EditorBrowsableState.Never)]
836         public string Title
837         {
838             get
839             {
840                 return (string)GetValue(TitleProperty);
841             }
842         }
843
844         /// <summary>
845         /// Gets favicon of web page.
846         /// </summary>
847         [EditorBrowsable(EditorBrowsableState.Never)]
848         public ImageView Favicon
849         {
850             get
851             {
852                 global::System.IntPtr imageView = Interop.WebView.GetFavicon(SwigCPtr);
853                 if (NDalicPINVOKE.SWIGPendingException.Pending)
854                     return null;
855                 return new ImageView(imageView, false);
856             }
857         }
858
859         /// <summary>
860         /// Zoom factor of web page.
861         /// </summary>
862         [EditorBrowsable(EditorBrowsableState.Never)]
863         public float PageZoomFactor
864         {
865             get
866             {
867                 return (float)GetValue(PageZoomFactorProperty);
868             }
869             set
870             {
871                 SetValue(PageZoomFactorProperty, value);
872                 NotifyPropertyChanged();
873             }
874         }
875
876         /// <summary>
877         /// Zoom factor of text in web page.
878         /// </summary>
879         [EditorBrowsable(EditorBrowsableState.Never)]
880         public float TextZoomFactor
881         {
882             get
883             {
884                 return (float)GetValue(TextZoomFactorProperty);
885             }
886             set
887             {
888                 SetValue(TextZoomFactorProperty, value);
889                 NotifyPropertyChanged();
890             }
891         }
892
893         /// <summary>
894         /// Gets percentage of loading progress.
895         /// </summary>
896         [EditorBrowsable(EditorBrowsableState.Never)]
897         public float LoadProgressPercentage
898         {
899             get
900             {
901                 return (float)GetValue(LoadProgressPercentageProperty);
902             }
903         }
904
905         internal static new class Property
906         {
907             internal static readonly int Url = Interop.WebView.UrlGet();
908             internal static readonly int UserAgent = Interop.WebView.UserAgentGet();
909             internal static readonly int ScrollPosition = Interop.WebView.ScrollPositionGet();
910             internal static readonly int ScrollSize = Interop.WebView.ScrollSizeGet();
911             internal static readonly int ContentSize = Interop.WebView.ContentSizeGet();
912             internal static readonly int Title = Interop.WebView.TitleGet();
913             internal static readonly int VideoHoleEnabled = Interop.WebView.VideoHoleEnabledGet();
914             internal static readonly int MouseEventsEnabled = Interop.WebView.MouseEventsEnabledGet();
915             internal static readonly int KeyEventsEnabled = Interop.WebView.KeyEventsEnabledGet();
916             internal static readonly int DocumentBackgroundColor = Interop.WebView.DocumentBackgroundColorGet();
917             internal static readonly int TilesClearedWhenHidden = Interop.WebView.TilesClearedWhenHiddenGet();
918             internal static readonly int TileCoverAreaMultiplier = Interop.WebView.TileCoverAreaMultiplierGet();
919             internal static readonly int CursorEnabledByClient = Interop.WebView.CursorEnabledByClientGet();
920             internal static readonly int SelectedText = Interop.WebView.SelectedTextGet();
921             internal static readonly int PageZoomFactor = Interop.WebView.PageZoomFactorGet();
922             internal static readonly int TextZoomFactor = Interop.WebView.TextZoomFactorGet();
923             internal static readonly int LoadProgressPercentage = Interop.WebView.LoadProgressPercentageGet();
924         }
925
926         private static readonly BindableProperty UrlProperty = BindableProperty.Create(nameof(Url), typeof(string), typeof(WebView), string.Empty, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) =>
927         {
928             var webview = (WebView)bindable;
929             if (newValue != null)
930             {
931                 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.Url, new Tizen.NUI.PropertyValue((string)newValue));
932             }
933         }),
934         defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
935         {
936             var webview = (WebView)bindable;
937             string temp;
938             Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.Url).Get(out temp);
939             return temp;
940         }));
941
942         private static readonly BindableProperty UserAgentProperty = BindableProperty.Create(nameof(UserAgent), typeof(string), typeof(WebView), string.Empty, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) =>
943         {
944             var webview = (WebView)bindable;
945             if (newValue != null)
946             {
947                 Tizen.NUI.Object.SetProperty((HandleRef)webview.SwigCPtr, WebView.Property.UserAgent, new Tizen.NUI.PropertyValue((string)newValue));
948             }
949         }),
950         defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
951         {
952             var webview = (WebView)bindable;
953             string temp;
954             Tizen.NUI.Object.GetProperty((HandleRef)webview.SwigCPtr, WebView.Property.UserAgent).Get(out temp);
955             return temp;
956         }));
957
958         private static readonly BindableProperty ScrollPositionProperty = BindableProperty.Create(nameof(ScrollPosition), typeof(Vector2), typeof(WebView), null, propertyChanged: (bindable, oldValue, newValue) =>
959         {
960             var webview = (WebView)bindable;
961             if (newValue != null)
962             {
963                 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.ScrollPosition, new Tizen.NUI.PropertyValue((Vector2)newValue));
964             }
965         },
966         defaultValueCreator: (bindable) =>
967         {
968             var webview = (WebView)bindable;
969             Vector2 temp = new Vector2(0.0f, 0.0f);
970             Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.ScrollPosition).Get(temp);
971             return temp;
972         });
973
974         private static readonly BindableProperty ScrollSizeProperty = BindableProperty.Create(nameof(ScrollSize), typeof(Vector2), typeof(WebView), null, defaultValueCreator: (bindable) =>
975         {
976             var webview = (WebView)bindable;
977             Vector2 temp = new Vector2(0.0f, 0.0f);
978             Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.ScrollSize).Get(temp);
979             return temp;
980         });
981
982         private static readonly BindableProperty ContentSizeProperty = BindableProperty.Create(nameof(ContentSize), typeof(Vector2), typeof(WebView), null, defaultValueCreator: (bindable) =>
983         {
984             var webview = (WebView)bindable;
985             Vector2 temp = new Vector2(0.0f, 0.0f);
986             Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.ContentSize).Get(temp);
987             return temp;
988         });
989
990         private static readonly BindableProperty TitleProperty = BindableProperty.Create(nameof(Title), typeof(string), typeof(WebView), null, defaultValueCreator: (bindable) =>
991         {
992             var webview = (WebView)bindable;
993             string title;
994             Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.Title).Get(out title);
995             return title;
996         });
997
998         private static readonly BindableProperty VideoHoleEnabledProperty = BindableProperty.Create(nameof(VideoHoleEnabled), typeof(bool), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
999         {
1000             var webview = (WebView)bindable;
1001             if (newValue != null)
1002             {
1003                 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.VideoHoleEnabled, new Tizen.NUI.PropertyValue((bool)newValue));
1004             }
1005         },
1006         defaultValueCreator: (bindable) =>
1007         {
1008             var webview = (WebView)bindable;
1009             bool temp;
1010             Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.VideoHoleEnabled).Get(out temp);
1011             return temp;
1012         });
1013
1014         private static readonly BindableProperty MouseEventsEnabledProperty = BindableProperty.Create(nameof(MouseEventsEnabled), typeof(bool), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
1015         {
1016             var webview = (WebView)bindable;
1017             if (newValue != null)
1018             {
1019                 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.MouseEventsEnabled, new Tizen.NUI.PropertyValue((bool)newValue));
1020             }
1021         },
1022         defaultValueCreator: (bindable) =>
1023         {
1024             var webview = (WebView)bindable;
1025             bool temp;
1026             Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.MouseEventsEnabled).Get(out temp);
1027             return temp;
1028         });
1029
1030         private static readonly BindableProperty KeyEventsEnabledProperty = BindableProperty.Create(nameof(KeyEventsEnabled), typeof(bool), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
1031         {
1032             var webview = (WebView)bindable;
1033             if (newValue != null)
1034             {
1035                 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.KeyEventsEnabled, new Tizen.NUI.PropertyValue((bool)newValue));
1036             }
1037         },
1038         defaultValueCreator: (bindable) =>
1039         {
1040             var webview = (WebView)bindable;
1041             bool temp;
1042             Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.KeyEventsEnabled).Get(out temp);
1043             return temp;
1044         });
1045
1046         private static readonly BindableProperty DocumentBackgroundColorProperty = BindableProperty.Create(nameof(DocumentBackgroundColor), typeof(Vector4), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
1047         {
1048             var webview = (WebView)bindable;
1049             if (newValue != null)
1050             {
1051                 webview.backgroundColor = (Vector4)newValue;
1052                 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.DocumentBackgroundColor, new Tizen.NUI.PropertyValue((Vector4)newValue));
1053             }
1054         },
1055         defaultValueCreator: (bindable) =>
1056         {
1057             var webview = (WebView)bindable;
1058             return webview.backgroundColor;
1059         });
1060
1061         private static readonly BindableProperty TilesClearedWhenHiddenProperty = BindableProperty.Create(nameof(TilesClearedWhenHidden), typeof(bool), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
1062         {
1063             var webview = (WebView)bindable;
1064             if (newValue != null)
1065             {
1066                 webview.tilesClearedWhenHidden = (bool)newValue;
1067                 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.TilesClearedWhenHidden, new Tizen.NUI.PropertyValue((bool)newValue));
1068             }
1069         },
1070         defaultValueCreator: (bindable) =>
1071         {
1072             var webview = (WebView)bindable;
1073             return webview.tilesClearedWhenHidden;
1074         });
1075
1076         private static readonly BindableProperty TileCoverAreaMultiplierProperty = BindableProperty.Create(nameof(TileCoverAreaMultiplier), typeof(float), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
1077         {
1078             var webview = (WebView)bindable;
1079             if (newValue != null)
1080             {
1081                 webview.tileCoverAreaMultiplier = (float)newValue;
1082                 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.TileCoverAreaMultiplier, new Tizen.NUI.PropertyValue((float)newValue));
1083             }
1084         },
1085         defaultValueCreator: (bindable) =>
1086         {
1087             var webview = (WebView)bindable;
1088             return webview.tileCoverAreaMultiplier;
1089         });
1090
1091         private static readonly BindableProperty CursorEnabledByClientProperty = BindableProperty.Create(nameof(CursorEnabledByClient), typeof(bool), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
1092         {
1093             var webview = (WebView)bindable;
1094             if (newValue != null)
1095             {
1096                 webview.cursorEnabledByClient = (bool)newValue;
1097                 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.CursorEnabledByClient, new Tizen.NUI.PropertyValue((bool)newValue));
1098             }
1099         },
1100         defaultValueCreator: (bindable) =>
1101         {
1102             var webview = (WebView)bindable;
1103             return webview.cursorEnabledByClient;
1104         });
1105
1106         private static readonly BindableProperty SelectedTextProperty = BindableProperty.Create(nameof(SelectedText), typeof(string), typeof(WebView), null, defaultValueCreator: (bindable) =>
1107         {
1108             var webview = (WebView)bindable;
1109             string text;
1110             Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.SelectedText).Get(out text);
1111             return text;
1112         });
1113
1114         private static readonly BindableProperty PageZoomFactorProperty = BindableProperty.Create(nameof(PageZoomFactor), typeof(float), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
1115         {
1116             var webview = (WebView)bindable;
1117             if (newValue != null)
1118             {
1119                 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.PageZoomFactor, new Tizen.NUI.PropertyValue((float)newValue));
1120             }
1121         },
1122         defaultValueCreator: (bindable) =>
1123         {
1124             var webview = (WebView)bindable;
1125             float temp;
1126             Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.PageZoomFactor).Get(out temp);
1127             return temp;
1128         });
1129
1130         private static readonly BindableProperty TextZoomFactorProperty = BindableProperty.Create(nameof(TextZoomFactor), typeof(float), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
1131         {
1132             var webview = (WebView)bindable;
1133             if (newValue != null)
1134             {
1135                 Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.TextZoomFactor, new Tizen.NUI.PropertyValue((float)newValue));
1136             }
1137         },
1138         defaultValueCreator: (bindable) =>
1139         {
1140             var webview = (WebView)bindable;
1141             float temp;
1142             Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.TextZoomFactor).Get(out temp);
1143             return temp;
1144         });
1145
1146         private static readonly BindableProperty LoadProgressPercentageProperty = BindableProperty.Create(nameof(LoadProgressPercentage), typeof(float), typeof(WebView), null, defaultValueCreator: (bindable) =>
1147         {
1148             var webview = (WebView)bindable;
1149             float percentage;
1150             Tizen.NUI.Object.GetProperty(webview.SwigCPtr, WebView.Property.LoadProgressPercentage).Get(out percentage);
1151             return percentage;
1152         });
1153
1154         // For rooting handlers
1155         internal Dictionary<string, JavaScriptMessageHandler> handlerRootMap = new Dictionary<string, JavaScriptMessageHandler>();
1156
1157         /// <summary>
1158         /// Loads a html.
1159         /// <param name="url">The path of Web</param>
1160         /// </summary>
1161         [EditorBrowsable(EditorBrowsableState.Never)]
1162         public void LoadUrl(string url)
1163         {
1164             Interop.WebView.LoadUrl(SwigCPtr, url);
1165             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1166         }
1167
1168         /// <summary>
1169         /// Deprecated. Loads a html by string.
1170         /// <param name="data">The data of Web</param>
1171         /// </summary>
1172         [EditorBrowsable(EditorBrowsableState.Never)]
1173         public void LoadHTMLString(string data)
1174         {
1175             Interop.WebView.LoadHtmlString(SwigCPtr, data);
1176             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1177         }
1178
1179         /// <summary>
1180         /// Loads a html by string.
1181         /// <param name="data">The data of Web</param>
1182         /// </summary>
1183         [EditorBrowsable(EditorBrowsableState.Never)]
1184         public void LoadHtmlString(string data)
1185         {
1186             Interop.WebView.LoadHtmlString(SwigCPtr, data);
1187             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1188         }
1189
1190         /// <summary>
1191         /// Loads the specified html as the content of the view to override current history entry.
1192         /// <param name="html">The html to be loaded</param>
1193         /// <param name="baseUri">Base URL used for relative paths to external objects</param>
1194         /// <param name="unreachableUri">URL that could not be reached</param>
1195         /// </summary>
1196         [EditorBrowsable(EditorBrowsableState.Never)]
1197         public bool LoadHtmlStringOverrideCurrentEntry(string html, string baseUri, string unreachableUri)
1198         {
1199             bool result = Interop.WebView.LoadHtmlStringOverrideCurrentEntry(SwigCPtr, html, baseUri, unreachableUri);
1200             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1201             return result;
1202         }
1203
1204         /// <summary>
1205         /// Requests to load the given contents by MIME type.
1206         /// <param name="contents">The contents to be loaded</param>
1207         /// <param name="contentSize">The size of contents (in bytes)</param>
1208         /// <param name="mimeType">The type of contents, "text/html" is assumed if null</param>
1209         /// <param name="encoding">The encoding for contents, "UTF-8" is assumed if null</param>
1210         /// <param name="baseUri">The base URI to use for relative resources</param>
1211         /// </summary>
1212         [EditorBrowsable(EditorBrowsableState.Never)]
1213         public bool LoadContents(string contents, uint contentSize, string mimeType, string encoding, string baseUri)
1214         {
1215             bool result = Interop.WebView.LoadContents(SwigCPtr, contents, contentSize, mimeType, encoding, baseUri);
1216             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1217             return result;
1218         }
1219
1220         /// <summary>
1221         /// Reloads the Web
1222         /// </summary>
1223         [EditorBrowsable(EditorBrowsableState.Never)]
1224         public void Reload()
1225         {
1226             Interop.WebView.Reload(SwigCPtr);
1227             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1228         }
1229
1230         /// <summary>
1231         /// Reloads the current page's document without cache
1232         /// </summary>
1233         [EditorBrowsable(EditorBrowsableState.Never)]
1234         public bool ReloadWithoutCache()
1235         {
1236             bool result = Interop.WebView.ReloadWithoutCache(SwigCPtr);
1237             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1238             return result;
1239         }
1240
1241         /// <summary>
1242         /// Stops loading the Web
1243         /// </summary>
1244         [EditorBrowsable(EditorBrowsableState.Never)]
1245         public void StopLoading()
1246         {
1247             Interop.WebView.StopLoading(SwigCPtr);
1248             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1249         }
1250
1251         /// <summary>
1252         /// Suspends the operation.
1253         /// </summary>
1254         [EditorBrowsable(EditorBrowsableState.Never)]
1255         public void Suspend()
1256         {
1257             Interop.WebView.Suspend(SwigCPtr);
1258             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1259         }
1260
1261         /// <summary>
1262         /// Resumes the operation after calling Suspend()
1263         /// </summary>
1264         [EditorBrowsable(EditorBrowsableState.Never)]
1265         public void Resume()
1266         {
1267             Interop.WebView.Resume(SwigCPtr);
1268             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1269         }
1270
1271         /// <summary>
1272         /// Suspends all network loading.
1273         /// </summary>
1274         [EditorBrowsable(EditorBrowsableState.Never)]
1275         public void SuspendNetworkLoading()
1276         {
1277             Interop.WebView.SuspendNetworkLoading(SwigCPtr);
1278             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1279         }
1280
1281         /// <summary>
1282         /// Resumes all network loading.
1283         /// </summary>
1284         [EditorBrowsable(EditorBrowsableState.Never)]
1285         public void ResumeNetworkLoading()
1286         {
1287             Interop.WebView.ResumeNetworkLoading(SwigCPtr);
1288             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1289         }
1290
1291         /// <summary>
1292         /// Adds custom header.
1293         /// <param name="name">The name of custom header</param>
1294         /// <param name="value">The value of custom header</param>
1295         /// </summary>
1296         [EditorBrowsable(EditorBrowsableState.Never)]
1297         public bool AddCustomHeader(string name, string value)
1298         {
1299             bool result = Interop.WebView.AddCustomHeader(SwigCPtr, name, value);
1300             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1301             return result;
1302         }
1303
1304         /// <summary>
1305         /// Removes custom header.
1306         /// <param name="name">The name of custom header</param>
1307         /// </summary>
1308         [EditorBrowsable(EditorBrowsableState.Never)]
1309         public bool RemoveCustomHeader(string name)
1310         {
1311             bool result = Interop.WebView.RemoveCustomHeader(SwigCPtr, name);
1312             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1313             return result;
1314         }
1315
1316         /// <summary>
1317         /// Starts the inspector server.
1318         /// <param name="port">The port number</param>
1319         /// </summary>
1320         [EditorBrowsable(EditorBrowsableState.Never)]
1321         public uint StartInspectorServer(uint port)
1322         {
1323             uint result = Interop.WebView.StartInspectorServer(SwigCPtr, port);
1324             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1325             return result;
1326         }
1327
1328         /// <summary>
1329         /// Stops the inspector server.
1330         /// </summary>
1331         [EditorBrowsable(EditorBrowsableState.Never)]
1332         public bool StopInspectorServer()
1333         {
1334             bool result = Interop.WebView.StopInspectorServer(SwigCPtr);
1335             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1336             return result;
1337         }
1338
1339         /// <summary>
1340         /// Scrolls page of web view by deltaX and detlaY.
1341         /// <param name="deltaX">The deltaX of scroll</param>
1342         /// <param name="deltaY">The deltaY of scroll</param>
1343         /// </summary>
1344         [EditorBrowsable(EditorBrowsableState.Never)]
1345         public void ScrollBy(int deltaX, int deltaY)
1346         {
1347             Interop.WebView.ScrollBy(SwigCPtr, deltaX, deltaY);
1348             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1349         }
1350
1351         /// <summary>
1352         /// Scrolls edge of web view by deltaX and deltaY.
1353         /// <param name="deltaX">The deltaX of scroll</param>
1354         /// <param name="deltaY">The deltaY of scroll</param>
1355         /// </summary>
1356         [EditorBrowsable(EditorBrowsableState.Never)]
1357         public bool ScrollEdgeBy(int deltaX, int deltaY)
1358         {
1359             bool result = Interop.WebView.ScrollEdgeBy(SwigCPtr, deltaX, deltaY);
1360             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1361             return result;
1362         }
1363
1364         /// <summary>
1365         /// Goes to the back
1366         /// </summary>
1367         [EditorBrowsable(EditorBrowsableState.Never)]
1368         public void GoBack()
1369         {
1370             Interop.WebView.GoBack(SwigCPtr);
1371             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1372         }
1373
1374         /// <summary>
1375         /// Goes to the forward
1376         /// </summary>
1377         [EditorBrowsable(EditorBrowsableState.Never)]
1378         public void GoForward()
1379         {
1380             Interop.WebView.GoForward(SwigCPtr);
1381             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1382         }
1383
1384         /// <summary>
1385         /// Returns whether backward is possible.
1386         /// <returns>True if backward is possible, false otherwise</returns>
1387         /// </summary>
1388         [EditorBrowsable(EditorBrowsableState.Never)]
1389         public bool CanGoBack()
1390         {
1391             bool ret = Interop.WebView.CanGoBack(SwigCPtr);
1392             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1393             return ret;
1394         }
1395
1396         /// <summary>
1397         /// Returns whether forward is possible.
1398         /// <returns>True if forward is possible, false otherwise</returns>
1399         /// </summary>
1400         [EditorBrowsable(EditorBrowsableState.Never)]
1401         public bool CanGoForward()
1402         {
1403             bool ret = Interop.WebView.CanGoForward(SwigCPtr);
1404             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1405             return ret;
1406         }
1407
1408         /// <summary>
1409         /// Evaluates JavaScript code represented as a string.
1410         /// <param name="script">The JavaScript code</param>
1411         /// </summary>
1412         [EditorBrowsable(EditorBrowsableState.Never)]
1413         public void EvaluateJavaScript(string script)
1414         {
1415             Interop.WebView.EvaluateJavaScript(SwigCPtr, script, new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero));
1416             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1417         }
1418
1419         /// <summary>
1420         /// Add a message handler into the WebView.
1421         /// <param name="objectName">The name of exposed object</param>
1422         /// <param name="handler">The callback function</param>
1423         /// </summary>
1424         [EditorBrowsable(EditorBrowsableState.Never)]
1425         public void AddJavaScriptMessageHandler(string objectName, JavaScriptMessageHandler handler)
1426         {
1427             if (handlerRootMap.ContainsKey(objectName))
1428             {
1429                 return;
1430             }
1431
1432             handlerRootMap.Add(objectName, handler);
1433
1434             System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(handler);
1435             Interop.WebView.AddJavaScriptMessageHandler(SwigCPtr, objectName, new System.Runtime.InteropServices.HandleRef(this, ip));
1436
1437             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1438         }
1439
1440         /// <summary>
1441         /// Add a message handler into the WebView.
1442         /// <param name="callback">The callback function</param>
1443         /// </summary>
1444         [EditorBrowsable(EditorBrowsableState.Never)]
1445         public void RegisterJavaScriptAlertCallback(JavaScriptAlertCallback callback)
1446         {
1447             System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(callback);
1448             Interop.WebView.RegisterJavaScriptAlertCallback(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
1449
1450             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1451         }
1452
1453         /// <summary>
1454         /// Reply for alert popup.
1455         /// </summary>
1456         [EditorBrowsable(EditorBrowsableState.Never)]
1457         public void JavaScriptAlertReply()
1458         {
1459             Interop.WebView.JavaScriptAlertReply(SwigCPtr);
1460             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1461         }
1462
1463         /// <summary>
1464         /// Add a message handler into the WebView.
1465         /// <param name="callback">The callback function</param>
1466         /// </summary>
1467         [EditorBrowsable(EditorBrowsableState.Never)]
1468         public void RegisterJavaScriptConfirmCallback(JavaScriptConfirmCallback callback)
1469         {
1470             System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(callback);
1471             Interop.WebView.RegisterJavaScriptConfirmCallback(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
1472
1473             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1474         }
1475
1476         /// <summary>
1477         /// Reply for confirm popup.
1478         /// <param name="confirmed">confirmed or not</param>
1479         /// </summary>
1480         [EditorBrowsable(EditorBrowsableState.Never)]
1481         public void JavaScriptConfirmReply(bool confirmed)
1482         {
1483             Interop.WebView.JavaScriptConfirmReply(SwigCPtr, confirmed);
1484             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1485         }
1486
1487         /// <summary>
1488         /// Add a message handler into the WebView.
1489         /// <param name="callback">The callback function</param>
1490         /// </summary>
1491         [EditorBrowsable(EditorBrowsableState.Never)]
1492         public void RegisterJavaScriptPromptCallback(JavaScriptPromptCallback callback)
1493         {
1494             System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(callback);
1495             Interop.WebView.RegisterJavaScriptPromptCallback(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
1496
1497             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1498         }
1499
1500         /// <summary>
1501         /// Reply for prompt popup.
1502         /// <param name="result">text in prompt input field.</param>
1503         /// </summary>
1504         [EditorBrowsable(EditorBrowsableState.Never)]
1505         public void JavaScriptPromptReply(string result)
1506         {
1507             Interop.WebView.JavaScriptPromptReply(SwigCPtr, result);
1508             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1509         }
1510
1511         /// <summary>
1512         /// Clears title resources of current WebView.
1513         /// </summary>
1514         [EditorBrowsable(EditorBrowsableState.Never)]
1515         public void ClearAllTilesResources()
1516         {
1517             Interop.WebView.ClearAllTilesResources(SwigCPtr);
1518             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1519         }
1520
1521         /// <summary>
1522         /// Clears the history of current WebView.
1523         /// </summary>
1524         [EditorBrowsable(EditorBrowsableState.Never)]
1525         public void ClearHistory()
1526         {
1527             Interop.WebView.ClearHistory(SwigCPtr);
1528             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1529         }
1530
1531         /// <summary>
1532         /// Scales the current page, centered at the given point.
1533         /// <param name="scaleFactor">The new factor to be scaled</param>
1534         /// <param name="point">The center coordinate</param>
1535         /// </summary>
1536         [EditorBrowsable(EditorBrowsableState.Never)]
1537         public void SetScaleFactor(float scaleFactor, Vector2 point)
1538         {
1539             Interop.WebView.SetScaleFactor(SwigCPtr, scaleFactor, Vector2.getCPtr(point));
1540             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1541         }
1542
1543         /// <summary>
1544         /// Gets the current scale factor of the page.
1545         /// </summary>
1546         [EditorBrowsable(EditorBrowsableState.Never)]
1547         public float GetScaleFactor()
1548         {
1549             float result = Interop.WebView.GetScaleFactor(SwigCPtr);
1550             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1551             return result;
1552         }
1553
1554         /// <summary>
1555         /// Requests to activate/deactivate the accessibility usage set by web app.
1556         /// <param name="activated">The new factor to be scaled</param>
1557         /// </summary>
1558         [EditorBrowsable(EditorBrowsableState.Never)]
1559         public void ActivateAccessibility(bool activated)
1560         {
1561             Interop.WebView.ActivateAccessibility(SwigCPtr, activated);
1562             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1563         }
1564
1565         /// <summary>
1566         /// Searches and highlights the given string in the document.
1567         /// <param name="text">The text to be searched</param>
1568         /// <param name="options">The options to search</param>
1569         /// <param name="maxMatchCount">The maximum match count to search</param>
1570         /// </summary>
1571         [EditorBrowsable(EditorBrowsableState.Never)]
1572         public bool HighlightText(string text, FindOption options, uint maxMatchCount)
1573         {
1574             bool result = Interop.WebView.HighlightText(SwigCPtr, text, (int)options, maxMatchCount);
1575             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1576             return result;
1577         }
1578
1579         /// <summary>
1580         /// Adds dynamic certificate path.
1581         /// <param name="host">Host that required client authentication</param>
1582         /// <param name="certPath">The file path stored certificate</param>
1583         /// </summary>
1584         [EditorBrowsable(EditorBrowsableState.Never)]
1585         public void AddDynamicCertificatePath(string host, string certPath)
1586         {
1587             Interop.WebView.AddDynamicCertificatePath(SwigCPtr, host, certPath);
1588             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1589         }
1590
1591         /// <summary>
1592         /// Get snapshot of the specified viewArea of page.
1593         /// <param name="viewArea">Host that required client authentication</param>
1594         /// <param name="scaleFactor">The file path stored certificate</param>
1595         /// </summary>
1596         [EditorBrowsable(EditorBrowsableState.Never)]
1597         public ImageView GetScreenshot(Rectangle viewArea, float scaleFactor)
1598         {
1599             IntPtr image = Interop.WebView.GetScreenshot(SwigCPtr, Rectangle.getCPtr(viewArea), scaleFactor);
1600             ImageView imageView = new ImageView(image, true);
1601             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1602             return imageView;
1603         }
1604
1605         /// <summary>
1606         /// Get snapshot of the specified viewArea of page.
1607         /// <param name="viewArea">Host that required client authentication</param>
1608         /// <param name="scaleFactor">The file path stored certificate</param>
1609         /// <param name="callback">The callback for getting screen shot</param>
1610         /// </summary>
1611         [EditorBrowsable(EditorBrowsableState.Never)]
1612         public bool GetScreenshotAsynchronously(Rectangle viewArea, float scaleFactor, ScreenshotAcquiredCallback callback)
1613         {
1614             System.IntPtr ip = Marshal.GetFunctionPointerForDelegate(callback);
1615             bool result = Interop.WebView.GetScreenshotAsynchronously(SwigCPtr, Rectangle.getCPtr(viewArea), scaleFactor, new HandleRef(this, ip));
1616             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1617             return result;
1618         }
1619
1620         /// <summary>
1621         /// Asynchronous requests to check if there is a video playing in the given view.
1622         /// <param name="callback">The callback called after checking if video is playing or not</param>
1623         /// </summary>
1624         [EditorBrowsable(EditorBrowsableState.Never)]
1625         public bool CheckVideoPlayingAsynchronously(VideoPlayingCallback callback)
1626         {
1627             System.IntPtr ip = Marshal.GetFunctionPointerForDelegate(callback);
1628             bool result = Interop.WebView.CheckVideoPlayingAsynchronously(SwigCPtr, new HandleRef(this, ip));
1629             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1630             return result;
1631         }
1632
1633         /// <summary>
1634         /// Registers callback which will be called upon geolocation permission request.
1635         /// <param name="callback">The callback for requesting geolocation permission</param>
1636         /// </summary>
1637         [EditorBrowsable(EditorBrowsableState.Never)]
1638         public void RegisterGeolocationPermissionCallback(GeolocationPermissionCallback callback)
1639         {
1640             System.IntPtr ip = Marshal.GetFunctionPointerForDelegate(callback);
1641             Interop.WebView.RegisterGeolocationPermissionCallback(SwigCPtr, new HandleRef(this, ip));
1642             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1643         }
1644
1645         /// <summary>
1646         /// Deprecated. Clears the cache of current WebView.
1647         /// </summary>
1648         [EditorBrowsable(EditorBrowsableState.Never)]
1649         public void ClearCache()
1650         {
1651             Context.ClearCache();
1652         }
1653
1654         /// <summary>
1655         /// Deprecated. Clears all the cookies of current WebView.
1656         /// </summary>
1657         [EditorBrowsable(EditorBrowsableState.Never)]
1658         public void ClearCookies()
1659         {
1660             CookieManager.ClearCookies();
1661         }
1662
1663         internal static WebView DownCast(BaseHandle handle)
1664         {
1665             WebView ret = new WebView(Interop.WebView.DownCast(BaseHandle.getCPtr(handle)), true);
1666             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1667             return ret;
1668         }
1669
1670         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WebView obj)
1671         {
1672             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
1673         }
1674
1675         internal WebView Assign(WebView webView)
1676         {
1677             WebView ret = new WebView(Interop.WebView.Assign(SwigCPtr, WebView.getCPtr(webView)), false);
1678             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1679             return ret;
1680         }
1681
1682         /// This will not be public opened.
1683         /// <param name="swigCPtr"></param>
1684         [EditorBrowsable(EditorBrowsableState.Never)]
1685         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
1686         {
1687             Interop.WebView.DeleteWebView(swigCPtr);
1688         }
1689
1690         private void OnPageLoadStarted(IntPtr data, string pageUrl)
1691         {
1692             WebViewPageLoadEventArgs e = new WebViewPageLoadEventArgs();
1693
1694             e.WebView = Registry.GetManagedBaseHandleFromNativePtr(data) as WebView;
1695             e.PageUrl = pageUrl;
1696
1697             pageLoadStartedEventHandler?.Invoke(this, e);
1698         }
1699
1700         private void OnPageLoading(IntPtr data, string pageUrl)
1701         {
1702             pageLoadingEventHandler?.Invoke(this, new WebViewPageLoadEventArgs());
1703         }
1704
1705         private void OnPageLoadFinished(IntPtr data, string pageUrl)
1706         {
1707             WebViewPageLoadEventArgs e = new WebViewPageLoadEventArgs();
1708
1709             e.WebView = Registry.GetManagedBaseHandleFromNativePtr(data) as WebView;
1710             e.PageUrl = pageUrl;
1711
1712             pageLoadFinishedEventHandler?.Invoke(this, e);
1713         }
1714
1715         private void OnPageLoadError(IntPtr data, string pageUrl, int errorCode)
1716         {
1717             WebViewPageLoadErrorEventArgs e = new WebViewPageLoadErrorEventArgs();
1718
1719             e.WebView = Registry.GetManagedBaseHandleFromNativePtr(data) as WebView;
1720             e.PageUrl = pageUrl;
1721             e.ErrorCode = (WebViewPageLoadErrorEventArgs.LoadErrorCode)errorCode;
1722
1723             pageLoadErrorEventHandler?.Invoke(this, e);
1724         }
1725
1726         private void OnScrollEdgeReached(IntPtr data, int edge)
1727         {
1728             WebViewScrollEdgeReachedEventArgs arg = new WebViewScrollEdgeReachedEventArgs((WebViewScrollEdgeReachedEventArgs.Edge)edge);
1729             scrollEdgeReachedEventHandler?.Invoke(this, arg);
1730         }
1731
1732         private void OnUrlChanged(IntPtr data, string pageUrl)
1733         {
1734             urlChangedEventHandler?.Invoke(this, new WebViewUrlChangedEventArgs(pageUrl));
1735         }
1736
1737         private void OnFormRepostPolicyDecided(IntPtr data, IntPtr decision)
1738         {
1739             WebFormRepostPolicyDecisionMaker repostDecision = new WebFormRepostPolicyDecisionMaker(decision, false);
1740             formRepostPolicyDecidedEventHandler?.Invoke(this, new WebViewFormRepostPolicyDecidedEventArgs(repostDecision));
1741             repostDecision.Dispose();
1742         }
1743
1744         private void OnFrameRendered(IntPtr data)
1745         {
1746             frameRenderedEventHandler?.Invoke(this, new EventArgs());
1747         }
1748     }
1749 }