2 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include "toolkit-timer.h"
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-context-menu.h>
27 #include <dali/devel-api/adaptor-framework/web-engine-context-menu-item.h>
28 #include <dali/devel-api/adaptor-framework/web-engine-cookie-manager.h>
29 #include <dali/devel-api/adaptor-framework/web-engine-form-repost-decision.h>
30 #include <dali/devel-api/adaptor-framework/web-engine-frame.h>
31 #include <dali/devel-api/adaptor-framework/web-engine-hit-test.h>
32 #include <dali/devel-api/adaptor-framework/web-engine-http-auth-handler.h>
33 #include <dali/devel-api/adaptor-framework/web-engine-load-error.h>
34 #include <dali/devel-api/adaptor-framework/web-engine-policy-decision.h>
35 #include <dali/devel-api/adaptor-framework/web-engine-request-interceptor.h>
36 #include <dali/devel-api/adaptor-framework/web-engine-security-origin.h>
37 #include <dali/devel-api/adaptor-framework/web-engine-settings.h>
38 #include <dali/public-api/adaptor-framework/native-image-source.h>
39 #include <dali/public-api/images/pixel-data.h>
40 #include <dali/public-api/object/any.h>
41 #include <dali/public-api/object/base-object.h>
42 #include <dali/public-api/object/property-map.h>
45 #include <toolkit-application.h>
57 class MockWebEngineContext;
62 // Generally only one WebEngine instance exists.
63 // If > 1, a new web engine has been created by CreateWindowSignal.
64 static WebEngine* gInstance = nullptr;
65 static int gInstanceCount = 0;
66 static MockWebEngineContext* gWebEngineContextInstance = nullptr;
71 bool OnEvaluteJavaScript();
72 bool OnJavaScriptAlert();
73 bool OnJavaScriptConfirm();
74 bool OnJavaScriptPrompt();
75 bool OnHitTestCreated();
77 bool OnScreenshotCaptured();
78 bool OnVideoPlaying();
79 bool OnGeolocationPermission();
80 bool OnClearHistory();
81 bool OnSecurityOriginAcquired();
82 bool OnStorageUsageAcquired();
83 bool OnFormPasswordAcquired();
84 bool OnDownloadStarted();
85 bool OnMimeOverridden();
86 bool OnChangesWatch();
88 static void ConnectToGlobalSignal( bool ( *func )() )
90 Dali::Timer timer = Dali::Timer::New( 0 );
91 timer.TickSignal().Connect( func );
94 static void DisconnectFromGlobalSignal( bool ( *func )() )
96 Dali::Timer timer = Dali::Timer::New( 0 );
97 timer.TickSignal().Disconnect( func );
99 } // namespace anonymous
101 class MockWebEngineContext : public Dali::WebEngineContext
104 MockWebEngineContext()
105 : mockModel( Dali::WebEngineContext::CacheModel::DOCUMENT_VIEWER )
109 Dali::WebEngineContext::CacheModel GetCacheModel() const override
114 void SetCacheModel( Dali::WebEngineContext::CacheModel cacheModel ) override
116 mockModel = cacheModel;
119 void SetProxyUri( const std::string& uri ) override
123 void SetDefaultProxyAuth( const std::string& username, const std::string& password ) override
127 void SetCertificateFilePath( const std::string& certificatePath ) override
131 void DeleteAllWebDatabase() override
135 bool GetWebDatabaseOrigins(Dali::WebEngineContext::WebEngineSecurityOriginAcquiredCallback callback)
139 ConnectToGlobalSignal(&OnSecurityOriginAcquired);
140 mSecurityOriginAcquiredCallback = callback;
145 bool DeleteWebDatabase(Dali::WebEngineSecurityOrigin& origin)
150 bool GetWebStorageOrigins(Dali::WebEngineContext::WebEngineSecurityOriginAcquiredCallback callback)
154 ConnectToGlobalSignal(&OnSecurityOriginAcquired);
155 mSecurityOriginAcquiredCallback = callback;
160 bool GetWebStorageUsageForOrigin(Dali::WebEngineSecurityOrigin& origin, Dali::WebEngineContext::WebEngineStorageUsageAcquiredCallback callback)
164 ConnectToGlobalSignal(&OnStorageUsageAcquired);
165 mStorageUsageAcquiredCallback = callback;
170 void DeleteAllWebStorage() override
174 bool DeleteWebStorage(Dali::WebEngineSecurityOrigin& origin)
179 void DeleteLocalFileSystem() override
183 void ClearCache() override
187 bool DeleteApplicationCache(Dali::WebEngineSecurityOrigin& origin)
192 void GetFormPasswordList(Dali::WebEngineContext::WebEngineFormPasswordAcquiredCallback callback)
196 ConnectToGlobalSignal(&OnFormPasswordAcquired);
197 mFormPasswordAcquiredCallback = callback;
201 void RegisterDownloadStartedCallback(Dali::WebEngineContext::WebEngineDownloadStartedCallback callback)
205 ConnectToGlobalSignal(&OnDownloadStarted);
206 mDownloadStartedCallback = callback;
210 void RegisterMimeOverriddenCallback(Dali::WebEngineContext::WebEngineMimeOverriddenCallback callback)
214 ConnectToGlobalSignal(&OnMimeOverridden);
215 mMimeOverriddenCallback = callback;
219 void EnableCache( bool cacheEnabled ) override
223 bool IsCacheEnabled() const override
228 std::string GetContextCertificateFile() const override
233 void SetContextAppId(const std::string& appID) override
237 bool SetContextAppVersion(const std::string& appVersion) override
242 void SetContextApplicationType(const Dali::WebEngineContext::ApplicationType applicationType) override
246 void SetContextTimeOffset(float timeOffset) override
250 void SetContextTimeZoneOffset(float timeZoneOffset, float daylightSavingTime) override
254 void RegisterUrlSchemesAsCorsEnabled(const std::vector<std::string>& schemes) override
258 void RegisterJsPluginMimeTypes(const std::vector<std::string>& mimeTypes) override
262 void SetDefaultZoomFactor(float zoomFactor) override
266 float GetContextDefaultZoomFactor() const override
271 bool DeleteAllApplicationCache() override
276 bool DeleteAllWebIndexedDatabase() override
281 void DeleteFormPasswordDataList(const std::vector<std::string>& list) override
285 void DeleteAllFormPasswordData() override
289 void DeleteAllFormCandidateData() override
293 std::string GetContextProxy() const override
298 void SetContextProxy(const std::string& proxy, const std::string& bypass) override
302 std::string GetProxyBypassRule() const override
307 bool FreeUnusedMemory() override
313 Dali::WebEngineContext::WebEngineSecurityOriginAcquiredCallback mSecurityOriginAcquiredCallback;
314 Dali::WebEngineContext::WebEngineStorageUsageAcquiredCallback mStorageUsageAcquiredCallback;
315 Dali::WebEngineContext::WebEngineFormPasswordAcquiredCallback mFormPasswordAcquiredCallback;
316 Dali::WebEngineContext::WebEngineDownloadStartedCallback mDownloadStartedCallback;
317 Dali::WebEngineContext::WebEngineMimeOverriddenCallback mMimeOverriddenCallback;
320 Dali::WebEngineContext::CacheModel mockModel;
323 class MockWebEngineCookieManager : public Dali::WebEngineCookieManager
326 MockWebEngineCookieManager()
327 : mockCookieAcceptPolicy( Dali::WebEngineCookieManager::CookieAcceptPolicy::NO_THIRD_PARTY )
331 void SetCookieAcceptPolicy( Dali::WebEngineCookieManager::CookieAcceptPolicy policy ) override
333 mockCookieAcceptPolicy = policy;
336 Dali::WebEngineCookieManager::CookieAcceptPolicy GetCookieAcceptPolicy() const override
338 return mockCookieAcceptPolicy;
341 void ClearCookies() override
345 void SetPersistentStorage( const std::string& path, Dali::WebEngineCookieManager::CookiePersistentStorage storage ) override
349 void ChangesWatch( Dali::WebEngineCookieManager::WebEngineCookieManagerChangesWatchCallback callback ) override
353 ConnectToGlobalSignal( &OnChangesWatch );
354 mChangesWatchCallback = callback;
359 Dali::WebEngineCookieManager::WebEngineCookieManagerChangesWatchCallback mChangesWatchCallback;
362 Dali::WebEngineCookieManager::CookieAcceptPolicy mockCookieAcceptPolicy;
365 class MockWebEngineBackForwardListItem : public Dali::WebEngineBackForwardListItem
368 MockWebEngineBackForwardListItem()
369 : mockUrl( "http://url" ),
370 mockTitle( "title" ),
371 mockOriginalUrl( "http://originalurl" )
375 std::string GetUrl() const override
380 std::string GetTitle() const override
385 std::string GetOriginalUrl() const override
387 return mockOriginalUrl;
392 std::string mockTitle;
393 std::string mockOriginalUrl;
396 class MockWebEngineBackForwardList : public Dali::WebEngineBackForwardList
399 MockWebEngineBackForwardList()
403 std::unique_ptr<Dali::WebEngineBackForwardListItem> GetCurrentItem() const override
405 std::unique_ptr<Dali::WebEngineBackForwardListItem> ret(new MockWebEngineBackForwardListItem());
409 std::unique_ptr<Dali::WebEngineBackForwardListItem> GetPreviousItem() const override
411 std::unique_ptr<Dali::WebEngineBackForwardListItem> ret(new MockWebEngineBackForwardListItem());
415 std::unique_ptr<Dali::WebEngineBackForwardListItem> GetNextItem() const override
417 std::unique_ptr<Dali::WebEngineBackForwardListItem> ret(new MockWebEngineBackForwardListItem());
421 std::unique_ptr<Dali::WebEngineBackForwardListItem> GetItemAtIndex( uint32_t index ) const override
423 std::unique_ptr<Dali::WebEngineBackForwardListItem> ret(new MockWebEngineBackForwardListItem());
427 uint32_t GetItemCount() const override
432 std::vector<std::unique_ptr<Dali::WebEngineBackForwardListItem>> GetBackwardItems(int limit) override
434 std::vector<std::unique_ptr<Dali::WebEngineBackForwardListItem>> ret;
435 std::unique_ptr<Dali::WebEngineBackForwardListItem> item(new MockWebEngineBackForwardListItem());
436 ret.push_back(std::move(item));
440 std::vector<std::unique_ptr<Dali::WebEngineBackForwardListItem>> GetForwardItems(int limit) override
442 std::vector<std::unique_ptr<Dali::WebEngineBackForwardListItem>> ret;
443 std::unique_ptr<Dali::WebEngineBackForwardListItem> item(new MockWebEngineBackForwardListItem());
444 ret.push_back(std::move(item));
450 class MockWebEngineCertificate : public Dali::WebEngineCertificate
453 MockWebEngineCertificate()
457 void Allow(bool allowed) override
461 bool IsFromMainFrame() const override
466 std::string GetPem() const override
471 bool IsContextSecure() const override
477 class MockWebEngineHttpAuthHandler : public Dali::WebEngineHttpAuthHandler
480 MockWebEngineHttpAuthHandler()
484 std::string GetRealm() const override
489 void Suspend() override
493 void UseCredential(const std::string& user, const std::string& password) override
497 void CancelCredential() override
502 class MockWebEngineFormRepostDecision : public WebEngineFormRepostDecision
505 MockWebEngineFormRepostDecision()
509 void Reply(bool allowed) override {}
512 class MockWebEngineFrame : public Dali::WebEngineFrame
519 bool IsMainFrame() const override
525 class MockWebEnginePolicyDecision : public Dali::WebEnginePolicyDecision
528 MockWebEnginePolicyDecision()
532 std::string GetUrl() const override
534 return "http://test.html";
537 std::string GetCookie() const override
542 Dali::WebEnginePolicyDecision::DecisionType GetDecisionType() const
544 return Dali::WebEnginePolicyDecision::DecisionType::USE;
547 std::string GetResponseMime() const
552 int32_t GetResponseStatusCode() const
557 Dali::WebEnginePolicyDecision::NavigationType GetNavigationType() const
559 return Dali::WebEnginePolicyDecision::NavigationType::LINK_CLICKED;
562 Dali::WebEngineFrame& GetFrame() const
564 return *(Dali::WebEngineFrame*)(&mockWebFrame);
567 std::string GetScheme() const
588 MockWebEngineFrame mockWebFrame;
591 class MockWebEngineRequestInterceptor : public WebEngineRequestInterceptor
594 MockWebEngineRequestInterceptor()
598 std::string GetUrl() const override
600 return "http://test.html";
603 bool Ignore() override
608 bool SetResponseStatus(int statusCode, const std::string &customedStatusText) override
613 bool AddResponseHeader(const std::string &fieldName, const std::string &fieldValue) override
618 bool AddResponseBody(const std::string &body, uint32_t length) override
624 class MockWebEngineConsoleMessage : public Dali::WebEngineConsoleMessage
627 MockWebEngineConsoleMessage()
631 std::string GetSource() const override
636 uint32_t GetLine() const override
641 SeverityLevel GetSeverityLevel() const override
643 return SeverityLevel::EMPTY;
646 std::string GetText() const override
648 return "This is a text.";
652 class MockWebEngineLoadError : public Dali::WebEngineLoadError
655 MockWebEngineLoadError(const std::string& url)
660 std::string GetUrl() const override
665 ErrorCode GetCode() const override
667 return ErrorCode::UNKNOWN;
670 std::string GetDescription() const override
672 return "This is an error.";
675 ErrorType GetType() const override
677 return ErrorType::NONE;
684 class MockWebEngineContextMenuItem : public Dali::WebEngineContextMenuItem
687 MockWebEngineContextMenuItem()
691 ItemTag GetTag() const override
693 return ItemTag::NO_ACTION;
696 ItemType GetType() const override
698 return ItemType::ACTION;
701 bool IsEnabled() const override
706 std::string GetLinkUrl() const override
708 return "http://test.html";
711 std::string GetImageUrl() const override
713 return "http://test.jpg";
716 std::string GetTitle() const override
721 std::unique_ptr<Dali::WebEngineContextMenu> GetParentMenu() const override
723 std::unique_ptr<Dali::WebEngineContextMenu> result;
728 class MockWebEngineContextMenu : public Dali::WebEngineContextMenu
731 MockWebEngineContextMenu()
735 uint32_t GetItemCount() const override
740 std::unique_ptr<Dali::WebEngineContextMenuItem> GetItemAt(uint32_t index) const override
742 std::unique_ptr<Dali::WebEngineContextMenuItem> webitem(new MockWebEngineContextMenuItem());
746 std::vector<std::unique_ptr<WebEngineContextMenuItem>> GetItemList() const override
748 std::vector<std::unique_ptr<WebEngineContextMenuItem>> result;
749 std::unique_ptr<Dali::WebEngineContextMenuItem> webitem(new MockWebEngineContextMenuItem());
750 result.push_back(std::move(webitem));
754 Dali::Vector2 GetPosition() const override
756 return Dali::Vector2(100, 100);
759 bool RemoveItem(WebEngineContextMenuItem& item) override
764 bool AppendItemAsAction(WebEngineContextMenuItem::ItemTag tag, const std::string& title, bool enabled) override
769 bool AppendItem(WebEngineContextMenuItem::ItemTag tag, const std::string& title, const std::string& iconFile, bool enabled) override
774 bool SelectItem(WebEngineContextMenuItem& item) override
785 class MockWebEngineHitTest : public Dali::WebEngineHitTest
788 MockWebEngineHitTest()
792 ResultContext GetResultContext() const override
794 return ResultContext::DOCUMENT;
797 std::string GetLinkUri() const override
799 return "http://test.html";
802 std::string GetLinkTitle() const override
807 std::string GetLinkLabel() const override
812 std::string GetImageUri() const override
814 return "http://test.jpg";
817 std::string GetMediaUri() const override
819 return "http://test.mp4";
822 std::string GetTagName() const override
827 std::string GetNodeValue() const override
832 Dali::Property::Map& GetAttributes() const override
834 return mockAttributesMap;
837 std::string GetImageFileNameExtension() const override
842 Dali::PixelData GetImageBuffer() override
844 uint8_t* imageData = new uint8_t[16];
845 memset(imageData, 0xff, 16);
846 return Dali::PixelData::New(imageData, 16, 2, 2,
847 Dali::Pixel::Format::RGBA8888,
848 Dali::PixelData::ReleaseFunction::DELETE_ARRAY);
852 mutable Dali::Property::Map mockAttributesMap;
855 class MockWebEngineSecurityOrigin : public Dali::WebEngineSecurityOrigin
858 MockWebEngineSecurityOrigin()
859 : mockUrl("https://test.html")
860 , mockPotocol("https")
864 std::string GetHost() const
869 std::string GetProtocol() const
876 std::string mockPotocol;
879 class MockWebEngineSettings : public WebEngineSettings
882 MockWebEngineSettings()
883 : mockDefaultFontSize( 16 ),
884 mockJavaScriptEnabled( true ),
885 mockAutoFittingEnabled ( true ),
886 mockPluginsEnabled ( true ),
887 mockPrivateBrowsingEnabled( true ),
888 mockLinkMagnifierEnabled( true ),
889 mockKeypadWithoutUserActionUsed( true ),
890 mockAutofillPasswordFormEnabled( true ),
891 mockFormCandidateDataEnabled( true ),
892 mockTextSelectionEnabled( true ),
893 mockTextAutosizingEnable( true ),
894 mockArrowScrollEnable( true ),
895 mockClipboardEnabled( true ),
896 mockImePanelEnabled( true ),
897 mockImageLoadedAutomatically( true ),
898 mockDefaultTextEncodingName()
902 uint32_t GetDefaultFontSize() const override
904 return mockDefaultFontSize;
907 void SetDefaultFontSize( uint32_t size ) override
909 mockDefaultFontSize = size;
912 bool IsJavaScriptEnabled() const override
914 return mockJavaScriptEnabled;
917 void EnableJavaScript( bool enabled ) override
919 mockJavaScriptEnabled = enabled;
922 bool IsAutoFittingEnabled() const override
924 return mockAutoFittingEnabled;
927 void EnableAutoFitting( bool enabled ) override
929 mockAutoFittingEnabled = enabled;
932 bool ArePluginsEnabled() const override
934 return mockPluginsEnabled;
937 void EnablePlugins( bool enabled ) override
939 mockPluginsEnabled = enabled;
942 bool IsPrivateBrowsingEnabled() const override
944 return mockPrivateBrowsingEnabled;
947 void EnablePrivateBrowsing( bool enabled ) override
949 mockPrivateBrowsingEnabled = enabled;
952 bool IsLinkMagnifierEnabled() const override
954 return mockLinkMagnifierEnabled;
957 void EnableLinkMagnifier( bool enabled ) override
959 mockLinkMagnifierEnabled = enabled;
962 bool IsKeypadWithoutUserActionUsed() const override
964 return mockKeypadWithoutUserActionUsed;
967 void UseKeypadWithoutUserAction( bool used ) override
969 mockKeypadWithoutUserActionUsed = used;
972 bool IsAutofillPasswordFormEnabled() const override
974 return mockAutofillPasswordFormEnabled;
977 void EnableAutofillPasswordForm( bool enabled ) override
979 mockAutofillPasswordFormEnabled = enabled;
982 bool IsFormCandidateDataEnabled() const override
984 return mockFormCandidateDataEnabled;
987 void EnableFormCandidateData( bool enabled ) override
989 mockFormCandidateDataEnabled = enabled;
992 bool IsTextSelectionEnabled() const override
994 return mockTextSelectionEnabled;
997 void EnableTextSelection( bool enabled ) override
999 mockTextSelectionEnabled = enabled;
1002 bool IsTextAutosizingEnabled() const override
1004 return mockTextAutosizingEnable;
1007 void EnableTextAutosizing( bool enabled ) override
1009 mockTextAutosizingEnable = enabled;
1012 bool IsArrowScrollEnabled() const override
1014 return mockArrowScrollEnable;
1017 void EnableArrowScroll( bool enabled ) override
1019 mockArrowScrollEnable = enabled;
1022 bool IsClipboardEnabled() const override
1024 return mockClipboardEnabled;
1027 void EnableClipboard( bool enabled ) override
1029 mockClipboardEnabled = enabled;
1032 bool IsImePanelEnabled() const override
1034 return mockImePanelEnabled;
1037 void EnableImePanel( bool enabled ) override
1039 mockImePanelEnabled = enabled;
1042 bool AreImagesLoadedAutomatically() const override
1044 return mockImageLoadedAutomatically;
1047 void AllowImagesLoadAutomatically( bool automatic ) override
1049 mockImageLoadedAutomatically = automatic;
1052 std::string GetDefaultTextEncodingName() const override
1054 return mockDefaultTextEncodingName;
1057 void SetDefaultTextEncodingName( const std::string& defaultTextEncodingName ) override
1059 mockDefaultTextEncodingName = defaultTextEncodingName;
1062 void AllowMixedContents( bool allowed ) override
1066 void EnableSpatialNavigation( bool enabled ) override
1070 void EnableWebSecurity( bool enabled ) override
1074 void EnableCacheBuilder( bool enabled ) override
1078 void UseScrollbarThumbFocusNotifications( bool used ) override
1082 void EnableDoNotTrack( bool enabled ) override
1086 void AllowFileAccessFromExternalUrl( bool allowed ) override
1090 void AllowScriptsOpenWindows( bool allowed ) override
1094 bool SetViewportMetaTag(bool enable) override
1099 bool SetForceZoom(bool enable) override
1104 bool IsZoomForced() const override
1109 bool SetTextZoomEnabled(bool enable) override
1114 bool IsTextZoomEnabled() const override
1119 void SetExtraFeature(const std::string& feature, bool enable) override
1123 bool IsExtraFeatureEnabled(const std::string& feature) const override
1129 int mockDefaultFontSize;
1130 bool mockJavaScriptEnabled;
1131 bool mockAutoFittingEnabled;
1132 bool mockPluginsEnabled;
1133 bool mockPrivateBrowsingEnabled;
1134 bool mockLinkMagnifierEnabled;
1135 bool mockKeypadWithoutUserActionUsed;
1136 bool mockAutofillPasswordFormEnabled;
1137 bool mockFormCandidateDataEnabled;
1138 bool mockTextSelectionEnabled;
1139 bool mockTextAutosizingEnable;
1140 bool mockArrowScrollEnable;
1141 bool mockClipboardEnabled;
1142 bool mockImePanelEnabled;
1143 bool mockImageLoadedAutomatically;
1144 std::string mockDefaultTextEncodingName;
1147 class WebEngine: public Dali::BaseObject
1151 using JavaScriptEvaluatedResultCallback = std::function<void(const std::string&)>;
1155 , mCurrentPlusOnePos( 0 )
1157 , mEvaluating( false )
1158 , mScrollPosition( 0, 0 )
1159 , mScrollSize( 500, 500 )
1160 , mContentSize( 500, 500 )
1163 if ( gInstanceCount == 1 ) // only first web engine need be saved.
1168 mockWebEngineSettings = new MockWebEngineSettings();
1169 MockWebEngineContext* engineContext = new MockWebEngineContext();
1170 mockWebEngineContext = engineContext;
1171 if ( gInstanceCount == 1 )
1173 gWebEngineContextInstance = engineContext;
1175 mockWebEngineCookieManager = new MockWebEngineCookieManager();
1176 mockWebEngineBackForwardList = new MockWebEngineBackForwardList();
1179 virtual ~WebEngine()
1182 if( !gInstanceCount )
1185 gWebEngineContextInstance = 0;
1188 delete mockWebEngineSettings;
1189 delete mockWebEngineContext;
1190 delete mockWebEngineCookieManager;
1191 delete mockWebEngineBackForwardList;
1194 Dali::WebEngineSettings& GetSettings() const
1196 return *mockWebEngineSettings;
1199 Dali::WebEngineContext& GetContext() const
1201 return *mockWebEngineContext;
1204 Dali::WebEngineCookieManager& GetCookieManager() const
1206 return *mockWebEngineCookieManager;
1209 Dali::WebEngineBackForwardList& GetBackForwardList() const
1211 return *mockWebEngineBackForwardList;
1214 void LoadUrl( const std::string& url )
1217 ConnectToGlobalSignal( &OnLoadUrl );
1220 const std::string& GetUrl() const
1225 std::string GetTitle() const
1227 return std::string("title");
1230 Dali::PixelData GetFavicon() const
1232 static int testGetFaviconCount = 0;
1233 if (testGetFaviconCount == 0)
1235 testGetFaviconCount++;
1236 uint8_t* faviconData = new uint8_t[16];
1237 memset(faviconData, 0xff, 16);
1238 return Dali::PixelData::New(faviconData, 16, 2, 2,
1239 Dali::Pixel::Format::RGBA8888,
1240 Dali::PixelData::ReleaseFunction::DELETE_ARRAY);
1244 return Dali::PixelData();
1248 bool CanGoForward() const
1250 return mHistory.size() > mCurrentPlusOnePos;
1255 ConnectToGlobalSignal( &OnGoForward );
1258 bool CanGoBack() const
1260 return mCurrentPlusOnePos > 1;
1265 ConnectToGlobalSignal( &OnGoBack );
1268 void EvaluateJavaScript( const std::string& script, std::function< void( const std::string& ) > resultHandler )
1274 ConnectToGlobalSignal( &OnEvaluteJavaScript );
1276 mResultCallbacks.push_back( resultHandler );
1280 void RegisterJavaScriptAlertCallback( Dali::WebEnginePlugin::JavaScriptAlertCallback callback )
1284 ConnectToGlobalSignal( &OnJavaScriptAlert );
1285 mJavaScriptAlertCallback = callback;
1289 void RegisterJavaScriptConfirmCallback( Dali::WebEnginePlugin::JavaScriptConfirmCallback callback )
1293 ConnectToGlobalSignal( &OnJavaScriptConfirm );
1294 mJavaScriptConfirmCallback = callback;
1298 void RegisterJavaScriptPromptCallback( Dali::WebEnginePlugin::JavaScriptPromptCallback callback )
1302 ConnectToGlobalSignal( &OnJavaScriptPrompt );
1303 mJavaScriptPromptCallback = callback;
1307 std::unique_ptr<Dali::WebEngineHitTest> CreateHitTest(int32_t x, int32_t y, Dali::WebEngineHitTest::HitTestMode mode)
1309 std::unique_ptr<Dali::WebEngineHitTest> hitTest(new MockWebEngineHitTest());
1313 bool CreateHitTestAsynchronously(int32_t x, int32_t y, Dali::WebEngineHitTest::HitTestMode mode, Dali::WebEnginePlugin::WebEngineHitTestCreatedCallback callback)
1317 ConnectToGlobalSignal( &OnHitTestCreated );
1318 mHitTestCreatedCallback = callback;
1325 ConnectToGlobalSignal( &OnClearHistory );
1328 const std::string& GetUserAgent() const
1333 void SetUserAgent( const std::string& userAgent )
1335 mUserAgent = userAgent;
1338 void ScrollBy( int32_t dx, int32_t dy )
1340 mScrollPosition += Dali::Vector2( dx, dy );
1341 if ( mScrollPosition.y + mScrollSize.height > mContentSize.height )
1343 ConnectToGlobalSignal( &OnScrollEdge );
1347 bool ScrollEdgeBy( int32_t dx, int32_t dy )
1349 mScrollPosition += Dali::Vector2( dx, dy );
1350 if ( mScrollPosition.y + mScrollSize.height > mContentSize.height )
1352 ConnectToGlobalSignal( &OnScrollEdge );
1357 void SetScrollPosition( int32_t x, int32_t y )
1359 mScrollPosition.x = x;
1360 mScrollPosition.y = y;
1363 Dali::Vector2 GetScrollPosition() const
1365 return mScrollPosition;
1368 Dali::Vector2 GetScrollSize() const
1373 Dali::Vector2 GetContentSize() const
1375 return mContentSize;
1378 void SetPageZoomFactor(float zoomFactor)
1380 mPageZoomFactor = zoomFactor;
1383 float GetPageZoomFactor() const
1385 return mPageZoomFactor;
1388 void SetTextZoomFactor(float zoomFactor)
1390 mTextZoomFactor = zoomFactor;
1393 float GetTextZoomFactor() const
1395 return mTextZoomFactor;
1398 float GetLoadProgressPercentage() const
1403 void SetScaleFactor(float scaleFactor, Dali::Vector2 point)
1405 mScaleFactor = scaleFactor;
1408 float GetScaleFactor() const
1410 return mScaleFactor;
1413 Dali::PixelData GetScreenshot(Dali::Rect<int32_t> viewArea, float scaleFactor)
1415 uint32_t bufferSize = viewArea.width * viewArea.height * 4 ;
1416 uint8_t* pixel = new uint8_t[ bufferSize ];
1417 memset(pixel, 0xff, bufferSize);
1418 return Dali::PixelData::New( pixel, bufferSize, viewArea.width, viewArea.height,
1419 Dali::Pixel::Format::RGBA8888,
1420 Dali::PixelData::ReleaseFunction::DELETE_ARRAY );
1423 bool GetScreenshotAsynchronously(Dali::Rect<int32_t> viewArea, float scaleFactor, Dali::WebEnginePlugin::ScreenshotCapturedCallback callback)
1427 ConnectToGlobalSignal( &OnScreenshotCaptured );
1428 mScreenshotCapturedCallback = callback;
1433 bool CheckVideoPlayingAsynchronously(Dali::WebEnginePlugin::VideoPlayingCallback callback)
1437 ConnectToGlobalSignal( &OnVideoPlaying );
1438 mVideoPlayingCallback = callback;
1443 void RegisterGeolocationPermissionCallback(Dali::WebEnginePlugin::GeolocationPermissionCallback callback)
1447 ConnectToGlobalSignal( &OnGeolocationPermission );
1448 mGeolocationPermissionCallback = callback;
1452 Dali::WebEnginePlugin::WebEnginePageLoadSignalType& PageLoadStartedSignal()
1454 return mPageLoadStartedSignal;
1457 Dali::WebEnginePlugin::WebEnginePageLoadSignalType& PageLoadInProgressSignal()
1459 return mPageLoadInProgressSignal;
1462 Dali::WebEnginePlugin::WebEnginePageLoadSignalType& PageLoadFinishedSignal()
1464 return mPageLoadFinishedSignal;
1467 Dali::WebEnginePlugin::WebEnginePageLoadErrorSignalType& PageLoadErrorSignal()
1469 return mPageLoadErrorSignal;
1472 Dali::WebEnginePlugin::WebEngineScrollEdgeReachedSignalType& ScrollEdgeReachedSignal()
1474 return mScrollEdgeReachedSignal;
1477 Dali::WebEnginePlugin::WebEngineUrlChangedSignalType& UrlChangedSignal()
1479 return mUrlChangedSignal;
1482 Dali::WebEnginePlugin::WebEngineFormRepostDecisionSignalType& FormRepostDecisionSignal()
1484 return mFormRepostDecisionSignal;
1487 Dali::WebEnginePlugin::WebEngineFrameRenderedSignalType& FrameRenderedSignal()
1489 return mFrameRenderedSignal;
1492 Dali::WebEnginePlugin::WebEngineRequestInterceptorSignalType& RequestInterceptorSignal()
1494 return mRequestInterceptorSignal;
1497 Dali::WebEnginePlugin::WebEngineConsoleMessageSignalType& ConsoleMessageSignal()
1499 return mConsoleMessageSignal;
1502 Dali::WebEnginePlugin::WebEngineResponsePolicyDecisionSignalType& ResponsePolicyDecisionSignal()
1504 return mResponsePolicyDecisionSignal;
1507 Dali::WebEnginePlugin::WebEngineCertificateSignalType& CertificateConfirmSignal()
1509 return mCertificateConfirmSignal;
1512 Dali::WebEnginePlugin::WebEngineCertificateSignalType& SslCertificateChangedSignal()
1514 return mSslCertificateChangedSignal;
1517 Dali::WebEnginePlugin::WebEngineHttpAuthHandlerSignalType& HttpAuthHandlerSignal()
1519 return mHttpAuthHandlerSignal;
1522 Dali::WebEnginePlugin::WebEngineContextMenuCustomizedSignalType& ContextMenuCustomizedSignal()
1524 return mContextMenuCustomizedSignal;
1527 Dali::WebEnginePlugin::WebEngineContextMenuItemSelectedSignalType& ContextMenuItemSelectedSignal()
1529 return mContextMenuItemSelectedSignal;
1533 std::vector<std::string> mHistory;
1534 size_t mCurrentPlusOnePos;
1535 std::string mUserAgent;
1537 Dali::WebEnginePlugin::WebEnginePageLoadSignalType mPageLoadStartedSignal;
1538 Dali::WebEnginePlugin::WebEnginePageLoadSignalType mPageLoadInProgressSignal;
1539 Dali::WebEnginePlugin::WebEnginePageLoadSignalType mPageLoadFinishedSignal;
1540 Dali::WebEnginePlugin::WebEnginePageLoadErrorSignalType mPageLoadErrorSignal;
1541 Dali::WebEnginePlugin::WebEngineScrollEdgeReachedSignalType mScrollEdgeReachedSignal;
1542 Dali::WebEnginePlugin::WebEngineUrlChangedSignalType mUrlChangedSignal;
1543 Dali::WebEnginePlugin::WebEngineFormRepostDecisionSignalType mFormRepostDecisionSignal;
1544 Dali::WebEnginePlugin::WebEngineFrameRenderedSignalType mFrameRenderedSignal;
1545 Dali::WebEnginePlugin::WebEngineRequestInterceptorSignalType mRequestInterceptorSignal;
1546 Dali::WebEnginePlugin::WebEngineConsoleMessageSignalType mConsoleMessageSignal;
1547 Dali::WebEnginePlugin::WebEngineResponsePolicyDecisionSignalType mResponsePolicyDecisionSignal;
1548 Dali::WebEnginePlugin::WebEngineCertificateSignalType mCertificateConfirmSignal;
1549 Dali::WebEnginePlugin::WebEngineCertificateSignalType mSslCertificateChangedSignal;
1550 Dali::WebEnginePlugin::WebEngineHttpAuthHandlerSignalType mHttpAuthHandlerSignal;
1551 Dali::WebEnginePlugin::WebEngineContextMenuCustomizedSignalType mContextMenuCustomizedSignal;
1552 Dali::WebEnginePlugin::WebEngineContextMenuItemSelectedSignalType mContextMenuItemSelectedSignal;
1555 float mPageZoomFactor;
1556 float mTextZoomFactor;
1559 Dali::Vector2 mScrollPosition;
1560 Dali::Vector2 mScrollSize;
1561 Dali::Vector2 mContentSize;
1562 WebEngineBackForwardList* mockWebEngineBackForwardList;
1563 WebEngineContext* mockWebEngineContext;
1564 WebEngineCookieManager* mockWebEngineCookieManager;
1565 WebEngineSettings* mockWebEngineSettings;
1567 std::vector<JavaScriptEvaluatedResultCallback> mResultCallbacks;
1568 Dali::WebEnginePlugin::JavaScriptAlertCallback mJavaScriptAlertCallback;
1569 Dali::WebEnginePlugin::JavaScriptConfirmCallback mJavaScriptConfirmCallback;
1570 Dali::WebEnginePlugin::JavaScriptPromptCallback mJavaScriptPromptCallback;
1571 Dali::WebEnginePlugin::ScreenshotCapturedCallback mScreenshotCapturedCallback;
1572 Dali::WebEnginePlugin::VideoPlayingCallback mVideoPlayingCallback;
1573 Dali::WebEnginePlugin::GeolocationPermissionCallback mGeolocationPermissionCallback;
1574 Dali::WebEnginePlugin::WebEngineHitTestCreatedCallback mHitTestCreatedCallback;
1583 DisconnectFromGlobalSignal( &OnGoBack );
1585 if( gInstance && gInstance->CanGoBack() )
1587 gInstance->mCurrentPlusOnePos--;
1594 DisconnectFromGlobalSignal( &OnGoForward );
1596 if( gInstance && gInstance->CanGoForward() )
1598 gInstance->mCurrentPlusOnePos++;
1605 DisconnectFromGlobalSignal( &OnLoadUrl );
1609 if( gInstance->mHistory.size() > gInstance->mCurrentPlusOnePos )
1611 gInstance->mHistory.erase( gInstance->mHistory.begin() + gInstance->mCurrentPlusOnePos, gInstance->mHistory.end() );
1613 gInstance->mHistory.push_back( gInstance->mUrl );
1614 gInstance->mCurrentPlusOnePos++;
1615 gInstance->mPageLoadStartedSignal.Emit( gInstance->mUrl );
1616 gInstance->mPageLoadInProgressSignal.Emit( gInstance->mUrl );
1617 gInstance->mPageLoadFinishedSignal.Emit( gInstance->mUrl );
1618 gInstance->mUrlChangedSignal.Emit( "http://new-test" );
1620 std::shared_ptr<Dali::WebEngineFormRepostDecision> repostDecision(new MockWebEngineFormRepostDecision());
1621 gInstance->mFormRepostDecisionSignal.Emit(std::move(repostDecision));
1622 gInstance->mFrameRenderedSignal.Emit();
1623 std::shared_ptr<Dali::WebEngineRequestInterceptor> interceptor(new MockWebEngineRequestInterceptor());
1624 gInstance->mRequestInterceptorSignal.Emit(std::move(interceptor));
1626 std::shared_ptr<Dali::WebEngineLoadError> error(new MockWebEngineLoadError(gInstance->mUrl));
1627 gInstance->mPageLoadErrorSignal.Emit(std::move(error));
1628 std::shared_ptr<Dali::WebEngineConsoleMessage> message(new MockWebEngineConsoleMessage());
1629 gInstance->mConsoleMessageSignal.Emit(std::move(message));
1630 std::shared_ptr<Dali::WebEnginePolicyDecision> policyDecision(new MockWebEnginePolicyDecision());
1631 gInstance->mResponsePolicyDecisionSignal.Emit(std::move(policyDecision));
1633 std::shared_ptr<Dali::WebEngineCertificate> certificate(new MockWebEngineCertificate());
1634 gInstance->mCertificateConfirmSignal.Emit(std::move(certificate));
1635 std::shared_ptr<Dali::WebEngineCertificate> sslCertificate(new MockWebEngineCertificate());
1636 gInstance->mSslCertificateChangedSignal.Emit(std::move(sslCertificate));
1637 std::shared_ptr<Dali::WebEngineHttpAuthHandler> handler(new MockWebEngineHttpAuthHandler());
1638 gInstance->mHttpAuthHandlerSignal.Emit(std::move(handler));
1640 std::shared_ptr<Dali::WebEngineContextMenu> menu(new MockWebEngineContextMenu());
1641 gInstance->mContextMenuCustomizedSignal.Emit(std::move(menu));
1642 std::shared_ptr<Dali::WebEngineContextMenuItem> item(new MockWebEngineContextMenuItem());
1643 gInstance->mContextMenuItemSelectedSignal.Emit(std::move(item));
1650 DisconnectFromGlobalSignal( &OnScrollEdge );
1654 gInstance->mScrollEdgeReachedSignal.Emit( Dali::WebEnginePlugin::ScrollEdge::BOTTOM );
1660 bool OnEvaluteJavaScript()
1662 DisconnectFromGlobalSignal( &OnEvaluteJavaScript );
1666 for( auto& func : gInstance->mResultCallbacks )
1670 gInstance->mResultCallbacks.clear();
1675 bool OnJavaScriptAlert()
1677 DisconnectFromGlobalSignal( &OnJavaScriptAlert );
1680 gInstance->mJavaScriptAlertCallback( "this is an alert popup." );
1685 bool OnJavaScriptConfirm()
1687 DisconnectFromGlobalSignal( &OnJavaScriptConfirm );
1690 gInstance->mJavaScriptConfirmCallback( "this is a confirm popup." );
1695 bool OnJavaScriptPrompt()
1697 DisconnectFromGlobalSignal( &OnJavaScriptPrompt );
1700 gInstance->mJavaScriptPromptCallback( "this is a prompt pompt.", "" );
1705 bool OnScreenshotCaptured()
1707 DisconnectFromGlobalSignal( &OnScreenshotCaptured );
1710 uint8_t* pixel = new uint8_t[ 2 * 2 * 4 ];
1711 memset(pixel, 0xff, 2 * 2 * 4);
1712 Dali::PixelData data = Dali::PixelData::New( pixel, 2 * 2 * 4, 2, 2,
1713 Dali::Pixel::Format::RGBA8888,
1714 Dali::PixelData::ReleaseFunction::DELETE_ARRAY );
1715 gInstance->mScreenshotCapturedCallback( data );
1720 bool OnVideoPlaying()
1722 DisconnectFromGlobalSignal( &OnVideoPlaying );
1725 gInstance->mVideoPlayingCallback( true );
1730 bool OnGeolocationPermission()
1732 DisconnectFromGlobalSignal( &OnGeolocationPermission );
1735 gInstance->mGeolocationPermissionCallback( "", "" );
1740 bool OnHitTestCreated()
1742 DisconnectFromGlobalSignal(&OnHitTestCreated);
1745 std::unique_ptr<Dali::WebEngineHitTest> test(new MockWebEngineHitTest());
1746 gInstance->mHitTestCreatedCallback(std::move(test));
1751 bool OnClearHistory()
1753 DisconnectFromGlobalSignal( &OnClearHistory );
1755 if( gInstance && gInstance->mCurrentPlusOnePos )
1757 std::string url = gInstance->mHistory[ gInstance->mCurrentPlusOnePos - 1 ];
1758 std::vector< std::string >().swap( gInstance->mHistory );
1759 gInstance->mHistory.push_back( url );
1760 gInstance->mCurrentPlusOnePos = 1;
1765 bool OnSecurityOriginAcquired()
1767 DisconnectFromGlobalSignal(&OnSecurityOriginAcquired);
1768 if (gWebEngineContextInstance)
1770 std::vector<std::unique_ptr<Dali::WebEngineSecurityOrigin>> securityOriginList;
1771 std::unique_ptr<Dali::WebEngineSecurityOrigin> origin(new MockWebEngineSecurityOrigin());
1772 securityOriginList.push_back(std::move(origin));
1773 gWebEngineContextInstance->mSecurityOriginAcquiredCallback(securityOriginList);
1778 bool OnStorageUsageAcquired()
1780 DisconnectFromGlobalSignal(&OnStorageUsageAcquired);
1781 if (gWebEngineContextInstance)
1783 gWebEngineContextInstance->mStorageUsageAcquiredCallback(0);
1788 bool OnFormPasswordAcquired()
1790 DisconnectFromGlobalSignal(&OnFormPasswordAcquired);
1791 if (gWebEngineContextInstance)
1793 std::vector<std::unique_ptr<Dali::WebEngineContext::PasswordData>> formPasswordList;
1794 std::unique_ptr<Dali::WebEngineContext::PasswordData> data(new Dali::WebEngineContext::PasswordData());
1795 data->url = "http://test.html";
1796 data->useFingerprint = false;
1797 formPasswordList.push_back(std::move(data));
1798 gWebEngineContextInstance->mFormPasswordAcquiredCallback(formPasswordList);
1803 bool OnDownloadStarted()
1805 DisconnectFromGlobalSignal(&OnDownloadStarted);
1806 if (gWebEngineContextInstance)
1808 gWebEngineContextInstance->mDownloadStartedCallback("http://test.html");
1813 bool OnMimeOverridden()
1815 DisconnectFromGlobalSignal(&OnMimeOverridden);
1816 if (gWebEngineContextInstance)
1818 std::string newMime;
1819 gWebEngineContextInstance->mMimeOverriddenCallback("http://test.html", "txt/xml", newMime);
1824 bool OnChangesWatch()
1826 DisconnectFromGlobalSignal( &OnChangesWatch );
1830 MockWebEngineCookieManager* temp = (MockWebEngineCookieManager *)(&(gInstance->GetCookieManager()));
1833 temp->mChangesWatchCallback();
1842 inline WebEngine& GetImplementation( Dali::WebEngine& webEngine )
1844 DALI_ASSERT_ALWAYS( webEngine && "WebEngine handle is empty." );
1845 BaseObject& handle = webEngine.GetBaseObject();
1846 return static_cast< Internal::Adaptor::WebEngine& >( handle );
1849 inline const WebEngine& GetImplementation( const Dali::WebEngine& webEngine )
1851 DALI_ASSERT_ALWAYS( webEngine && "WebEngine handle is empty." );
1852 const BaseObject& handle = webEngine.GetBaseObject();
1853 return static_cast< const Internal::Adaptor::WebEngine& >( handle );
1856 } // namespace Adaptor
1858 } // namespace Internal
1860 // Dali::WebEngine Implementation
1861 WebEngine::WebEngine()
1865 WebEngine::WebEngine( Internal::Adaptor::WebEngine* internal )
1866 : BaseHandle( internal )
1870 WebEngine::~WebEngine()
1874 WebEngine WebEngine::New()
1876 Internal::Adaptor::WebEngine* baseObject = new Internal::Adaptor::WebEngine();
1878 return WebEngine( baseObject );
1881 WebEngine::WebEngine( const WebEngine& WebEngine )
1882 : BaseHandle( WebEngine )
1886 WebEngine& WebEngine::operator=( const WebEngine& webEngine )
1888 BaseHandle::operator=( webEngine );
1892 WebEngine WebEngine::DownCast( BaseHandle handle )
1894 return WebEngine( dynamic_cast< Internal::Adaptor::WebEngine* >( handle.GetObjectPtr() ) );
1897 void WebEngine::Create( uint32_t width, uint32_t height, const std::string& locale, const std::string& timezoneId )
1901 void WebEngine::Create( uint32_t width, uint32_t height, uint32_t argc, char** argv )
1905 void WebEngine::Destroy()
1909 WebEngineSettings& WebEngine::GetSettings() const
1911 return Internal::Adaptor::GetImplementation( *this ).GetSettings();
1914 WebEngineContext& WebEngine::GetContext() const
1916 return Internal::Adaptor::GetImplementation( *this ).GetContext();
1919 WebEngineCookieManager& WebEngine::GetCookieManager() const
1921 return Internal::Adaptor::GetImplementation( *this ).GetCookieManager();
1924 WebEngineBackForwardList& WebEngine::GetBackForwardList() const
1926 return Internal::Adaptor::GetImplementation( *this ).GetBackForwardList();
1929 void WebEngine::LoadUrl( const std::string& url )
1931 return Internal::Adaptor::GetImplementation( *this ).LoadUrl( url );
1934 std::string WebEngine::GetTitle() const
1936 return Internal::Adaptor::GetImplementation( *this ).GetTitle();
1939 Dali::PixelData WebEngine::GetFavicon() const
1941 return Internal::Adaptor::GetImplementation( *this ).GetFavicon();
1944 const std::string& WebEngine::GetUrl()
1946 return Internal::Adaptor::GetImplementation( *this ).GetUrl();
1949 NativeImageInterfacePtr WebEngine::GetNativeImageSource()
1952 Dali::NativeImageSourcePtr sourcePtr = Dali::NativeImageSource::New( source );
1956 void WebEngine::LoadHtmlString( const std::string& htmlString )
1960 bool WebEngine::LoadHtmlStringOverrideCurrentEntry(const std::string& html, const std::string& basicUri, const std::string& unreachableUrl)
1965 bool WebEngine::LoadContents(const std::string& contents, uint32_t contentSize, const std::string& mimeType, const std::string& encoding, const std::string& baseUri)
1970 void WebEngine::Reload()
1974 bool WebEngine::ReloadWithoutCache()
1979 void WebEngine::StopLoading()
1983 void WebEngine::Suspend()
1987 void WebEngine::Resume()
1991 void WebEngine::SuspendNetworkLoading()
1995 void WebEngine::ResumeNetworkLoading()
1999 bool WebEngine::AddCustomHeader(const std::string& name, const std::string& value)
2004 bool WebEngine::RemoveCustomHeader(const std::string& name)
2009 uint32_t WebEngine::StartInspectorServer(uint32_t port)
2014 bool WebEngine::StopInspectorServer()
2019 bool WebEngine::CanGoForward()
2021 return Internal::Adaptor::GetImplementation( *this ).CanGoForward();
2024 void WebEngine::GoForward()
2026 Internal::Adaptor::GetImplementation( *this ).GoForward();
2029 bool WebEngine::CanGoBack()
2031 return Internal::Adaptor::GetImplementation( *this ).CanGoBack();
2034 void WebEngine::GoBack()
2036 Internal::Adaptor::GetImplementation( *this ).GoBack();
2039 void WebEngine::EvaluateJavaScript( const std::string& script, std::function< void( const std::string& ) > resultHandler )
2041 Internal::Adaptor::GetImplementation( *this ).EvaluateJavaScript( script, resultHandler );
2044 void WebEngine::AddJavaScriptMessageHandler( const std::string& exposedObjectName, std::function< void(const std::string&) > handler )
2048 void WebEngine::RegisterJavaScriptAlertCallback( Dali::WebEnginePlugin::JavaScriptAlertCallback callback )
2050 Internal::Adaptor::GetImplementation( *this ).RegisterJavaScriptAlertCallback( callback );
2053 void WebEngine::JavaScriptAlertReply()
2057 void WebEngine::RegisterJavaScriptConfirmCallback( Dali::WebEnginePlugin::JavaScriptConfirmCallback callback )
2059 Internal::Adaptor::GetImplementation( *this ).RegisterJavaScriptConfirmCallback( callback );
2062 void WebEngine::JavaScriptConfirmReply( bool confirmed )
2066 void WebEngine::RegisterJavaScriptPromptCallback( Dali::WebEnginePlugin::JavaScriptPromptCallback callback )
2068 Internal::Adaptor::GetImplementation( *this ).RegisterJavaScriptPromptCallback( callback );
2071 void WebEngine::JavaScriptPromptReply( const std::string& result )
2075 std::unique_ptr<Dali::WebEngineHitTest> WebEngine::CreateHitTest(int32_t x, int32_t y, Dali::WebEngineHitTest::HitTestMode mode)
2077 return Internal::Adaptor::GetImplementation(*this).CreateHitTest(x, y, mode);
2080 bool WebEngine::CreateHitTestAsynchronously(int32_t x, int32_t y, Dali::WebEngineHitTest::HitTestMode mode, Dali::WebEnginePlugin::WebEngineHitTestCreatedCallback callback)
2082 return Internal::Adaptor::GetImplementation(*this).CreateHitTestAsynchronously(x, y, mode, callback);
2085 void WebEngine::ClearAllTilesResources()
2089 void WebEngine::ClearHistory()
2091 Internal::Adaptor::GetImplementation( *this ).ClearHistory();
2094 void WebEngine::SetScaleFactor(float scaleFactor, Dali::Vector2 point)
2096 Internal::Adaptor::GetImplementation( *this ).SetScaleFactor(scaleFactor, point);
2099 float WebEngine::GetScaleFactor() const
2101 return Internal::Adaptor::GetImplementation( *this ).GetScaleFactor();
2104 void WebEngine::ActivateAccessibility(bool activated)
2108 bool WebEngine::HighlightText(const std::string& text, Dali::WebEnginePlugin::FindOption options, uint32_t maxMatchCount)
2113 void WebEngine::AddDynamicCertificatePath(const std::string& host, const std::string& certPath)
2117 Dali::PixelData WebEngine::GetScreenshot(Dali::Rect<int32_t> viewArea, float scaleFactor)
2119 return Internal::Adaptor::GetImplementation( *this ).GetScreenshot(viewArea, scaleFactor);
2122 bool WebEngine::GetScreenshotAsynchronously(Dali::Rect<int32_t> viewArea, float scaleFactor, Dali::WebEnginePlugin::ScreenshotCapturedCallback callback)
2124 return Internal::Adaptor::GetImplementation( *this ).GetScreenshotAsynchronously(viewArea, scaleFactor, callback);
2127 bool WebEngine::CheckVideoPlayingAsynchronously(Dali::WebEnginePlugin::VideoPlayingCallback callback)
2129 return Internal::Adaptor::GetImplementation( *this ).CheckVideoPlayingAsynchronously(callback);
2132 void WebEngine::RegisterGeolocationPermissionCallback(Dali::WebEnginePlugin::GeolocationPermissionCallback callback)
2134 Internal::Adaptor::GetImplementation( *this ).RegisterGeolocationPermissionCallback(callback);
2137 const std::string& WebEngine::GetUserAgent() const
2139 return Internal::Adaptor::GetImplementation( *this ).GetUserAgent();
2142 void WebEngine::SetUserAgent( const std::string& userAgent )
2144 Internal::Adaptor::GetImplementation( *this ).SetUserAgent( userAgent );
2147 void WebEngine::ScrollBy( int32_t dx, int32_t dy )
2149 Internal::Adaptor::GetImplementation( *this ).ScrollBy( dx, dy );
2152 bool WebEngine::ScrollEdgeBy( int32_t dx, int32_t dy )
2154 return Internal::Adaptor::GetImplementation( *this ).ScrollEdgeBy( dx, dy );
2157 void WebEngine::SetScrollPosition( int32_t x, int32_t y )
2159 Internal::Adaptor::GetImplementation( *this ).SetScrollPosition( x, y );
2162 Dali::Vector2 WebEngine::GetScrollPosition() const
2164 return Internal::Adaptor::GetImplementation( *this ).GetScrollPosition();
2167 Dali::Vector2 WebEngine::GetScrollSize() const
2169 return Internal::Adaptor::GetImplementation( *this ).GetScrollSize();
2172 Dali::Vector2 WebEngine::GetContentSize() const
2174 return Internal::Adaptor::GetImplementation( *this ).GetContentSize();
2177 void WebEngine::SetSize( uint32_t width, uint32_t height )
2181 void WebEngine::SetDocumentBackgroundColor(Dali::Vector4 color)
2185 void WebEngine::ClearTilesWhenHidden(bool cleared)
2189 void WebEngine::SetTileCoverAreaMultiplier(float multiplier)
2193 void WebEngine::EnableCursorByClient(bool enabled)
2197 std::string WebEngine::GetSelectedText() const
2202 bool WebEngine::SendTouchEvent( const TouchEvent& touch )
2207 bool WebEngine::SendKeyEvent( const KeyEvent& event )
2212 bool WebEngine::SendHoverEvent( const HoverEvent& event )
2217 bool WebEngine::SendWheelEvent( const WheelEvent& event )
2222 void WebEngine::SetFocus( bool focused )
2226 void WebEngine::SetPageZoomFactor(float zoomFactor)
2228 Internal::Adaptor::GetImplementation( *this ).SetPageZoomFactor(zoomFactor);
2231 float WebEngine::GetPageZoomFactor() const
2233 return Internal::Adaptor::GetImplementation( *this ).GetPageZoomFactor();
2236 void WebEngine::SetTextZoomFactor(float zoomFactor)
2238 Internal::Adaptor::GetImplementation( *this ).SetTextZoomFactor(zoomFactor);
2241 float WebEngine::GetTextZoomFactor() const
2243 return Internal::Adaptor::GetImplementation( *this ).GetTextZoomFactor();
2246 float WebEngine::GetLoadProgressPercentage() const
2248 return Internal::Adaptor::GetImplementation( *this ).GetLoadProgressPercentage();
2251 void WebEngine::UpdateDisplayArea( Dali::Rect< int32_t > displayArea )
2255 void WebEngine::EnableVideoHole( bool enabled )
2259 void WebEngine::EnableMouseEvents( bool enabled )
2263 void WebEngine::EnableKeyEvents( bool enabled )
2267 Dali::WebEnginePlugin::WebEnginePageLoadSignalType& WebEngine::PageLoadStartedSignal()
2269 return Internal::Adaptor::GetImplementation( *this ).PageLoadStartedSignal();
2272 Dali::WebEnginePlugin::WebEnginePageLoadSignalType& WebEngine::PageLoadInProgressSignal()
2274 return Internal::Adaptor::GetImplementation( *this ).PageLoadInProgressSignal();
2277 Dali::WebEnginePlugin::WebEnginePageLoadSignalType& WebEngine::PageLoadFinishedSignal()
2279 return Internal::Adaptor::GetImplementation( *this ).PageLoadFinishedSignal();
2282 Dali::WebEnginePlugin::WebEnginePageLoadErrorSignalType& WebEngine::PageLoadErrorSignal()
2284 return Internal::Adaptor::GetImplementation( *this ).PageLoadErrorSignal();
2287 Dali::WebEnginePlugin::WebEngineScrollEdgeReachedSignalType& WebEngine::ScrollEdgeReachedSignal()
2289 return Internal::Adaptor::GetImplementation( *this ).ScrollEdgeReachedSignal();
2292 Dali::WebEnginePlugin::WebEngineUrlChangedSignalType& WebEngine::UrlChangedSignal()
2294 return Internal::Adaptor::GetImplementation( *this ).UrlChangedSignal();
2297 Dali::WebEnginePlugin::WebEngineFormRepostDecisionSignalType& WebEngine::FormRepostDecisionSignal()
2299 return Internal::Adaptor::GetImplementation(*this).FormRepostDecisionSignal();
2302 Dali::WebEnginePlugin::WebEngineFrameRenderedSignalType& WebEngine::FrameRenderedSignal()
2304 return Internal::Adaptor::GetImplementation(*this).FrameRenderedSignal();
2307 Dali::WebEnginePlugin::WebEngineRequestInterceptorSignalType& WebEngine::RequestInterceptorSignal()
2309 return Internal::Adaptor::GetImplementation(*this).RequestInterceptorSignal();
2312 Dali::WebEnginePlugin::WebEngineConsoleMessageSignalType& WebEngine::ConsoleMessageSignal()
2314 return Internal::Adaptor::GetImplementation(*this).ConsoleMessageSignal();
2317 Dali::WebEnginePlugin::WebEngineResponsePolicyDecisionSignalType& WebEngine::ResponsePolicyDecisionSignal()
2319 return Internal::Adaptor::GetImplementation(*this).ResponsePolicyDecisionSignal();
2322 Dali::WebEnginePlugin::WebEngineCertificateSignalType& WebEngine::CertificateConfirmSignal()
2324 return Internal::Adaptor::GetImplementation(*this).CertificateConfirmSignal();
2327 Dali::WebEnginePlugin::WebEngineCertificateSignalType& WebEngine::SslCertificateChangedSignal()
2329 return Internal::Adaptor::GetImplementation(*this).SslCertificateChangedSignal();
2332 Dali::WebEnginePlugin::WebEngineHttpAuthHandlerSignalType& WebEngine::HttpAuthHandlerSignal()
2334 return Internal::Adaptor::GetImplementation(*this).HttpAuthHandlerSignal();
2337 Dali::WebEnginePlugin::WebEngineContextMenuCustomizedSignalType& WebEngine::ContextMenuCustomizedSignal()
2339 return Internal::Adaptor::GetImplementation( *this ).ContextMenuCustomizedSignal();
2342 Dali::WebEnginePlugin::WebEngineContextMenuItemSelectedSignalType& WebEngine::ContextMenuItemSelectedSignal()
2344 return Internal::Adaptor::GetImplementation( *this ).ContextMenuItemSelectedSignal();
2347 } // namespace Dali;