2 * Copyright (C) 2012 Samsung Electronics
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public License
15 * along with this program; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
22 #include "ewk_context.h"
24 #include "BatteryProvider.h"
25 #include "NetworkInfoProvider.h"
26 #include "VibrationProvider.h"
27 #include "WKAPICast.h"
28 #include "WKContextSoup.h"
29 #include "WKRetainPtr.h"
31 #include "ewk_context_download_client_private.h"
32 #include "ewk_context_private.h"
33 #include "ewk_context_request_manager_client_private.h"
34 #include "ewk_cookie_manager_private.h"
35 #include "ewk_download_job.h"
36 #include "ewk_download_job_private.h"
37 #include <wtf/HashMap.h>
38 #include <wtf/text/WTFString.h>
41 #include "WKApplicationCacheManager.h"
43 #include "WKContext.h"
44 #include "WKContextPrivate.h"
45 #include "WKContextTizen.h"
46 #include "WKDatabaseManager.h"
47 #include "WKIconDatabase.h"
48 #include "WKIconDatabaseTizen.h"
49 #include "WKKeyValueStorageManager.h"
50 #if ENABLE(TIZEN_FILE_SYSTEM)
51 #include "WKLocalFileSystemManager.h"
54 #include "WKSecurityOrigin.h"
57 #include "WebContext.h"
58 #include "ewk_context_injected_bundle_client.h"
59 #include "ewk_security_origin.h"
61 #include <WebCore/FileSystem.h>
62 #include <wtf/text/WTFString.h>
64 #if ENABLE(TIZEN_WRT_LAUNCHING_PERFORMANCE)
65 #include "ProcessLauncher.h"
69 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
70 #include "FormDatabase.h"
71 #include "WKDictionary.h"
73 #endif // #if OS(TIZEN)
74 #if ENABLE(SPELLCHECK)
75 #include "ewk_settings.h"
76 #include "ewk_text_checker_private.h"
79 using namespace WebKit;
81 struct _Ewk_Url_Scheme_Handler {
82 Ewk_Url_Scheme_Request_Cb callback;
85 _Ewk_Url_Scheme_Handler()
90 _Ewk_Url_Scheme_Handler(Ewk_Url_Scheme_Request_Cb callback, void* userData)
96 typedef HashMap<String, _Ewk_Url_Scheme_Handler> URLSchemeHandlerMap;
99 WKRetainPtr<WKContextRef> context;
101 Ewk_Cookie_Manager* cookieManager;
102 #if ENABLE(BATTERY_STATUS)
103 RefPtr<BatteryProvider> batteryProvider;
105 #if ENABLE(NETWORK_INFO)
106 RefPtr<NetworkInfoProvider> networkInfoProvider;
108 #if ENABLE(VIBRATION)
109 RefPtr<VibrationProvider> vibrationProvider;
111 HashMap<uint64_t, Ewk_Download_Job*> downloadJobs;
113 WKRetainPtr<WKSoupRequestManagerRef> requestManager;
114 URLSchemeHandlerMap urlSchemeHandlers;
117 const char* proxyAddress;
118 #if ENABLE(TIZEN_CERTIFICATE_HANDLING)
119 const char* certificateFile;
121 #if ENABLE(TIZEN_SQL_DATABASE)
122 uint64_t defaultDatabaseQuota;
125 Ewk_Context_Message_From_Injected_Bundle_Callback callback;
127 } messageFromInjectedBundle;
129 Ewk_Context_Did_Start_Download_Callback callback;
132 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_X_WINDOW)
133 Ecore_X_Window xWindow;
135 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
136 RefPtr<FormDatabase> formDatabase;
140 _Ewk_Context(WKRetainPtr<WKContextRef> contextRef)
141 : context(contextRef)
143 , requestManager(WKContextGetSoupRequestManager(contextRef.get()))
145 #if ENABLE(BATTERY_STATUS)
146 batteryProvider = BatteryProvider::create(context.get());
149 #if ENABLE(NETWORK_INFO)
150 networkInfoProvider = NetworkInfoProvider::create(context.get());
153 #if ENABLE(VIBRATION)
154 vibrationProvider = VibrationProvider::create(context.get());
157 ewk_context_request_manager_client_attach(this);
158 ewk_context_download_client_attach(this);
159 #if ENABLE(SPELLCHECK)
160 Ewk_Text_Checker::initialize();
161 if (ewk_settings_continuous_spell_checking_enabled_get()) {
162 // Load the default language.
163 ewk_settings_spell_checking_languages_set(0);
168 this->proxyAddress = 0;
169 #if ENABLE(TIZEN_CERTIFICATE_HANDLING)
170 this->certificateFile = 0;
172 #if ENABLE(TIZEN_SQL_DATABASE)
173 this->defaultDatabaseQuota = 5 * 1024 * 1024;
175 this->messageFromInjectedBundle.callback = 0;
176 this->messageFromInjectedBundle.userData = 0;
177 this->didStartDownload.callback = 0;
178 this->didStartDownload.userData = 0;
179 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
180 this->formDatabase = FormDatabase::create();
181 this->formDatabase->open(FormDatabase::defaultDatabaseDirectoryPath(), FormDatabase::defaultDatabaseFilename());
189 ewk_cookie_manager_free(cookieManager);
191 #if ENABLE(TIZEN_CACHE_DUMP_SYNC)
192 ewk_context_cache_dump(this);
195 HashMap<uint64_t, Ewk_Download_Job*>::iterator it = downloadJobs.begin();
196 HashMap<uint64_t, Ewk_Download_Job*>::iterator end = downloadJobs.end();
197 for ( ; it != end; ++it)
198 ewk_download_job_unref(it->second);
202 Ewk_Cookie_Manager* ewk_context_cookie_manager_get(const Ewk_Context* ewkContext)
204 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, 0);
206 if (!ewkContext->cookieManager)
207 const_cast<Ewk_Context*>(ewkContext)->cookieManager = ewk_cookie_manager_new(WKContextGetCookieManager(ewkContext->context.get()));
209 return ewkContext->cookieManager;
212 WKContextRef ewk_context_WKContext_get(const Ewk_Context* ewkContext)
214 return ewkContext->context.get();
219 * Registers that a new download has been requested.
221 void ewk_context_download_job_add(Ewk_Context* ewkContext, Ewk_Download_Job* ewkDownload)
223 EINA_SAFETY_ON_NULL_RETURN(ewkContext);
224 EINA_SAFETY_ON_NULL_RETURN(ewkDownload);
226 uint64_t downloadId = ewk_download_job_id_get(ewkDownload);
227 if (ewkContext->downloadJobs.contains(downloadId))
230 ewk_download_job_ref(ewkDownload);
231 ewkContext->downloadJobs.add(downloadId, ewkDownload);
236 * Returns the #Ewk_Download_Job with the given @a downloadId, or
237 * @c 0 in case of failure.
239 Ewk_Download_Job* ewk_context_download_job_get(const Ewk_Context* ewkContext, uint64_t downloadId)
241 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, 0);
243 return ewkContext->downloadJobs.get(downloadId);
248 * Removes the #Ewk_Download_Job with the given @a downloadId from the internal
251 void ewk_context_download_job_remove(Ewk_Context* ewkContext, uint64_t downloadId)
253 EINA_SAFETY_ON_NULL_RETURN(ewkContext);
254 Ewk_Download_Job* download = ewkContext->downloadJobs.take(downloadId);
256 ewk_download_job_unref(download);
260 * Retrieve the request manager for @a ewkContext.
262 * @param ewkContext a #Ewk_Context object.
264 WKSoupRequestManagerRef ewk_context_request_manager_get(const Ewk_Context* ewkContext)
266 return ewkContext->requestManager.get();
271 * A new URL request was received.
273 * @param ewkContext a #Ewk_Context object.
274 * @param schemeRequest a #Ewk_Url_Scheme_Request object.
276 void ewk_context_url_scheme_request_received(Ewk_Context* ewkContext, Ewk_Url_Scheme_Request* schemeRequest)
278 EINA_SAFETY_ON_NULL_RETURN(ewkContext);
279 EINA_SAFETY_ON_NULL_RETURN(schemeRequest);
281 _Ewk_Url_Scheme_Handler handler = ewkContext->urlSchemeHandlers.get(ewk_url_scheme_request_scheme_get(schemeRequest));
282 if (!handler.callback)
285 handler.callback(schemeRequest, handler.userData);
288 static inline Ewk_Context* createDefaultEwkContext()
290 return new Ewk_Context(WKContextGetSharedProcessContext());
293 Ewk_Context* ewk_context_default_get()
296 static Ewk_Context* defaultContext = ewk_context_new();
297 return defaultContext;
298 #else // #if OS(TIZEN)
299 DEFINE_STATIC_LOCAL(Ewk_Context, defaultContext, (WKContextGetSharedProcessContext()));
300 return &defaultContext;
301 #endif // #if OS(TIZEN)
305 typedef struct _Ewk_Context_Callback_Context
308 #if ENABLE(TIZEN_FILE_SYSTEM)
309 Ewk_Local_File_System_Origins_Get_Callback localFileSystemOriginsCallback;
311 Ewk_Web_Application_Cache_Origins_Get_Callback webApplicationCacheOriginsCallback;
312 Ewk_Web_Application_Cache_Quota_Get_Callback webApplicationCacheQuotaCallback;
313 Ewk_Web_Application_Cache_Usage_For_Origin_Get_Callback webApplicationCacheUsageForOriginCallback;
314 Ewk_Web_Application_Cache_Path_Get_Callback webApplicationCachePathCallback;
315 Ewk_Web_Database_Origins_Get_Callback webDatabaseOriginsCallback;
316 Ewk_Web_Database_Quota_Get_Callback webDatabaseQuotaCallback;
317 Ewk_Web_Database_Usage_Get_Callback webDatabaseUsageCallback;
318 Ewk_Web_Database_Path_Get_Callback webDatabasePathCallback;
319 Ewk_Web_Storage_Origins_Get_Callback webStorageOriginsCallback;
320 Ewk_Web_Storage_Usage_Get_Callback webStorageUsageCallback;
321 Ewk_Web_Storage_Path_Get_Callback webStoragePathCallback;
324 } Ewk_Context_Callback_Context;
326 #if ENABLE(TIZEN_SQL_DATABASE)
327 struct _Ewk_Context_Exceeded_Quota
329 Ewk_Security_Origin* origin;
330 const char* databaseName;
331 const char* displayName;
332 unsigned long long currentQuota;
333 unsigned long long currentOriginUsage;
334 unsigned long long currentDatabaseUsage;
335 unsigned long long expectedUsage;
336 unsigned long long newQuota;
342 * Create Ewk_Context with WKContext.
344 Ewk_Context* ewk_context_new_from_WKContext(WKContextRef contextRef)
346 EINA_SAFETY_ON_NULL_RETURN_VAL(contextRef, 0);
348 return new Ewk_Context(contextRef);
351 #if ENABLE(TIZEN_SQL_DATABASE)
352 Ewk_Context_Exceeded_Quota* ewkContextCreateExceededQuota(WKSecurityOriginRef origin, WKStringRef databaseName, WKStringRef displayName, unsigned long long currentQuota, unsigned long long currentOriginUsage, unsigned long long currentDatabaseUsage, unsigned long long expectedUsage)
354 Ewk_Context_Exceeded_Quota* exceededQuota = new Ewk_Context_Exceeded_Quota();
356 int length = WKStringGetMaximumUTF8CStringSize(databaseName);
357 OwnArrayPtr<char> databaseNameBuffer = adoptArrayPtr(new char[length]);
358 WKStringGetUTF8CString(databaseName, databaseNameBuffer.get(), length);
360 length = WKStringGetMaximumUTF8CStringSize(displayName);
361 OwnArrayPtr<char> displayNameBuffer = adoptArrayPtr(new char[length]);
362 WKStringGetUTF8CString(displayName, displayNameBuffer.get(), length);
364 exceededQuota->origin = createSecurityOrigin(origin);
365 exceededQuota->databaseName = eina_stringshare_add(databaseNameBuffer.get());
366 exceededQuota->displayName = eina_stringshare_add(displayNameBuffer.get());
367 exceededQuota->currentQuota = currentQuota;
368 exceededQuota->currentOriginUsage = currentOriginUsage;
369 exceededQuota->currentDatabaseUsage = currentDatabaseUsage;
370 exceededQuota->expectedUsage = expectedUsage;
372 return exceededQuota;
375 void ewkContextDeleteExceededQuota(Ewk_Context_Exceeded_Quota* exceededQuota)
377 deleteSecurityOrigin(exceededQuota->origin);
378 eina_stringshare_del(exceededQuota->databaseName);
379 eina_stringshare_del(exceededQuota->displayName);
380 delete exceededQuota;
383 unsigned long long ewkContextGetNewQuotaForExceededQuota(Ewk_Context* ewkContext, Ewk_Context_Exceeded_Quota* exceededQuota)
385 if (exceededQuota->newQuota)
386 return exceededQuota->newQuota + exceededQuota->currentQuota;
388 if (exceededQuota->currentQuota)
389 return exceededQuota->currentQuota;
391 return ewkContext->defaultDatabaseQuota;
394 uint64_t ewkContextGetDatabaseQuota(Ewk_Context* ewkContext)
396 return ewkContext->defaultDatabaseQuota;
401 Ewk_Context* ewk_context_new()
403 Ewk_Context* ewk_context = new Ewk_Context(adoptWK(WKContextCreate()));
405 ewkContextInjectedBundleClientAttachClient(ewk_context);
410 Ewk_Context* ewk_context_new_with_injected_bundle_path(const char* path)
412 EINA_SAFETY_ON_NULL_RETURN_VAL(path, 0);
414 #if ENABLE(TIZEN_WRT_LAUNCHING_PERFORMANCE)
415 char* wrtLaunchingPerformance = getenv("WRT_LAUNCHING_PERFORMANCE");
416 if (wrtLaunchingPerformance && !strcmp(wrtLaunchingPerformance, "1")) {
417 static bool firstTime = true;
421 if (ProcessLauncher::isInitialFork())
422 ProcessLauncher::setSkipExec(true);
424 ProcessLauncher::setSkipExec(false);
426 ProcessLauncher::forkProcess();
428 if (ProcessLauncher::isParentProcess()) {
429 Ewk_Context* ewkContext = ewk_context_new_with_injected_bundle_path(path);
430 WKContextRef contextRef = ewk_context_WKContext_get(ewkContext);
431 toImpl(contextRef)->ensureWebProcess();
434 else if (ProcessLauncher::isChildProcess()) {
435 ProcessLauncher::callWebProcessMain();
439 ASSERT_NOT_REACHED();
445 WKRetainPtr<WKStringRef> pathRef(AdoptWK, WKStringCreateWithUTF8CString(path));
446 Ewk_Context* ewk_context = new Ewk_Context(adoptWK(WKContextCreateWithInjectedBundlePath(pathRef.get())));
448 ewkContextInjectedBundleClientAttachClient(ewk_context);
453 void ewk_context_delete(Ewk_Context* ewkContext)
455 EINA_SAFETY_ON_NULL_RETURN(ewkContext);
456 if (ewkContext == ewk_context_default_get())
459 eina_stringshare_del(ewkContext->proxyAddress);
460 #if ENABLE(TIZEN_CERTIFICATE_HANDLING)
461 eina_stringshare_del(ewkContext->certificateFile);
466 void ewk_context_proxy_uri_set(Ewk_Context* ewkContext, const char* proxy)
468 if (ewkContext && eina_stringshare_replace(&ewkContext->proxyAddress, proxy)) {
469 WKRetainPtr<WKURLRef> proxyAddress(AdoptWK, WKURLCreateWithUTF8CString(proxy));
471 WKContextRef contextRef = ewk_context_WKContext_get(ewkContext);
472 toImpl(contextRef)->setProxy(toWTFString(proxyAddress.get()));
476 const char* ewk_context_proxy_uri_get(Ewk_Context* ewkContext)
478 #if ENABLE(TIZEN_WEBKIT2_PATCH_FOR_TC)
479 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, 0);
481 return ewkContext->proxyAddress;
484 void ewk_context_network_session_requests_cancel(Ewk_Context* ewkContext)
486 EINA_SAFETY_ON_NULL_RETURN(ewkContext);
488 WKContextRef contextRef = ewk_context_WKContext_get(ewkContext);
489 toImpl(contextRef)->abortSession();
492 Eina_Bool ewk_context_notify_low_memory(Ewk_Context* ewkContext)
494 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
496 WKContextRef contextRef = ewk_context_WKContext_get(ewkContext);
497 toImpl(contextRef)->notifyLowMemory();
501 #if ENABLE(TIZEN_FILE_SYSTEM)
502 static void didGetLocalFileSystemOrigins(WKArrayRef origins, WKErrorRef error, void* context)
504 Eina_List* originList = 0;
505 for (size_t i = 0; i < WKArrayGetSize(origins); ++i) {
506 WKSecurityOriginRef securityOriginRef = static_cast<WKSecurityOriginRef>(WKArrayGetItemAtIndex(origins, i));
507 Ewk_Security_Origin* origin = createSecurityOrigin(securityOriginRef);
508 originList = eina_list_append(originList, origin);
511 Ewk_Context_Callback_Context* locaFileSystemContext = static_cast<Ewk_Context_Callback_Context*>(context);
512 locaFileSystemContext->localFileSystemOriginsCallback(originList, locaFileSystemContext->userData);
513 delete locaFileSystemContext;
517 #if ENABLE(TIZEN_APPLICATION_CACHE)
518 static void didGetWebApplicationOrigins(WKArrayRef origins, WKErrorRef error, void* context)
520 TIZEN_LOGI("origin size(%d)", WKArrayGetSize(origins));
521 Eina_List* originList = 0;
523 for(size_t i = 0; i < WKArrayGetSize(origins); i++) {
524 WKSecurityOriginRef securityOriginRef = static_cast<WKSecurityOriginRef>(WKArrayGetItemAtIndex(origins, i));
525 Ewk_Security_Origin* origin = createSecurityOrigin(securityOriginRef);
526 originList = eina_list_append(originList, origin);
529 Ewk_Context_Callback_Context* applicationCacheContext = static_cast<Ewk_Context_Callback_Context*>(context);
530 applicationCacheContext->webApplicationCacheOriginsCallback(originList, applicationCacheContext->userData);
531 delete applicationCacheContext;
534 static void didGetWebApplicationPath(WKStringRef path, WKErrorRef error, void* context)
536 Ewk_Context_Callback_Context* applicationCacheContext = static_cast<Ewk_Context_Callback_Context*>(context);
538 int length = WKStringGetMaximumUTF8CStringSize(path);
539 OwnArrayPtr<char> applicationCachePath = adoptArrayPtr(new char[length]);
540 WKStringGetUTF8CString(path, applicationCachePath.get(), length);
542 TIZEN_LOGI("path (%s)", applicationCachePath.get());
543 applicationCacheContext->webApplicationCachePathCallback(eina_stringshare_add(applicationCachePath.get()), applicationCacheContext->userData);
544 delete applicationCacheContext;
547 #if ENABLE(TIZEN_WEBKIT2_NUMBER_TYPE_SUPPORT)
548 static void didGetWebApplicationQuota(WKInt64Ref quota, WKErrorRef error, void* context)
550 Ewk_Context_Callback_Context* applicationCacheContext = static_cast<Ewk_Context_Callback_Context*>(context);
551 TIZEN_LOGI("quota (%d)", toImpl(quota)->value());
552 applicationCacheContext->webApplicationCacheQuotaCallback(toImpl(quota)->value(), applicationCacheContext->userData);
553 delete applicationCacheContext;
556 static void didGetWebApplicationUsageForOrigin(WKInt64Ref usage, WKErrorRef error, void* context)
558 Ewk_Context_Callback_Context* applicationCacheContext = static_cast<Ewk_Context_Callback_Context*>(context);
559 TIZEN_LOGI("usage (%d)", toImpl(usage)->value());
560 applicationCacheContext->webApplicationCacheUsageForOriginCallback(toImpl(usage)->value(), applicationCacheContext->userData);
561 delete applicationCacheContext;
566 #if ENABLE(TIZEN_SQL_DATABASE)
567 static void didGetWebDatabaseOrigins(WKArrayRef origins, WKErrorRef error, void* context)
569 TIZEN_LOGI("origin size(%d)", WKArrayGetSize(origins));
570 Eina_List* originList = 0;
572 for(size_t i = 0; i < WKArrayGetSize(origins); i++) {
573 WKSecurityOriginRef securityOriginRef = static_cast<WKSecurityOriginRef>(WKArrayGetItemAtIndex(origins, i));
574 Ewk_Security_Origin* origin = createSecurityOrigin(securityOriginRef);
575 originList = eina_list_append(originList, origin);
578 Ewk_Context_Callback_Context* webDatabaseContext = static_cast<Ewk_Context_Callback_Context*>(context);
579 webDatabaseContext->webDatabaseOriginsCallback(originList, webDatabaseContext->userData);
580 delete webDatabaseContext;
583 static void didGetWebDatabaseQuota(WKUInt64Ref quota, WKErrorRef error, void* context)
585 Ewk_Context_Callback_Context* webDatabaseContext = static_cast<Ewk_Context_Callback_Context*>(context);
586 TIZEN_LOGI("quota (%d)", toImpl(quota)->value());
587 webDatabaseContext->webDatabaseQuotaCallback(toImpl(quota)->value(), webDatabaseContext->userData);
588 delete webDatabaseContext;
591 static void didGetWebDatabaseUsage(WKUInt64Ref usage, WKErrorRef error, void* context)
593 Ewk_Context_Callback_Context* webDatabaseContext = static_cast<Ewk_Context_Callback_Context*>(context);
594 TIZEN_LOGI("usage (%d)", toImpl(usage)->value());
595 webDatabaseContext->webDatabaseUsageCallback(toImpl(usage)->value(), webDatabaseContext->userData);
596 delete webDatabaseContext;
599 static void didGetWebDatabasePath(WKStringRef path, WKErrorRef error, void * context)
601 Ewk_Context_Callback_Context* webDatabaseContext = static_cast<Ewk_Context_Callback_Context*>(context);
603 int length = WKStringGetMaximumUTF8CStringSize(path);
604 OwnArrayPtr<char> databasePath = adoptArrayPtr(new char[length]);
605 WKStringGetUTF8CString(path, databasePath.get(), length);
607 TIZEN_LOGI("path (%s)", databasePath.get());
608 webDatabaseContext->webDatabasePathCallback(eina_stringshare_add(databasePath.get()), webDatabaseContext->userData);
609 delete webDatabaseContext;
613 #if ENABLE(TIZEN_WEB_STORAGE)
614 static void didGetWebStorageOrigins(WKArrayRef origins, WKErrorRef error, void* context)
616 TIZEN_LOGI("origin size(%d)", WKArrayGetSize(origins));
617 Eina_List* originList = 0;
619 for(size_t i = 0; i < WKArrayGetSize(origins); i++) {
620 WKSecurityOriginRef securityOriginRef = static_cast<WKSecurityOriginRef>(WKArrayGetItemAtIndex(origins, i));
621 Ewk_Security_Origin* origin = createSecurityOrigin(securityOriginRef);
622 originList = eina_list_append(originList, origin);
625 Ewk_Context_Callback_Context* webStorageContext = static_cast<Ewk_Context_Callback_Context*>(context);
626 webStorageContext->webStorageOriginsCallback(originList, webStorageContext->userData);
627 delete webStorageContext;
630 static void didGetWebStoragePath(WKStringRef path, WKErrorRef error, void * context)
632 Ewk_Context_Callback_Context* webStorageContext = static_cast<Ewk_Context_Callback_Context*>(context);
634 int length = WKStringGetMaximumUTF8CStringSize(path);
635 OwnArrayPtr<char> storagePath = adoptArrayPtr(new char[length]);
636 WKStringGetUTF8CString(path, storagePath.get(), length);
638 TIZEN_LOGI("path (%s)", storagePath.get());
639 webStorageContext->webStoragePathCallback(eina_stringshare_add(storagePath.get()), webStorageContext->userData);
640 delete webStorageContext;
643 #if ENABLE(TIZEN_WEBKIT2_NUMBER_TYPE_SUPPORT)
644 static void didGetWebStorageUsage(WKInt64Ref usage, WKErrorRef error, void* context)
646 Ewk_Context_Callback_Context* webStorageContext = static_cast<Ewk_Context_Callback_Context*>(context);
648 TIZEN_LOGI("usage (%s)", toImpl(usage)->value());
649 webStorageContext->webStorageUsageCallback(toImpl(usage)->value(), webStorageContext->userData);
650 delete webStorageContext;
656 Eina_Bool ewk_context_origins_free(Eina_List* originList)
658 EINA_SAFETY_ON_NULL_RETURN_VAL(originList, false);
661 EINA_LIST_FREE(originList, currentOrigin) {
662 Ewk_Security_Origin* origin = static_cast<Ewk_Security_Origin*>(currentOrigin);
663 deleteSecurityOrigin(origin);
669 Eina_Bool ewk_context_application_cache_delete_all(Ewk_Context* ewkContext)
671 #if ENABLE(TIZEN_APPLICATION_CACHE)
672 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
674 TIZEN_LOGI("ewkContext (%p)", ewkContext);
675 WKApplicationCacheManagerRef applicationCache = WKContextGetApplicationCacheManager(ewk_context_WKContext_get(ewkContext));
676 WKApplicationCacheManagerDeleteAllEntries(applicationCache);
684 Eina_Bool ewk_context_application_cache_delete(Ewk_Context* ewkContext, Ewk_Security_Origin* origin)
686 #if ENABLE(TIZEN_APPLICATION_CACHE)
687 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
688 EINA_SAFETY_ON_NULL_RETURN_VAL(origin, false);
690 TIZEN_LOGI("host (%s)", ewk_security_origin_host_get(origin));
691 WKRetainPtr<WKStringRef> protocolRef(AdoptWK, WKStringCreateWithUTF8CString(ewk_security_origin_protocol_get(origin)));
692 WKRetainPtr<WKStringRef> hostRef(AdoptWK, WKStringCreateWithUTF8CString(ewk_security_origin_host_get(origin)));
693 WKRetainPtr<WKSecurityOriginRef> securityOriginRef(AdoptWK, WKSecurityOriginCreate(protocolRef.get(), hostRef.get(), ewk_security_origin_port_get(origin)));
694 WKApplicationCacheManagerRef applicationCacheRef = WKContextGetApplicationCacheManager(ewk_context_WKContext_get(ewkContext));
695 WKApplicationCacheManagerDeleteEntriesForOrigin(applicationCacheRef, securityOriginRef.get());
703 Eina_Bool ewk_context_application_cache_origins_get(Ewk_Context* ewkContext, Ewk_Web_Application_Cache_Origins_Get_Callback callback, void *userData)
705 #if ENABLE(TIZEN_APPLICATION_CACHE)
706 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
707 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
709 TIZEN_LOGI("ewkContext (%p)", ewkContext);
710 Ewk_Context_Callback_Context* context = new Ewk_Context_Callback_Context;
711 context->webApplicationCacheOriginsCallback = callback;
712 context->userData = userData;
714 WKApplicationCacheManagerRef applicationCacheRef = WKContextGetApplicationCacheManager(ewk_context_WKContext_get(ewkContext));
715 WKApplicationCacheManagerGetApplicationCacheOrigins(applicationCacheRef, context, didGetWebApplicationOrigins);
723 Eina_Bool ewk_context_application_cache_path_set(Ewk_Context* ewkContext, const char* path)
725 #if ENABLE(TIZEN_APPLICATION_CACHE)
726 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
727 EINA_SAFETY_ON_NULL_RETURN_VAL(path, false);
730 TIZEN_LOGE("Path value is invalid");
734 TIZEN_LOGI("path (%s)", path);
735 WKRetainPtr<WKStringRef> applicationCachePathRef(AdoptWK, WKStringCreateWithUTF8CString(path));
736 WKContextSetApplicationCacheDirectory(ewk_context_WKContext_get(ewkContext), applicationCachePathRef.get());
744 Eina_Bool ewk_context_application_cache_path_get(Ewk_Context* ewkContext, Ewk_Web_Application_Cache_Path_Get_Callback callback, void* userData)
746 #if ENABLE(TIZEN_APPLICATION_CACHE)
747 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
748 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
750 TIZEN_LOGI("callback (%p)", callback);
751 Ewk_Context_Callback_Context* context = new Ewk_Context_Callback_Context;
752 context->webApplicationCachePathCallback= callback;
753 context->userData = userData;
755 WKApplicationCacheManagerRef applicationCacheRef = WKContextGetApplicationCacheManager(ewk_context_WKContext_get(ewkContext));
756 WKApplicationCacheManagerGetApplicationCachePath(applicationCacheRef, context, didGetWebApplicationPath);
763 Eina_Bool ewk_context_application_cache_quota_get(Ewk_Context* ewkContext, Ewk_Web_Application_Cache_Quota_Get_Callback callback, void* userData)
765 #if ENABLE(TIZEN_APPLICATION_CACHE) && ENABLE(TIZEN_WEBKIT2_NUMBER_TYPE_SUPPORT)
766 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
767 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
769 TIZEN_LOGI("callback (%p)", callback);
770 Ewk_Context_Callback_Context* context = new Ewk_Context_Callback_Context;
771 context->webApplicationCacheQuotaCallback = callback;
772 context->userData = userData;
774 WKApplicationCacheManagerRef applicationCacheRef = WKContextGetApplicationCacheManager(ewk_context_WKContext_get(ewkContext));
775 WKApplicationCacheManagerGetApplicationCacheQuota(applicationCacheRef, context, didGetWebApplicationQuota);
783 Eina_Bool ewk_context_application_cache_usage_for_origin_get(Ewk_Context* ewkContext, const Ewk_Security_Origin* origin, Ewk_Web_Application_Cache_Usage_For_Origin_Get_Callback callback, void* userData)
785 #if ENABLE(TIZEN_APPLICATION_CACHE) && ENABLE(TIZEN_WEBKIT2_NUMBER_TYPE_SUPPORT)
786 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
787 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
788 EINA_SAFETY_ON_NULL_RETURN_VAL(origin, false);
790 TIZEN_LOGI("host (%s)", ewk_security_origin_host_get(origin));
791 Ewk_Context_Callback_Context* context = new Ewk_Context_Callback_Context;
792 context->webApplicationCacheUsageForOriginCallback = callback;
793 context->userData = userData;
794 WKRetainPtr<WKStringRef> protocolRef(AdoptWK, WKStringCreateWithUTF8CString(ewk_security_origin_protocol_get(origin)));
795 WKRetainPtr<WKStringRef> hostRef(AdoptWK, WKStringCreateWithUTF8CString(ewk_security_origin_host_get(origin)));
796 WKRetainPtr<WKSecurityOriginRef> originRef(AdoptWK, WKSecurityOriginCreate(protocolRef.get(), hostRef.get(), ewk_security_origin_port_get(origin)));
798 WKApplicationCacheManagerRef applicationCache = WKContextGetApplicationCacheManager(ewk_context_WKContext_get(ewkContext));
799 WKApplicationCacheManagerGetApplicationCacheUsageForOrigin(applicationCache, context, originRef.get(), didGetWebApplicationUsageForOrigin);
807 Eina_Bool ewk_context_application_cache_quota_set(Ewk_Context* ewkContext, int64_t quota)
809 #if ENABLE(TIZEN_APPLICATION_CACHE)
810 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
812 TIZEN_LOGE("Quota value is invalid");
816 TIZEN_LOGI("quota (%d)", quota);
817 WKApplicationCacheManagerRef applicationCacheRef = WKContextGetApplicationCacheManager(ewk_context_WKContext_get(ewkContext));
818 WKApplicationCacheManagerSetApplicationCacheQuota(applicationCacheRef, quota);
826 Eina_Bool ewk_context_application_cache_quota_for_origin_set(Ewk_Context* ewkContext, const Ewk_Security_Origin* origin, int64_t quota)
828 #if ENABLE(TIZEN_APPLICATION_CACHE)
829 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
830 EINA_SAFETY_ON_NULL_RETURN_VAL(origin, false);
832 TIZEN_LOGE("Quota value is invalid");
836 TIZEN_LOGI("quota (%d)", quota);
837 WKRetainPtr<WKStringRef> protocolRef(AdoptWK, WKStringCreateWithUTF8CString(ewk_security_origin_protocol_get(origin)));
838 WKRetainPtr<WKStringRef> hostRef(AdoptWK, WKStringCreateWithUTF8CString(ewk_security_origin_host_get(origin)));
839 WKRetainPtr<WKSecurityOriginRef> originRef(AdoptWK, WKSecurityOriginCreate(protocolRef.get(), hostRef.get(), ewk_security_origin_port_get(origin)));
841 WKApplicationCacheManagerRef applicationCache = WKContextGetApplicationCacheManager(ewk_context_WKContext_get(ewkContext));
842 WKApplicationCacheManagerSetApplicationCacheQuotaForOrigin(applicationCache, originRef.get(), quota);
851 Eina_Bool ewk_context_icon_database_path_set(Ewk_Context* ewkContext, const char* path)
853 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
854 EINA_SAFETY_ON_NULL_RETURN_VAL(path, false);
856 WKRetainPtr<WKStringRef> databasePath(AdoptWK, WKStringCreateWithUTF8CString(path));
857 WKContextSetIconDatabasePath(ewk_context_WKContext_get(ewkContext), databasePath.get());
862 Evas_Object* ewk_context_icon_database_icon_object_add(Ewk_Context* ewkContext, const char* uri, Evas* canvas)
864 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, 0);
865 EINA_SAFETY_ON_NULL_RETURN_VAL(uri, 0);
866 EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0);
868 WKIconDatabaseRef iconDatabase = WKContextGetIconDatabase(ewk_context_WKContext_get(ewkContext));
869 WKRetainPtr<WKURLRef> urlString(AdoptWK, WKURLCreateWithUTF8CString(uri));
871 return WKIconDatabaseTryGetImageForURL(iconDatabase, canvas, urlString.get());
874 void ewk_context_icon_database_delete_all(Ewk_Context* ewkContext)
876 EINA_SAFETY_ON_NULL_RETURN(ewkContext);
878 WKIconDatabaseRef iconDatabase = WKContextGetIconDatabase(ewk_context_WKContext_get(ewkContext));
879 WKIconDatabaseRemoveAllIcons(iconDatabase);
882 Eina_Bool ewk_context_local_file_system_path_set(Ewk_Context* ewkContext, const char* path)
884 #if ENABLE(TIZEN_FILE_SYSTEM)
885 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
886 EINA_SAFETY_ON_NULL_RETURN_VAL(path, false);
888 TIZEN_LOGI("path (%s)", path);
889 WKRetainPtr<WKStringRef> localFileSystemPathRef(AdoptWK, WKStringCreateWithUTF8CString(path));
890 WKContextSetLocalFileSystemDirectory(ewk_context_WKContext_get(ewkContext), localFileSystemPathRef.get());
898 Eina_Bool ewk_context_local_file_system_all_delete(Ewk_Context* ewkContext)
900 #if ENABLE(TIZEN_FILE_SYSTEM)
901 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
903 TIZEN_LOGI("ewkContex (%p)", ewkContext);
904 WKLocalFileSystemManagerRef localFileSystemManager = WKContextGetLocalFileSystemManager(ewk_context_WKContext_get(ewkContext));
905 WKLocalFileSystemManagerDeleteAllLocalFileSystem(localFileSystemManager);
909 UNUSED_PARAM(ewkContext);
915 Eina_Bool ewk_context_local_file_system_delete(Ewk_Context* ewkContext, Ewk_Security_Origin* origin)
917 #if ENABLE(TIZEN_FILE_SYSTEM)
918 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
919 EINA_SAFETY_ON_NULL_RETURN_VAL(origin, false);
921 TIZEN_LOGI("host (%s)", ewk_security_origin_host_get(origin));
922 WKRetainPtr<WKStringRef> hostRef(AdoptWK, WKStringCreateWithUTF8CString(ewk_security_origin_host_get(origin)));
923 WKRetainPtr<WKStringRef> protocolRef(AdoptWK, WKStringCreateWithUTF8CString(ewk_security_origin_protocol_get(origin)));
924 WKRetainPtr<WKSecurityOriginRef> originRef(AdoptWK, WKSecurityOriginCreate(protocolRef.get(), hostRef.get(), ewk_security_origin_port_get(origin)));
925 WKLocalFileSystemManagerRef localFileSystemManager = WKContextGetLocalFileSystemManager(ewk_context_WKContext_get(ewkContext));
927 WKLocalFileSystemManagerDeleteLocalFileSystem(localFileSystemManager, originRef.get());
931 UNUSED_PARAM(ewkContext);
932 UNUSED_PARAM(origin);
938 Eina_Bool ewk_context_local_file_system_origins_get(const Ewk_Context* ewkContext, Ewk_Local_File_System_Origins_Get_Callback callback, void* userData)
940 #if ENABLE(TIZEN_FILE_SYSTEM)
941 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
942 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
944 TIZEN_LOGI("callback (%p)", callback);
945 Ewk_Context_Callback_Context* context = new Ewk_Context_Callback_Context;
946 context->localFileSystemOriginsCallback= callback;
947 context->userData = userData;
948 WKLocalFileSystemManagerRef localFileSystemManager = WKContextGetLocalFileSystemManager(ewk_context_WKContext_get(ewkContext));
950 WKLocalFileSystemManagerGetLocalFileSystemOrigins(localFileSystemManager, context, didGetLocalFileSystemOrigins);
954 UNUSED_PARAM(ewkContext);
955 UNUSED_PARAM(callback);
956 UNUSED_PARAM(userData);
962 Ewk_Security_Origin* ewk_context_web_database_exceeded_quota_security_origin_get(Ewk_Context_Exceeded_Quota* exceededQuota)
964 #if ENABLE(TIZEN_SQL_DATABASE)
965 EINA_SAFETY_ON_NULL_RETURN_VAL(exceededQuota, 0);
967 TIZEN_LOGI("host (%s)", ewk_security_origin_host_get(exceededQuota->origin));
968 return exceededQuota->origin;
974 const char* ewk_context_web_database_exceeded_quota_database_name_get(Ewk_Context_Exceeded_Quota* exceededQuota)
976 #if ENABLE(TIZEN_SQL_DATABASE)
977 EINA_SAFETY_ON_NULL_RETURN_VAL(exceededQuota, 0);
979 TIZEN_LOGI("name (%s)", exceededQuota->databaseName);
980 return exceededQuota->databaseName;
986 const char* ewk_context_web_database_exceeded_quota_display_name_get(Ewk_Context_Exceeded_Quota* exceededQuota)
988 #if ENABLE(TIZEN_SQL_DATABASE)
989 EINA_SAFETY_ON_NULL_RETURN_VAL(exceededQuota, 0);
991 TIZEN_LOGI("displayName (%s)", exceededQuota->displayName);
992 return exceededQuota->displayName;
998 unsigned long long ewk_context_web_database_exceeded_quota_current_quota_get(Ewk_Context_Exceeded_Quota* exceededQuota)
1000 #if ENABLE(TIZEN_SQL_DATABASE)
1001 EINA_SAFETY_ON_NULL_RETURN_VAL(exceededQuota, 0);
1003 TIZEN_LOGI("quota (%d)", exceededQuota->currentQuota);
1004 return exceededQuota->currentQuota;
1010 unsigned long long ewk_context_web_database_exceeded_quota_current_origin_usage_get(Ewk_Context_Exceeded_Quota* exceededQuota)
1012 #if ENABLE(TIZEN_SQL_DATABASE)
1013 EINA_SAFETY_ON_NULL_RETURN_VAL(exceededQuota, 0);
1015 TIZEN_LOGI("currentOriginUsage (%d)", exceededQuota->currentOriginUsage);
1016 return exceededQuota->currentOriginUsage;
1022 unsigned long long ewk_context_web_database_exceeded_quota_current_database_usage_get(Ewk_Context_Exceeded_Quota* exceededQuota)
1024 #if ENABLE(TIZEN_SQL_DATABASE)
1025 EINA_SAFETY_ON_NULL_RETURN_VAL(exceededQuota, 0);
1027 TIZEN_LOGI("currentDatabaseUsage (%d)", exceededQuota->currentDatabaseUsage);
1028 return exceededQuota->currentDatabaseUsage;
1034 unsigned long long ewk_context_web_database_exceeded_quota_expected_usage_get(Ewk_Context_Exceeded_Quota* exceededQuota)
1036 #if ENABLE(TIZEN_SQL_DATABASE)
1037 EINA_SAFETY_ON_NULL_RETURN_VAL(exceededQuota, 0);
1039 TIZEN_LOGI("expectedUsage (%d)", exceededQuota->expectedUsage);
1040 return exceededQuota->expectedUsage;
1046 void ewk_context_web_database_exceeded_quota_new_quota_set(Ewk_Context_Exceeded_Quota* exceededQuota, unsigned long long quota)
1048 #if ENABLE(TIZEN_SQL_DATABASE)
1049 EINA_SAFETY_ON_NULL_RETURN(exceededQuota);
1051 TIZEN_LOGI("quota (%d)", quota);
1052 exceededQuota->newQuota = quota;
1056 Eina_Bool ewk_context_web_database_delete_all(Ewk_Context* ewkContext)
1058 #if ENABLE(TIZEN_SQL_DATABASE)
1059 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
1061 TIZEN_LOGI("ewkContext (%p)", ewkContext);
1062 WKDatabaseManagerRef databaseManager = WKContextGetDatabaseManager(ewk_context_WKContext_get(ewkContext));
1063 WKDatabaseManagerDeleteAllDatabases(databaseManager);
1071 Eina_Bool ewk_context_web_database_delete(Ewk_Context* ewkContext, Ewk_Security_Origin* origin)
1073 #if ENABLE(TIZEN_SQL_DATABASE)
1074 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
1075 EINA_SAFETY_ON_NULL_RETURN_VAL(origin, false);
1077 TIZEN_LOGI("host (%s)", ewk_security_origin_host_get(origin));
1078 WKRetainPtr<WKStringRef> hostRef(AdoptWK, WKStringCreateWithUTF8CString(ewk_security_origin_host_get(origin)));
1079 WKRetainPtr<WKStringRef> protocolRef(AdoptWK, WKStringCreateWithUTF8CString(ewk_security_origin_protocol_get(origin)));
1080 WKRetainPtr<WKSecurityOriginRef> originRef(AdoptWK, WKSecurityOriginCreate(protocolRef.get(), hostRef.get(), ewk_security_origin_port_get(origin)));
1081 WKDatabaseManagerRef databaseManager = WKContextGetDatabaseManager(ewk_context_WKContext_get(ewkContext));
1082 WKDatabaseManagerDeleteDatabasesForOrigin(databaseManager, originRef.get());
1090 Eina_Bool ewk_context_web_database_origins_get(Ewk_Context* ewkContext, Ewk_Web_Database_Origins_Get_Callback callback, void* userData)
1092 #if ENABLE(TIZEN_SQL_DATABASE)
1093 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
1094 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
1096 TIZEN_LOGI("callback (%p)", callback);
1097 Ewk_Context_Callback_Context* context = new Ewk_Context_Callback_Context;
1098 context->webDatabaseOriginsCallback = callback;
1099 context->userData = userData;
1101 WKDatabaseManagerRef databaseManager = WKContextGetDatabaseManager(ewk_context_WKContext_get(ewkContext));
1102 WKDatabaseManagerGetDatabaseOrigins(databaseManager, context, didGetWebDatabaseOrigins);
1110 Eina_Bool ewk_context_web_database_path_set(Ewk_Context* ewkContext, const char* path)
1112 #if ENABLE(TIZEN_SQL_DATABASE)
1113 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
1114 EINA_SAFETY_ON_NULL_RETURN_VAL(path, false);
1116 TIZEN_LOGI("path (%s)", path);
1117 WKRetainPtr<WKStringRef> databasePath(AdoptWK, WKStringCreateWithUTF8CString(path));
1118 WKContextSetDatabaseDirectory(ewk_context_WKContext_get(ewkContext), databasePath.get());
1126 Eina_Bool ewk_context_web_database_path_get(Ewk_Context* ewkContext, Ewk_Web_Database_Path_Get_Callback callback, void* userData)
1128 #if ENABLE(TIZEN_WEB_STORAGE)
1129 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
1130 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
1132 TIZEN_LOGI("callback (%p)", callback);
1133 Ewk_Context_Callback_Context* context = new Ewk_Context_Callback_Context;
1134 context->webDatabasePathCallback= callback;
1135 context->userData = userData;
1137 WKDatabaseManagerRef databaseManager = WKContextGetDatabaseManager(ewk_context_WKContext_get(ewkContext));
1138 WKDatabaseManagerGetDatabasePath(databaseManager, context, didGetWebDatabasePath);
1144 Eina_Bool ewk_context_web_database_quota_for_origin_get(Ewk_Context* ewkContext, Ewk_Web_Database_Quota_Get_Callback callback, void* userData, Ewk_Security_Origin* origin)
1146 #if ENABLE(TIZEN_SQL_DATABASE)
1147 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
1148 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
1149 EINA_SAFETY_ON_NULL_RETURN_VAL(origin, false);
1151 TIZEN_LOGI("host (%s)", ewk_security_origin_host_get(origin));
1152 Ewk_Context_Callback_Context* context = new Ewk_Context_Callback_Context;
1153 context->webDatabaseQuotaCallback = callback;
1154 context->userData = userData;
1156 WKRetainPtr<WKStringRef> hostRef(AdoptWK, WKStringCreateWithUTF8CString(ewk_security_origin_host_get(origin)));
1157 WKRetainPtr<WKStringRef> protocolRef(AdoptWK, WKStringCreateWithUTF8CString(ewk_security_origin_protocol_get(origin)));
1158 WKRetainPtr<WKSecurityOriginRef> originRef(AdoptWK, WKSecurityOriginCreate(protocolRef.get(), hostRef.get(), ewk_security_origin_port_get(origin)));
1159 WKDatabaseManagerRef databaseManager = WKContextGetDatabaseManager(ewk_context_WKContext_get(ewkContext));
1160 WKDatabaseManagerGetQuotaForOrigin(databaseManager, context, didGetWebDatabaseQuota, originRef.get());
1168 Eina_Bool ewk_context_web_database_default_quota_set(Ewk_Context* ewkContext, uint64_t quota)
1170 #if ENABLE(TIZEN_SQL_DATABASE)
1171 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
1173 TIZEN_LOGI("quota (%d)", quota);
1174 ewkContext->defaultDatabaseQuota = quota;
1182 Eina_Bool ewk_context_web_database_quota_for_origin_set(Ewk_Context* ewkContext, Ewk_Security_Origin* origin, uint64_t quota)
1184 #if ENABLE(TIZEN_SQL_DATABASE)
1185 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
1186 EINA_SAFETY_ON_NULL_RETURN_VAL(origin, false);
1188 TIZEN_LOGI("host (%s) quota(%d)", ewk_security_origin_host_get(origin), quota);
1189 WKRetainPtr<WKStringRef> hostRef(AdoptWK, WKStringCreateWithUTF8CString(ewk_security_origin_host_get(origin)));
1190 WKRetainPtr<WKStringRef> protocolRef(AdoptWK, WKStringCreateWithUTF8CString(ewk_security_origin_protocol_get(origin)));
1191 WKRetainPtr<WKSecurityOriginRef> originRef(AdoptWK, WKSecurityOriginCreate(protocolRef.get(), hostRef.get(), ewk_security_origin_port_get(origin)));
1192 WKDatabaseManagerRef databaseManager = WKContextGetDatabaseManager(ewk_context_WKContext_get(ewkContext));
1193 WKDatabaseManagerSetQuotaForOrigin(databaseManager, originRef.get(), quota);
1201 Eina_Bool ewk_context_web_database_usage_for_origin_get(Ewk_Context* ewkContext, Ewk_Web_Database_Quota_Get_Callback callback, void* userData, Ewk_Security_Origin* origin)
1203 #if ENABLE(TIZEN_SQL_DATABASE)
1204 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
1205 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
1206 EINA_SAFETY_ON_NULL_RETURN_VAL(origin, false);
1208 TIZEN_LOGI("host (%s)", ewk_security_origin_host_get(origin));
1209 Ewk_Context_Callback_Context* context = new Ewk_Context_Callback_Context;
1210 context->webDatabaseQuotaCallback = callback;
1211 context->userData = userData;
1213 WKRetainPtr<WKStringRef> protocolRef(AdoptWK, WKStringCreateWithUTF8CString(ewk_security_origin_protocol_get(origin)));
1214 WKRetainPtr<WKStringRef> hostRef(AdoptWK, WKStringCreateWithUTF8CString(ewk_security_origin_host_get(origin)));
1215 WKRetainPtr<WKSecurityOriginRef> originRef(AdoptWK, WKSecurityOriginCreate(protocolRef.get(), hostRef.get(), ewk_security_origin_port_get(origin)));
1216 WKDatabaseManagerRef databaseManager = WKContextGetDatabaseManager(ewk_context_WKContext_get(ewkContext));
1217 WKDatabaseManagerGetUsageForOrigin(databaseManager, context, didGetWebDatabaseUsage, originRef.get());
1225 Eina_Bool ewk_context_web_indexed_database_delete_all(Ewk_Context* ewkContext)
1227 #if ENABLE(TIZEN_INDEXED_DATABASE)
1228 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
1230 TIZEN_LOGI("ewkContext (%p)", ewkContext);
1231 DEFINE_STATIC_LOCAL(const String, fileMatchPattern, ("*"));
1232 DEFINE_STATIC_LOCAL(const String, indexedDatabaseDirectory, ("/opt/apps/com.samsung.browser/data/.webkit/indexedDatabases"));
1234 Vector<String> paths = WebCore::listDirectory(indexedDatabaseDirectory, fileMatchPattern);
1235 Vector<String>::const_iterator end = paths.end();
1236 for(Vector<String>::const_iterator it = paths.begin(); it != end; ++it){
1238 #if ENABLE(TIZEN_FILE_SYSTEM)
1239 WebCore::removeDirectory(path);
1249 Eina_Bool ewk_context_web_storage_delete_all(Ewk_Context* ewkContext)
1251 #if ENABLE(TIZEN_WEB_STORAGE)
1252 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
1254 TIZEN_LOGI("ewkContext (%p)", ewkContext);
1255 WKKeyValueStorageManagerRef storageManager = WKContextGetKeyValueStorageManager(ewk_context_WKContext_get(ewkContext));
1256 WKKeyValueStorageManagerDeleteAllEntries(storageManager);
1264 Eina_Bool ewk_context_web_storage_origin_delete(Ewk_Context* ewkContext, Ewk_Security_Origin* origin)
1266 #if ENABLE(TIZEN_WEB_STORAGE)
1267 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
1268 EINA_SAFETY_ON_NULL_RETURN_VAL(origin, false);
1270 TIZEN_LOGI("host (%s)", ewk_security_origin_host_get(origin));
1271 WKRetainPtr<WKStringRef> hostRef(AdoptWK, WKStringCreateWithUTF8CString(ewk_security_origin_host_get(origin)));
1272 WKRetainPtr<WKStringRef> protocolRef(AdoptWK, WKStringCreateWithUTF8CString(ewk_security_origin_protocol_get(origin)));
1273 WKRetainPtr<WKSecurityOriginRef> securityOriginRef(AdoptWK, WKSecurityOriginCreate(protocolRef.get(), hostRef.get(), ewk_security_origin_port_get(origin)));
1274 WKKeyValueStorageManagerRef storageManager = WKContextGetKeyValueStorageManager(ewk_context_WKContext_get(ewkContext));
1275 WKKeyValueStorageManagerDeleteEntriesForOrigin(storageManager, securityOriginRef.get());
1283 Eina_Bool ewk_context_web_storage_origins_get(Ewk_Context* ewkContext, Ewk_Web_Storage_Origins_Get_Callback callback, void* userData)
1285 #if ENABLE(TIZEN_WEB_STORAGE)
1286 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
1287 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
1289 TIZEN_LOGI("callback (%p)", callback);
1290 Ewk_Context_Callback_Context* context = new Ewk_Context_Callback_Context;
1291 context->webStorageOriginsCallback = callback;
1292 context->userData = userData;
1294 WKKeyValueStorageManagerRef storageManager = WKContextGetKeyValueStorageManager(ewk_context_WKContext_get(ewkContext));
1295 WKKeyValueStorageManagerGetKeyValueStorageOrigins(storageManager, context, didGetWebStorageOrigins);
1303 Eina_Bool ewk_context_web_storage_path_set(Ewk_Context* ewkContext, const char* path)
1305 #if ENABLE(TIZEN_WEB_STORAGE)
1306 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
1307 EINA_SAFETY_ON_NULL_RETURN_VAL(path, false);
1309 TIZEN_LOGI("path (%s)", path);
1310 WKRetainPtr<WKStringRef> webStoragePath(AdoptWK, WKStringCreateWithUTF8CString(path));
1311 WKContextSetLocalStorageDirectory(ewk_context_WKContext_get(ewkContext), webStoragePath.get());
1319 Eina_Bool ewk_context_web_storage_path_get(Ewk_Context* ewkContext, Ewk_Web_Storage_Path_Get_Callback callback, void* userData)
1321 #if ENABLE(TIZEN_WEB_STORAGE)
1322 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
1323 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
1325 TIZEN_LOGI("callback (%p)", callback);
1326 Ewk_Context_Callback_Context* context = new Ewk_Context_Callback_Context;
1327 context->webStoragePathCallback= callback;
1328 context->userData = userData;
1330 WKKeyValueStorageManagerRef storageManager = WKContextGetKeyValueStorageManager(ewk_context_WKContext_get(ewkContext));
1331 WKKeyValueStorageManagerGetKeyValueStoragePath(storageManager, context, didGetWebStoragePath);
1337 Eina_Bool ewk_context_web_storage_usage_for_origin_get(Ewk_Context* ewkContext, Ewk_Security_Origin* origin, Ewk_Web_Storage_Usage_Get_Callback callback, void* userData)
1339 #if ENABLE(TIZEN_WEB_STORAGE) && ENABLE(TIZEN_WEBKIT2_NUMBER_TYPE_SUPPORT)
1340 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
1341 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
1342 EINA_SAFETY_ON_NULL_RETURN_VAL(origin, false);
1344 TIZEN_LOGI("host (%s)", ewk_security_origin_host_get(origin));
1345 Ewk_Context_Callback_Context* context = new Ewk_Context_Callback_Context;
1346 context->webStorageUsageCallback = callback;
1347 context->userData = userData;
1348 WKRetainPtr<WKStringRef> protocolRef(AdoptWK, WKStringCreateWithUTF8CString(ewk_security_origin_protocol_get(origin)));
1349 WKRetainPtr<WKStringRef> hostRef(AdoptWK, WKStringCreateWithUTF8CString(ewk_security_origin_host_get(origin)));
1350 WKRetainPtr<WKSecurityOriginRef> originRef(AdoptWK, WKSecurityOriginCreate(protocolRef.get(), hostRef.get(), ewk_security_origin_port_get(origin)));
1352 WKKeyValueStorageManagerRef storageManager = WKContextGetKeyValueStorageManager(ewk_context_WKContext_get(ewkContext));
1353 WKKeyValueStorageManagerGetKeyValueStorageUsageForOrigin(storageManager, context, didGetWebStorageUsage, originRef.get());
1361 //#if ENABLE(TIZEN_SOUP_COOKIE_CACHE_FOR_WEBKIT2)
1362 Eina_Bool ewk_context_soup_data_directory_set(Ewk_Context* ewkContext, const char* path)
1364 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
1365 EINA_SAFETY_ON_NULL_RETURN_VAL(path, false);
1367 WKRetainPtr<WKStringRef> soupDataDirectory(AdoptWK, WKStringCreateWithUTF8CString(path));
1368 WKContextSetSoupDataDirectory(ewk_context_WKContext_get(ewkContext), soupDataDirectory.get());
1373 Eina_Bool ewk_context_cache_model_set(Ewk_Context* ewkContext, Ewk_Cache_Model model)
1375 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
1376 if (model == EWK_CACHE_MODEL_DOCUMENT_VIEWER)
1377 WKContextSetCacheModel(ewk_context_WKContext_get(ewkContext), kWKCacheModelDocumentViewer);
1378 else if (model == EWK_CACHE_MODEL_DOCUMENT_BROWSER)
1379 WKContextSetCacheModel(ewk_context_WKContext_get(ewkContext), kWKCacheModelDocumentBrowser);
1381 WKContextSetCacheModel(ewk_context_WKContext_get(ewkContext), kWKCacheModelPrimaryWebBrowser);
1386 Ewk_Cache_Model ewk_context_cache_model_get(Ewk_Context* ewkContext)
1388 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, EWK_CACHE_MODEL_DOCUMENT_VIEWER);
1389 WKCacheModel cacheModel = WKContextGetCacheModel(ewk_context_WKContext_get(ewkContext));
1391 if (cacheModel == kWKCacheModelDocumentViewer)
1392 return EWK_CACHE_MODEL_DOCUMENT_VIEWER;
1393 else if (cacheModel == kWKCacheModelDocumentBrowser)
1394 return EWK_CACHE_MODEL_DOCUMENT_BROWSER;
1396 return EWK_CACHE_MODEL_PRIMARY_WEBBROWSER;
1399 Eina_Bool ewk_context_cache_disabled_set(Ewk_Context* ewkContext, Eina_Bool cacheDisabled)
1401 #if ENABLE(TIZEN_CACHE_CONTROL)
1402 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
1403 WKContextSetCacheDisabled(ewk_context_WKContext_get(ewkContext), cacheDisabled);
1409 Eina_Bool ewk_context_cache_disabled_get(Ewk_Context* ewkContext)
1411 #if ENABLE(TIZEN_CACHE_CONTROL)
1412 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
1413 return WKContextGetCacheDisabled(ewk_context_WKContext_get(ewkContext));
1419 Eina_Bool ewk_context_certificate_file_set(Ewk_Context* context, const char* certificateFile)
1421 EINA_SAFETY_ON_NULL_RETURN_VAL(context, false);
1422 EINA_SAFETY_ON_NULL_RETURN_VAL(certificateFile, false);
1423 #if ENABLE(TIZEN_CERTIFICATE_HANDLING)
1424 eina_stringshare_replace(&context->certificateFile, certificateFile);
1426 if (!fileExists(WTF::String::fromUTF8(certificateFile)))
1427 LOG_ERROR("[Network] ewk_context_certificate_file_set certificateFile does not exist!\n");
1429 WKRetainPtr<WKStringRef> certificateFileRef(AdoptWK, WKStringCreateWithUTF8CString(certificateFile));
1430 WKContextSetCertificateFile(ewk_context_WKContext_get(context), certificateFileRef.get());
1433 UNUSED_PARAM(context);
1434 UNUSED_PARAM(certificateFile);
1439 const char* ewk_context_certificate_file_get(const Ewk_Context* context)
1441 EINA_SAFETY_ON_NULL_RETURN_VAL(context, 0);
1442 #if ENABLE(TIZEN_CERTIFICATE_HANDLING)
1443 return context->certificateFile;
1445 UNUSED_PARAM(context);
1450 Eina_Bool ewk_context_cache_clear(Ewk_Context* ewkContext)
1452 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
1453 WKResourceCacheManagerRef cacheManager = WKContextGetResourceCacheManager(ewk_context_WKContext_get(ewkContext));
1454 #if ENABLE(TIZEN_EWK_CONTEXT_CACHE_MANAGER_NULL_CHECK_WORKAROUND)
1458 WKResourceCacheManagerClearCacheForAllOrigins(cacheManager, WKResourceCachesToClearAll);
1463 #if ENABLE(TIZEN_CACHE_DUMP_SYNC)
1466 * Request WebProcess to dump cache.
1468 * This sends sync message to WebProcess to dump memory cache, that is, soup cache.
1470 * @param context context object
1472 * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
1474 * @note This can effect UIProcess's performance because it calls to sync IPC message eventually.
1476 void ewk_context_cache_dump(Ewk_Context* ewkContext)
1478 EINA_SAFETY_ON_NULL_RETURN(ewkContext);
1479 WKResourceCacheManagerRef cacheManager = WKContextGetResourceCacheManager(ewk_context_WKContext_get(ewkContext));
1480 toImpl(cacheManager)->dumpCache();
1484 void ewk_context_message_post_to_injected_bundle(Ewk_Context* ewkContext, const char* name, const char* body)
1486 EINA_SAFETY_ON_NULL_RETURN(ewkContext);
1487 EINA_SAFETY_ON_NULL_RETURN(name);
1488 EINA_SAFETY_ON_NULL_RETURN(body);
1490 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString(name));
1491 WKRetainPtr<WKStringRef> messageBody(AdoptWK, WKStringCreateWithUTF8CString(body));
1492 WKContextPostMessageToInjectedBundle(ewk_context_WKContext_get(ewkContext), messageName.get(), messageBody.get());
1495 void ewk_context_message_from_injected_bundle_callback_set(Ewk_Context* ewkContext, Ewk_Context_Message_From_Injected_Bundle_Callback callback, void* userData)
1497 EINA_SAFETY_ON_NULL_RETURN(ewkContext);
1499 ewkContext->messageFromInjectedBundle.callback = callback;
1500 ewkContext->messageFromInjectedBundle.userData = userData;
1503 void ewkContextDidReceiveMessageFromInjectedBundle(Ewk_Context* ewkContext, WKStringRef messageName, WKTypeRef messageBody, WKTypeRef* returnData)
1505 EINA_SAFETY_ON_NULL_RETURN(ewkContext);
1507 if (!ewkContext->messageFromInjectedBundle.callback)
1510 CString name = toImpl(messageName)->string().utf8();
1512 if (messageBody && WKStringGetTypeID() == WKGetTypeID(messageBody))
1513 body = toImpl(static_cast<WKStringRef>(messageBody))->string().utf8();
1516 char* returnString = 0;
1517 ewkContext->messageFromInjectedBundle.callback(name.data(), body.data(), &returnString,
1518 ewkContext->messageFromInjectedBundle.userData);
1520 *returnData = WKStringCreateWithUTF8CString(returnString);
1523 *returnData = WKStringCreateWithUTF8CString("");
1526 ewkContext->messageFromInjectedBundle.callback(name.data(), body.data(), 0,
1527 ewkContext->messageFromInjectedBundle.userData);
1531 void ewk_context_did_start_download_callback_set(Ewk_Context* ewkContext, Ewk_Context_Did_Start_Download_Callback callback, void* userData)
1533 EINA_SAFETY_ON_NULL_RETURN(ewkContext);
1535 ewkContext->didStartDownload.callback = callback;
1536 ewkContext->didStartDownload.userData = userData;
1539 void ewkContextDidStartDownload(Ewk_Context* ewkContext, WKStringRef downloadURL)
1541 EINA_SAFETY_ON_NULL_RETURN(ewkContext);
1542 EINA_SAFETY_ON_NULL_RETURN(ewkContext->didStartDownload.callback);
1544 ewkContext->didStartDownload.callback(toImpl(downloadURL)->string().utf8().data(), ewkContext->didStartDownload.userData);
1547 #if ENABLE(MEMORY_SAMPLER)
1548 void ewk_context_memory_sampler_start(Ewk_Context* ewkContext, double timerInterval)
1550 EINA_SAFETY_ON_NULL_RETURN(ewkContext);
1551 WKRetainPtr<WKDoubleRef> interval(AdoptWK, WKDoubleCreate(timerInterval));
1552 WKContextStartMemorySampler(ewk_context_WKContext_get(ewkContext), interval.get());
1555 void ewk_context_memory_sampler_stop(Ewk_Context* ewkContext)
1557 EINA_SAFETY_ON_NULL_RETURN(ewkContext);
1558 WKContextStopMemorySampler(ewk_context_WKContext_get(ewkContext));
1562 #if ENABLE(TIZEN_CACHE_MEMORY_OPTIMIZATION)
1563 Eina_Bool ewk_context_decoded_data_clear_all(Ewk_Context* ewkContext)
1565 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
1566 WKResourceCacheManagerRef cacheManager = WKContextGetResourceCacheManager(ewk_context_WKContext_get(ewkContext));
1567 WKResourceCacheManagerClearCacheForAllOrigins(cacheManager, WKResourceCachesToClearInDecodedDataOnly);
1573 Eina_Bool ewk_context_additional_plugin_path_set(Ewk_Context* ewkContext, const char* path)
1575 #if ENABLE(TIZEN_SUPPORT_PLUGINS)
1576 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
1577 EINA_SAFETY_ON_NULL_RETURN_VAL(path, false);
1579 WKRetainPtr<WKStringRef> pluginPath(AdoptWK, WKStringCreateWithUTF8CString(path));
1580 WKContextSetAdditionalPluginsDirectory(ewk_context_WKContext_get(ewkContext), pluginPath.get());
1588 #if ENABLE(TIZEN_WEBKIT2_MEMORY_SAVING_MODE)
1589 void ewk_context_memory_saving_mode_set(Ewk_Context* ewkContext, Eina_Bool mode)
1591 EINA_SAFETY_ON_NULL_RETURN(ewkContext);
1593 WKContextRef contextRef = ewk_context_WKContext_get(ewkContext);
1594 toImpl(contextRef)->setMemorySavingMode(mode);
1598 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_X_WINDOW)
1599 Ecore_X_Window ewk_context_x_window_get(Ewk_Context* ewkContext)
1601 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, 0);
1602 return ewkContext->xWindow;
1605 void ewk_context_x_window_set(Ewk_Context* ewkContext, Ecore_X_Window xWindow)
1607 EINA_SAFETY_ON_NULL_RETURN(ewkContext);
1608 WKContextRef contextRef = ewk_context_WKContext_get(ewkContext);
1609 toImpl(contextRef)->setXWindow(xWindow);
1613 #if ENABLE(TIZEN_WEBKIT2_FORM_DATABASE)
1614 void ewk_context_form_data_add(Ewk_Context* ewkContext, const char* url, WKDictionaryRef& formData, bool isPasswordForm)
1616 EINA_SAFETY_ON_NULL_RETURN(ewkContext);
1617 EINA_SAFETY_ON_NULL_RETURN(url);
1618 if (!ewkContext->formDatabase->isOpen())
1621 Vector<std::pair<String, String> > formDataVector;
1622 WKRetainPtr<WKArrayRef> wkKeys(AdoptWK, WKDictionaryCopyKeys(formData));
1623 size_t numKeys = WKArrayGetSize(wkKeys.get());
1624 for (size_t i = 0; i < numKeys; ++i) {
1625 WKStringRef wkKey = static_cast<WKStringRef>(WKArrayGetItemAtIndex(wkKeys.get(), i));
1626 WKStringRef wkValue = static_cast<WKStringRef>(WKDictionaryGetItemForKey(formData, wkKey));
1628 int length = WKStringGetMaximumUTF8CStringSize(wkKey);
1631 OwnArrayPtr<char> keyBuffer = adoptArrayPtr(new char[length]);
1632 WKStringGetUTF8CString(wkKey, keyBuffer.get(), length);
1634 length = WKStringGetMaximumUTF8CStringSize(wkValue);
1637 OwnArrayPtr<char> valueBuffer = adoptArrayPtr(new char[length]);
1638 WKStringGetUTF8CString(wkValue, valueBuffer.get(), length);
1639 formDataVector.append(pair<String, String>(keyBuffer.get(), valueBuffer.get()));
1642 ewkContext->formDatabase->addFormDataForURL(String::fromUTF8(url), formDataVector, isPasswordForm);
1645 void ewk_context_form_password_data_get(Ewk_Context* ewkContext, const char* url, Vector<std::pair<String, String> >& passwordFormData)
1647 EINA_SAFETY_ON_NULL_RETURN(ewkContext);
1648 EINA_SAFETY_ON_NULL_RETURN(url);
1649 if (!ewkContext->formDatabase->isOpen())
1651 ewkContext->formDatabase->getPasswordFormDataForURL(String::fromUTF8(url), passwordFormData);
1654 void ewk_context_form_candidate_data_get(Ewk_Context* ewkContext, const String& name, Vector<String>& candidates)
1656 EINA_SAFETY_ON_NULL_RETURN(ewkContext);
1657 if (!ewkContext->formDatabase->isOpen())
1659 ewkContext->formDatabase->getCandidateFormDataForName(name, candidates);
1662 void ewk_context_form_password_data_clear(Ewk_Context* ewkContext)
1664 EINA_SAFETY_ON_NULL_RETURN(ewkContext);
1665 ewkContext->formDatabase->clearPasswordFormData();
1668 void ewk_context_form_candidate_data_clear(Ewk_Context* ewkContext)
1670 EINA_SAFETY_ON_NULL_RETURN(ewkContext);
1671 ewkContext->formDatabase->clearCandidateFormData();
1674 #endif // #if OS(TIZEN)
1676 Eina_Bool ewk_context_url_scheme_register(Ewk_Context* ewkContext, const char* scheme, Ewk_Url_Scheme_Request_Cb callback, void* userData)
1678 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
1679 EINA_SAFETY_ON_NULL_RETURN_VAL(scheme, false);
1680 EINA_SAFETY_ON_NULL_RETURN_VAL(callback, false);
1682 ewkContext->urlSchemeHandlers.set(String::fromUTF8(scheme), _Ewk_Url_Scheme_Handler(callback, userData));
1683 WKRetainPtr<WKStringRef> wkScheme(AdoptWK, WKStringCreateWithUTF8CString(scheme));
1684 WKSoupRequestManagerRegisterURIScheme(ewkContext->requestManager.get(), wkScheme.get());
1689 void ewk_context_vibration_client_callbacks_set(Ewk_Context* ewkContext, Ewk_Vibration_Client_Vibrate_Cb vibrate, Ewk_Vibration_Client_Vibration_Cancel_Cb cancel, void* data)
1691 EINA_SAFETY_ON_NULL_RETURN(ewkContext);
1693 TIZEN_LOGI("vibrate (%p)", vibrate);
1694 #if ENABLE(VIBRATION)
1695 ewkContext->vibrationProvider->setVibrationClientCallbacks(vibrate, cancel, data);
1699 Eina_Bool ewk_context_tizen_extensible_api_set(Ewk_Context* ewkContext, Ewk_Extensible_API extensibleAPI, Eina_Bool enable)
1701 #if ENABLE(TIZEN_EXTENSIBLE_API)
1702 EINA_SAFETY_ON_NULL_RETURN_VAL(ewkContext, false);
1704 TIZEN_LOGI("extensibleAPI (%d) enable (%d)", extensibleAPI, enable);
1705 WKContextSetTizenExtensibleAPI(ewk_context_WKContext_get(ewkContext), static_cast<WKTizenExtensibleAPI>(extensibleAPI), enable);
1709 UNUSED_PARAM(ewkContext);
1710 UNUSED_PARAM(extensibleAPI);
1711 UNUSED_PARAM(enable);
1717 void ewk_context_storage_path_reset(Ewk_Context* ewkContext)
1719 #if ENABLE(TIZEN_RESET_PATH)
1720 EINA_SAFETY_ON_NULL_RETURN(ewkContext);
1722 TIZEN_LOGI("ewkContext (%p)", ewkContext);
1723 WKContextResetStoragePath(ewk_context_WKContext_get(ewkContext));
1725 UNUSED_PARAM(ewkContext);