Revert "Revert "[Tizen] Revert "[Web] Fix WebView terminate crash"""
[platform/core/uifw/dali-adaptor.git] / dali / internal / web-engine / common / web-engine-impl.h
index 0423b6b..085c28a 100755 (executable)
@@ -2,7 +2,7 @@
 #define DALI_WEB_ENGINE_IMPL_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * 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.
@@ -23,8 +23,8 @@
 
 // INTERNAL INCLUDES
 #include <dali/devel-api/adaptor-framework/accessibility.h>
-#include <dali/devel-api/adaptor-framework/web-engine-plugin.h>
-#include <dali/devel-api/adaptor-framework/web-engine.h>
+#include <dali/devel-api/adaptor-framework/web-engine/web-engine-plugin.h>
+#include <dali/devel-api/adaptor-framework/web-engine/web-engine.h>
 
 namespace Dali
 {
@@ -56,6 +56,18 @@ public:
   static WebEnginePtr New();
 
   /**
+   * @brief Get context of web engine
+   *
+   */
+  static Dali::WebEngineContext* GetContext();
+
+  /**
+   * @brief Get cookie manager of web engine
+   *
+   */
+  static Dali::WebEngineCookieManager* GetCookieManager();
+
+  /**
    * @copydoc Dali::WebEngine::Create()
    */
   void Create(uint32_t width, uint32_t height, const std::string& locale, const std::string& timezoneId);
@@ -71,6 +83,11 @@ public:
   void Destroy();
 
   /**
+   * @copydoc Dali::WebEngine::GetPlugin()
+   */
+  Dali::WebEnginePlugin* GetPlugin() const;
+
+  /**
    * @copydoc Dali::WebEngine::GetNativeImageSource()
    */
   Dali::NativeImageSourcePtr GetNativeImageSource();
@@ -81,16 +98,6 @@ public:
   Dali::WebEngineSettings& GetSettings() const;
 
   /**
-   * @copydoc Dali::WebEngine::GetContext()
-   */
-  Dali::WebEngineContext& GetContext() const;
-
-  /**
-   * @copydoc Dali::WebEngine::GetCookieManager()
-   */
-  Dali::WebEngineCookieManager& GetCookieManager() const;
-
-  /**
    * @copydoc Dali::WebEngine::GetBackForwardList()
    */
   Dali::WebEngineBackForwardList& GetBackForwardList() const;
@@ -574,16 +581,22 @@ private:
    *
    * @return Whether the initialization succeed or not.
    */
-  bool InitializePluginHandle();
+  static bool InitializePluginHandle();
+
+  /**
+   * @brief Close library handle.
+   */
+  static void ClosePluginHandle();
 
 private:
-  typedef Dali::WebEnginePlugin* (*CreateWebEngineFunction)();
-  typedef void (*DestroyWebEngineFunction)(Dali::WebEnginePlugin* plugin);
+  using CreateWebEngineFunction  = Dali::WebEnginePlugin* (*)();
+  using DestroyWebEngineFunction = void (*)(Dali::WebEnginePlugin* plugin);
+
+  Dali::WebEnginePlugin* mPlugin; ///< WebEnginePlugin instance
 
-  Dali::WebEnginePlugin*   mPlugin;              ///< WebEnginePlugin instance
-  void*                    mHandle;              ///< Handle for the loaded library
-  CreateWebEngineFunction  mCreateWebEnginePtr;  ///< Function to create plugin instance
-  DestroyWebEngineFunction mDestroyWebEnginePtr; ///< Function to destroy plugin instance
+  static void*                    mHandle;              ///< Handle for the loaded library
+  static CreateWebEngineFunction  mCreateWebEnginePtr;  ///< Function to create plugin instance
+  static DestroyWebEngineFunction mDestroyWebEnginePtr; ///< Function to destroy plugin instance
 };
 
 } // namespace Adaptor