class WebEngine;
class MockWebEngineContext;
+class MockWebEngineCookieManager;
namespace
{
-
// Generally only one WebEngine instance exists.
// If > 1, a new web engine has been created by CreateWindowSignal.
-static WebEngine* gInstance = nullptr;
-static int gInstanceCount = 0;
-static MockWebEngineContext* gWebEngineContextInstance = nullptr;
+WebEngine* gInstance = nullptr;
+int gInstanceCount = 0;
+MockWebEngineContext* gWebEngineContextInstance = nullptr;
+MockWebEngineCookieManager* gMockWebEngineCookieManager = nullptr;
bool OnGoBack();
bool OnGoForward();
float mockZoomFactor;
};
+Dali::WebEngineContext* GetContext()
+{
+ if (!gWebEngineContextInstance)
+ {
+ gWebEngineContextInstance = new MockWebEngineContext();
+ }
+ return gWebEngineContextInstance;
+}
+
class MockWebEngineCookieManager : public Dali::WebEngineCookieManager
{
public:
Dali::WebEngineCookieManager::CookieAcceptPolicy mockCookieAcceptPolicy;
};
+Dali::WebEngineCookieManager* GetCookieManager()
+{
+ if (!gMockWebEngineCookieManager)
+ {
+ gMockWebEngineCookieManager = new MockWebEngineCookieManager();
+ }
+ return gMockWebEngineCookieManager;
+}
+
class MockWebEngineBackForwardListItem : public Dali::WebEngineBackForwardListItem
{
public:
}
mockWebEngineSettings = new MockWebEngineSettings();
- MockWebEngineContext* engineContext = new MockWebEngineContext();
- mockWebEngineContext = engineContext;
- if ( gInstanceCount == 1 )
- {
- gWebEngineContextInstance = engineContext;
- }
- mockWebEngineCookieManager = new MockWebEngineCookieManager();
mockWebEngineBackForwardList = new MockWebEngineBackForwardList();
}
gInstanceCount--;
if( !gInstanceCount )
{
- gInstance = 0;
- gWebEngineContextInstance = 0;
+ gInstance = nullptr;
}
delete mockWebEngineSettings;
- delete mockWebEngineContext;
- delete mockWebEngineCookieManager;
delete mockWebEngineBackForwardList;
}
return *mockWebEngineSettings;
}
- Dali::WebEngineContext& GetContext() const
- {
- return *mockWebEngineContext;
- }
-
- Dali::WebEngineCookieManager& GetCookieManager() const
- {
- return *mockWebEngineCookieManager;
- }
-
Dali::WebEngineBackForwardList& GetBackForwardList() const
{
return *mockWebEngineBackForwardList;
Dali::Vector2 mScrollSize;
Dali::Vector2 mContentSize;
WebEngineBackForwardList* mockWebEngineBackForwardList;
- WebEngineContext* mockWebEngineContext;
- WebEngineCookieManager* mockWebEngineCookieManager;
WebEngineSettings* mockWebEngineSettings;
std::vector<Dali::WebEnginePlugin::JavaScriptMessageHandlerCallback> mResultCallbacks;
bool OnChangesWatch()
{
- DisconnectFromGlobalSignal( &OnChangesWatch );
-
- if ( gInstance )
+ DisconnectFromGlobalSignal(&OnChangesWatch);
+ if (gMockWebEngineCookieManager)
{
- MockWebEngineCookieManager* temp = (MockWebEngineCookieManager *)(&(gInstance->GetCookieManager()));
- if ( temp )
- {
- temp->mChangesWatchCallback();
- }
+ gMockWebEngineCookieManager->mChangesWatchCallback();
}
-
return false;
}
return WebEngine( baseObject );
}
+Dali::WebEngineContext* WebEngine::GetContext()
+{
+ return Internal::Adaptor::GetContext();
+}
+
+Dali::WebEngineCookieManager* WebEngine::GetCookieManager()
+{
+ return Internal::Adaptor::GetCookieManager();
+}
+
WebEngine::WebEngine( const WebEngine& WebEngine )
: BaseHandle( WebEngine )
{
return Internal::Adaptor::GetImplementation( *this ).GetSettings();
}
-WebEngineContext& WebEngine::GetContext() const
-{
- return Internal::Adaptor::GetImplementation( *this ).GetContext();
-}
-
-WebEngineCookieManager& WebEngine::GetCookieManager() const
-{
- return Internal::Adaptor::GetImplementation( *this ).GetCookieManager();
-}
-
WebEngineBackForwardList& WebEngine::GetBackForwardList() const
{
return Internal::Adaptor::GetImplementation( *this ).GetBackForwardList();
#include "dali-toolkit-test-utils/toolkit-timer.h"
#include <dali-toolkit/devel-api/controls/web-view/web-back-forward-list.h>
-#include <dali-toolkit/devel-api/controls/web-view/web-context.h>
-#include <dali-toolkit/devel-api/controls/web-view/web-cookie-manager.h>
#include <dali-toolkit/devel-api/controls/web-view/web-settings.h>
#include <dali-toolkit/devel-api/controls/web-view/web-view.h>
#include <dali-toolkit/public-api/controls/image-view/image-view.h>
#include <dali.h>
#include <dali/devel-api/adaptor-framework/web-engine/web-engine-certificate.h>
#include <dali/devel-api/adaptor-framework/web-engine/web-engine-console-message.h>
+#include <dali/devel-api/adaptor-framework/web-engine/web-engine-context.h>
#include <dali/devel-api/adaptor-framework/web-engine/web-engine-context-menu-item.h>
#include <dali/devel-api/adaptor-framework/web-engine/web-engine-context-menu.h>
-#include <dali/devel-api/adaptor-framework/web-engine/web-engine-context.h>
+#include <dali/devel-api/adaptor-framework/web-engine/web-engine-cookie-manager.h>
#include <dali/devel-api/adaptor-framework/web-engine/web-engine-form-repost-decision.h>
#include <dali/devel-api/adaptor-framework/web-engine/web-engine-frame.h>
#include <dali/devel-api/adaptor-framework/web-engine/web-engine-hit-test.h>
{
ToolkitTestApplication application;
- WebView view = WebView::New();
- DALI_TEST_CHECK(view);
-
- Dali::Toolkit::WebContext* context = view.GetContext();
+ Dali::WebEngineContext* context = WebView::GetContext();
DALI_TEST_CHECK(context != 0);
END_TEST;
{
ToolkitTestApplication application;
- WebView view = WebView::New();
- DALI_TEST_CHECK(view);
-
- Dali::Toolkit::WebCookieManager* cookieManager = view.GetCookieManager();
+ Dali::WebEngineCookieManager* cookieManager = WebView::GetCookieManager();
DALI_TEST_CHECK(cookieManager != 0);
END_TEST;
// test cases for web context.
-int UtcDaliWebContextGetSetCacheModel(void)
+int UtcDaliWebContextGetSetCacheModelEtc(void)
{
ToolkitTestApplication application;
- WebView view = WebView::New();
- DALI_TEST_CHECK(view);
-
- Dali::Toolkit::WebContext* context = view.GetContext();
+ Dali::WebEngineContext* context = WebView::GetContext();
DALI_TEST_CHECK(context != 0)
std::string kDefaultValue;
{
ToolkitTestApplication application;
- WebView view = WebView::New();
- DALI_TEST_CHECK(view);
-
- Dali::Toolkit::WebContext* context = view.GetContext();
+ Dali::WebEngineContext* context = WebView::GetContext();
DALI_TEST_CHECK(context != 0)
std::string kDefaultValue;
{
ToolkitTestApplication application;
- WebView view = WebView::New();
- DALI_TEST_CHECK(view);
-
- Dali::Toolkit::WebContext* context = view.GetContext();
+ Dali::WebEngineContext* context = WebView::GetContext();
DALI_TEST_CHECK(context != 0)
// load url.
{
ToolkitTestApplication application;
- WebView view = WebView::New();
- DALI_TEST_CHECK(view);
-
- Dali::Toolkit::WebCookieManager* cookieManager = view.GetCookieManager();
+ Dali::WebEngineCookieManager* cookieManager = WebView::GetCookieManager();
DALI_TEST_CHECK(cookieManager != 0)
const std::string kDefaultValue;
{
ToolkitTestApplication application;
- WebView view = WebView::New();
- DALI_TEST_CHECK(view);
-
- Dali::Toolkit::WebCookieManager* cookieManager = view.GetCookieManager();
+ Dali::WebEngineCookieManager* cookieManager = WebView::GetCookieManager();
DALI_TEST_CHECK(cookieManager != 0)
cookieManager->ChangesWatch(&OnChangesWatch);
+++ /dev/null
-/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali-toolkit/devel-api/controls/web-view/web-context.h>
-
-// EXTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/web-engine/web-engine-security-origin.h>
-
-namespace Dali
-{
-namespace Toolkit
-{
-WebContext::WebContext(Dali::WebEngineContext& context)
-: mWebEngineContext(context)
-{
-}
-
-WebContext::~WebContext()
-{
-}
-
-Dali::WebEngineContext::CacheModel WebContext::GetCacheModel() const
-{
- return mWebEngineContext.GetCacheModel();
-}
-
-void WebContext::SetCacheModel(Dali::WebEngineContext::CacheModel cacheModel)
-{
- mWebEngineContext.SetCacheModel(cacheModel);
-}
-
-void WebContext::SetProxyUri(const std::string& uri)
-{
- mWebEngineContext.SetProxyUri(uri);
-}
-
-std::string WebContext::GetProxyUri() const
-{
- return mWebEngineContext.GetProxyUri();
-}
-
-void WebContext::SetProxyBypassRule(const std::string& proxy, const std::string& bypass)
-{
- mWebEngineContext.SetProxyBypassRule(proxy, bypass);
-}
-
-std::string WebContext::GetProxyBypassRule() const
-{
- return mWebEngineContext.GetProxyBypassRule();
-}
-
-void WebContext::SetCertificateFilePath(const std::string& certificatePath)
-{
- mWebEngineContext.SetCertificateFilePath(certificatePath);
-}
-
-std::string WebContext::GetCertificateFilePath() const
-{
- return mWebEngineContext.GetCertificateFilePath();
-}
-
-void WebContext::SetDefaultProxyAuth(const std::string& username, const std::string& password)
-{
- mWebEngineContext.SetDefaultProxyAuth(username, password);
-}
-
-void WebContext::DeleteAllWebDatabase()
-{
- mWebEngineContext.DeleteAllWebDatabase();
-}
-
-bool WebContext::GetWebDatabaseOrigins(Dali::WebEngineContext::WebEngineSecurityOriginAcquiredCallback callback)
-{
- return mWebEngineContext.GetWebDatabaseOrigins(callback);
-}
-
-bool WebContext::DeleteWebDatabase(Dali::WebEngineSecurityOrigin& origin)
-{
- return mWebEngineContext.DeleteWebDatabase(origin);
-}
-
-bool WebContext::GetWebStorageOrigins(Dali::WebEngineContext::WebEngineSecurityOriginAcquiredCallback callback)
-{
- return mWebEngineContext.GetWebStorageOrigins(callback);
-}
-
-bool WebContext::GetWebStorageUsageForOrigin(Dali::WebEngineSecurityOrigin& origin, Dali::WebEngineContext::WebEngineStorageUsageAcquiredCallback callback)
-{
- return mWebEngineContext.GetWebStorageUsageForOrigin(origin, callback);
-}
-
-void WebContext::DeleteAllWebStorage()
-{
- mWebEngineContext.DeleteAllWebStorage();
-}
-
-bool WebContext::DeleteWebStorage(Dali::WebEngineSecurityOrigin& origin)
-{
- return mWebEngineContext.DeleteWebStorage(origin);
-}
-
-void WebContext::DeleteLocalFileSystem()
-{
- mWebEngineContext.DeleteLocalFileSystem();
-}
-
-void WebContext::ClearCache()
-{
- mWebEngineContext.ClearCache();
-}
-
-bool WebContext::DeleteApplicationCache(Dali::WebEngineSecurityOrigin& origin)
-{
- return mWebEngineContext.DeleteApplicationCache(origin);
-}
-
-void WebContext::GetFormPasswordList(Dali::WebEngineContext::WebEngineFormPasswordAcquiredCallback callback)
-{
- mWebEngineContext.GetFormPasswordList(callback);
-}
-
-void WebContext::RegisterDownloadStartedCallback(Dali::WebEngineContext::WebEngineDownloadStartedCallback callback)
-{
- mWebEngineContext.RegisterDownloadStartedCallback(callback);
-}
-
-void WebContext::RegisterMimeOverriddenCallback(Dali::WebEngineContext::WebEngineMimeOverriddenCallback callback)
-{
- mWebEngineContext.RegisterMimeOverriddenCallback(callback);
-}
-
-void WebContext::RegisterRequestInterceptedCallback(Dali::WebEngineContext::WebEngineRequestInterceptedCallback callback)
-{
- mWebEngineContext.RegisterRequestInterceptedCallback(callback);
-}
-
-void WebContext::EnableCache(bool cacheEnabled)
-{
- mWebEngineContext.EnableCache(cacheEnabled);
-}
-
-bool WebContext::IsCacheEnabled() const
-{
- return mWebEngineContext.IsCacheEnabled();
-}
-
-void WebContext::SetAppId(const std::string& appId)
-{
- mWebEngineContext.SetAppId(appId);
-}
-
-bool WebContext::SetAppVersion(const std::string& appVersion)
-{
- return mWebEngineContext.SetAppVersion(appVersion);
-}
-
-void WebContext::SetApplicationType(const Dali::WebEngineContext::ApplicationType applicationType)
-{
- mWebEngineContext.SetApplicationType(applicationType);
-}
-
-void WebContext::SetTimeOffset(float timeOffset)
-{
- mWebEngineContext.SetTimeOffset(timeOffset);
-}
-
-void WebContext::SetTimeZoneOffset(float timeZoneOffset, float daylightSavingTime)
-{
- mWebEngineContext.SetTimeZoneOffset(timeZoneOffset, daylightSavingTime);
-}
-
-void WebContext::SetDefaultZoomFactor(float zoomFactor)
-{
- mWebEngineContext.SetDefaultZoomFactor(zoomFactor);
-}
-
-float WebContext::GetDefaultZoomFactor() const
-{
- return mWebEngineContext.GetDefaultZoomFactor();
-}
-
-void WebContext::RegisterUrlSchemesAsCorsEnabled(const std::vector<std::string>& schemes)
-{
- mWebEngineContext.RegisterUrlSchemesAsCorsEnabled(schemes);
-}
-
-void WebContext::RegisterJsPluginMimeTypes(const std::vector<std::string>& mimeTypes)
-{
- mWebEngineContext.RegisterJsPluginMimeTypes(mimeTypes);
-}
-
-bool WebContext::DeleteAllApplicationCache()
-{
- return mWebEngineContext.DeleteAllApplicationCache();
-}
-
-bool WebContext::DeleteAllWebIndexedDatabase()
-{
- return mWebEngineContext.DeleteAllWebIndexedDatabase();
-}
-
-void WebContext::DeleteFormPasswordDataList(const std::vector<std::string>& list)
-{
- mWebEngineContext.DeleteFormPasswordDataList(list);
-}
-
-void WebContext::DeleteAllFormPasswordData()
-{
- mWebEngineContext.DeleteAllFormPasswordData();
-}
-
-void WebContext::DeleteAllFormCandidateData()
-{
- mWebEngineContext.DeleteAllFormCandidateData();
-}
-
-bool WebContext::FreeUnusedMemory()
-{
- return mWebEngineContext.FreeUnusedMemory();
-}
-
-} // namespace Toolkit
-} // namespace Dali
+++ /dev/null
-#ifndef DALI_TOOLKIT_WEB_CONTEXT_H
-#define DALI_TOOLKIT_WEB_CONTEXT_H
-
-/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/web-engine/web-engine-context.h>
-#include <string>
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/dali-toolkit-common.h>
-
-namespace Dali
-{
-class WebEngineSecurityOrigin;
-
-namespace Toolkit
-{
-/**
- * @addtogroup dali_toolkit_controls_web_view
- * @{
- */
-
-/**
- * @brief WebContext is a control for context of WebView.
- *
- * For working WebContext, a WebEngineContext should be provided.
- *
- */
-class DALI_TOOLKIT_API WebContext
-{
-public:
- /**
- * @brief Create a WebContext.
- *
- * @param[in] context The context of web engine.
- */
- WebContext(Dali::WebEngineContext& context);
-
- /**
- * @brief Destructor.
- */
- virtual ~WebContext() final;
-
- /**
- * @brief Return the cache model type.
- *
- * @return #Dali::WebEngineContext::CacheModel
- */
- Dali::WebEngineContext::CacheModel GetCacheModel() const;
-
- /**
- * @brief Request to set the cache model.
- *
- * @param[in] cacheModel The cache model
- */
- void SetCacheModel(Dali::WebEngineContext::CacheModel cacheModel);
-
- /**
- * @brief Set the given proxy URI to network backend of specific context.
- *
- * @param[in] uri The proxy URI to set
- */
- void SetProxyUri(const std::string& uri);
-
- /**
- * @brief Get the proxy URI from the network backend of specific context.
- *
- * @return current proxy URI or null string if it's not set
- */
- std::string GetProxyUri() const;
-
- /**
- * @brief Set the given proxy to network backend of specific context.
- *
- * @param[in] proxy URI to set
- * @param[in] bypass rule to set
- */
- void SetProxyBypassRule(const std::string& proxy, const std::string& bypass);
-
- /**
- * @brief Get the proxy bypass rule from the network backend of specific context.
- *
- * @return current proxy bypass rule or null string if it's not set
- */
- std::string GetProxyBypassRule() const;
-
- /**
- * @brief Add CA certificates to persistent NSS certificate database
- *
- * Function accepts a path to a CA certificate file, a path to a directory
- * containing CA certificate files, or a colon-seprarated list of those.
- * Certificate files should have *.crt extension.
- * Directories are traversed recursively.
- *
- * @param[in] certificatePath path to a CA certificate file(s), see above for details
- */
- void SetCertificateFilePath(const std::string& certificatePath);
-
- /**
- * @brief Get CA certifcate file path
- *
- * It returns an internal string and should not be modified.
- *
- * @return certificate_file path which is set during ewk_context_certificate_file_set or null string otherwise
- */
- std::string GetCertificateFilePath() const;
-
- /**
- * @brief Set a proxy auth credential to network backend of specific context.
- *
- * @param[in] username username to set
- * @param[in] password password to set
- */
- void SetDefaultProxyAuth(const std::string& username, const std::string& password);
-
- /**
- * @brief Requests for deleting all web databases.
- */
- void DeleteAllWebDatabase();
-
- /**
- * @brief Request for getting web database origins.
- *
- * @param[in] callback callback called after getting web database origins
- *
- * @return true if succeeded, false otherwise
- */
- bool GetWebDatabaseOrigins(Dali::WebEngineContext::WebEngineSecurityOriginAcquiredCallback callback);
-
- /**
- * @brief Request for deleting web databases for origin.
- *
- * @param[in] origin database origin
- *
- * @return true if succeeded, false otherwise
- */
- bool DeleteWebDatabase(Dali::WebEngineSecurityOrigin& origin);
-
- /**
- * @brief Gets list of origins that is stored in web storage db.
- *
- * @param[in] callback callback called after getting web storage origins
- *
- * @return true if succeeded, false otherwise
- */
- bool GetWebStorageOrigins(Dali::WebEngineContext::WebEngineSecurityOriginAcquiredCallback callback);
-
- /**
- * @brief Get list of origins that is stored in web storage db.
- *
- * @param[in] origin storage origin
- * @param[in] callback callback called after getting web storage origins
- *
- * @return true if succeeded, false otherwise
- */
- bool GetWebStorageUsageForOrigin(Dali::WebEngineSecurityOrigin& origin, Dali::WebEngineContext::WebEngineStorageUsageAcquiredCallback callback);
-
- /**
- * @brief Delete all web storage.
- *
- * @details This function does not ensure that all data will be removed.
- * Should be used to extend free physical memory.
- */
- void DeleteAllWebStorage();
-
- /**
- * @brief Delete web storage db.
- *
- * @param[in] origin origin of db
- *
- * @return true if succeeded, false otherwise
- */
- bool DeleteWebStorage(Dali::WebEngineSecurityOrigin& origin);
-
- /**
- * @brief Request for deleting all local file systems.
- */
- void DeleteLocalFileSystem();
-
- /**
- * @brief Requests to clear cache
- */
- void ClearCache();
-
- /**
- * @brief Request for deleting web application cache for origin.
- *
- * @param[in] origin application cache origin
- *
- * @return true if succeeded, false otherwise
- */
- bool DeleteApplicationCache(Dali::WebEngineSecurityOrigin& origin);
-
- /**
- * @brief Asynchronous request to get list of all password data.
- *
- * @param[in] callback callback called after getting form password
- */
- void GetFormPasswordList(Dali::WebEngineContext::WebEngineFormPasswordAcquiredCallback callback);
-
- /**
- * @brief Register callback for download started.
- *
- * @param[in] callback callback for download started
- */
- void RegisterDownloadStartedCallback(Dali::WebEngineContext::WebEngineDownloadStartedCallback callback);
-
- /**
- * @brief Register callback for mime overridden.
- *
- * @param[in] callback callback for mime overridden
- */
- void RegisterMimeOverriddenCallback(Dali::WebEngineContext::WebEngineMimeOverriddenCallback callback);
-
- /**
- * @brief Callback to be called when http request need be intercepted.
- *
- * @param[in] callback
- */
- void RegisterRequestInterceptedCallback(Dali::WebEngineContext::WebEngineRequestInterceptedCallback callback);
-
- /**
- * @brief Toggle the cache to be enabled or disabled
- *
- * @param[in] cacheEnabled enable or disable cache
- */
- void EnableCache(bool cacheEnabled);
-
- /**
- * @brief Query if the cache is enabled
- *
- * @return true is cache is enabled or false otherwise
- */
- bool IsCacheEnabled() const;
-
- /**
- * @brief Set application id for context.
- *
- * @param[in] appId application id
- */
- void SetAppId(const std::string& appId);
-
- /**
- * @brief Set application version for context.
- *
- * @param[in] appVersion application version
- *
- * @return true if successful, false otherwise
- */
- bool SetAppVersion(const std::string& appVersion);
-
- /**
- * @brief To declare application type
- *
- * @param[in] applicationType The Application_Type enum
- *
- */
- void SetApplicationType(const Dali::WebEngineContext::ApplicationType applicationType);
-
- /**
- * @brief Set time offset
- *
- * @param[in] timeOffset The value will be added to system time as offset
- */
- void SetTimeOffset(float timeOffset);
-
- /**
- * @brief Set timezone offset
- *
- * @param[in] timeZoneOffset offset for time zone.
- * @param[in] daylightSavingTime The value is for daylight saving time use.
- */
- void SetTimeZoneOffset(float timeZoneOffset, float daylightSavingTime);
-
- /**
- * @brief Set default zoom factor
- *
- * @param[in] zoomFactor default zoom factor
- */
- void SetDefaultZoomFactor(float zoomFactor);
-
- /**
- * @brief Get default zoom factor
- *
- * Gets default zoom factor for all pages opened with this context.
- *
- * @return default zoom factor or negative value on error
- */
- float GetDefaultZoomFactor() const;
-
- /**
- * @brief Register url schemes as CORS enabled
- *
- * @param[in] schemes The URL schemes list which will be added to web security policy
- *
- */
- void RegisterUrlSchemesAsCorsEnabled(const std::vector<std::string>& schemes);
-
- /**
- * @brief Register JS plugin mime types.
- *
- * @param[in] mimeTypes The MIME types will be checked by the renderer frame loader
- * to skip creating default frame for the object tags with the registered MIME type.
- */
- void RegisterJsPluginMimeTypes(const std::vector<std::string>& mimeTypes);
-
- /**
- * @brief Request for deleting all web application caches.
- *
- * @return @c true on success, otherwise @c false
- */
- bool DeleteAllApplicationCache();
-
- /**
- * @brief Request for deleting all web indexed databases.
- *
- * @return @c true on success, otherwise @c false
- */
- bool DeleteAllWebIndexedDatabase();
-
- /**
- * @brief Delete a given password data list
- *
- * @param[in] list List with Ewk_Password_Data
- */
- void DeleteFormPasswordDataList(const std::vector<std::string>& list);
-
- /**
- * @brief Delete whole password data from DB
- */
- void DeleteAllFormPasswordData();
-
- /**
- * @brief Delete all candidate form data from DB
- */
- void DeleteAllFormCandidateData();
-
- /**
- * @brief Notify low memory to free unused memory.
- *
- * @return @c true on success or @c false otherwise.
- */
- bool FreeUnusedMemory();
-
-private:
- Dali::WebEngineContext& mWebEngineContext;
-};
-
-/**
- * @}
- */
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // DALI_TOOLKIT_WEB_CONTEXT_H
+++ /dev/null
-/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali-toolkit/devel-api/controls/web-view/web-cookie-manager.h>
-
-namespace Dali
-{
-namespace Toolkit
-{
-WebCookieManager::WebCookieManager(Dali::WebEngineCookieManager& manager)
-: mWebEngineCookieManager(manager)
-{
-}
-
-WebCookieManager::~WebCookieManager()
-{
-}
-
-void WebCookieManager::SetCookieAcceptPolicy(Dali::WebEngineCookieManager::CookieAcceptPolicy cookieAcceptPolicy)
-{
- mWebEngineCookieManager.SetCookieAcceptPolicy(cookieAcceptPolicy);
-}
-
-Dali::WebEngineCookieManager::CookieAcceptPolicy WebCookieManager::GetCookieAcceptPolicy() const
-{
- return mWebEngineCookieManager.GetCookieAcceptPolicy();
-}
-
-void WebCookieManager::ClearCookies()
-{
- mWebEngineCookieManager.ClearCookies();
-}
-
-void WebCookieManager::SetPersistentStorage(const std::string& path, Dali::WebEngineCookieManager::CookiePersistentStorage storage)
-{
- mWebEngineCookieManager.SetPersistentStorage(path, storage);
-}
-
-void WebCookieManager::ChangesWatch(Dali::WebEngineCookieManager::WebEngineCookieManagerChangesWatchCallback callback)
-{
- mWebEngineCookieManager.ChangesWatch(callback);
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
+++ /dev/null
-#ifndef DALI_TOOLKIT_WEB_COOKIE_MANAGER_H
-#define DALI_TOOLKIT_WEB_COOKIE_MANAGER_H
-
-/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/web-engine/web-engine-cookie-manager.h>
-#include <string>
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/dali-toolkit-common.h>
-
-namespace Dali
-{
-class WebEngineCookieManager;
-
-namespace Toolkit
-{
-/**
- * @addtogroup dali_toolkit_controls_web_view
- * @{
- */
-
-/**
- * @brief WebCookieManager is a control for cookie manager of WebView.
- *
- *
- * For working WebCookieManager, a WebView should be provided.
- *
- */
-class DALI_TOOLKIT_API WebCookieManager
-{
-public:
- /**
- * @brief Creates a WebCookieManager.
- * @param[in] manager A #Dali::WebEngineCookieManager
- */
- WebCookieManager(Dali::WebEngineCookieManager& manager);
-
- /**
- * @brief Destructor.
- */
- virtual ~WebCookieManager() final;
-
- /**
- * @brief Sets @a policy as the cookie acceptance policy for @a manager.
- *
- * @details By default, only cookies set by the main document loaded are
- * accepted.
- *
- * @param[in] policy A #Dali::WebEngineCookieManager::CookieAcceptPolicy
- */
- void SetCookieAcceptPolicy(Dali::WebEngineCookieManager::CookieAcceptPolicy policy);
-
- /**
- * @brief Gets the cookie acceptance policy. The default is Toolkit::WebCookieManager::CookieAcceptPolicy::NO_THIRD_PARTY.
- * @see Dali::WebEngineCookieManager::CookieAcceptPolicy
- */
- Dali::WebEngineCookieManager::CookieAcceptPolicy GetCookieAcceptPolicy() const;
-
- /**
- * @brief Deletes all the cookies of @a manager.
- */
- void ClearCookies();
-
- /**
- * @brief Sets the @a path where non-session cookies are stored persistently using
- * @a storage as the format to read/write the cookies.
- *
- * @details Cookies are initially read from @a path/Cookies to create an initial
- * set of cookies. Then, non-session cookies will be written to @a path/Cookies.
- * By default, @a manager doesn't store the cookies persistently, so you need to
- * call this method to keep cookies saved across sessions.
- * If @a path does not exist it will be created.
- *
- * @param[in] path The path where to read/write Cookies
- * @param[in] storage The type of storage
- */
- void SetPersistentStorage(const std::string& path, Dali::WebEngineCookieManager::CookiePersistentStorage storage);
-
- /**
- * @brief Watch for cookies' changes in @a manager.
- *
- * @param[in] callback cookies are added, removed or modified.
- */
- void ChangesWatch(Dali::WebEngineCookieManager::WebEngineCookieManagerChangesWatchCallback callback);
-
-private:
- Dali::WebEngineCookieManager& mWebEngineCookieManager;
-};
-
-/**
- * @}
- */
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // DALI_TOOLKIT_WEB_COOKIE_MANAGER_H
return Internal::WebView::New(argc, argv);
}
-WebView WebView::DownCast(BaseHandle handle)
+Dali::WebEngineContext* WebView::GetContext()
{
- return Control::DownCast<WebView, Internal::WebView>(handle);
+ return Internal::WebView::GetContext();
}
-Dali::Toolkit::WebSettings* WebView::GetSettings() const
+Dali::WebEngineCookieManager* WebView::GetCookieManager()
{
- return Dali::Toolkit::GetImpl(*this).GetSettings();
+ return Internal::WebView::GetCookieManager();
}
-Dali::Toolkit::WebContext* WebView::GetContext() const
+WebView WebView::DownCast(BaseHandle handle)
{
- return Dali::Toolkit::GetImpl(*this).GetContext();
+ return Control::DownCast<WebView, Internal::WebView>(handle);
}
-Dali::Toolkit::WebCookieManager* WebView::GetCookieManager() const
+Dali::Toolkit::WebSettings* WebView::GetSettings() const
{
- return Dali::Toolkit::GetImpl(*this).GetCookieManager();
+ return Dali::Toolkit::GetImpl(*this).GetSettings();
}
Dali::Toolkit::WebBackForwardList* WebView::GetBackForwardList() const
static WebView New(uint32_t argc, char** argv);
/**
+ * @brief Get context of web engine.
+ */
+ static Dali::WebEngineContext* GetContext();
+
+ /**
+ * @brief Get cookie manager of web engine.
+ */
+ static Dali::WebEngineCookieManager* GetCookieManager();
+
+ /**
* @brief Create an uninitialized WebView.
*/
WebView();
Dali::Toolkit::WebSettings* GetSettings() const;
/**
- * @brief Get WebContext of WebEngine.
- */
- Dali::Toolkit::WebContext* GetContext() const;
-
- /**
- * @brief Get CookieManager of WebEngine.
- */
- Dali::Toolkit::WebCookieManager* GetCookieManager() const;
-
- /**
* @brief Get WebBackForwardList of WebEngine.
*/
Dali::Toolkit::WebBackForwardList* GetBackForwardList() const;
${devel_api_src_dir}/controls/tool-bar/tool-bar.cpp
${devel_api_src_dir}/controls/video-view/video-view-devel.cpp
${devel_api_src_dir}/controls/web-view/web-back-forward-list.cpp
- ${devel_api_src_dir}/controls/web-view/web-context.cpp
- ${devel_api_src_dir}/controls/web-view/web-cookie-manager.cpp
${devel_api_src_dir}/controls/web-view/web-settings.cpp
${devel_api_src_dir}/controls/web-view/web-view.cpp
${devel_api_src_dir}/focus-manager/keyinput-focus-manager.cpp
SET( devel_api_web_view_header_files
${devel_api_src_dir}/controls/web-view/web-back-forward-list.h
- ${devel_api_src_dir}/controls/web-view/web-context.h
- ${devel_api_src_dir}/controls/web-view/web-cookie-manager.h
${devel_api_src_dir}/controls/web-view/web-settings.h
${devel_api_src_dir}/controls/web-view/web-view.h
)
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali-toolkit/devel-api/controls/web-view/web-back-forward-list.h>
-#include <dali-toolkit/devel-api/controls/web-view/web-context.h>
-#include <dali-toolkit/devel-api/controls/web-view/web-cookie-manager.h>
#include <dali-toolkit/devel-api/controls/web-view/web-settings.h>
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
#include <dali-toolkit/public-api/image-loader/image.h>
return handle;
}
+Dali::WebEngineContext* WebView::GetContext()
+{
+ return Dali::WebEngine::GetContext();
+}
+
+Dali::WebEngineCookieManager* WebView::GetCookieManager()
+{
+ return Dali::WebEngine::GetCookieManager();
+}
+
void WebView::OnInitialize()
{
Actor self = Self();
if(mWebEngine)
{
mWebEngine.FrameRenderedSignal().Connect(this, &WebView::OnFrameRendered);
- mWebContext = std::unique_ptr<Dali::Toolkit::WebContext>(new WebContext(mWebEngine.GetContext()));
- mWebCookieManager = std::unique_ptr<Dali::Toolkit::WebCookieManager>(new WebCookieManager(mWebEngine.GetCookieManager()));
mWebSettings = std::unique_ptr<Dali::Toolkit::WebSettings>(new WebSettings(mWebEngine.GetSettings()));
mWebBackForwardList = std::unique_ptr<Dali::Toolkit::WebBackForwardList>(new WebBackForwardList(mWebEngine.GetBackForwardList()));
}
return mWebSettings.get();
}
-Dali::Toolkit::WebContext* WebView::GetContext() const
-{
- return mWebContext.get();
-}
-
-Dali::Toolkit::WebCookieManager* WebView::GetCookieManager() const
-{
- return mWebCookieManager.get();
-}
-
Dali::Toolkit::WebBackForwardList* WebView::GetBackForwardList() const
{
return mWebBackForwardList.get();
class KeyEvent;
class TouchEvent;
class WebBackForwardList;
-class WebContext;
-class WebCookieManager;
class WebSettings;
class WebView;
static Toolkit::WebView New(uint32_t argc, char** argv);
/**
- * @copydoc Dali::Toolkit::WebView::GetSettings()
+ * @copydoc Dali::Toolkit::WebView::GetContext()
*/
- Dali::Toolkit::WebSettings* GetSettings() const;
+ static Dali::WebEngineContext* GetContext();
/**
- * @copydoc Dali::Toolkit::WebView::GetContext()
+ * @copydoc Dali::Toolkit::WebView::GetCookieManager()
*/
- Dali::Toolkit::WebContext* GetContext() const;
+ static Dali::WebEngineCookieManager* GetCookieManager();
/**
- * @copydoc Dali::Toolkit::WebView::GetCookieManager()
+ * @copydoc Dali::Toolkit::WebView::GetSettings()
*/
- Dali::Toolkit::WebCookieManager* GetCookieManager() const;
+ Dali::Toolkit::WebSettings* GetSettings() const;
/**
* @copydoc Dali::Toolkit::WebView::GetBackForwardList()
Dali::Size mWebViewSize;
Dali::WebEngine mWebEngine;
- std::unique_ptr<Dali::Toolkit::WebContext> mWebContext;
- std::unique_ptr<Dali::Toolkit::WebCookieManager> mWebCookieManager;
std::unique_ptr<Dali::Toolkit::WebSettings> mWebSettings;
std::unique_ptr<Dali::Toolkit::WebBackForwardList> mWebBackForwardList;