WebEngine WebEngine::New()
{
- Internal::Adaptor::WebEnginePtr engine = Internal::Adaptor::WebEngine::New();
+ Internal::Adaptor::WebEnginePtr engine = Internal::Adaptor::WebEngine::New(-1);
+
+ return WebEngine(engine.Get());
+}
+
+WebEngine WebEngine::New(int32_t type)
+{
+ Internal::Adaptor::WebEnginePtr engine = Internal::Adaptor::WebEngine::New(type);
return WebEngine(engine.Get());
}
static WebEngine New();
/**
+ * @brief Create a new instance of a WebEngine with type (0: Chromium, 1: LWE, otherwise: depend on system environment).
+ * @param[in] type The WebEngine type (0: Chromium, 1: LWE, otherwise: depend on system environment).
+ */
+ static WebEngine New(int type);
+
+ /**
* @brief Get context of WebEngine.
*/
static Dali::WebEngineContext* GetContext();
{
namespace // unnamed namespace
{
+static constexpr int32_t USE_ENVIRONMENT_VALUE = -1;
+static constexpr int32_t USE_CHROMIUM_WEB_ENGINE = 0;
+static constexpr int32_t USE_LIGHT_WEIGHT_WEB_ENGINE = 1;
+static constexpr int32_t DEFAULT_WEB_ENGINE_PLUGIN_TYPE = USE_ENVIRONMENT_VALUE;
+static int32_t webEnginePluginType = DEFAULT_WEB_ENGINE_PLUGIN_TYPE;
+
constexpr char const* const kPluginFullNamePrefix = "libdali2-web-engine-";
constexpr char const* const kPluginFullNamePostfix = "-plugin.so";
constexpr char const* const kPluginFullNameDefault = "libdali2-web-engine-plugin.so";
+constexpr char const* const kPluginFullNameChromium = "libdali2-web-engine-chromium-plugin.so";
+constexpr char const* const kPluginFullNameLwe = "libdali2-web-engine-lwe-plugin.so";
std::string MakePluginName(const char* environmentName)
{
mGetWebEngineCookieManagerPtr{nullptr}
{
std::string pluginName;
- const char* name = EnvironmentVariable::GetEnvironmentVariable(DALI_ENV_WEB_ENGINE_NAME);
- if(name)
+
+ if(webEnginePluginType == USE_CHROMIUM_WEB_ENGINE)
+ {
+ pluginName = kPluginFullNameChromium;
+ }
+ else if(webEnginePluginType == USE_LIGHT_WEIGHT_WEB_ENGINE)
{
- pluginName = MakePluginName(name);
+ pluginName = kPluginFullNameLwe;
}
else
{
- pluginName = std::string(kPluginFullNameDefault);
+ const char* name = EnvironmentVariable::GetEnvironmentVariable(DALI_ENV_WEB_ENGINE_NAME);
+ if(name)
+ {
+ pluginName = MakePluginName(name);
+ }
+ else
+ {
+ pluginName = std::string(kPluginFullNameDefault);
+ }
}
mHandle = dlopen(pluginName.c_str(), RTLD_LAZY);
} // unnamed namespace
-WebEnginePtr WebEngine::New()
+WebEnginePtr WebEngine::New(int32_t type)
{
- WebEngine* instance = new WebEngine();
+ WebEngine* instance = new WebEngine(type);
if(!instance->Initialize())
{
delete instance;
return nullptr;
}
-WebEngine::WebEngine()
+WebEngine::WebEngine(int32_t type)
: mPlugin(nullptr)
{
+ webEnginePluginType = type;
}
WebEngine::~WebEngine()
{
public:
/**
- * @brief Create a new WebEngine handle
- *
+ * @brief Create a new WebEngine handle with type (0: Chromium, 1: LWE, otherwise: depend on system environment).
+ * @param[in] type The WebEngine type (0: Chromium, 1: LWE, otherwise: depend on system environment).
* @return WebEngine pointer
*/
- static WebEnginePtr New();
+ static WebEnginePtr New(int32_t type);
/**
* @brief Get context of web engine
private:
/**
- * @brief Constructor.
+ * @brief Constructor with WebEngine type (0: Chromium, 1: LWE, otherwise: depend on system environment).
*/
- WebEngine();
+ WebEngine(int32_t type);
/**
* @brief Destructor.