2a7090b2476fc99e200d2b135be65a7cda7f94fb
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / controls / web-view / web-context.cpp
1 /*
2  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali-toolkit/devel-api/controls/web-view/web-context.h>
20
21 // EXTERNAL INCLUDES
22 #include <dali/devel-api/adaptor-framework/web-engine-security-origin.h>
23
24 namespace Dali
25 {
26 namespace Toolkit
27 {
28 WebContext::WebContext(Dali::WebEngineContext& context)
29 : mWebEngineContext(context)
30 {
31 }
32
33 WebContext::~WebContext()
34 {
35 }
36
37 Dali::WebEngineContext::CacheModel WebContext::GetCacheModel() const
38 {
39   return mWebEngineContext.GetCacheModel();
40 }
41
42 void WebContext::SetCacheModel(Dali::WebEngineContext::CacheModel cacheModel)
43 {
44   mWebEngineContext.SetCacheModel(cacheModel);
45 }
46
47 void WebContext::SetProxyUri(const std::string& uri)
48 {
49   mWebEngineContext.SetProxyUri(uri);
50 }
51
52 void WebContext::SetCertificateFilePath(const std::string& certificatePath)
53 {
54   mWebEngineContext.SetCertificateFilePath(certificatePath);
55 }
56
57 void WebContext::SetDefaultProxyAuth(const std::string& username, const std::string& password)
58 {
59   mWebEngineContext.SetDefaultProxyAuth(username, password);
60 }
61
62 void WebContext::DeleteAllWebDatabase()
63 {
64   mWebEngineContext.DeleteAllWebDatabase();
65 }
66
67 bool WebContext::GetWebDatabaseOrigins(Dali::WebEngineContext::WebEngineSecurityOriginAcquiredCallback callback)
68 {
69   return mWebEngineContext.GetWebDatabaseOrigins(callback);
70 }
71
72 bool WebContext::DeleteWebDatabase(Dali::WebEngineSecurityOrigin& origin)
73 {
74   return mWebEngineContext.DeleteWebDatabase(origin);
75 }
76
77 bool WebContext::GetWebStorageOrigins(Dali::WebEngineContext::WebEngineSecurityOriginAcquiredCallback callback)
78 {
79   return mWebEngineContext.GetWebStorageOrigins(callback);
80 }
81
82 bool WebContext::GetWebStorageUsageForOrigin(Dali::WebEngineSecurityOrigin& origin, Dali::WebEngineContext::WebEngineStorageUsageAcquiredCallback callback)
83 {
84   return mWebEngineContext.GetWebStorageUsageForOrigin(origin, callback);
85 }
86
87 void WebContext::DeleteAllWebStorage()
88 {
89   mWebEngineContext.DeleteAllWebStorage();
90 }
91
92 bool WebContext::DeleteWebStorage(Dali::WebEngineSecurityOrigin& origin)
93 {
94   return mWebEngineContext.DeleteWebStorage(origin);
95 }
96
97 void WebContext::DeleteLocalFileSystem()
98 {
99   mWebEngineContext.DeleteLocalFileSystem();
100 }
101
102 void WebContext::ClearCache()
103 {
104   mWebEngineContext.ClearCache();
105 }
106
107 bool WebContext::DeleteApplicationCache(Dali::WebEngineSecurityOrigin& origin)
108 {
109   return mWebEngineContext.DeleteApplicationCache(origin);
110 }
111
112 void WebContext::GetFormPasswordList(Dali::WebEngineContext::WebEngineFormPasswordAcquiredCallback callback)
113 {
114   mWebEngineContext.GetFormPasswordList(callback);
115 }
116
117 void WebContext::RegisterDownloadStartedCallback(Dali::WebEngineContext::WebEngineDownloadStartedCallback callback)
118 {
119   mWebEngineContext.RegisterDownloadStartedCallback(callback);
120 }
121
122 void WebContext::RegisterMimeOverriddenCallback(Dali::WebEngineContext::WebEngineMimeOverriddenCallback callback)
123 {
124   mWebEngineContext.RegisterMimeOverriddenCallback(callback);
125 }
126
127 void WebContext::EnableCache(bool cacheEnabled)
128 {
129   mWebEngineContext.EnableCache(cacheEnabled);
130 }
131
132 bool WebContext::IsCacheEnabled() const
133 {
134   return mWebEngineContext.IsCacheEnabled();
135 }
136
137 std::string WebContext::GetContextCertificateFile() const
138 {
139   return mWebEngineContext.GetContextCertificateFile();
140 }
141
142 void WebContext::SetContextAppId(const std::string& appID)
143 {
144   mWebEngineContext.SetContextAppId(appID);
145 }
146
147 bool WebContext::SetContextAppVersion(const std::string& appVersion)
148 {
149   return mWebEngineContext.SetContextAppVersion(appVersion);
150 }
151
152 void WebContext::SetContextApplicationType(const Dali::WebEngineContext::ApplicationType applicationType)
153 {
154   mWebEngineContext.SetContextApplicationType(applicationType);
155 }
156
157 void WebContext::SetContextTimeOffset(float timeOffset)
158 {
159   mWebEngineContext.SetContextTimeOffset(timeOffset);
160 }
161
162 void WebContext::SetContextTimeZoneOffset(float timeZoneOffset, float daylightSavingTime)
163 {
164   mWebEngineContext.SetContextTimeZoneOffset(timeZoneOffset, daylightSavingTime);
165 }
166
167 void WebContext::RegisterUrlSchemesAsCorsEnabled(const std::vector<std::string>& schemes)
168 {
169   mWebEngineContext.RegisterUrlSchemesAsCorsEnabled(schemes);
170 }
171
172 void WebContext::RegisterJsPluginMimeTypes(const std::vector<std::string>& mimeTypes)
173 {
174   mWebEngineContext.RegisterJsPluginMimeTypes(mimeTypes);
175 }
176
177 void WebContext::SetDefaultZoomFactor(float zoomFactor)
178 {
179   mWebEngineContext.SetDefaultZoomFactor(zoomFactor);
180 }
181
182 float WebContext::GetContextDefaultZoomFactor() const
183 {
184   return mWebEngineContext.GetContextDefaultZoomFactor();
185 }
186
187 bool WebContext::DeleteAllApplicationCache()
188 {
189   return mWebEngineContext.DeleteAllApplicationCache();
190 }
191
192 bool WebContext::DeleteAllWebIndexedDatabase()
193 {
194   return mWebEngineContext.DeleteAllWebIndexedDatabase();
195 }
196
197 void WebContext::DeleteFormPasswordDataList(const std::vector<std::string>& list)
198 {
199   mWebEngineContext.DeleteFormPasswordDataList(list);
200 }
201
202 void WebContext::DeleteAllFormPasswordData()
203 {
204   mWebEngineContext.DeleteAllFormPasswordData();
205 }
206
207 void WebContext::DeleteAllFormCandidateData()
208 {
209   mWebEngineContext.DeleteAllFormCandidateData();
210 }
211
212 std::string WebContext::GetContextProxy() const
213 {
214   return mWebEngineContext.GetContextProxy();
215 }
216
217 void WebContext::SetContextProxy(const std::string& proxy, const std::string& bypass)
218 {
219   mWebEngineContext.SetContextProxy(proxy, bypass);
220 }
221
222 std::string WebContext::GetProxyBypassRule() const
223 {
224   return mWebEngineContext.GetProxyBypassRule();
225 }
226
227 bool WebContext::FreeUnusedMemory()
228 {
229   return mWebEngineContext.FreeUnusedMemory();
230 }
231
232 } // namespace Toolkit
233 } // namespace Dali