Add APIs of webview back forward list
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / toolkit-web-engine.cpp
1 /*
2  * Copyright (c) 2021 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 #include "toolkit-timer.h"
19
20 #include <dali/devel-api/adaptor-framework/web-engine.h>
21 #include <dali/devel-api/adaptor-framework/web-engine-back-forward-list.h>
22 #include <dali/devel-api/adaptor-framework/web-engine-back-forward-list-item.h>
23 #include <dali/devel-api/adaptor-framework/web-engine-certificate.h>
24 #include <dali/devel-api/adaptor-framework/web-engine-console-message.h>
25 #include <dali/devel-api/adaptor-framework/web-engine-context.h>
26 #include <dali/devel-api/adaptor-framework/web-engine-cookie-manager.h>
27 #include <dali/devel-api/adaptor-framework/web-engine-form-repost-decision.h>
28 #include <dali/devel-api/adaptor-framework/web-engine-frame.h>
29 #include <dali/devel-api/adaptor-framework/web-engine-http-auth-handler.h>
30 #include <dali/devel-api/adaptor-framework/web-engine-load-error.h>
31 #include <dali/devel-api/adaptor-framework/web-engine-policy-decision.h>
32 #include <dali/devel-api/adaptor-framework/web-engine-request-interceptor.h>
33 #include <dali/devel-api/adaptor-framework/web-engine-settings.h>
34 #include <dali/public-api/adaptor-framework/native-image-source.h>
35 #include <dali/public-api/images/pixel-data.h>
36 #include <dali/public-api/object/any.h>
37 #include <dali/public-api/object/base-object.h>
38 #include <memory>
39 #include <string.h>
40 #include <toolkit-application.h>
41
42 namespace Dali
43 {
44
45 namespace Internal
46 {
47
48 namespace Adaptor
49 {
50
51 class WebEngine;
52
53 namespace
54 {
55
56 // Generally only one WebEngine instance exists.
57 // If > 1, a new web engine has been created by CreateWindowSignal.
58 static WebEngine* gInstance = 0;
59 static int gInstanceCount = 0;
60
61 bool OnGoBack();
62 bool OnGoForward();
63 bool OnLoadUrl();
64 bool OnEvaluteJavaScript();
65 bool OnJavaScriptAlert();
66 bool OnJavaScriptConfirm();
67 bool OnJavaScriptPrompt();
68 bool OnScrollEdge();
69 bool OnScreenshotCaptured();
70 bool OnVideoPlaying();
71 bool OnGeolocationPermission();
72 bool OnClearHistory();
73
74 static void ConnectToGlobalSignal( bool ( *func )() )
75 {
76   Dali::Timer timer = Dali::Timer::New( 0 );
77   timer.TickSignal().Connect( func );
78 }
79
80 static void DisconnectFromGlobalSignal( bool ( *func )() )
81 {
82   Dali::Timer timer = Dali::Timer::New( 0 );
83   timer.TickSignal().Disconnect( func );
84 }
85 } // namespace anonymous
86
87 class MockWebEngineContext : public Dali::WebEngineContext
88 {
89 public:
90   MockWebEngineContext()
91     : mockModel( Dali::WebEngineContext::CacheModel::DOCUMENT_VIEWER )
92   {
93   }
94
95   Dali::WebEngineContext::CacheModel GetCacheModel() const override
96   {
97     return mockModel;
98   }
99
100   void SetCacheModel( Dali::WebEngineContext::CacheModel cacheModel ) override
101   {
102     mockModel = cacheModel;
103   }
104
105   void SetProxyUri( const std::string& uri ) override
106   {
107   }
108
109   void SetDefaultProxyAuth( const std::string& username, const std::string& password ) override
110   {
111   }
112
113   void SetCertificateFilePath( const std::string& certificatePath ) override
114   {
115   }
116
117   void DeleteWebDatabase() override
118   {
119   }
120
121   void DeleteWebStorage() override
122   {
123   }
124
125   void DeleteLocalFileSystem() override
126   {
127   }
128
129   void DisableCache( bool cacheDisabled ) override
130   {
131   }
132
133   void ClearCache() override
134   {
135   }
136
137 private:
138   Dali::WebEngineContext::CacheModel mockModel;
139 };
140
141 class MockWebEngineCookieManager : public Dali::WebEngineCookieManager
142 {
143 public:
144   MockWebEngineCookieManager()
145     : mockCookieAcceptPolicy( Dali::WebEngineCookieManager::CookieAcceptPolicy::NO_THIRD_PARTY )
146   {
147   }
148
149   void SetCookieAcceptPolicy( Dali::WebEngineCookieManager::CookieAcceptPolicy policy ) override
150   {
151     mockCookieAcceptPolicy = policy;
152   }
153
154   Dali::WebEngineCookieManager::CookieAcceptPolicy GetCookieAcceptPolicy() const override
155   {
156     return mockCookieAcceptPolicy;
157   }
158
159   void ClearCookies() override
160   {
161   }
162
163   void SetPersistentStorage( const std::string& path, Dali::WebEngineCookieManager::CookiePersistentStorage storage ) override
164   {
165   }
166
167 private:
168   Dali::WebEngineCookieManager::CookieAcceptPolicy mockCookieAcceptPolicy;
169 };
170
171 class MockWebEngineBackForwardListItem : public Dali::WebEngineBackForwardListItem
172 {
173 public:
174   MockWebEngineBackForwardListItem()
175     : mockUrl( "http://url" ),
176       mockTitle( "title" ),
177       mockOriginalUrl( "http://originalurl" )
178   {
179   }
180
181   std::string GetUrl() const override
182   {
183     return mockUrl;
184   }
185
186   std::string GetTitle() const override
187   {
188     return mockTitle;
189   }
190
191   std::string GetOriginalUrl() const override
192   {
193     return mockOriginalUrl;
194   }
195
196 private:
197   std::string mockUrl;
198   std::string mockTitle;
199   std::string mockOriginalUrl;
200 };
201
202 class MockWebEngineBackForwardList : public Dali::WebEngineBackForwardList
203 {
204 public:
205   MockWebEngineBackForwardList()
206   {
207   }
208
209   std::unique_ptr<Dali::WebEngineBackForwardListItem> GetCurrentItem() const override
210   {
211     std::unique_ptr<Dali::WebEngineBackForwardListItem> ret(new MockWebEngineBackForwardListItem());
212     return ret;
213   }
214
215   std::unique_ptr<Dali::WebEngineBackForwardListItem> GetPreviousItem() const override
216   {
217     std::unique_ptr<Dali::WebEngineBackForwardListItem> ret(new MockWebEngineBackForwardListItem());
218     return ret;
219   }
220
221   std::unique_ptr<Dali::WebEngineBackForwardListItem> GetNextItem() const override
222   {
223     std::unique_ptr<Dali::WebEngineBackForwardListItem> ret(new MockWebEngineBackForwardListItem());
224     return ret;
225   }
226
227   std::unique_ptr<Dali::WebEngineBackForwardListItem> GetItemAtIndex( uint32_t index ) const override
228   {
229     std::unique_ptr<Dali::WebEngineBackForwardListItem> ret(new MockWebEngineBackForwardListItem());
230     return ret;
231   }
232
233   uint32_t GetItemCount() const override
234   {
235     return 1;
236   }
237
238   std::vector<std::unique_ptr<Dali::WebEngineBackForwardListItem>> GetBackwardItems(int limit) override
239   {
240     std::vector<std::unique_ptr<Dali::WebEngineBackForwardListItem>> ret;
241     std::unique_ptr<Dali::WebEngineBackForwardListItem> item(new MockWebEngineBackForwardListItem());
242     ret.push_back(std::move(item));
243     return ret;
244   }
245
246   std::vector<std::unique_ptr<Dali::WebEngineBackForwardListItem>> GetForwardItems(int limit) override
247   {
248     std::vector<std::unique_ptr<Dali::WebEngineBackForwardListItem>> ret;
249     std::unique_ptr<Dali::WebEngineBackForwardListItem> item(new MockWebEngineBackForwardListItem());
250     ret.push_back(std::move(item));
251     return ret;
252   }
253 };
254
255
256 class MockWebEngineCertificate : public Dali::WebEngineCertificate
257 {
258 public:
259   MockWebEngineCertificate()
260   {
261   }
262
263   void Allow(bool allowed) override
264   {
265   }
266
267   bool IsFromMainFrame() const override
268   {
269     return true;
270   }
271
272   std::string GetPem() const override
273   {
274     return "abc";
275   }
276
277   bool IsContextSecure() const override
278   {
279     return true;
280   }
281 };
282
283 class MockWebEngineHttpAuthHandler : public Dali::WebEngineHttpAuthHandler
284 {
285 public:
286   MockWebEngineHttpAuthHandler()
287   {
288   }
289
290   std::string GetRealm() const override
291   {
292     return "test";
293   }
294
295   void Suspend() override
296   {
297   }
298
299   void UseCredential(const std::string& user, const std::string& password) override
300   {
301   }
302
303   void CancelCredential() override
304   {
305   }
306 };
307
308 class MockWebEngineFormRepostDecision : public WebEngineFormRepostDecision
309 {
310 public:
311   MockWebEngineFormRepostDecision()
312   {
313   }
314
315   void Reply(bool allowed) override {}
316 };
317
318 class MockWebEngineFrame : public Dali::WebEngineFrame
319 {
320 public:
321   MockWebEngineFrame()
322   {
323   }
324
325   bool IsMainFrame() const override
326   {
327     return true;
328   }
329 };
330
331 class MockWebEnginePolicyDecision : public Dali::WebEnginePolicyDecision
332 {
333 public:
334   MockWebEnginePolicyDecision()
335   {
336   }
337
338   std::string GetUrl() const override
339   {
340     return "http://test.html";
341   }
342
343   std::string GetCookie() const override
344   {
345     return "test:abc";
346   }
347
348   Dali::WebEnginePolicyDecision::DecisionType GetDecisionType() const
349   {
350     return Dali::WebEnginePolicyDecision::DecisionType::USE;
351   }
352
353   std::string GetResponseMime() const
354   {
355     return "txt/xml";
356   }
357
358   int32_t GetResponseStatusCode() const
359   {
360     return 500;
361   }
362
363   Dali::WebEnginePolicyDecision::NavigationType GetNavigationType() const
364   {
365     return Dali::WebEnginePolicyDecision::NavigationType::LINK_CLICKED;
366   }
367
368   Dali::WebEngineFrame& GetFrame() const
369   {
370     return *(Dali::WebEngineFrame*)(&mockWebFrame);
371   }
372
373   std::string GetScheme() const
374   {
375     return "test";
376   }
377
378   bool Use()
379   {
380     return true;
381   }
382
383   bool Ignore()
384   {
385     return true;
386   }
387
388   bool Suspend()
389   {
390     return true;
391   }
392
393 private:
394   MockWebEngineFrame mockWebFrame;
395 };
396
397 class MockWebEngineRequestInterceptor : public WebEngineRequestInterceptor
398 {
399 public:
400   MockWebEngineRequestInterceptor()
401   {
402   }
403
404   std::string GetUrl() const override
405   {
406     return "http://test.html";
407   }
408
409   bool Ignore() override
410   {
411     return true;
412   }
413
414   bool SetResponseStatus(int statusCode, const std::string &customedStatusText) override
415   {
416     return true;
417   }
418
419   bool AddResponseHeader(const std::string &fieldName, const std::string &fieldValue) override
420   {
421     return true;
422   }
423
424   bool AddResponseBody(const std::string &body, uint32_t length) override
425   {
426     return true;
427   }
428 };
429
430 class MockWebEngineConsoleMessage : public Dali::WebEngineConsoleMessage
431 {
432 public:
433   MockWebEngineConsoleMessage()
434   {
435   }
436
437   std::string GetSource() const override
438   {
439     return "source";
440   }
441
442   uint32_t GetLine() const override
443   {
444     return 10;
445   }
446
447   SeverityLevel GetSeverityLevel() const override
448   {
449     return SeverityLevel::EMPTY;
450   }
451
452   std::string GetText() const override
453   {
454     return "This is a text.";
455   }
456 };
457
458 class MockWebEngineLoadError : public Dali::WebEngineLoadError
459 {
460 public:
461   MockWebEngineLoadError(const std::string& url)
462     : mockUrl(url)
463   {
464   }
465
466   std::string GetUrl() const override
467   {
468     return mockUrl;
469   }
470
471   ErrorCode GetCode() const override
472   {
473     return ErrorCode::UNKNOWN;
474   }
475
476   std::string GetDescription() const override
477   {
478     return "This is an error.";
479   }
480
481   ErrorType GetType() const override
482   {
483     return ErrorType::NONE;
484   }
485
486 private:
487   std::string mockUrl;
488 };
489
490 class MockWebEngineSettings : public WebEngineSettings
491 {
492 public:
493   MockWebEngineSettings()
494     : mockDefaultFontSize( 16 ),
495       mockJavaScriptEnabled( true ),
496       mockAutoFittingEnabled ( true ),
497       mockPluginsEnabled ( true ),
498       mockPrivateBrowsingEnabled( true ),
499       mockLinkMagnifierEnabled( true ),
500       mockKeypadWithoutUserActionUsed( true ),
501       mockAutofillPasswordFormEnabled( true ),
502       mockFormCandidateDataEnabled( true ),
503       mockTextSelectionEnabled( true ),
504       mockTextAutosizingEnable( true ),
505       mockArrowScrollEnable( true ),
506       mockClipboardEnabled( true ),
507       mockImePanelEnabled( true ),
508       mockImageLoadedAutomatically( true ),
509       mockDefaultTextEncodingName()
510   {
511   }
512
513   uint32_t GetDefaultFontSize() const override
514   {
515     return mockDefaultFontSize;
516   }
517
518   void SetDefaultFontSize( uint32_t size ) override
519   {
520     mockDefaultFontSize = size;
521   }
522
523   bool IsJavaScriptEnabled() const override
524   {
525     return mockJavaScriptEnabled;
526   }
527
528   void EnableJavaScript( bool enabled ) override
529   {
530     mockJavaScriptEnabled = enabled;
531   }
532
533   bool IsAutoFittingEnabled() const override
534   {
535     return mockAutoFittingEnabled;
536   }
537
538   void EnableAutoFitting( bool enabled ) override
539   {
540     mockAutoFittingEnabled = enabled;
541   }
542
543   bool ArePluginsEnabled() const override
544   {
545     return mockPluginsEnabled;
546   }
547
548   void EnablePlugins( bool enabled ) override
549   {
550     mockPluginsEnabled = enabled;
551   }
552
553   bool IsPrivateBrowsingEnabled() const override
554   {
555     return mockPrivateBrowsingEnabled;
556   }
557
558   void EnablePrivateBrowsing( bool enabled ) override
559   {
560     mockPrivateBrowsingEnabled = enabled;
561   }
562
563   bool IsLinkMagnifierEnabled() const override
564   {
565     return mockLinkMagnifierEnabled;
566   }
567
568   void EnableLinkMagnifier( bool enabled ) override
569   {
570     mockLinkMagnifierEnabled = enabled;
571   }
572
573   bool IsKeypadWithoutUserActionUsed() const override
574   {
575     return mockKeypadWithoutUserActionUsed;
576   }
577
578   void UseKeypadWithoutUserAction( bool used ) override
579   {
580     mockKeypadWithoutUserActionUsed = used;
581   }
582
583   bool IsAutofillPasswordFormEnabled() const override
584   {
585     return mockAutofillPasswordFormEnabled;
586   }
587
588   void EnableAutofillPasswordForm( bool enabled ) override
589   {
590     mockAutofillPasswordFormEnabled = enabled;
591   }
592
593   bool IsFormCandidateDataEnabled() const override
594   {
595     return mockFormCandidateDataEnabled;
596   }
597
598   void EnableFormCandidateData( bool enabled ) override
599   {
600     mockFormCandidateDataEnabled = enabled;
601   }
602
603   bool IsTextSelectionEnabled() const override
604   {
605     return mockTextSelectionEnabled;
606   }
607
608   void EnableTextSelection( bool enabled ) override
609   {
610     mockTextSelectionEnabled = enabled;
611   }
612
613   bool IsTextAutosizingEnabled() const override
614   {
615     return mockTextAutosizingEnable;
616   }
617
618   void EnableTextAutosizing( bool enabled ) override
619   {
620     mockTextAutosizingEnable = enabled;
621   }
622
623   bool IsArrowScrollEnabled() const override
624   {
625     return mockArrowScrollEnable;
626   }
627
628   void EnableArrowScroll( bool enabled ) override
629   {
630     mockArrowScrollEnable = enabled;
631   }
632
633   bool IsClipboardEnabled() const override
634   {
635     return mockClipboardEnabled;
636   }
637
638   void EnableClipboard( bool enabled ) override
639   {
640     mockClipboardEnabled = enabled;
641   }
642
643   bool IsImePanelEnabled() const override
644   {
645     return mockImePanelEnabled;
646   }
647
648   void EnableImePanel( bool enabled ) override
649   {
650     mockImePanelEnabled = enabled;
651   }
652
653   bool AreImagesLoadedAutomatically() const override
654   {
655     return mockImageLoadedAutomatically;
656   }
657
658   void AllowImagesLoadAutomatically( bool automatic ) override
659   {
660     mockImageLoadedAutomatically = automatic;
661   }
662
663   std::string GetDefaultTextEncodingName() const override
664   {
665     return mockDefaultTextEncodingName;
666   }
667
668   void SetDefaultTextEncodingName( const std::string& defaultTextEncodingName ) override
669   {
670     mockDefaultTextEncodingName = defaultTextEncodingName;
671   }
672
673   void AllowMixedContents( bool allowed ) override
674   {
675   }
676
677   void EnableSpatialNavigation( bool enabled ) override
678   {
679   }
680
681   void EnableWebSecurity( bool enabled ) override
682   {
683   }
684
685   void EnableCacheBuilder( bool enabled ) override
686   {
687   }
688
689   void UseScrollbarThumbFocusNotifications( bool used ) override
690   {
691   }
692
693   void EnableDoNotTrack( bool enabled ) override
694   {
695   }
696
697   void AllowFileAccessFromExternalUrl( bool allowed ) override
698   {
699   }
700
701   void AllowScriptsOpenWindows( bool allowed ) override
702   {
703   }
704
705 private:
706   int mockDefaultFontSize;
707   bool mockJavaScriptEnabled;
708   bool mockAutoFittingEnabled;
709   bool mockPluginsEnabled;
710   bool mockPrivateBrowsingEnabled;
711   bool mockLinkMagnifierEnabled;
712   bool mockKeypadWithoutUserActionUsed;
713   bool mockAutofillPasswordFormEnabled;
714   bool mockFormCandidateDataEnabled;
715   bool mockTextSelectionEnabled;
716   bool mockTextAutosizingEnable;
717   bool mockArrowScrollEnable;
718   bool mockClipboardEnabled;
719   bool mockImePanelEnabled;
720   bool mockImageLoadedAutomatically;
721   std::string mockDefaultTextEncodingName;
722 };
723
724 class WebEngine: public Dali::BaseObject
725 {
726 public:
727
728   using JavaScriptEvaluatedResultCallback = std::function<void(const std::string&)>;
729
730   WebEngine()
731     : mUrl()
732     , mCurrentPlusOnePos( 0 )
733     , mUserAgent()
734     , mEvaluating( false )
735     , mScrollPosition( 0, 0 )
736     , mScrollSize( 500, 500 )
737     , mContentSize( 500, 500 )
738   {
739     gInstanceCount++;
740     if ( gInstanceCount == 1 ) // only first web engine need be saved.
741     {
742       gInstance = this;
743     }
744
745     mockWebEngineSettings = new MockWebEngineSettings();
746     mockWebEngineContext = new MockWebEngineContext();
747     mockWebEngineCookieManager = new MockWebEngineCookieManager();
748     mockWebEngineBackForwardList = new MockWebEngineBackForwardList();
749   }
750
751   virtual ~WebEngine()
752   {
753     gInstanceCount--;
754     if( !gInstanceCount )
755     {
756       gInstance = 0;
757     }
758
759     delete mockWebEngineSettings;
760     delete mockWebEngineContext;
761     delete mockWebEngineCookieManager;
762     delete mockWebEngineBackForwardList;
763   }
764
765   Dali::WebEngineSettings& GetSettings() const
766   {
767     return *mockWebEngineSettings;
768   }
769
770   Dali::WebEngineContext& GetContext() const
771   {
772     return *mockWebEngineContext;
773   }
774
775   Dali::WebEngineCookieManager& GetCookieManager() const
776   {
777     return *mockWebEngineCookieManager;
778   }
779
780   Dali::WebEngineBackForwardList& GetBackForwardList() const
781   {
782     return *mockWebEngineBackForwardList;
783   }
784
785   void LoadUrl( const std::string& url )
786   {
787     mUrl = url;
788     ConnectToGlobalSignal( &OnLoadUrl );
789   }
790
791   const std::string& GetUrl() const
792   {
793     return mUrl;
794   }
795
796   std::string GetTitle() const
797   {
798     return std::string("title");
799   }
800
801   Dali::PixelData GetFavicon() const
802   {
803     uint8_t* faviconData = new uint8_t[ 16 ];
804
805     faviconData[ 0 ] = 0xff;
806     faviconData[ 1 ] = 0x00;
807     faviconData[ 2 ] = 0x00;
808     faviconData[ 3 ] = 0xff;
809     faviconData[ 4 ] = 0xff;
810     faviconData[ 5 ] = 0x00;
811     faviconData[ 6 ] = 0x00;
812     faviconData[ 7 ] = 0xff;
813     faviconData[ 8 ] = 0xff;
814     faviconData[ 9 ] = 0x00;
815     faviconData[ 10 ] = 0x00;
816     faviconData[ 11 ] = 0xff;
817     faviconData[ 12 ] = 0xff;
818     faviconData[ 13 ] = 0x00;
819     faviconData[ 14 ] = 0x00;
820     faviconData[ 15 ] = 0xff;
821
822     return Dali::PixelData::New( faviconData, 16, 2, 2,
823                                  Dali::Pixel::Format::RGBA8888,
824                                  Dali::PixelData::ReleaseFunction::DELETE_ARRAY );
825   }
826
827   bool CanGoForward() const
828   {
829     return mHistory.size() > mCurrentPlusOnePos;
830   }
831
832   void GoForward()
833   {
834     ConnectToGlobalSignal( &OnGoForward );
835   }
836
837   bool CanGoBack() const
838   {
839     return mCurrentPlusOnePos > 1;
840   }
841
842   void GoBack()
843   {
844     ConnectToGlobalSignal( &OnGoBack );
845   }
846
847   void EvaluateJavaScript( const std::string& script, std::function< void( const std::string& ) > resultHandler )
848   {
849     if( resultHandler )
850     {
851       if( !mEvaluating )
852       {
853         ConnectToGlobalSignal( &OnEvaluteJavaScript );
854       }
855       mResultCallbacks.push_back( resultHandler );
856     }
857   }
858
859   void RegisterJavaScriptAlertCallback( Dali::WebEnginePlugin::JavaScriptAlertCallback callback )
860   {
861     if ( callback )
862     {
863       ConnectToGlobalSignal( &OnJavaScriptAlert );
864       mJavaScriptAlertCallback = callback;
865     }
866   }
867
868   void RegisterJavaScriptConfirmCallback( Dali::WebEnginePlugin::JavaScriptConfirmCallback callback )
869   {
870     if ( callback )
871     {
872       ConnectToGlobalSignal( &OnJavaScriptConfirm );
873       mJavaScriptConfirmCallback = callback;
874     }
875   }
876
877   void RegisterJavaScriptPromptCallback( Dali::WebEnginePlugin::JavaScriptPromptCallback callback )
878   {
879     if ( callback )
880     {
881       ConnectToGlobalSignal( &OnJavaScriptPrompt );
882       mJavaScriptPromptCallback = callback;
883     }
884   }
885
886   void ClearHistory()
887   {
888     ConnectToGlobalSignal( &OnClearHistory );
889   }
890
891   const std::string& GetUserAgent() const
892   {
893     return mUserAgent;
894   }
895
896   void SetUserAgent( const std::string& userAgent )
897   {
898     mUserAgent = userAgent;
899   }
900
901   void ScrollBy( int dx, int dy )
902   {
903     mScrollPosition += Dali::Vector2( dx, dy );
904     if ( mScrollPosition.y + mScrollSize.height > mContentSize.height )
905     {
906       ConnectToGlobalSignal( &OnScrollEdge );
907     }
908   }
909
910   bool ScrollEdgeBy( int dx, int dy )
911   {
912     mScrollPosition += Dali::Vector2( dx, dy );
913     if ( mScrollPosition.y + mScrollSize.height > mContentSize.height )
914     {
915       ConnectToGlobalSignal( &OnScrollEdge );
916     }
917     return true;
918   }
919
920   void SetScrollPosition( int x, int y )
921   {
922     mScrollPosition.x = x;
923     mScrollPosition.y = y;
924   }
925
926   Dali::Vector2 GetScrollPosition() const
927   {
928     return mScrollPosition;
929   }
930
931   Dali::Vector2 GetScrollSize() const
932   {
933     return mScrollSize;
934   }
935
936   Dali::Vector2 GetContentSize() const
937   {
938     return mContentSize;
939   }
940
941   void SetPageZoomFactor(float zoomFactor)
942   {
943     mPageZoomFactor = zoomFactor;
944   }
945
946   float GetPageZoomFactor() const
947   {
948     return mPageZoomFactor;
949   }
950
951   void SetTextZoomFactor(float zoomFactor)
952   {
953     mTextZoomFactor = zoomFactor;
954   }
955
956   float GetTextZoomFactor() const
957   {
958     return mTextZoomFactor;
959   }
960
961   float GetLoadProgressPercentage() const
962   {
963     return 0.5f;
964   }
965
966   void SetScaleFactor(float scaleFactor, Dali::Vector2 point)
967   {
968     mScaleFactor = scaleFactor;
969   }
970
971   float GetScaleFactor() const
972   {
973     return mScaleFactor;
974   }
975
976   Dali::PixelData GetScreenshot(Dali::Rect<int> viewArea, float scaleFactor)
977   {
978     uint32_t bufferSize = viewArea.width * viewArea.height * 4 ;
979     uint8_t* pixel = new uint8_t[ bufferSize ];
980     memset(pixel, 0xff, bufferSize);
981     return Dali::PixelData::New( pixel, bufferSize, viewArea.width, viewArea.height,
982                                  Dali::Pixel::Format::RGBA8888,
983                                  Dali::PixelData::ReleaseFunction::DELETE_ARRAY );
984   }
985
986   bool GetScreenshotAsynchronously(Dali::Rect<int> viewArea, float scaleFactor, Dali::WebEnginePlugin::ScreenshotCapturedCallback callback)
987   {
988     if ( callback )
989     {
990       ConnectToGlobalSignal( &OnScreenshotCaptured );
991       mScreenshotCapturedCallback = callback;
992     }
993     return true;
994   }
995
996   bool CheckVideoPlayingAsynchronously(Dali::WebEnginePlugin::VideoPlayingCallback callback)
997   {
998     if ( callback )
999     {
1000       ConnectToGlobalSignal( &OnVideoPlaying );
1001       mVideoPlayingCallback = callback;
1002     }
1003     return true;
1004   }
1005
1006   void RegisterGeolocationPermissionCallback(Dali::WebEnginePlugin::GeolocationPermissionCallback callback)
1007   {
1008     if ( callback )
1009     {
1010       ConnectToGlobalSignal( &OnGeolocationPermission );
1011       mGeolocationPermissionCallback = callback;
1012     }
1013   }
1014
1015   Dali::WebEnginePlugin::WebEnginePageLoadSignalType& PageLoadStartedSignal()
1016   {
1017     return mPageLoadStartedSignal;
1018   }
1019
1020   Dali::WebEnginePlugin::WebEnginePageLoadSignalType& PageLoadInProgressSignal()
1021   {
1022     return mPageLoadInProgressSignal;
1023   }
1024
1025   Dali::WebEnginePlugin::WebEnginePageLoadSignalType& PageLoadFinishedSignal()
1026   {
1027     return mPageLoadFinishedSignal;
1028   }
1029
1030   Dali::WebEnginePlugin::WebEnginePageLoadErrorSignalType& PageLoadErrorSignal()
1031   {
1032     return mPageLoadErrorSignal;
1033   }
1034
1035   Dali::WebEnginePlugin::WebEngineScrollEdgeReachedSignalType& ScrollEdgeReachedSignal()
1036   {
1037     return mScrollEdgeReachedSignal;
1038   }
1039
1040   Dali::WebEnginePlugin::WebEngineUrlChangedSignalType& UrlChangedSignal()
1041   {
1042     return mUrlChangedSignal;
1043   }
1044
1045   Dali::WebEnginePlugin::WebEngineFormRepostDecisionSignalType& FormRepostDecisionSignal()
1046   {
1047     return mFormRepostDecisionSignal;
1048   }
1049
1050   Dali::WebEnginePlugin::WebEngineFrameRenderedSignalType& FrameRenderedSignal()
1051   {
1052     return mFrameRenderedSignal;
1053   }
1054
1055   Dali::WebEnginePlugin::WebEngineRequestInterceptorSignalType& RequestInterceptorSignal()
1056   {
1057     return mRequestInterceptorSignal;
1058   }
1059
1060   Dali::WebEnginePlugin::WebEngineConsoleMessageSignalType& ConsoleMessageSignal()
1061   {
1062     return mConsoleMessageSignal;
1063   }
1064
1065   Dali::WebEnginePlugin::WebEnginePolicyDecisionSignalType& PolicyDecisionSignal()
1066   {
1067     return mPolicyDecisionSignal;
1068   }
1069
1070   Dali::WebEnginePlugin::WebEngineCertificateSignalType& CertificateConfirmSignal()
1071   {
1072     return mCertificateConfirmSignal;
1073   }
1074
1075   Dali::WebEnginePlugin::WebEngineCertificateSignalType& SslCertificateChangedSignal()
1076   {
1077     return mSslCertificateChangedSignal;
1078   }
1079
1080   Dali::WebEnginePlugin::WebEngineHttpAuthHandlerSignalType& HttpAuthHandlerSignal()
1081   {
1082     return mHttpAuthHandlerSignal;
1083   }
1084
1085   std::string              mUrl;
1086   std::vector<std::string> mHistory;
1087   size_t                   mCurrentPlusOnePos;
1088   std::string              mUserAgent;
1089
1090   Dali::WebEnginePlugin::WebEnginePageLoadSignalType           mPageLoadStartedSignal;
1091   Dali::WebEnginePlugin::WebEnginePageLoadSignalType           mPageLoadInProgressSignal;
1092   Dali::WebEnginePlugin::WebEnginePageLoadSignalType           mPageLoadFinishedSignal;
1093   Dali::WebEnginePlugin::WebEnginePageLoadErrorSignalType      mPageLoadErrorSignal;
1094   Dali::WebEnginePlugin::WebEngineScrollEdgeReachedSignalType  mScrollEdgeReachedSignal;
1095   Dali::WebEnginePlugin::WebEngineUrlChangedSignalType         mUrlChangedSignal;
1096   Dali::WebEnginePlugin::WebEngineFormRepostDecisionSignalType mFormRepostDecisionSignal;
1097   Dali::WebEnginePlugin::WebEngineFrameRenderedSignalType      mFrameRenderedSignal;
1098   Dali::WebEnginePlugin::WebEngineRequestInterceptorSignalType mRequestInterceptorSignal;
1099   Dali::WebEnginePlugin::WebEngineConsoleMessageSignalType     mConsoleMessageSignal;
1100   Dali::WebEnginePlugin::WebEnginePolicyDecisionSignalType     mPolicyDecisionSignal;
1101   Dali::WebEnginePlugin::WebEngineCertificateSignalType        mCertificateConfirmSignal;
1102   Dali::WebEnginePlugin::WebEngineCertificateSignalType        mSslCertificateChangedSignal;
1103   Dali::WebEnginePlugin::WebEngineHttpAuthHandlerSignalType    mHttpAuthHandlerSignal;
1104
1105   bool  mEvaluating;
1106   float mPageZoomFactor;
1107   float mTextZoomFactor;
1108   float mScaleFactor;
1109
1110   Dali::Vector2             mScrollPosition;
1111   Dali::Vector2             mScrollSize;
1112   Dali::Vector2             mContentSize;
1113   WebEngineBackForwardList* mockWebEngineBackForwardList;
1114   WebEngineContext*         mockWebEngineContext;
1115   WebEngineCookieManager*   mockWebEngineCookieManager;
1116   WebEngineSettings*        mockWebEngineSettings;
1117
1118   std::vector<JavaScriptEvaluatedResultCallback>       mResultCallbacks;
1119   Dali::WebEnginePlugin::JavaScriptAlertCallback       mJavaScriptAlertCallback;
1120   Dali::WebEnginePlugin::JavaScriptConfirmCallback     mJavaScriptConfirmCallback;
1121   Dali::WebEnginePlugin::JavaScriptPromptCallback      mJavaScriptPromptCallback;
1122   Dali::WebEnginePlugin::ScreenshotCapturedCallback    mScreenshotCapturedCallback;
1123   Dali::WebEnginePlugin::VideoPlayingCallback          mVideoPlayingCallback;
1124   Dali::WebEnginePlugin::GeolocationPermissionCallback mGeolocationPermissionCallback;
1125 };
1126
1127
1128 namespace
1129 {
1130
1131 bool OnGoBack()
1132 {
1133   DisconnectFromGlobalSignal( &OnGoBack );
1134
1135   if( gInstance && gInstance->CanGoBack() )
1136   {
1137     gInstance->mCurrentPlusOnePos--;
1138   }
1139   return false;
1140 }
1141
1142 bool OnGoForward()
1143 {
1144   DisconnectFromGlobalSignal( &OnGoForward );
1145
1146   if( gInstance && gInstance->CanGoForward() )
1147   {
1148     gInstance->mCurrentPlusOnePos++;
1149   }
1150   return false;
1151 }
1152
1153 bool OnLoadUrl()
1154 {
1155   DisconnectFromGlobalSignal( &OnLoadUrl );
1156
1157   if( gInstance )
1158   {
1159     if( gInstance->mHistory.size() > gInstance->mCurrentPlusOnePos )
1160     {
1161       gInstance->mHistory.erase( gInstance->mHistory.begin() + gInstance->mCurrentPlusOnePos, gInstance->mHistory.end() );
1162     }
1163     gInstance->mHistory.push_back( gInstance->mUrl );
1164     gInstance->mCurrentPlusOnePos++;
1165     gInstance->mPageLoadStartedSignal.Emit( gInstance->mUrl );
1166     gInstance->mPageLoadInProgressSignal.Emit( gInstance->mUrl );
1167     gInstance->mPageLoadFinishedSignal.Emit( gInstance->mUrl );
1168     gInstance->mUrlChangedSignal.Emit( "http://new-test" );
1169
1170     std::shared_ptr<Dali::WebEngineFormRepostDecision> repostDecision(new MockWebEngineFormRepostDecision());
1171     gInstance->mFormRepostDecisionSignal.Emit(std::move(repostDecision));
1172     gInstance->mFrameRenderedSignal.Emit();
1173     std::shared_ptr<Dali::WebEngineRequestInterceptor> interceptor(new MockWebEngineRequestInterceptor());
1174     gInstance->mRequestInterceptorSignal.Emit(std::move(interceptor));
1175
1176     std::shared_ptr<Dali::WebEngineLoadError> error(new MockWebEngineLoadError(gInstance->mUrl));
1177     gInstance->mPageLoadErrorSignal.Emit(std::move(error));
1178     std::shared_ptr<Dali::WebEngineConsoleMessage> message(new MockWebEngineConsoleMessage());
1179     gInstance->mConsoleMessageSignal.Emit(std::move(message));
1180     std::shared_ptr<Dali::WebEnginePolicyDecision> policyDecision(new MockWebEnginePolicyDecision());
1181     gInstance->mPolicyDecisionSignal.Emit(std::move(policyDecision));
1182
1183     std::shared_ptr<Dali::WebEngineCertificate> certificate(new MockWebEngineCertificate());
1184     gInstance->mCertificateConfirmSignal.Emit(std::move(certificate));
1185     std::shared_ptr<Dali::WebEngineCertificate> sslCertificate(new MockWebEngineCertificate());
1186     gInstance->mSslCertificateChangedSignal.Emit(std::move(sslCertificate));
1187     std::shared_ptr<Dali::WebEngineHttpAuthHandler> handler(new MockWebEngineHttpAuthHandler());
1188     gInstance->mHttpAuthHandlerSignal.Emit(std::move(handler));
1189   }
1190   return false;
1191 }
1192
1193 bool OnScrollEdge()
1194 {
1195   DisconnectFromGlobalSignal( &OnScrollEdge );
1196
1197   if( gInstance )
1198   {
1199     gInstance->mScrollEdgeReachedSignal.Emit( Dali::WebEnginePlugin::ScrollEdge::BOTTOM );
1200   }
1201
1202   return false;
1203 }
1204
1205 bool OnEvaluteJavaScript()
1206 {
1207   DisconnectFromGlobalSignal( &OnEvaluteJavaScript );
1208
1209   if( gInstance )
1210   {
1211     for( auto& func : gInstance->mResultCallbacks )
1212     {
1213       func("undefined");
1214     }
1215     gInstance->mResultCallbacks.clear();
1216   }
1217   return false;
1218 }
1219
1220 bool OnJavaScriptAlert()
1221 {
1222   DisconnectFromGlobalSignal( &OnJavaScriptAlert );
1223   if ( gInstance )
1224   {
1225     gInstance->mJavaScriptAlertCallback( "this is an alert popup." );
1226   }
1227   return false;
1228 }
1229
1230 bool OnJavaScriptConfirm()
1231 {
1232   DisconnectFromGlobalSignal( &OnJavaScriptConfirm );
1233   if ( gInstance )
1234   {
1235     gInstance->mJavaScriptConfirmCallback( "this is a confirm popup." );
1236   }
1237   return false;
1238 }
1239
1240 bool OnJavaScriptPrompt()
1241 {
1242   DisconnectFromGlobalSignal( &OnJavaScriptPrompt );
1243   if ( gInstance )
1244   {
1245     gInstance->mJavaScriptPromptCallback( "this is a prompt pompt.", "" );
1246   }
1247   return false;
1248 }
1249
1250 bool OnScreenshotCaptured()
1251 {
1252   DisconnectFromGlobalSignal( &OnScreenshotCaptured );
1253   if ( gInstance )
1254   {
1255     uint8_t* pixel = new uint8_t[ 2 * 2 * 4 ];
1256     memset(pixel, 0xff, 2 * 2 * 4);
1257     Dali::PixelData data = Dali::PixelData::New( pixel, 2 * 2 * 4, 2, 2,
1258                                  Dali::Pixel::Format::RGBA8888,
1259                                  Dali::PixelData::ReleaseFunction::DELETE_ARRAY );
1260     gInstance->mScreenshotCapturedCallback( data );
1261   }
1262   return false;
1263 }
1264
1265 bool OnVideoPlaying()
1266 {
1267   DisconnectFromGlobalSignal( &OnVideoPlaying );
1268   if ( gInstance )
1269   {
1270     gInstance->mVideoPlayingCallback( true );
1271   }
1272   return false;
1273 }
1274
1275 bool OnGeolocationPermission()
1276 {
1277   DisconnectFromGlobalSignal( &OnGeolocationPermission );
1278   if ( gInstance )
1279   {
1280     gInstance->mGeolocationPermissionCallback( "", "" );
1281   }
1282   return false;
1283 }
1284
1285 bool OnClearHistory()
1286 {
1287   DisconnectFromGlobalSignal( &OnClearHistory );
1288
1289   if( gInstance && gInstance->mCurrentPlusOnePos )
1290   {
1291     std::string url = gInstance->mHistory[ gInstance->mCurrentPlusOnePos - 1 ];
1292     std::vector< std::string >().swap( gInstance->mHistory );
1293     gInstance->mHistory.push_back( url );
1294     gInstance->mCurrentPlusOnePos = 1;
1295   }
1296   return false;
1297 }
1298
1299 } // namespace
1300
1301 inline WebEngine& GetImplementation( Dali::WebEngine& webEngine )
1302 {
1303   DALI_ASSERT_ALWAYS( webEngine && "WebEngine handle is empty." );
1304   BaseObject& handle = webEngine.GetBaseObject();
1305   return static_cast< Internal::Adaptor::WebEngine& >( handle );
1306 }
1307
1308 inline const WebEngine& GetImplementation( const Dali::WebEngine& webEngine )
1309 {
1310   DALI_ASSERT_ALWAYS( webEngine && "WebEngine handle is empty." );
1311   const BaseObject& handle = webEngine.GetBaseObject();
1312   return static_cast< const Internal::Adaptor::WebEngine& >( handle );
1313 }
1314
1315 } // namespace Adaptor
1316
1317 } // namespace Internal
1318
1319 // Dali::WebEngine Implementation
1320 WebEngine::WebEngine()
1321 {
1322 }
1323
1324 WebEngine::WebEngine( Internal::Adaptor::WebEngine* internal )
1325 : BaseHandle( internal )
1326 {
1327 }
1328
1329 WebEngine::~WebEngine()
1330 {
1331 }
1332
1333 WebEngine WebEngine::New()
1334 {
1335   Internal::Adaptor::WebEngine* baseObject = new Internal::Adaptor::WebEngine();
1336
1337   return WebEngine( baseObject );
1338 }
1339
1340 WebEngine::WebEngine( const WebEngine& WebEngine )
1341 : BaseHandle( WebEngine )
1342 {
1343 }
1344
1345 WebEngine& WebEngine::operator=( const WebEngine& webEngine )
1346 {
1347   BaseHandle::operator=( webEngine );
1348   return *this;
1349 }
1350
1351 WebEngine WebEngine::DownCast( BaseHandle handle )
1352 {
1353   return WebEngine( dynamic_cast< Internal::Adaptor::WebEngine* >( handle.GetObjectPtr() ) );
1354 }
1355
1356 void WebEngine::Create( int width, int height, const std::string& locale, const std::string& timezoneId )
1357 {
1358 }
1359
1360 void WebEngine::Create( int width, int height, int argc, char** argv )
1361 {
1362 }
1363
1364 void WebEngine::Destroy()
1365 {
1366 }
1367
1368 WebEngineSettings& WebEngine::GetSettings() const
1369 {
1370   return Internal::Adaptor::GetImplementation( *this ).GetSettings();
1371 }
1372
1373 WebEngineContext& WebEngine::GetContext() const
1374 {
1375   return Internal::Adaptor::GetImplementation( *this ).GetContext();
1376 }
1377
1378 WebEngineCookieManager& WebEngine::GetCookieManager() const
1379 {
1380   return Internal::Adaptor::GetImplementation( *this ).GetCookieManager();
1381 }
1382
1383 WebEngineBackForwardList& WebEngine::GetBackForwardList() const
1384 {
1385   return Internal::Adaptor::GetImplementation( *this ).GetBackForwardList();
1386 }
1387
1388 void WebEngine::LoadUrl( const std::string& url )
1389 {
1390   return Internal::Adaptor::GetImplementation( *this ).LoadUrl( url );
1391 }
1392
1393 std::string WebEngine::GetTitle() const
1394 {
1395   return Internal::Adaptor::GetImplementation( *this ).GetTitle();
1396 }
1397
1398 Dali::PixelData WebEngine::GetFavicon() const
1399 {
1400   return Internal::Adaptor::GetImplementation( *this ).GetFavicon();
1401 }
1402
1403 const std::string& WebEngine::GetUrl()
1404 {
1405   return Internal::Adaptor::GetImplementation( *this ).GetUrl();
1406 }
1407
1408 NativeImageInterfacePtr WebEngine::GetNativeImageSource()
1409 {
1410   Any source;
1411   Dali::NativeImageSourcePtr sourcePtr = Dali::NativeImageSource::New( source );
1412   return sourcePtr;
1413 }
1414
1415 void WebEngine::LoadHtmlString( const std::string& htmlString )
1416 {
1417 }
1418
1419 bool WebEngine::LoadHtmlStringOverrideCurrentEntry(const std::string& html, const std::string& basicUri, const std::string& unreachableUrl)
1420 {
1421   return true;
1422 }
1423
1424 bool WebEngine::LoadContents(const std::string& contents, uint32_t contentSize, const std::string& mimeType, const std::string& encoding, const std::string& baseUri)
1425 {
1426   return true;
1427 }
1428
1429 void WebEngine::Reload()
1430 {
1431 }
1432
1433 bool WebEngine::ReloadWithoutCache()
1434 {
1435   return true;
1436 }
1437
1438 void WebEngine::StopLoading()
1439 {
1440 }
1441
1442 void WebEngine::Suspend()
1443 {
1444 }
1445
1446 void WebEngine::Resume()
1447 {
1448 }
1449
1450 void WebEngine::SuspendNetworkLoading()
1451 {
1452 }
1453
1454 void WebEngine::ResumeNetworkLoading()
1455 {
1456 }
1457
1458 bool WebEngine::AddCustomHeader(const std::string& name, const std::string& value)
1459 {
1460   return true;
1461 }
1462
1463 bool WebEngine::RemoveCustomHeader(const std::string& name)
1464 {
1465   return true;
1466 }
1467
1468 uint32_t WebEngine::StartInspectorServer(uint32_t port)
1469 {
1470   return port;
1471 }
1472
1473 bool WebEngine::StopInspectorServer()
1474 {
1475   return true;
1476 }
1477
1478 bool WebEngine::CanGoForward()
1479 {
1480   return Internal::Adaptor::GetImplementation( *this ).CanGoForward();
1481 }
1482
1483 void WebEngine::GoForward()
1484 {
1485   Internal::Adaptor::GetImplementation( *this ).GoForward();
1486 }
1487
1488 bool WebEngine::CanGoBack()
1489 {
1490   return Internal::Adaptor::GetImplementation( *this ).CanGoBack();
1491 }
1492
1493 void WebEngine::GoBack()
1494 {
1495   Internal::Adaptor::GetImplementation( *this ).GoBack();
1496 }
1497
1498 void WebEngine::EvaluateJavaScript( const std::string& script, std::function< void( const std::string& ) > resultHandler )
1499 {
1500   Internal::Adaptor::GetImplementation( *this ).EvaluateJavaScript( script, resultHandler );
1501 }
1502
1503 void WebEngine::AddJavaScriptMessageHandler( const std::string& exposedObjectName, std::function< void(const std::string&) > handler )
1504 {
1505 }
1506
1507 void WebEngine::RegisterJavaScriptAlertCallback( Dali::WebEnginePlugin::JavaScriptAlertCallback callback )
1508 {
1509   Internal::Adaptor::GetImplementation( *this ).RegisterJavaScriptAlertCallback( callback );
1510 }
1511
1512 void WebEngine::JavaScriptAlertReply()
1513 {
1514 }
1515
1516 void WebEngine::RegisterJavaScriptConfirmCallback( Dali::WebEnginePlugin::JavaScriptConfirmCallback callback )
1517 {
1518   Internal::Adaptor::GetImplementation( *this ).RegisterJavaScriptConfirmCallback( callback );
1519 }
1520
1521 void WebEngine::JavaScriptConfirmReply( bool confirmed )
1522 {
1523 }
1524
1525 void WebEngine::RegisterJavaScriptPromptCallback( Dali::WebEnginePlugin::JavaScriptPromptCallback callback )
1526 {
1527   Internal::Adaptor::GetImplementation( *this ).RegisterJavaScriptPromptCallback( callback );
1528 }
1529
1530 void WebEngine::JavaScriptPromptReply( const std::string& result )
1531 {
1532 }
1533
1534 void WebEngine::ClearAllTilesResources()
1535 {
1536 }
1537
1538 void WebEngine::ClearHistory()
1539 {
1540   Internal::Adaptor::GetImplementation( *this ).ClearHistory();
1541 }
1542
1543 void WebEngine::SetScaleFactor(float scaleFactor, Dali::Vector2 point)
1544 {
1545   Internal::Adaptor::GetImplementation( *this ).SetScaleFactor(scaleFactor, point);
1546 }
1547
1548 float WebEngine::GetScaleFactor() const
1549 {
1550   return Internal::Adaptor::GetImplementation( *this ).GetScaleFactor();
1551 }
1552
1553 void WebEngine::ActivateAccessibility(bool activated)
1554 {
1555 }
1556
1557 bool WebEngine::HighlightText(const std::string& text, Dali::WebEnginePlugin::FindOption options, uint32_t maxMatchCount)
1558 {
1559   return true;
1560 }
1561
1562 void WebEngine::AddDynamicCertificatePath(const std::string& host, const std::string& certPath)
1563 {
1564 }
1565
1566 Dali::PixelData WebEngine::GetScreenshot(Dali::Rect<int> viewArea, float scaleFactor)
1567 {
1568   return Internal::Adaptor::GetImplementation( *this ).GetScreenshot(viewArea, scaleFactor);
1569 }
1570
1571 bool WebEngine::GetScreenshotAsynchronously(Dali::Rect<int> viewArea, float scaleFactor, Dali::WebEnginePlugin::ScreenshotCapturedCallback callback)
1572 {
1573   return Internal::Adaptor::GetImplementation( *this ).GetScreenshotAsynchronously(viewArea, scaleFactor, callback);
1574 }
1575
1576 bool WebEngine::CheckVideoPlayingAsynchronously(Dali::WebEnginePlugin::VideoPlayingCallback callback)
1577 {
1578   return Internal::Adaptor::GetImplementation( *this ).CheckVideoPlayingAsynchronously(callback);
1579 }
1580
1581 void WebEngine::RegisterGeolocationPermissionCallback(Dali::WebEnginePlugin::GeolocationPermissionCallback callback)
1582 {
1583   Internal::Adaptor::GetImplementation( *this ).RegisterGeolocationPermissionCallback(callback);
1584 }
1585
1586 const std::string& WebEngine::GetUserAgent() const
1587 {
1588   return Internal::Adaptor::GetImplementation( *this ).GetUserAgent();
1589 }
1590
1591 void WebEngine::SetUserAgent( const std::string& userAgent )
1592 {
1593   Internal::Adaptor::GetImplementation( *this ).SetUserAgent( userAgent );
1594 }
1595
1596 void WebEngine::ScrollBy( int dx, int dy )
1597 {
1598   Internal::Adaptor::GetImplementation( *this ).ScrollBy( dx, dy );
1599 }
1600
1601 bool WebEngine::ScrollEdgeBy( int dx, int dy )
1602 {
1603   return Internal::Adaptor::GetImplementation( *this ).ScrollEdgeBy( dx, dy );
1604 }
1605
1606 void WebEngine::SetScrollPosition( int x, int y )
1607 {
1608   Internal::Adaptor::GetImplementation( *this ).SetScrollPosition( x, y );
1609 }
1610
1611 Dali::Vector2 WebEngine::GetScrollPosition() const
1612 {
1613   return Internal::Adaptor::GetImplementation( *this ).GetScrollPosition();
1614 }
1615
1616 Dali::Vector2 WebEngine::GetScrollSize() const
1617 {
1618   return Internal::Adaptor::GetImplementation( *this ).GetScrollSize();
1619 }
1620
1621 Dali::Vector2 WebEngine::GetContentSize() const
1622 {
1623   return Internal::Adaptor::GetImplementation( *this ).GetContentSize();
1624 }
1625
1626 void WebEngine::SetSize( int width, int height )
1627 {
1628 }
1629
1630 void WebEngine::SetDocumentBackgroundColor(Dali::Vector4 color)
1631 {
1632 }
1633
1634 void WebEngine::ClearTilesWhenHidden(bool cleared)
1635 {
1636 }
1637
1638 void WebEngine::SetTileCoverAreaMultiplier(float multiplier)
1639 {
1640 }
1641
1642 void WebEngine::EnableCursorByClient(bool enabled)
1643 {
1644 }
1645
1646 std::string WebEngine::GetSelectedText() const
1647 {
1648   return "test";
1649 }
1650
1651 bool WebEngine::SendTouchEvent( const TouchEvent& touch )
1652 {
1653   return true;
1654 }
1655
1656 bool WebEngine::SendKeyEvent( const KeyEvent& event )
1657 {
1658   return true;
1659 }
1660
1661 bool WebEngine::SendHoverEvent( const HoverEvent& event )
1662 {
1663   return true;
1664 }
1665
1666 bool WebEngine::SendWheelEvent( const WheelEvent& event )
1667 {
1668   return true;
1669 }
1670
1671 void WebEngine::SetFocus( bool focused )
1672 {
1673 }
1674
1675 void WebEngine::SetPageZoomFactor(float zoomFactor)
1676 {
1677   Internal::Adaptor::GetImplementation( *this ).SetPageZoomFactor(zoomFactor);
1678 }
1679
1680 float WebEngine::GetPageZoomFactor() const
1681 {
1682   return Internal::Adaptor::GetImplementation( *this ).GetPageZoomFactor();
1683 }
1684
1685 void WebEngine::SetTextZoomFactor(float zoomFactor)
1686 {
1687   Internal::Adaptor::GetImplementation( *this ).SetTextZoomFactor(zoomFactor);
1688 }
1689
1690 float WebEngine::GetTextZoomFactor() const
1691 {
1692   return Internal::Adaptor::GetImplementation( *this ).GetTextZoomFactor();
1693 }
1694
1695 float WebEngine::GetLoadProgressPercentage() const
1696 {
1697   return Internal::Adaptor::GetImplementation( *this ).GetLoadProgressPercentage();
1698 }
1699
1700 void WebEngine::UpdateDisplayArea( Dali::Rect< int > displayArea )
1701 {
1702 }
1703
1704 void WebEngine::EnableVideoHole( bool enabled )
1705 {
1706 }
1707
1708 void WebEngine::EnableMouseEvents( bool enabled )
1709 {
1710 }
1711
1712 void WebEngine::EnableKeyEvents( bool enabled )
1713 {
1714 }
1715
1716 Dali::WebEnginePlugin::WebEnginePageLoadSignalType& WebEngine::PageLoadStartedSignal()
1717 {
1718   return Internal::Adaptor::GetImplementation( *this ).PageLoadStartedSignal();
1719 }
1720
1721 Dali::WebEnginePlugin::WebEnginePageLoadSignalType& WebEngine::PageLoadInProgressSignal()
1722 {
1723   return Internal::Adaptor::GetImplementation( *this ).PageLoadInProgressSignal();
1724 }
1725
1726 Dali::WebEnginePlugin::WebEnginePageLoadSignalType& WebEngine::PageLoadFinishedSignal()
1727 {
1728   return Internal::Adaptor::GetImplementation( *this ).PageLoadFinishedSignal();
1729 }
1730
1731 Dali::WebEnginePlugin::WebEnginePageLoadErrorSignalType& WebEngine::PageLoadErrorSignal()
1732 {
1733   return Internal::Adaptor::GetImplementation( *this ).PageLoadErrorSignal();
1734 }
1735
1736 Dali::WebEnginePlugin::WebEngineScrollEdgeReachedSignalType& WebEngine::ScrollEdgeReachedSignal()
1737 {
1738   return Internal::Adaptor::GetImplementation( *this ).ScrollEdgeReachedSignal();
1739 }
1740
1741 Dali::WebEnginePlugin::WebEngineUrlChangedSignalType& WebEngine::UrlChangedSignal()
1742 {
1743   return Internal::Adaptor::GetImplementation( *this ).UrlChangedSignal();
1744 }
1745
1746 Dali::WebEnginePlugin::WebEngineFormRepostDecisionSignalType& WebEngine::FormRepostDecisionSignal()
1747 {
1748   return Internal::Adaptor::GetImplementation(*this).FormRepostDecisionSignal();
1749 }
1750
1751 Dali::WebEnginePlugin::WebEngineFrameRenderedSignalType& WebEngine::FrameRenderedSignal()
1752 {
1753   return Internal::Adaptor::GetImplementation(*this).FrameRenderedSignal();
1754 }
1755
1756 Dali::WebEnginePlugin::WebEngineRequestInterceptorSignalType& WebEngine::RequestInterceptorSignal()
1757 {
1758   return Internal::Adaptor::GetImplementation(*this).RequestInterceptorSignal();
1759 }
1760
1761 Dali::WebEnginePlugin::WebEngineConsoleMessageSignalType& WebEngine::ConsoleMessageSignal()
1762 {
1763   return Internal::Adaptor::GetImplementation(*this).ConsoleMessageSignal();
1764 }
1765
1766 Dali::WebEnginePlugin::WebEnginePolicyDecisionSignalType& WebEngine::PolicyDecisionSignal()
1767 {
1768   return Internal::Adaptor::GetImplementation(*this).PolicyDecisionSignal();
1769 }
1770
1771 Dali::WebEnginePlugin::WebEngineCertificateSignalType& WebEngine::CertificateConfirmSignal()
1772 {
1773   return Internal::Adaptor::GetImplementation(*this).CertificateConfirmSignal();
1774 }
1775
1776 Dali::WebEnginePlugin::WebEngineCertificateSignalType& WebEngine::SslCertificateChangedSignal()
1777 {
1778   return Internal::Adaptor::GetImplementation(*this).SslCertificateChangedSignal();
1779 }
1780
1781 Dali::WebEnginePlugin::WebEngineHttpAuthHandlerSignalType& WebEngine::HttpAuthHandlerSignal()
1782 {
1783   return Internal::Adaptor::GetImplementation(*this).HttpAuthHandlerSignal();
1784 }
1785
1786 } // namespace Dali;
1787