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