Merge "Fix svace issue" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / controls / web-view / web-context.h
old mode 100644 (file)
new mode 100755 (executable)
index ead4efd..ebdbae0
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_WEB_CONTEXT_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.
@@ -19,7 +19,7 @@
  */
 
 // EXTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/web-engine-context.h>
+#include <dali/devel-api/adaptor-framework/web-engine/web-engine-context.h>
 #include <string>
 
 // INTERNAL INCLUDES
@@ -27,6 +27,8 @@
 
 namespace Dali
 {
+class WebEngineSecurityOrigin;
+
 namespace Toolkit
 {
 /**
@@ -35,16 +37,16 @@ namespace Toolkit
  */
 
 /**
- * @brief WebContext is a control for settings of WebView.
+ * @brief WebContext is a control for context of WebView.
  *
- * For working WebContext, a WebView should be provided.
+ * For working WebContext, a WebEngineContext should be provided.
  *
  */
 class DALI_TOOLKIT_API WebContext
 {
 public:
   /**
-   * @brief Creates a WebContext.
+   * @brief Create a WebContext.
    *
    * @param[in] context The context of web engine.
    */
@@ -56,28 +58,50 @@ public:
   virtual ~WebContext() final;
 
   /**
-   * @brief Returns the cache model type.
+   * @brief Return the cache model type.
    *
    * @return #Dali::WebEngineContext::CacheModel
    */
   Dali::WebEngineContext::CacheModel GetCacheModel() const;
 
   /**
-   * @brief Requests to set the cache model.
+   * @brief Request to set the cache model.
    *
    * @param[in] cacheModel The cache model
    */
   void SetCacheModel(Dali::WebEngineContext::CacheModel cacheModel);
 
   /**
-   * @brief Sets the given proxy URI to network backend of specific context.
+   * @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);
 
   /**
-   * Adds CA certificates to persistent NSS certificate database
+   * @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.
@@ -89,17 +113,16 @@ public:
   void SetCertificateFilePath(const std::string& certificatePath);
 
   /**
-   * Toggles the cache to be enabled or disabled
+   * @brief Get CA certifcate file path
    *
-   * Function works asynchronously.
-   * By default the cache is disabled resulting in not storing network data on disk.
+   * It returns an internal string and should not be modified.
    *
-   * @param[in] cacheDisabled enable or disable cache
+   * @return certificate_file path which is set during ewk_context_certificate_file_set or null string otherwise
    */
-  void DisableCache(bool cacheDisabled);
+  std::string GetCertificateFilePath() const;
 
   /**
-   * @brief Sets a proxy auth credential to network backend of specific context.
+   * @brief Set a proxy auth credential to network backend of specific context.
    *
    * @param[in] username username to set
    * @param[in] password password to set
@@ -107,20 +130,66 @@ public:
   void SetDefaultProxyAuth(const std::string& username, const std::string& password);
 
   /**
-   * Requests for deleting all web databases.
+   * @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
    */
-  void DeleteWebDatabase();
+  bool GetWebStorageUsageForOrigin(Dali::WebEngineSecurityOrigin& origin, Dali::WebEngineContext::WebEngineStorageUsageAcquiredCallback callback);
 
   /**
-   * @brief Deletes web storage.
+   * @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 DeleteWebStorage();
+  void DeleteAllWebStorage();
 
   /**
-   * @brief Requests for deleting all local file systems.
+   * @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();
 
@@ -129,6 +198,166 @@ public:
    */
   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;
 };