Merge "Implement some new ewk apis in web engine." into devel/master
[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) 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
23 namespace Dali
24 {
25
26 /**
27  * @brief A class WebEngineContext for context of web engine.
28  */
29 class WebEngineContext
30 {
31
32 public:
33
34   /**
35    * @brief Enumeration for cache model options.
36    */
37   enum class CacheModel
38   {
39     DOCUMENT_VIEWER,     ///< Use the smallest cache capacity.
40     DOCUMENT_BROWSER,    ///< Use the bigger cache capacity than DocumentBrowser.
41     PRIMARY_WEB_BROWSER, ///< Use the biggest cache capacity.
42   };
43
44   /**
45    * @brief Constructor.
46    */
47   WebEngineContext() = default;
48
49   /**
50    * @brief Destructor.
51    */
52   virtual ~WebEngineContext() = default;
53
54   /**
55    * @brief Returns the cache model type.
56    * @return #CacheModel
57    */
58   virtual CacheModel GetCacheModel() const = 0;
59
60   /**
61    * @brief Requests to set the cache model.
62    * @param[in] cacheModel The cache model
63    */
64   virtual void SetCacheModel( CacheModel cacheModel ) = 0;
65
66   /**
67    * @brief Sets the given proxy URI to network backend of specific context.
68    * @param[in] uri The proxy URI to set
69    */
70   virtual void SetProxyUri( const std::string& uri ) = 0;
71
72   /**
73    * @brief Sets a proxy auth credential to network backend of specific context.
74    * @details Normally, proxy auth credential should be got from the callback
75    *          set by ewk_view_authentication_callback_set, once the username in
76    *          this API has been set with a non-null value, the authentication
77    *          callback will never been invoked. Try to avoid using this API.
78    * @param[in] username username to set
79    * @param[in] password password to set
80    */
81   virtual void SetDefaultProxyAuth( const std::string& username, const std::string& password ) = 0;
82
83   /**
84    * Adds CA certificates to persistent NSS certificate database
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    * @param[in] certificatePath path to a CA certificate file(s), see above for details
90    */
91   virtual void SetCertificateFilePath( const std::string& certificatePath ) = 0;
92
93   /**
94    * Requests for deleting all web databases.
95    */
96   virtual void DeleteWebDatabase() = 0;
97
98   /**
99    * @brief Deletes web storage.
100    * @details This function does not ensure that all data will be removed.
101    *          Should be used to extend free physical memory.
102    */
103   virtual void DeleteWebStorage() = 0;
104
105   /**
106    * @brief Requests for deleting all local file systems.
107    */
108   virtual void DeleteLocalFileSystem() = 0;
109
110   /**
111    * Toggles the cache to be enabled or disabled
112    * Function works asynchronously.
113    * By default the cache is disabled resulting in not storing network data on disk.
114    * @param[in] cacheDisabled enable or disable cache
115    */
116   virtual void DisableCache( bool cacheDisabled ) = 0;
117
118   /**
119    * @brief Requests to clear cache
120    */
121   virtual void ClearCache() = 0;
122
123 };
124
125 } // namespace Dali
126
127 #endif // DALI_WEB_ENGINE_CONTEXT_H