22a5b67afbf98cec11b31b268f1eaa45566036df
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / web-engine-context.h
1 #ifndef DALI_WEB_ENGINE_CONTEXT_H
2 #define DALI_WEB_ENGINE_CONTEXT_H
3
4 /*
5  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <string>
23
24 namespace Dali
25 {
26 /**
27  * @brief A class WebEngineContext for context of web engine.
28  */
29 class WebEngineContext
30 {
31 public:
32   /**
33    * @brief Enumeration for cache model options.
34    */
35   enum class CacheModel
36   {
37     DOCUMENT_VIEWER,     ///< Use the smallest cache capacity.
38     DOCUMENT_BROWSER,    ///< Use the bigger cache capacity than DocumentBrowser.
39     PRIMARY_WEB_BROWSER, ///< Use the biggest cache capacity.
40   };
41
42   /**
43    * @brief Constructor.
44    */
45   WebEngineContext() = default;
46
47   /**
48    * @brief Destructor.
49    */
50   virtual ~WebEngineContext() = default;
51
52   /**
53    * @brief Returns the cache model type.
54    * @return #CacheModel
55    */
56   virtual CacheModel GetCacheModel() const = 0;
57
58   /**
59    * @brief Requests to set the cache model.
60    * @param[in] cacheModel The cache model
61    */
62   virtual void SetCacheModel(CacheModel cacheModel) = 0;
63
64   /**
65    * @brief Sets the given proxy URI to network backend of specific context.
66    * @param[in] uri The proxy URI to set
67    */
68   virtual void SetProxyUri(const std::string& uri) = 0;
69
70   /**
71    * @brief Sets a proxy auth credential to network backend of specific context.
72    * @details Normally, proxy auth credential should be got from the callback
73    *          set by ewk_view_authentication_callback_set, once the username in
74    *          this API has been set with a non-null value, the authentication
75    *          callback will never been invoked. Try to avoid using this API.
76    * @param[in] username username to set
77    * @param[in] password password to set
78    */
79   virtual void SetDefaultProxyAuth(const std::string& username, const std::string& password) = 0;
80
81   /**
82    * Adds CA certificates to persistent NSS certificate database
83    * Function accepts a path to a CA certificate file, a path to a directory
84    * containing CA certificate files, or a colon-seprarated list of those.
85    * Certificate files should have *.crt extension.
86    * Directories are traversed recursively.
87    * @param[in] certificatePath path to a CA certificate file(s), see above for details
88    */
89   virtual void SetCertificateFilePath(const std::string& certificatePath) = 0;
90
91   /**
92    * Requests for deleting all web databases.
93    */
94   virtual void DeleteWebDatabase() = 0;
95
96   /**
97    * @brief Deletes web storage.
98    * @details This function does not ensure that all data will be removed.
99    *          Should be used to extend free physical memory.
100    */
101   virtual void DeleteWebStorage() = 0;
102
103   /**
104    * @brief Requests for deleting all local file systems.
105    */
106   virtual void DeleteLocalFileSystem() = 0;
107
108   /**
109    * Toggles the cache to be enabled or disabled
110    * Function works asynchronously.
111    * By default the cache is disabled resulting in not storing network data on disk.
112    * @param[in] cacheDisabled enable or disable cache
113    */
114   virtual void DisableCache(bool cacheDisabled) = 0;
115
116   /**
117    * @brief Requests to clear cache
118    */
119   virtual void ClearCache() = 0;
120 };
121
122 } // namespace Dali
123
124 #endif // DALI_WEB_ENGINE_CONTEXT_H