/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
*/
explicit operator bool() const
{
- return mLoadSuccess;
+ return mLoadSucceeded;
}
bool InitializeContextHandle()
if(!mGetWebEngineContextPtr)
{
mGetWebEngineContextPtr = reinterpret_cast<GetWebEngineContext>(dlsym(mHandle, "GetWebEngineContext"));
-
if(!mGetWebEngineContextPtr)
{
DALI_LOG_ERROR("Can't load symbol GetWebEngineContext(), error: %s\n", dlerror());
if(!mGetWebEngineCookieManagerPtr)
{
mGetWebEngineCookieManagerPtr = reinterpret_cast<GetWebEngineCookieManager>(dlsym(mHandle, "GetWebEngineCookieManager"));
-
if(!mGetWebEngineCookieManagerPtr)
{
DALI_LOG_ERROR("Can't load symbol GetWebEngineCookieManager(), error: %s\n", dlerror());
private:
// Private constructor / destructor
WebEnginePluginObject()
- : mPluginName{},
- mLoadSuccess{false},
+ : mLoadSucceeded{false},
mHandle{nullptr},
mCreateWebEnginePtr{nullptr},
mDestroyWebEnginePtr{nullptr},
mGetWebEngineContextPtr{nullptr},
mGetWebEngineCookieManagerPtr{nullptr}
{
- if(mPluginName.length() == 0)
+ std::string pluginName;
+ const char* name = EnvironmentVariable::GetEnvironmentVariable(DALI_ENV_WEB_ENGINE_NAME);
+ if(name)
{
- // mPluginName is not initialized yet.
- const char* name = EnvironmentVariable::GetEnvironmentVariable(DALI_ENV_WEB_ENGINE_NAME);
- if(name)
- {
- mPluginName = MakePluginName(name);
- }
- else
- {
- mPluginName = std::string(kPluginFullNameDefault);
- }
+ pluginName = MakePluginName(name);
+ }
+ else
+ {
+ pluginName = std::string(kPluginFullNameDefault);
}
- mHandle = dlopen(mPluginName.c_str(), RTLD_LAZY);
+ mHandle = dlopen(pluginName.c_str(), RTLD_LAZY);
if(!mHandle)
{
- DALI_LOG_ERROR("Can't load %s : %s\n", mPluginName.c_str(), dlerror());
+ DALI_LOG_ERROR("Can't load %s : %s\n", pluginName.c_str(), dlerror());
return;
}
return;
}
- mLoadSuccess = true;
+ mLoadSucceeded = true;
}
~WebEnginePluginObject()
if(mHandle)
{
dlclose(mHandle);
- mHandle = nullptr;
- mLoadSuccess = false;
+ mHandle = nullptr;
+ mLoadSucceeded = false;
}
}
WebEnginePluginObject& operator=(WebEnginePluginObject&&) = delete;
private:
- std::string mPluginName; ///< Name of web engine plugin
- /// Note: Dali WebView policy does not allow to use multiple web engines in an application.
- /// So once pluginName is set to non-empty string, it will not change.
-
- bool mLoadSuccess; ///< True if library loaded successfully. False otherwise.
+ bool mLoadSucceeded; ///< True if library loaded successfully. False otherwise.
public:
using CreateWebEngineFunction = Dali::WebEnginePlugin* (*)();
return mPlugin->LoadHtmlStringOverrideCurrentEntry(html, basicUri, unreachableUrl);
}
-bool WebEngine::LoadContents(const std::string& contents, uint32_t contentSize, const std::string& mimeType, const std::string& encoding, const std::string& baseUri)
+bool WebEngine::LoadContents(const int8_t* contents, uint32_t contentSize, const std::string& mimeType, const std::string& encoding, const std::string& baseUri)
{
return mPlugin->LoadContents(contents, contentSize, mimeType, encoding, baseUri);
}
return mPlugin->SendWheelEvent(event);
}
-Dali::WebEnginePlugin::WebEngineFrameRenderedSignalType& WebEngine::FrameRenderedSignal()
+void WebEngine::RegisterFrameRenderedCallback(Dali::WebEnginePlugin::WebEngineFrameRenderedCallback callback)
{
- return mPlugin->FrameRenderedSignal();
+ mPlugin->RegisterFrameRenderedCallback(callback);
}
void WebEngine::RegisterPageLoadStartedCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback)
mPlugin->RegisterNavigationPolicyDecidedCallback(callback);
}
+void WebEngine::RegisterNewWindowCreatedCallback(Dali::WebEnginePlugin::WebEngineNewWindowCreatedCallback callback)
+{
+ mPlugin->RegisterNewWindowCreatedCallback(callback);
+}
+
void WebEngine::RegisterCertificateConfirmedCallback(Dali::WebEnginePlugin::WebEngineCertificateCallback callback)
{
mPlugin->RegisterCertificateConfirmedCallback(callback);