Merge "Allow Large font size in dali" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / controls / web-view / web-context.h
1 #ifndef DALI_TOOLKIT_WEB_CONTEXT_H
2 #define DALI_TOOLKIT_WEB_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 <dali/devel-api/adaptor-framework/web-engine-context.h>
23 #include <string>
24
25 // INTERNAL INCLUDES
26 #include <dali-toolkit/public-api/dali-toolkit-common.h>
27
28 namespace Dali
29 {
30 class WebEngineSecurityOrigin;
31
32 namespace Toolkit
33 {
34 /**
35  * @addtogroup dali_toolkit_controls_web_view
36  * @{
37  */
38
39 /**
40  * @brief WebContext is a control for context of WebView.
41  *
42  * For working WebContext, a WebEngineContext should be provided.
43  *
44  */
45 class DALI_TOOLKIT_API WebContext
46 {
47 public:
48   /**
49    * @brief Create a WebContext.
50    *
51    * @param[in] context The context of web engine.
52    */
53   WebContext(Dali::WebEngineContext& context);
54
55   /**
56    * @brief Destructor.
57    */
58   virtual ~WebContext() final;
59
60   /**
61    * @brief Return the cache model type.
62    *
63    * @return #Dali::WebEngineContext::CacheModel
64    */
65   Dali::WebEngineContext::CacheModel GetCacheModel() const;
66
67   /**
68    * @brief Request to set the cache model.
69    *
70    * @param[in] cacheModel The cache model
71    */
72   void SetCacheModel(Dali::WebEngineContext::CacheModel cacheModel);
73
74   /**
75    * @brief Set the given proxy URI to network backend of specific context.
76    *
77    * @param[in] uri The proxy URI to set
78    */
79   void SetProxyUri(const std::string& uri);
80
81   /**
82    * @brief Add CA certificates to persistent NSS certificate database
83    *
84    * Function accepts a path to a CA certificate file, a path to a directory
85    * containing CA certificate files, or a colon-seprarated list of those.
86    * Certificate files should have *.crt extension.
87    * Directories are traversed recursively.
88    *
89    * @param[in] certificatePath path to a CA certificate file(s), see above for details
90    */
91   void SetCertificateFilePath(const std::string& certificatePath);
92
93   /**
94    * @brief Toggle the cache to be enabled or disabled
95    *
96    * Function works asynchronously.
97    * By default the cache is disabled resulting in not storing network data on disk.
98    *
99    * @param[in] cacheDisabled enable or disable cache
100    */
101   void DisableCache(bool cacheDisabled);
102
103   /**
104    * @brief Set a proxy auth credential to network backend of specific context.
105    *
106    * @param[in] username username to set
107    * @param[in] password password to set
108    */
109   void SetDefaultProxyAuth(const std::string& username, const std::string& password);
110
111   /**
112    * @brief Requests for deleting all web databases.
113    */
114   void DeleteAllWebDatabase();
115
116   /**
117    * @brief Request for getting web database origins.
118    *
119    * @param[in] callback callback called after getting web database origins
120    *
121    * @return true if succeeded, false otherwise
122    */
123   bool GetWebDatabaseOrigins(Dali::WebEngineContext::WebEngineSecurityOriginAcquiredCallback callback);
124
125   /**
126    * @brief Request for deleting web databases for origin.
127    *
128    * @param[in] origin database origin
129    *
130    * @return true if succeeded, false otherwise
131    */
132   bool DeleteWebDatabase(Dali::WebEngineSecurityOrigin& origin);
133
134   /**
135    * @brief Gets list of origins that is stored in web storage db.
136    *
137    * @param[in] callback callback called after getting web storage origins
138    *
139    * @return true if succeeded, false otherwise
140    */
141   bool GetWebStorageOrigins(Dali::WebEngineContext::WebEngineSecurityOriginAcquiredCallback callback);
142
143   /**
144    * @brief Get list of origins that is stored in web storage db.
145    *
146    * @param[in] origin storage origin
147    * @param[in] callback callback called after getting web storage origins
148    *
149    * @return true if succeeded, false otherwise
150    */
151   bool GetWebStorageUsageForOrigin(Dali::WebEngineSecurityOrigin& origin, Dali::WebEngineContext::WebEngineStorageUsageAcquiredCallback callback);
152
153   /**
154    * @brief Delete all web storage.
155    *
156    * @details This function does not ensure that all data will be removed.
157    *          Should be used to extend free physical memory.
158    */
159   void DeleteAllWebStorage();
160
161   /**
162    * @brief Delete origin that is stored in web storage db.
163    *
164    * @param[in] origin origin of db
165    *
166    * @return true if succeeded, false otherwise
167    */
168   bool DeleteWebStorageOrigin(Dali::WebEngineSecurityOrigin& origin);
169
170   /**
171    * @brief Request for deleting all local file systems.
172    */
173   void DeleteLocalFileSystem();
174
175   /**
176    * @brief Requests to clear cache
177    */
178   void ClearCache();
179
180   /**
181    * @brief Request for deleting web application cache for origin.
182    *
183    * @param[in] origin application cache origin
184    *
185    * @return true if succeeded, false otherwise
186    */
187   bool DeleteApplicationCache(Dali::WebEngineSecurityOrigin& origin);
188
189   /**
190    * @brief Asynchronous request to get list of all password data.
191    *
192    * @param[in] callback callback called after getting form password
193    */
194   void GetFormPasswordList(Dali::WebEngineContext::WebEngineFormPasswordAcquiredCallback callback);
195
196   /**
197    * @brief Register callback for download started.
198    *
199    * @param[in] callback callback for download started
200    */
201   void RegisterDownloadStartedCallback(Dali::WebEngineContext::WebEngineDownloadStartedCallback callback);
202
203   /**
204    * @brief Register callback for mime overridden.
205    *
206    * @param[in] callback callback for mime overridden
207    */
208   void RegisterMimeOverriddenCallback(Dali::WebEngineContext::WebEngineMimeOverriddenCallback callback);
209
210 private:
211   Dali::WebEngineContext& mWebEngineContext;
212 };
213
214 /**
215  * @}
216  */
217
218 } // namespace Toolkit
219
220 } // namespace Dali
221
222 #endif // DALI_TOOLKIT_WEB_CONTEXT_H