ead4efda082d3bea42f6f97b2dcca3f7bd542316
[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 namespace Toolkit
31 {
32 /**
33  * @addtogroup dali_toolkit_controls_web_view
34  * @{
35  */
36
37 /**
38  * @brief WebContext is a control for settings of WebView.
39  *
40  * For working WebContext, a WebView should be provided.
41  *
42  */
43 class DALI_TOOLKIT_API WebContext
44 {
45 public:
46   /**
47    * @brief Creates a WebContext.
48    *
49    * @param[in] context The context of web engine.
50    */
51   WebContext(Dali::WebEngineContext& context);
52
53   /**
54    * @brief Destructor.
55    */
56   virtual ~WebContext() final;
57
58   /**
59    * @brief Returns the cache model type.
60    *
61    * @return #Dali::WebEngineContext::CacheModel
62    */
63   Dali::WebEngineContext::CacheModel GetCacheModel() const;
64
65   /**
66    * @brief Requests to set the cache model.
67    *
68    * @param[in] cacheModel The cache model
69    */
70   void SetCacheModel(Dali::WebEngineContext::CacheModel cacheModel);
71
72   /**
73    * @brief Sets the given proxy URI to network backend of specific context.
74    *
75    * @param[in] uri The proxy URI to set
76    */
77   void SetProxyUri(const std::string& uri);
78
79   /**
80    * Adds CA certificates to persistent NSS certificate database
81    *
82    * Function accepts a path to a CA certificate file, a path to a directory
83    * containing CA certificate files, or a colon-seprarated list of those.
84    * Certificate files should have *.crt extension.
85    * Directories are traversed recursively.
86    *
87    * @param[in] certificatePath path to a CA certificate file(s), see above for details
88    */
89   void SetCertificateFilePath(const std::string& certificatePath);
90
91   /**
92    * Toggles the cache to be enabled or disabled
93    *
94    * Function works asynchronously.
95    * By default the cache is disabled resulting in not storing network data on disk.
96    *
97    * @param[in] cacheDisabled enable or disable cache
98    */
99   void DisableCache(bool cacheDisabled);
100
101   /**
102    * @brief Sets a proxy auth credential to network backend of specific context.
103    *
104    * @param[in] username username to set
105    * @param[in] password password to set
106    */
107   void SetDefaultProxyAuth(const std::string& username, const std::string& password);
108
109   /**
110    * Requests for deleting all web databases.
111    */
112   void DeleteWebDatabase();
113
114   /**
115    * @brief Deletes web storage.
116    *
117    * @details This function does not ensure that all data will be removed.
118    *          Should be used to extend free physical memory.
119    */
120   void DeleteWebStorage();
121
122   /**
123    * @brief Requests for deleting all local file systems.
124    */
125   void DeleteLocalFileSystem();
126
127   /**
128    * @brief Requests to clear cache
129    */
130   void ClearCache();
131
132 private:
133   Dali::WebEngineContext& mWebEngineContext;
134 };
135
136 /**
137  * @}
138  */
139
140 } // namespace Toolkit
141
142 } // namespace Dali
143
144 #endif // DALI_TOOLKIT_WEB_CONTEXT_H