X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Fdali-toolkit-test-utils%2Ftoolkit-web-engine.cpp;h=8f8853c369595e1739aa94b5edf8cf0ae58a20ea;hp=5b0f13daf986bcdea9f16e1181f0a207234e20a5;hb=8ebe42b2ca06a57a08b02a975146af34c1b9bcd6;hpb=5f6b0f07046b8218cdc079197bef037f5c140ce6 diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-web-engine.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-web-engine.cpp index 5b0f13d..8f8853c 100755 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-web-engine.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-web-engine.cpp @@ -20,15 +20,28 @@ #include #include #include +#include +#include #include +#include +#include #include #include +#include +#include +#include +#include +#include +#include +#include #include #include #include #include #include +#include #include +#include #include namespace Dali @@ -41,14 +54,16 @@ namespace Adaptor { class WebEngine; +class MockWebEngineContext; namespace { // Generally only one WebEngine instance exists. // If > 1, a new web engine has been created by CreateWindowSignal. -static WebEngine* gInstance = 0; +static WebEngine* gInstance = nullptr; static int gInstanceCount = 0; +static MockWebEngineContext* gWebEngineContextInstance = nullptr; bool OnGoBack(); bool OnGoForward(); @@ -57,8 +72,20 @@ bool OnEvaluteJavaScript(); bool OnJavaScriptAlert(); bool OnJavaScriptConfirm(); bool OnJavaScriptPrompt(); +bool OnHitTestCreated(); bool OnScrollEdge(); +bool OnScreenshotCaptured(); +bool OnVideoPlaying(); +bool OnGeolocationPermission(); bool OnClearHistory(); +bool OnSecurityOriginAcquired(); +bool OnStorageUsageAcquired(); +bool OnFormPasswordAcquired(); +bool OnDownloadStarted(); +bool OnMimeOverridden(); +bool OnRequestIntercepted(); +bool OnChangesWatch(); +bool OnPlainTextReceived(); static void ConnectToGlobalSignal( bool ( *func )() ) { @@ -93,138 +120,807 @@ public: void SetProxyUri( const std::string& uri ) override { + mockProxyUri = uri; + } + + std::string GetProxyUri() const override + { + return mockProxyUri; + } + + void SetProxyBypassRule(const std::string& proxy, const std::string& bypass) override + { + mockBypassRule = bypass; + } + + std::string GetProxyBypassRule() const override + { + return mockBypassRule; } void SetDefaultProxyAuth( const std::string& username, const std::string& password ) override { } - void SetCertificateFilePath( const std::string& certificatePath ) override + void SetCertificateFilePath( const std::string& certificatePath ) override + { + mockCertificateFilePath = certificatePath; + } + + std::string GetCertificateFilePath() const override + { + return mockCertificateFilePath; + } + + void DeleteAllWebDatabase() override + { + } + + bool GetWebDatabaseOrigins(Dali::WebEngineContext::WebEngineSecurityOriginAcquiredCallback callback) override + { + if (callback) + { + ConnectToGlobalSignal(&OnSecurityOriginAcquired); + mSecurityOriginAcquiredCallback = callback; + } + return true; + } + + bool DeleteWebDatabase(Dali::WebEngineSecurityOrigin& origin) override + { + return true; + } + + bool GetWebStorageOrigins(Dali::WebEngineContext::WebEngineSecurityOriginAcquiredCallback callback) override + { + if (callback) + { + ConnectToGlobalSignal(&OnSecurityOriginAcquired); + mSecurityOriginAcquiredCallback = callback; + } + return true; + } + + bool GetWebStorageUsageForOrigin(Dali::WebEngineSecurityOrigin& origin, Dali::WebEngineContext::WebEngineStorageUsageAcquiredCallback callback) override + { + if (callback) + { + ConnectToGlobalSignal(&OnStorageUsageAcquired); + mStorageUsageAcquiredCallback = callback; + } + return true; + } + + void DeleteAllWebStorage() override + { + } + + bool DeleteWebStorage(Dali::WebEngineSecurityOrigin& origin) override + { + return true; + } + + void DeleteLocalFileSystem() override + { + } + + void ClearCache() override + { + } + + bool DeleteApplicationCache(Dali::WebEngineSecurityOrigin& origin) override + { + return true; + } + + void GetFormPasswordList(Dali::WebEngineContext::WebEngineFormPasswordAcquiredCallback callback) override + { + if (callback) + { + ConnectToGlobalSignal(&OnFormPasswordAcquired); + mFormPasswordAcquiredCallback = callback; + } + } + + void RegisterDownloadStartedCallback(Dali::WebEngineContext::WebEngineDownloadStartedCallback callback) override + { + if (callback) + { + ConnectToGlobalSignal(&OnDownloadStarted); + mDownloadStartedCallback = callback; + } + } + + void RegisterMimeOverriddenCallback(Dali::WebEngineContext::WebEngineMimeOverriddenCallback callback) override + { + if (callback) + { + ConnectToGlobalSignal(&OnMimeOverridden); + mMimeOverriddenCallback = callback; + } + } + + void RegisterRequestInterceptedCallback(Dali::WebEngineContext::WebEngineRequestInterceptedCallback callback) override + { + if (callback) + { + ConnectToGlobalSignal(&OnRequestIntercepted); + mRequestInterceptedCallback = callback; + } + } + + void EnableCache( bool cacheEnabled ) override + { + mockCacheEnabled = cacheEnabled; + } + + bool IsCacheEnabled() const override + { + return mockCacheEnabled; + } + + void SetAppId(const std::string& appID) override + { + } + + bool SetAppVersion(const std::string& appVersion) override + { + return true; + } + + void SetApplicationType(const Dali::WebEngineContext::ApplicationType applicationType) override + { + } + + void SetTimeOffset(float timeOffset) override + { + } + + void SetTimeZoneOffset(float timeZoneOffset, float daylightSavingTime) override + { + } + + void RegisterUrlSchemesAsCorsEnabled(const std::vector& schemes) override + { + } + + void RegisterJsPluginMimeTypes(const std::vector& mimeTypes) override + { + } + + void SetDefaultZoomFactor(float zoomFactor) override + { + mockZoomFactor = zoomFactor; + } + + float GetDefaultZoomFactor() const override + { + return mockZoomFactor; + } + + bool DeleteAllApplicationCache() override + { + return true; + } + + bool DeleteAllWebIndexedDatabase() override + { + return true; + } + + void DeleteFormPasswordDataList(const std::vector& list) override + { + } + + void DeleteAllFormPasswordData() override + { + } + + void DeleteAllFormCandidateData() override + { + } + + bool FreeUnusedMemory() override + { + return true; + } + +public: + Dali::WebEngineContext::WebEngineSecurityOriginAcquiredCallback mSecurityOriginAcquiredCallback; + Dali::WebEngineContext::WebEngineStorageUsageAcquiredCallback mStorageUsageAcquiredCallback; + Dali::WebEngineContext::WebEngineFormPasswordAcquiredCallback mFormPasswordAcquiredCallback; + Dali::WebEngineContext::WebEngineDownloadStartedCallback mDownloadStartedCallback; + Dali::WebEngineContext::WebEngineMimeOverriddenCallback mMimeOverriddenCallback; + Dali::WebEngineContext::WebEngineRequestInterceptedCallback mRequestInterceptedCallback; + +private: + Dali::WebEngineContext::CacheModel mockModel; + std::string mockProxyUri; + std::string mockBypassRule; + std::string mockCertificateFilePath; + bool mockCacheEnabled; + float mockZoomFactor; +}; + +class MockWebEngineCookieManager : public Dali::WebEngineCookieManager +{ +public: + MockWebEngineCookieManager() + : mockCookieAcceptPolicy( Dali::WebEngineCookieManager::CookieAcceptPolicy::NO_THIRD_PARTY ) + { + } + + void SetCookieAcceptPolicy( Dali::WebEngineCookieManager::CookieAcceptPolicy policy ) override + { + mockCookieAcceptPolicy = policy; + } + + Dali::WebEngineCookieManager::CookieAcceptPolicy GetCookieAcceptPolicy() const override + { + return mockCookieAcceptPolicy; + } + + void ClearCookies() override + { + } + + void SetPersistentStorage( const std::string& path, Dali::WebEngineCookieManager::CookiePersistentStorage storage ) override + { + } + + void ChangesWatch( Dali::WebEngineCookieManager::WebEngineCookieManagerChangesWatchCallback callback ) override + { + if ( callback ) + { + ConnectToGlobalSignal( &OnChangesWatch ); + mChangesWatchCallback = callback; + } + } + +public: + Dali::WebEngineCookieManager::WebEngineCookieManagerChangesWatchCallback mChangesWatchCallback; + +private: + Dali::WebEngineCookieManager::CookieAcceptPolicy mockCookieAcceptPolicy; +}; + +class MockWebEngineBackForwardListItem : public Dali::WebEngineBackForwardListItem +{ +public: + MockWebEngineBackForwardListItem() + : mockUrl( "http://url" ), + mockTitle( "title" ), + mockOriginalUrl( "http://originalurl" ) + { + } + + std::string GetUrl() const override + { + return mockUrl; + } + + std::string GetTitle() const override + { + return mockTitle; + } + + std::string GetOriginalUrl() const override + { + return mockOriginalUrl; + } + +private: + std::string mockUrl; + std::string mockTitle; + std::string mockOriginalUrl; +}; + +class MockWebEngineBackForwardList : public Dali::WebEngineBackForwardList +{ +public: + MockWebEngineBackForwardList() + { + } + + std::unique_ptr GetCurrentItem() const override + { + std::unique_ptr ret(new MockWebEngineBackForwardListItem()); + return ret; + } + + std::unique_ptr GetPreviousItem() const override + { + std::unique_ptr ret(new MockWebEngineBackForwardListItem()); + return ret; + } + + std::unique_ptr GetNextItem() const override + { + std::unique_ptr ret(new MockWebEngineBackForwardListItem()); + return ret; + } + + std::unique_ptr GetItemAtIndex( uint32_t index ) const override + { + std::unique_ptr ret(new MockWebEngineBackForwardListItem()); + return ret; + } + + uint32_t GetItemCount() const override + { + return 1; + } + + std::vector> GetBackwardItems(int limit) override + { + std::vector> ret; + std::unique_ptr item(new MockWebEngineBackForwardListItem()); + ret.push_back(std::move(item)); + return ret; + } + + std::vector> GetForwardItems(int limit) override + { + std::vector> ret; + std::unique_ptr item(new MockWebEngineBackForwardListItem()); + ret.push_back(std::move(item)); + return ret; + } +}; + + +class MockWebEngineCertificate : public Dali::WebEngineCertificate +{ +public: + MockWebEngineCertificate() + { + } + + void Allow(bool allowed) override + { + } + + bool IsFromMainFrame() const override + { + return true; + } + + std::string GetPem() const override + { + return "abc"; + } + + bool IsContextSecure() const override + { + return true; + } +}; + +class MockWebEngineHttpAuthHandler : public Dali::WebEngineHttpAuthHandler +{ +public: + MockWebEngineHttpAuthHandler() + { + } + + std::string GetRealm() const override + { + return "test"; + } + + void Suspend() override + { + } + + void UseCredential(const std::string& user, const std::string& password) override + { + } + + void CancelCredential() override + { + } +}; + +class MockWebEngineFormRepostDecision : public WebEngineFormRepostDecision +{ +public: + MockWebEngineFormRepostDecision() + { + } + + void Reply(bool allowed) override {} +}; + +class MockWebEngineFrame : public Dali::WebEngineFrame +{ +public: + MockWebEngineFrame() + { + } + + bool IsMainFrame() const override + { + return true; + } +}; + +class MockWebEnginePolicyDecision : public Dali::WebEnginePolicyDecision +{ +public: + MockWebEnginePolicyDecision() + { + } + + std::string GetUrl() const override + { + return "http://test.html"; + } + + std::string GetCookie() const override + { + return "test:abc"; + } + + Dali::WebEnginePolicyDecision::DecisionType GetDecisionType() const + { + return Dali::WebEnginePolicyDecision::DecisionType::USE; + } + + std::string GetResponseMime() const + { + return "txt/xml"; + } + + int32_t GetResponseStatusCode() const + { + return 500; + } + + Dali::WebEnginePolicyDecision::NavigationType GetNavigationType() const + { + return Dali::WebEnginePolicyDecision::NavigationType::LINK_CLICKED; + } + + Dali::WebEngineFrame& GetFrame() const + { + return *(Dali::WebEngineFrame*)(&mockWebFrame); + } + + std::string GetScheme() const + { + return "test"; + } + + bool Use() + { + return true; + } + + bool Ignore() + { + return true; + } + + bool Suspend() + { + return true; + } + +private: + MockWebEngineFrame mockWebFrame; +}; + +class MockWebEngineRequestInterceptor : public WebEngineRequestInterceptor +{ +public: + MockWebEngineRequestInterceptor() + { + } + + std::string GetUrl() const override + { + return "http://test.html"; + } + + Dali::Property::Map GetHeaders() const override + { + return mockHeadersMap; + } + + std::string GetMethod() const override + { + return "GET"; + } + + bool Ignore() override + { + return true; + } + + bool SetResponseStatus(int statusCode, const std::string& customedStatusText) override + { + return true; + } + + bool AddResponseHeader(const std::string& fieldName, const std::string& fieldValue) override + { + mockHeadersMap.Add(fieldName, fieldValue); + return true; + } + + bool AddResponseHeaders(const Dali::Property::Map& headers) override + { + mockHeadersMap.Merge(headers); + return true; + } + + bool AddResponseBody(const std::string& body, uint32_t length) override + { + return true; + } + + bool AddResponse(const std::string& headers, const std::string& body, uint32_t length) override + { + return true; + } + + bool WriteResponseChunk(const std::string& chunk, uint32_t length) override + { + return true; + } + +private: + Dali::Property::Map mockHeadersMap; +}; + +class MockWebEngineConsoleMessage : public Dali::WebEngineConsoleMessage +{ +public: + MockWebEngineConsoleMessage() { } - void DeleteWebDatabase() override + std::string GetSource() const override { + return "source"; } - void DeleteWebStorage() override + uint32_t GetLine() const override { + return 10; } - void DeleteLocalFileSystem() override + SeverityLevel GetSeverityLevel() const override + { + return SeverityLevel::EMPTY; + } + + std::string GetText() const override { + return "This is a text."; } +}; - void DisableCache( bool cacheDisabled ) override +class MockWebEngineLoadError : public Dali::WebEngineLoadError +{ +public: + MockWebEngineLoadError(const std::string& url) + : mockUrl(url) { } - void ClearCache() override + std::string GetUrl() const override + { + return mockUrl; + } + + ErrorCode GetCode() const override + { + return ErrorCode::UNKNOWN; + } + + std::string GetDescription() const override + { + return "This is an error."; + } + + ErrorType GetType() const override { + return ErrorType::NONE; } private: - Dali::WebEngineContext::CacheModel mockModel; + std::string mockUrl; }; -class MockWebEngineCookieManager : public Dali::WebEngineCookieManager +class MockWebEngineContextMenuItem : public Dali::WebEngineContextMenuItem { public: - MockWebEngineCookieManager() - : mockCookieAcceptPolicy( Dali::WebEngineCookieManager::CookieAcceptPolicy::NO_THIRD_PARTY ) + MockWebEngineContextMenuItem() { } - void SetCookieAcceptPolicy( Dali::WebEngineCookieManager::CookieAcceptPolicy policy ) override + ItemTag GetTag() const override { - mockCookieAcceptPolicy = policy; + return ItemTag::NO_ACTION; } - Dali::WebEngineCookieManager::CookieAcceptPolicy GetCookieAcceptPolicy() const override + ItemType GetType() const override { - return mockCookieAcceptPolicy; + return ItemType::ACTION; } - void ClearCookies() override + bool IsEnabled() const override { + return true; } - void SetPersistentStorage( const std::string& path, Dali::WebEngineCookieManager::CookiePersistentStorage storage ) override + std::string GetLinkUrl() const override { + return "http://test.html"; } -private: - Dali::WebEngineCookieManager::CookieAcceptPolicy mockCookieAcceptPolicy; + std::string GetImageUrl() const override + { + return "http://test.jpg"; + } + + std::string GetTitle() const override + { + return "title"; + } + + std::unique_ptr GetParentMenu() const override + { + std::unique_ptr result; + return result; + } }; -class MockWebEngineBackForwardListItem : public Dali::WebEngineBackForwardListItem +class MockWebEngineContextMenu : public Dali::WebEngineContextMenu { public: - MockWebEngineBackForwardListItem() - : mockUrl( "http://url" ), - mockTitle( "title" ), - mockOriginalUrl( "http://originalurl" ) + MockWebEngineContextMenu() { } - std::string GetUrl() const override + uint32_t GetItemCount() const override { - return mockUrl; + return 1; } - std::string GetTitle() const override + std::unique_ptr GetItemAt(uint32_t index) const override { - return mockTitle; + std::unique_ptr webitem(new MockWebEngineContextMenuItem()); + return webitem; } - std::string GetOriginalUrl() const override + std::vector> GetItemList() const override { - return mockOriginalUrl; + std::vector> result; + std::unique_ptr webitem(new MockWebEngineContextMenuItem()); + result.push_back(std::move(webitem)); + return result; } -private: - std::string mockUrl; - std::string mockTitle; - std::string mockOriginalUrl; + bool RemoveItem(WebEngineContextMenuItem& item) override + { + return true; + } + + bool AppendItemAsAction(WebEngineContextMenuItem::ItemTag tag, const std::string& title, bool enabled) override + { + return true; + } + + bool AppendItem(WebEngineContextMenuItem::ItemTag tag, const std::string& title, const std::string& iconFile, bool enabled) override + { + return true; + } + + bool SelectItem(WebEngineContextMenuItem& item) override + { + return true; + } + + bool Hide() override + { + return true; + } }; -class MockWebEngineBackForwardList : public Dali::WebEngineBackForwardList +class MockWebEngineHitTest : public Dali::WebEngineHitTest { public: - MockWebEngineBackForwardList( ) - : mockItem(), - pMockItem( &mockItem ) + MockWebEngineHitTest() { } - Dali::WebEngineBackForwardListItem& GetCurrentItem() const override + ResultContext GetResultContext() const override { - return *pMockItem; + return ResultContext::DOCUMENT; } - Dali::WebEngineBackForwardListItem& GetItemAtIndex( uint32_t index ) const override + std::string GetLinkUri() const override { - return *pMockItem; + return "http://test.html"; } - uint32_t GetItemCount() const override + std::string GetLinkTitle() const override { - return 1; + return "test"; + } + + std::string GetLinkLabel() const override + { + return "label"; + } + + std::string GetImageUri() const override + { + return "http://test.jpg"; + } + + std::string GetMediaUri() const override + { + return "http://test.mp4"; + } + + std::string GetTagName() const override + { + return "img"; + } + + std::string GetNodeValue() const override + { + return "test"; + } + + Dali::Property::Map GetAttributes() const override + { + return mockAttributesMap; + } + + std::string GetImageFileNameExtension() const override + { + return "jpg"; + } + + Dali::PixelData GetImageBuffer() override + { + uint8_t* imageData = new uint8_t[16]; + memset(imageData, 0xff, 16); + return Dali::PixelData::New(imageData, 16, 2, 2, + Dali::Pixel::Format::RGBA8888, + Dali::PixelData::ReleaseFunction::DELETE_ARRAY); } private: - MockWebEngineBackForwardListItem mockItem; - WebEngineBackForwardListItem* pMockItem; + mutable Dali::Property::Map mockAttributesMap; }; -class MockWebEngineFormRepostDecision : public WebEngineFormRepostDecision +class MockWebEngineSecurityOrigin : public Dali::WebEngineSecurityOrigin { public: - MockWebEngineFormRepostDecision() + MockWebEngineSecurityOrigin() + : mockUrl("https://test.html") + , mockPotocol("https") { } - void Reply(bool allowed) override {} + std::string GetHost() const + { + return mockUrl; + } + + std::string GetProtocol() const + { + return mockPotocol; + } + +private: + std::string mockUrl; + std::string mockPotocol; }; class MockWebEngineSettings : public WebEngineSettings @@ -442,6 +1138,40 @@ public: { } + bool SetViewportMetaTag(bool enable) override + { + return true; + } + + bool SetForceZoom(bool enable) override + { + return true; + } + + bool IsZoomForced() const override + { + return true; + } + + bool SetTextZoomEnabled(bool enable) override + { + return true; + } + + bool IsTextZoomEnabled() const override + { + return true; + } + + void SetExtraFeature(const std::string& feature, bool enable) override + { + } + + bool IsExtraFeatureEnabled(const std::string& feature) const override + { + return true; + } + private: int mockDefaultFontSize; bool mockJavaScriptEnabled; @@ -465,11 +1195,6 @@ class WebEngine: public Dali::BaseObject { public: - using JavaScriptEvaluatedResultCallback = std::function; - using JavaScriptAlertCallback = std::function; - using JavaScriptConfirmCallback = std::function; - using JavaScriptPromptCallback = std::function; - WebEngine() : mUrl() , mCurrentPlusOnePos( 0 ) @@ -486,7 +1211,12 @@ public: } mockWebEngineSettings = new MockWebEngineSettings(); - mockWebEngineContext = new MockWebEngineContext(); + MockWebEngineContext* engineContext = new MockWebEngineContext(); + mockWebEngineContext = engineContext; + if ( gInstanceCount == 1 ) + { + gWebEngineContextInstance = engineContext; + } mockWebEngineCookieManager = new MockWebEngineCookieManager(); mockWebEngineBackForwardList = new MockWebEngineBackForwardList(); } @@ -497,6 +1227,7 @@ public: if( !gInstanceCount ) { gInstance = 0; + gWebEngineContextInstance = 0; } delete mockWebEngineSettings; @@ -531,7 +1262,7 @@ public: ConnectToGlobalSignal( &OnLoadUrl ); } - const std::string& GetUrl() const + std::string GetUrl() const { return mUrl; } @@ -543,28 +1274,20 @@ public: Dali::PixelData GetFavicon() const { - uint8_t* faviconData = new uint8_t[ 16 ]; - - faviconData[ 0 ] = 0xff; - faviconData[ 1 ] = 0x00; - faviconData[ 2 ] = 0x00; - faviconData[ 3 ] = 0xff; - faviconData[ 4 ] = 0xff; - faviconData[ 5 ] = 0x00; - faviconData[ 6 ] = 0x00; - faviconData[ 7 ] = 0xff; - faviconData[ 8 ] = 0xff; - faviconData[ 9 ] = 0x00; - faviconData[ 10 ] = 0x00; - faviconData[ 11 ] = 0xff; - faviconData[ 12 ] = 0xff; - faviconData[ 13 ] = 0x00; - faviconData[ 14 ] = 0x00; - faviconData[ 15 ] = 0xff; - - return Dali::PixelData::New( faviconData, 16, 2, 2, - Dali::Pixel::Format::RGBA8888, - Dali::PixelData::ReleaseFunction::DELETE_ARRAY ); + static int testGetFaviconCount = 0; + if (testGetFaviconCount == 0) + { + testGetFaviconCount++; + uint8_t* faviconData = new uint8_t[16]; + memset(faviconData, 0xff, 16); + return Dali::PixelData::New(faviconData, 16, 2, 2, + Dali::Pixel::Format::RGBA8888, + Dali::PixelData::ReleaseFunction::DELETE_ARRAY); + } + else + { + return Dali::PixelData(); + } } bool CanGoForward() const @@ -599,144 +1322,307 @@ public: } } - void RegisterJavaScriptAlertCallback( Dali::WebEnginePlugin::JavaScriptAlertCallback callback ) + void RegisterJavaScriptAlertCallback( Dali::WebEnginePlugin::JavaScriptAlertCallback callback ) + { + if ( callback ) + { + ConnectToGlobalSignal( &OnJavaScriptAlert ); + mJavaScriptAlertCallback = callback; + } + } + + void RegisterJavaScriptConfirmCallback( Dali::WebEnginePlugin::JavaScriptConfirmCallback callback ) + { + if ( callback ) + { + ConnectToGlobalSignal( &OnJavaScriptConfirm ); + mJavaScriptConfirmCallback = callback; + } + } + + void RegisterJavaScriptPromptCallback( Dali::WebEnginePlugin::JavaScriptPromptCallback callback ) + { + if ( callback ) + { + ConnectToGlobalSignal( &OnJavaScriptPrompt ); + mJavaScriptPromptCallback = callback; + } + } + + std::unique_ptr CreateHitTest(int32_t x, int32_t y, Dali::WebEngineHitTest::HitTestMode mode) + { + std::unique_ptr hitTest(new MockWebEngineHitTest()); + return hitTest; + } + + bool CreateHitTestAsynchronously(int32_t x, int32_t y, Dali::WebEngineHitTest::HitTestMode mode, Dali::WebEnginePlugin::WebEngineHitTestCreatedCallback callback) + { + if (callback) + { + ConnectToGlobalSignal( &OnHitTestCreated ); + mHitTestCreatedCallback = callback; + } + return true; + } + + void ClearHistory() + { + ConnectToGlobalSignal( &OnClearHistory ); + } + + std::string GetUserAgent() const + { + return mUserAgent; + } + + void SetUserAgent( const std::string& userAgent ) + { + mUserAgent = userAgent; + } + + void ScrollBy( int32_t dx, int32_t dy ) + { + mScrollPosition += Dali::Vector2( dx, dy ); + if ( mScrollPosition.y + mScrollSize.height > mContentSize.height ) + { + ConnectToGlobalSignal( &OnScrollEdge ); + } + } + + bool ScrollEdgeBy( int32_t dx, int32_t dy ) + { + mScrollPosition += Dali::Vector2( dx, dy ); + if ( mScrollPosition.y + mScrollSize.height > mContentSize.height ) + { + ConnectToGlobalSignal( &OnScrollEdge ); + } + return true; + } + + void SetScrollPosition( int32_t x, int32_t y ) + { + mScrollPosition.x = x; + mScrollPosition.y = y; + } + + Dali::Vector2 GetScrollPosition() const + { + return mScrollPosition; + } + + Dali::Vector2 GetScrollSize() const + { + return mScrollSize; + } + + Dali::Vector2 GetContentSize() const + { + return mContentSize; + } + + void SetPageZoomFactor(float zoomFactor) + { + mPageZoomFactor = zoomFactor; + } + + float GetPageZoomFactor() const + { + return mPageZoomFactor; + } + + void SetTextZoomFactor(float zoomFactor) + { + mTextZoomFactor = zoomFactor; + } + + float GetTextZoomFactor() const + { + return mTextZoomFactor; + } + + float GetLoadProgressPercentage() const + { + return 0.5f; + } + + void SetScaleFactor(float scaleFactor, Dali::Vector2 point) + { + mScaleFactor = scaleFactor; + } + + float GetScaleFactor() const + { + return mScaleFactor; + } + + Dali::PixelData GetScreenshot(Dali::Rect viewArea, float scaleFactor) + { + uint32_t bufferSize = viewArea.width * viewArea.height * 4 ; + uint8_t* pixel = new uint8_t[ bufferSize ]; + memset(pixel, 0xff, bufferSize); + return Dali::PixelData::New( pixel, bufferSize, viewArea.width, viewArea.height, + Dali::Pixel::Format::RGBA8888, + Dali::PixelData::ReleaseFunction::DELETE_ARRAY ); + } + + bool GetScreenshotAsynchronously(Dali::Rect viewArea, float scaleFactor, Dali::WebEnginePlugin::ScreenshotCapturedCallback callback) { if ( callback ) { - ConnectToGlobalSignal( &OnJavaScriptAlert ); - mJavaScriptAlertCallback = callback; + ConnectToGlobalSignal( &OnScreenshotCaptured ); + mScreenshotCapturedCallback = callback; } + return true; } - void RegisterJavaScriptConfirmCallback( Dali::WebEnginePlugin::JavaScriptConfirmCallback callback ) + bool CheckVideoPlayingAsynchronously(Dali::WebEnginePlugin::VideoPlayingCallback callback) { if ( callback ) { - ConnectToGlobalSignal( &OnJavaScriptConfirm ); - mJavaScriptConfirmCallback = callback; + ConnectToGlobalSignal( &OnVideoPlaying ); + mVideoPlayingCallback = callback; } + return true; } - void RegisterJavaScriptPromptCallback( Dali::WebEnginePlugin::JavaScriptPromptCallback callback ) + void RegisterGeolocationPermissionCallback(Dali::WebEnginePlugin::GeolocationPermissionCallback callback) { if ( callback ) { - ConnectToGlobalSignal( &OnJavaScriptPrompt ); - mJavaScriptPromptCallback = callback; + ConnectToGlobalSignal( &OnGeolocationPermission ); + mGeolocationPermissionCallback = callback; } } - void ClearHistory() + Dali::WebEnginePlugin::WebEngineFrameRenderedSignalType& FrameRenderedSignal() { - ConnectToGlobalSignal( &OnClearHistory ); + return mFrameRenderedSignal; } - const std::string& GetUserAgent() const + void RegisterPageLoadStartedCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback) { - return mUserAgent; + mPageLoadStartedCallback = callback; } - void SetUserAgent( const std::string& userAgent ) + void RegisterPageLoadInProgressCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback) { - mUserAgent = userAgent; + mPageLoadInProgressCallback = callback; } - void ScrollBy( int dx, int dy ) + void RegisterPageLoadFinishedCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback) { - mScrollPosition += Dali::Vector2( dx, dy ); - if ( mScrollPosition.y + mScrollSize.height > mContentSize.height ) - { - ConnectToGlobalSignal( &OnScrollEdge ); - } + mPageLoadFinishedCallback = callback; } - void SetScrollPosition( int x, int y ) + void RegisterPageLoadErrorCallback(Dali::WebEnginePlugin::WebEnginePageLoadErrorCallback callback) { - mScrollPosition.x = x; - mScrollPosition.y = y; + mPageLoadErrorCallback = callback; } - Dali::Vector2 GetScrollPosition() const + void RegisterScrollEdgeReachedCallback(Dali::WebEnginePlugin::WebEngineScrollEdgeReachedCallback callback) { - return mScrollPosition; + mScrollEdgeReachedCallback = callback; } - Dali::Vector2 GetScrollSize() const + void RegisterUrlChangedCallback(Dali::WebEnginePlugin::WebEngineUrlChangedCallback callback) { - return mScrollSize; + mUrlChangedCallback = callback; } - Dali::Vector2 GetContentSize() const + void RegisterFormRepostDecidedCallback(Dali::WebEnginePlugin::WebEngineFormRepostDecidedCallback callback) { - return mContentSize; + mFormRepostDecidedCallback = callback; } - Dali::WebEnginePlugin::WebEnginePageLoadSignalType& PageLoadStartedSignal() + void RegisterConsoleMessageReceivedCallback(Dali::WebEnginePlugin::WebEngineConsoleMessageReceivedCallback callback) { - return mPageLoadStartedSignal; + mConsoleMessageCallback = callback; } - Dali::WebEnginePlugin::WebEnginePageLoadSignalType& PageLoadInProgressSignal() + void RegisterResponsePolicyDecidedCallback(Dali::WebEnginePlugin::WebEngineResponsePolicyDecidedCallback callback) { - return mPageLoadInProgressSignal; + mResponsePolicyDecisionCallback = callback; } - Dali::WebEnginePlugin::WebEnginePageLoadSignalType& PageLoadFinishedSignal() + void RegisterCertificateConfirmedCallback(Dali::WebEnginePlugin::WebEngineCertificateCallback callback) { - return mPageLoadFinishedSignal; + mCertificateConfirmCallback = callback; } - Dali::WebEnginePlugin::WebEnginePageLoadErrorSignalType& PageLoadErrorSignal() + void RegisterSslCertificateChangedCallback(Dali::WebEnginePlugin::WebEngineCertificateCallback callback) { - return mPageLoadErrorSignal; + mSslCertificateChangedCallback = callback; } - Dali::WebEnginePlugin::WebEngineScrollEdgeReachedSignalType& ScrollEdgeReachedSignal() + void RegisterHttpAuthHandlerCallback(Dali::WebEnginePlugin::WebEngineHttpAuthHandlerCallback callback) { - return mScrollEdgeReachedSignal; + mHttpAuthHandlerCallback = callback; } - Dali::WebEnginePlugin::WebEngineUrlChangedSignalType& UrlChangedSignal() + void RegisterContextMenuShownCallback(Dali::WebEnginePlugin::WebEngineContextMenuShownCallback callback) { - return mUrlChangedSignal; + mContextMenuShownCallback = callback; } - Dali::WebEnginePlugin::WebEngineFormRepostDecisionSignalType& FormRepostDecisionSignal() + void RegisterContextMenuHiddenCallback(Dali::WebEnginePlugin::WebEngineContextMenuHiddenCallback callback) { - return mFormRepostDecisionSignal; + mContextMenuHiddenCallback = callback; } - Dali::WebEnginePlugin::WebEngineFrameRenderedSignalType& FrameRenderedSignal() + void GetPlainTextAsynchronously(Dali::WebEnginePlugin::PlainTextReceivedCallback callback) { - return mFrameRenderedSignal; + if (callback) + { + ConnectToGlobalSignal(&OnPlainTextReceived); + mPlainTextReceivedCallback = callback; + } } - std::string mUrl; - std::vector< std::string > mHistory; - size_t mCurrentPlusOnePos; - std::string mUserAgent; - Dali::WebEnginePlugin::WebEnginePageLoadSignalType mPageLoadStartedSignal; - Dali::WebEnginePlugin::WebEnginePageLoadSignalType mPageLoadInProgressSignal; - Dali::WebEnginePlugin::WebEnginePageLoadSignalType mPageLoadFinishedSignal; - Dali::WebEnginePlugin::WebEnginePageLoadErrorSignalType mPageLoadErrorSignal; - std::vector mResultCallbacks; - bool mEvaluating; - - Dali::WebEnginePlugin::WebEngineScrollEdgeReachedSignalType mScrollEdgeReachedSignal; - Dali::Vector2 mScrollPosition; - Dali::Vector2 mScrollSize; - Dali::Vector2 mContentSize; - WebEngineBackForwardList* mockWebEngineBackForwardList; - WebEngineContext* mockWebEngineContext; - WebEngineCookieManager* mockWebEngineCookieManager; - WebEngineSettings* mockWebEngineSettings; - Dali::WebEnginePlugin::WebEngineUrlChangedSignalType mUrlChangedSignal; - Dali::WebEnginePlugin::WebEngineFormRepostDecisionSignalType mFormRepostDecisionSignal; - Dali::WebEnginePlugin::WebEngineFrameRenderedSignalType mFrameRenderedSignal; - - JavaScriptAlertCallback mJavaScriptAlertCallback; - JavaScriptConfirmCallback mJavaScriptConfirmCallback; - JavaScriptPromptCallback mJavaScriptPromptCallback; + std::string mUrl; + std::vector mHistory; + size_t mCurrentPlusOnePos; + std::string mUserAgent; + + Dali::WebEnginePlugin::WebEngineFrameRenderedSignalType mFrameRenderedSignal; + + bool mEvaluating; + float mPageZoomFactor; + float mTextZoomFactor; + float mScaleFactor; + + Dali::Vector2 mScrollPosition; + Dali::Vector2 mScrollSize; + Dali::Vector2 mContentSize; + WebEngineBackForwardList* mockWebEngineBackForwardList; + WebEngineContext* mockWebEngineContext; + WebEngineCookieManager* mockWebEngineCookieManager; + WebEngineSettings* mockWebEngineSettings; + + std::vector mResultCallbacks; + + Dali::WebEnginePlugin::WebEnginePageLoadCallback mPageLoadStartedCallback; + Dali::WebEnginePlugin::WebEnginePageLoadCallback mPageLoadInProgressCallback; + Dali::WebEnginePlugin::WebEnginePageLoadCallback mPageLoadFinishedCallback; + Dali::WebEnginePlugin::WebEnginePageLoadErrorCallback mPageLoadErrorCallback; + Dali::WebEnginePlugin::WebEngineScrollEdgeReachedCallback mScrollEdgeReachedCallback; + Dali::WebEnginePlugin::WebEngineUrlChangedCallback mUrlChangedCallback; + Dali::WebEnginePlugin::WebEngineFormRepostDecidedCallback mFormRepostDecidedCallback; + Dali::WebEnginePlugin::WebEngineFrameRenderedCallback mFrameRenderedCallback; + Dali::WebEnginePlugin::WebEngineConsoleMessageReceivedCallback mConsoleMessageCallback; + Dali::WebEnginePlugin::WebEngineResponsePolicyDecidedCallback mResponsePolicyDecisionCallback; + Dali::WebEnginePlugin::WebEngineCertificateCallback mCertificateConfirmCallback; + Dali::WebEnginePlugin::WebEngineCertificateCallback mSslCertificateChangedCallback; + Dali::WebEnginePlugin::WebEngineHttpAuthHandlerCallback mHttpAuthHandlerCallback; + Dali::WebEnginePlugin::WebEngineContextMenuShownCallback mContextMenuShownCallback; + Dali::WebEnginePlugin::WebEngineContextMenuHiddenCallback mContextMenuHiddenCallback; + Dali::WebEnginePlugin::JavaScriptAlertCallback mJavaScriptAlertCallback; + Dali::WebEnginePlugin::JavaScriptConfirmCallback mJavaScriptConfirmCallback; + Dali::WebEnginePlugin::JavaScriptPromptCallback mJavaScriptPromptCallback; + Dali::WebEnginePlugin::ScreenshotCapturedCallback mScreenshotCapturedCallback; + Dali::WebEnginePlugin::VideoPlayingCallback mVideoPlayingCallback; + Dali::WebEnginePlugin::GeolocationPermissionCallback mGeolocationPermissionCallback; + Dali::WebEnginePlugin::WebEngineHitTestCreatedCallback mHitTestCreatedCallback; + Dali::WebEnginePlugin::PlainTextReceivedCallback mPlainTextReceivedCallback; }; @@ -777,14 +1663,72 @@ bool OnLoadUrl() } gInstance->mHistory.push_back( gInstance->mUrl ); gInstance->mCurrentPlusOnePos++; - gInstance->mPageLoadStartedSignal.Emit( gInstance->mUrl ); - gInstance->mPageLoadInProgressSignal.Emit( gInstance->mUrl ); - gInstance->mPageLoadFinishedSignal.Emit( gInstance->mUrl ); - gInstance->mUrlChangedSignal.Emit( "http://new-test" ); - - std::shared_ptr decision(new MockWebEngineFormRepostDecision()); - gInstance->mFormRepostDecisionSignal.Emit(decision); + if (gInstance->mPageLoadStartedCallback) + { + gInstance->mPageLoadStartedCallback( gInstance->mUrl ); + } + if (gInstance->mPageLoadInProgressCallback) + { + gInstance->mPageLoadInProgressCallback( gInstance->mUrl ); + } + if (gInstance->mPageLoadFinishedCallback) + { + gInstance->mPageLoadFinishedCallback( gInstance->mUrl ); + } + if (gInstance->mPageLoadErrorCallback) + { + std::unique_ptr error(new MockWebEngineLoadError(gInstance->mUrl)); + gInstance->mPageLoadErrorCallback(std::move(error)); + } + if (gInstance->mUrlChangedCallback) + { + gInstance->mUrlChangedCallback( "http://new-test" ); + } + if (gInstance->mFormRepostDecidedCallback) + { + std::unique_ptr repostDecision(new MockWebEngineFormRepostDecision()); + gInstance->mFormRepostDecidedCallback(std::move(repostDecision)); + } gInstance->mFrameRenderedSignal.Emit(); + if (gInstance->mFrameRenderedCallback) + { + gInstance->mFrameRenderedCallback(); + } + if (gInstance->mConsoleMessageCallback) + { + std::unique_ptr message(new MockWebEngineConsoleMessage()); + gInstance->mConsoleMessageCallback(std::move(message)); + } + if (gInstance->mResponsePolicyDecisionCallback) + { + std::unique_ptr policyDecision(new MockWebEnginePolicyDecision()); + gInstance->mResponsePolicyDecisionCallback(std::move(policyDecision)); + } + if (gInstance->mCertificateConfirmCallback) + { + std::unique_ptr certificate(new MockWebEngineCertificate()); + gInstance->mCertificateConfirmCallback(std::move(certificate)); + } + if (gInstance->mSslCertificateChangedCallback) + { + std::unique_ptr sslCertificate(new MockWebEngineCertificate()); + gInstance->mSslCertificateChangedCallback(std::move(sslCertificate)); + } + if (gInstance->mHttpAuthHandlerCallback) + { + std::unique_ptr handler(new MockWebEngineHttpAuthHandler()); + gInstance->mHttpAuthHandlerCallback(std::move(handler)); + } + if (gInstance->mContextMenuShownCallback) + { + std::unique_ptr menu(new MockWebEngineContextMenu()); + gInstance->mContextMenuShownCallback(std::move(menu)); + } + if (gInstance->mContextMenuHiddenCallback) + { + std::unique_ptr hiddenMenu(new MockWebEngineContextMenu()); + gInstance->mContextMenuHiddenCallback(std::move(hiddenMenu)); + } } return false; } @@ -793,9 +1737,9 @@ bool OnScrollEdge() { DisconnectFromGlobalSignal( &OnScrollEdge ); - if( gInstance ) + if( gInstance && gInstance->mScrollEdgeReachedCallback ) { - gInstance->mScrollEdgeReachedSignal.Emit( Dali::WebEnginePlugin::ScrollEdge::BOTTOM ); + gInstance->mScrollEdgeReachedCallback( Dali::WebEnginePlugin::ScrollEdge::BOTTOM ); } return false; @@ -846,6 +1790,52 @@ bool OnJavaScriptPrompt() return false; } +bool OnScreenshotCaptured() +{ + DisconnectFromGlobalSignal( &OnScreenshotCaptured ); + if ( gInstance ) + { + uint8_t* pixel = new uint8_t[ 2 * 2 * 4 ]; + memset(pixel, 0xff, 2 * 2 * 4); + Dali::PixelData data = Dali::PixelData::New( pixel, 2 * 2 * 4, 2, 2, + Dali::Pixel::Format::RGBA8888, + Dali::PixelData::ReleaseFunction::DELETE_ARRAY ); + gInstance->mScreenshotCapturedCallback( data ); + } + return false; +} + +bool OnVideoPlaying() +{ + DisconnectFromGlobalSignal( &OnVideoPlaying ); + if ( gInstance ) + { + gInstance->mVideoPlayingCallback( true ); + } + return false; +} + +bool OnGeolocationPermission() +{ + DisconnectFromGlobalSignal( &OnGeolocationPermission ); + if ( gInstance ) + { + gInstance->mGeolocationPermissionCallback( "", "" ); + } + return false; +} + +bool OnHitTestCreated() +{ + DisconnectFromGlobalSignal(&OnHitTestCreated); + if (gInstance) + { + std::unique_ptr test(new MockWebEngineHitTest()); + gInstance->mHitTestCreatedCallback(std::move(test)); + } + return false; +} + bool OnClearHistory() { DisconnectFromGlobalSignal( &OnClearHistory ); @@ -860,6 +1850,103 @@ bool OnClearHistory() return false; } +bool OnSecurityOriginAcquired() +{ + DisconnectFromGlobalSignal(&OnSecurityOriginAcquired); + if (gWebEngineContextInstance) + { + std::vector> securityOriginList; + std::unique_ptr origin(new MockWebEngineSecurityOrigin()); + securityOriginList.push_back(std::move(origin)); + gWebEngineContextInstance->mSecurityOriginAcquiredCallback(securityOriginList); + } + return false; +} + +bool OnStorageUsageAcquired() +{ + DisconnectFromGlobalSignal(&OnStorageUsageAcquired); + if (gWebEngineContextInstance) + { + gWebEngineContextInstance->mStorageUsageAcquiredCallback(0); + } + return false; +} + +bool OnFormPasswordAcquired() +{ + DisconnectFromGlobalSignal(&OnFormPasswordAcquired); + if (gWebEngineContextInstance) + { + std::vector> formPasswordList; + std::unique_ptr data(new Dali::WebEngineContext::PasswordData()); + data->url = "http://test.html"; + data->useFingerprint = false; + formPasswordList.push_back(std::move(data)); + gWebEngineContextInstance->mFormPasswordAcquiredCallback(formPasswordList); + } + return false; +} + +bool OnDownloadStarted() +{ + DisconnectFromGlobalSignal(&OnDownloadStarted); + if (gWebEngineContextInstance) + { + gWebEngineContextInstance->mDownloadStartedCallback("http://test.html"); + } + return false; +} + +bool OnMimeOverridden() +{ + DisconnectFromGlobalSignal(&OnMimeOverridden); + if (gWebEngineContextInstance) + { + std::string newMime; + gWebEngineContextInstance->mMimeOverriddenCallback("http://test.html", "txt/xml", newMime); + } + return false; +} + +bool OnRequestIntercepted() +{ + DisconnectFromGlobalSignal(&OnRequestIntercepted); + if (gWebEngineContextInstance) + { + Dali::WebEngineRequestInterceptorPtr interceptor = new MockWebEngineRequestInterceptor(); + gWebEngineContextInstance->mRequestInterceptedCallback(interceptor); + } + return false; +} + +bool OnChangesWatch() +{ + DisconnectFromGlobalSignal( &OnChangesWatch ); + + if ( gInstance ) + { + MockWebEngineCookieManager* temp = (MockWebEngineCookieManager *)(&(gInstance->GetCookieManager())); + if ( temp ) + { + temp->mChangesWatchCallback(); + } + } + + return false; +} + +bool OnPlainTextReceived() +{ + DisconnectFromGlobalSignal(&OnPlainTextReceived); + if (gInstance) + { + std::string dummyResultText; + gInstance->mPlainTextReceivedCallback(dummyResultText); + } + return false; +} + } // namespace inline WebEngine& GetImplementation( Dali::WebEngine& webEngine ) @@ -917,11 +2004,11 @@ WebEngine WebEngine::DownCast( BaseHandle handle ) return WebEngine( dynamic_cast< Internal::Adaptor::WebEngine* >( handle.GetObjectPtr() ) ); } -void WebEngine::Create( int width, int height, const std::string& locale, const std::string& timezoneId ) +void WebEngine::Create( uint32_t width, uint32_t height, const std::string& locale, const std::string& timezoneId ) { } -void WebEngine::Create( int width, int height, int argc, char** argv ) +void WebEngine::Create( uint32_t width, uint32_t height, uint32_t argc, char** argv ) { } @@ -964,7 +2051,7 @@ Dali::PixelData WebEngine::GetFavicon() const return Internal::Adaptor::GetImplementation( *this ).GetFavicon(); } -const std::string& WebEngine::GetUrl() +std::string WebEngine::GetUrl() const { return Internal::Adaptor::GetImplementation( *this ).GetUrl(); } @@ -980,10 +2067,25 @@ void WebEngine::LoadHtmlString( const std::string& htmlString ) { } +bool WebEngine::LoadHtmlStringOverrideCurrentEntry(const std::string& html, const std::string& basicUri, const std::string& unreachableUrl) +{ + return true; +} + +bool WebEngine::LoadContents(const std::string& contents, uint32_t contentSize, const std::string& mimeType, const std::string& encoding, const std::string& baseUri) +{ + return true; +} + void WebEngine::Reload() { } +bool WebEngine::ReloadWithoutCache() +{ + return true; +} + void WebEngine::StopLoading() { } @@ -996,6 +2098,34 @@ void WebEngine::Resume() { } +void WebEngine::SuspendNetworkLoading() +{ +} + +void WebEngine::ResumeNetworkLoading() +{ +} + +bool WebEngine::AddCustomHeader(const std::string& name, const std::string& value) +{ + return true; +} + +bool WebEngine::RemoveCustomHeader(const std::string& name) +{ + return true; +} + +uint32_t WebEngine::StartInspectorServer(uint32_t port) +{ + return port; +} + +bool WebEngine::StopInspectorServer() +{ + return true; +} + bool WebEngine::CanGoForward() { return Internal::Adaptor::GetImplementation( *this ).CanGoForward(); @@ -1052,6 +2182,16 @@ void WebEngine::JavaScriptPromptReply( const std::string& result ) { } +std::unique_ptr WebEngine::CreateHitTest(int32_t x, int32_t y, Dali::WebEngineHitTest::HitTestMode mode) +{ + return Internal::Adaptor::GetImplementation(*this).CreateHitTest(x, y, mode); +} + +bool WebEngine::CreateHitTestAsynchronously(int32_t x, int32_t y, Dali::WebEngineHitTest::HitTestMode mode, Dali::WebEnginePlugin::WebEngineHitTestCreatedCallback callback) +{ + return Internal::Adaptor::GetImplementation(*this).CreateHitTestAsynchronously(x, y, mode, callback); +} + void WebEngine::ClearAllTilesResources() { } @@ -1061,7 +2201,50 @@ void WebEngine::ClearHistory() Internal::Adaptor::GetImplementation( *this ).ClearHistory(); } -const std::string& WebEngine::GetUserAgent() const +void WebEngine::SetScaleFactor(float scaleFactor, Dali::Vector2 point) +{ + Internal::Adaptor::GetImplementation( *this ).SetScaleFactor(scaleFactor, point); +} + +float WebEngine::GetScaleFactor() const +{ + return Internal::Adaptor::GetImplementation( *this ).GetScaleFactor(); +} + +void WebEngine::ActivateAccessibility(bool activated) +{ +} + +bool WebEngine::HighlightText(const std::string& text, Dali::WebEnginePlugin::FindOption options, uint32_t maxMatchCount) +{ + return true; +} + +void WebEngine::AddDynamicCertificatePath(const std::string& host, const std::string& certPath) +{ +} + +Dali::PixelData WebEngine::GetScreenshot(Dali::Rect viewArea, float scaleFactor) +{ + return Internal::Adaptor::GetImplementation( *this ).GetScreenshot(viewArea, scaleFactor); +} + +bool WebEngine::GetScreenshotAsynchronously(Dali::Rect viewArea, float scaleFactor, Dali::WebEnginePlugin::ScreenshotCapturedCallback callback) +{ + return Internal::Adaptor::GetImplementation( *this ).GetScreenshotAsynchronously(viewArea, scaleFactor, callback); +} + +bool WebEngine::CheckVideoPlayingAsynchronously(Dali::WebEnginePlugin::VideoPlayingCallback callback) +{ + return Internal::Adaptor::GetImplementation( *this ).CheckVideoPlayingAsynchronously(callback); +} + +void WebEngine::RegisterGeolocationPermissionCallback(Dali::WebEnginePlugin::GeolocationPermissionCallback callback) +{ + Internal::Adaptor::GetImplementation( *this ).RegisterGeolocationPermissionCallback(callback); +} + +std::string WebEngine::GetUserAgent() const { return Internal::Adaptor::GetImplementation( *this ).GetUserAgent(); } @@ -1071,12 +2254,17 @@ void WebEngine::SetUserAgent( const std::string& userAgent ) Internal::Adaptor::GetImplementation( *this ).SetUserAgent( userAgent ); } -void WebEngine::ScrollBy( int dx, int dy ) +void WebEngine::ScrollBy( int32_t dx, int32_t dy ) { Internal::Adaptor::GetImplementation( *this ).ScrollBy( dx, dy ); } -void WebEngine::SetScrollPosition( int x, int y ) +bool WebEngine::ScrollEdgeBy( int32_t dx, int32_t dy ) +{ + return Internal::Adaptor::GetImplementation( *this ).ScrollEdgeBy( dx, dy ); +} + +void WebEngine::SetScrollPosition( int32_t x, int32_t y ) { Internal::Adaptor::GetImplementation( *this ).SetScrollPosition( x, y ); } @@ -1096,7 +2284,7 @@ Dali::Vector2 WebEngine::GetContentSize() const return Internal::Adaptor::GetImplementation( *this ).GetContentSize(); } -void WebEngine::SetSize( int width, int height ) +void WebEngine::SetSize( uint32_t width, uint32_t height ) { } @@ -1145,7 +2333,32 @@ void WebEngine::SetFocus( bool focused ) { } -void WebEngine::UpdateDisplayArea( Dali::Rect< int > displayArea ) +void WebEngine::SetPageZoomFactor(float zoomFactor) +{ + Internal::Adaptor::GetImplementation( *this ).SetPageZoomFactor(zoomFactor); +} + +float WebEngine::GetPageZoomFactor() const +{ + return Internal::Adaptor::GetImplementation( *this ).GetPageZoomFactor(); +} + +void WebEngine::SetTextZoomFactor(float zoomFactor) +{ + Internal::Adaptor::GetImplementation( *this ).SetTextZoomFactor(zoomFactor); +} + +float WebEngine::GetTextZoomFactor() const +{ + return Internal::Adaptor::GetImplementation( *this ).GetTextZoomFactor(); +} + +float WebEngine::GetLoadProgressPercentage() const +{ + return Internal::Adaptor::GetImplementation( *this ).GetLoadProgressPercentage(); +} + +void WebEngine::UpdateDisplayArea( Dali::Rect< int32_t > displayArea ) { } @@ -1161,44 +2374,84 @@ void WebEngine::EnableKeyEvents( bool enabled ) { } -Dali::WebEnginePlugin::WebEnginePageLoadSignalType& WebEngine::PageLoadStartedSignal() +Dali::WebEnginePlugin::WebEngineFrameRenderedSignalType& WebEngine::FrameRenderedSignal() { - return Internal::Adaptor::GetImplementation( *this ).PageLoadStartedSignal(); + return Internal::Adaptor::GetImplementation(*this).FrameRenderedSignal(); } -Dali::WebEnginePlugin::WebEnginePageLoadSignalType& WebEngine::PageLoadInProgressSignal() +void WebEngine::RegisterPageLoadStartedCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback) { - return Internal::Adaptor::GetImplementation( *this ).PageLoadInProgressSignal(); + Internal::Adaptor::GetImplementation( *this ).RegisterPageLoadStartedCallback(callback); } -Dali::WebEnginePlugin::WebEnginePageLoadSignalType& WebEngine::PageLoadFinishedSignal() +void WebEngine::RegisterPageLoadInProgressCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback) { - return Internal::Adaptor::GetImplementation( *this ).PageLoadFinishedSignal(); + Internal::Adaptor::GetImplementation( *this ).RegisterPageLoadInProgressCallback(callback); } -Dali::WebEnginePlugin::WebEnginePageLoadErrorSignalType& WebEngine::PageLoadErrorSignal() +void WebEngine::RegisterPageLoadFinishedCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback) { - return Internal::Adaptor::GetImplementation( *this ).PageLoadErrorSignal(); + Internal::Adaptor::GetImplementation( *this ).RegisterPageLoadFinishedCallback(callback); } -Dali::WebEnginePlugin::WebEngineScrollEdgeReachedSignalType& WebEngine::ScrollEdgeReachedSignal() +void WebEngine::RegisterPageLoadErrorCallback(Dali::WebEnginePlugin::WebEnginePageLoadErrorCallback callback) { - return Internal::Adaptor::GetImplementation( *this ).ScrollEdgeReachedSignal(); + Internal::Adaptor::GetImplementation( *this ).RegisterPageLoadErrorCallback(callback); } -Dali::WebEnginePlugin::WebEngineUrlChangedSignalType& WebEngine::UrlChangedSignal() +void WebEngine::RegisterScrollEdgeReachedCallback(Dali::WebEnginePlugin::WebEngineScrollEdgeReachedCallback callback) { - return Internal::Adaptor::GetImplementation( *this ).UrlChangedSignal(); + Internal::Adaptor::GetImplementation( *this ).RegisterScrollEdgeReachedCallback(callback); } -Dali::WebEnginePlugin::WebEngineFormRepostDecisionSignalType& WebEngine::FormRepostDecisionSignal() +void WebEngine::RegisterUrlChangedCallback(Dali::WebEnginePlugin::WebEngineUrlChangedCallback callback) { - return Internal::Adaptor::GetImplementation( *this ).FormRepostDecisionSignal(); + Internal::Adaptor::GetImplementation( *this ).RegisterUrlChangedCallback(callback); } -Dali::WebEnginePlugin::WebEngineFrameRenderedSignalType& WebEngine::FrameRenderedSignal() +void WebEngine::RegisterFormRepostDecidedCallback(Dali::WebEnginePlugin::WebEngineFormRepostDecidedCallback callback) +{ + Internal::Adaptor::GetImplementation( *this ).RegisterFormRepostDecidedCallback(callback); +} + +void WebEngine::RegisterConsoleMessageReceivedCallback(Dali::WebEnginePlugin::WebEngineConsoleMessageReceivedCallback callback) +{ + Internal::Adaptor::GetImplementation( *this ).RegisterConsoleMessageReceivedCallback(callback); +} + +void WebEngine::RegisterResponsePolicyDecidedCallback(Dali::WebEnginePlugin::WebEngineResponsePolicyDecidedCallback callback) +{ + Internal::Adaptor::GetImplementation( *this ).RegisterResponsePolicyDecidedCallback(callback); +} + +void WebEngine::RegisterCertificateConfirmedCallback(Dali::WebEnginePlugin::WebEngineCertificateCallback callback) +{ + Internal::Adaptor::GetImplementation( *this ).RegisterCertificateConfirmedCallback(callback); +} + +void WebEngine::RegisterSslCertificateChangedCallback(Dali::WebEnginePlugin::WebEngineCertificateCallback callback) +{ + Internal::Adaptor::GetImplementation( *this ).RegisterSslCertificateChangedCallback(callback); +} + +void WebEngine::RegisterHttpAuthHandlerCallback(Dali::WebEnginePlugin::WebEngineHttpAuthHandlerCallback callback) +{ + Internal::Adaptor::GetImplementation( *this ).RegisterHttpAuthHandlerCallback(callback); +} + +void WebEngine::RegisterContextMenuShownCallback(Dali::WebEnginePlugin::WebEngineContextMenuShownCallback callback) +{ + Internal::Adaptor::GetImplementation( *this ).RegisterContextMenuShownCallback(callback); +} + +void WebEngine::RegisterContextMenuHiddenCallback(Dali::WebEnginePlugin::WebEngineContextMenuHiddenCallback callback) +{ + Internal::Adaptor::GetImplementation( *this ).RegisterContextMenuHiddenCallback(callback); +} + +void WebEngine::GetPlainTextAsynchronously(Dali::WebEnginePlugin::PlainTextReceivedCallback callback) { - return Internal::Adaptor::GetImplementation( *this ).FrameRenderedSignal(); + Internal::Adaptor::GetImplementation(*this).GetPlainTextAsynchronously(callback); } } // namespace Dali;