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 library 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 library; 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.
21 #include "ewk_view_tizen_client.h"
25 #include "WKPageTizen.h"
27 #include "ewk_view_private.h"
28 #include "ewk_user_media_permission.h"
30 #if ENABLE(TIZEN_CERTIFICATE_HANDLING)
31 #include "ewk_certificate.h"
34 static void decidePolicyForUserMediaPermissionRequest(WKPageRef page, WKUserMediaPermissionRequestRef permissionRequest, const void *clientInfo)
36 #if ENABLE(TIZEN_MEDIA_STREAM)
37 Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo));
38 Ewk_User_Media_Permission* userMediaPermission = ewkUserMediaPermissionCreate(permissionRequest);
39 ewkViewRequestUserMediaPermission(ewkView, userMediaPermission);
43 static void processJSBridgePlugin(WKPageRef page, WKStringRef request, WKStringRef message, const void* clientInfo)
45 #if ENABLE(TIZEN_JSBRIDGE_PLUGIN)
46 ewkViewProcessJSBridgePlugin(static_cast<Evas_Object*>(const_cast<void*>(clientInfo)), request, message);
50 static bool decidePolicyForCertificateError(WKPageRef page, WKStringRef url, WKStringRef certificate, int error, const void* clientInfo)
52 #if ENABLE(TIZEN_CERTIFICATE_HANDLING)
53 Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo));
55 Ewk_Certificate_Policy_Decision* certificatePolicyDecision = ewkCertificatePolicyDecisionCreate(page, url, certificate, error);
56 ewkViewRequestCertificateConfirm(ewkView, certificatePolicyDecision);
58 if (!ewkCertificatePolicyDecisionDecided(certificatePolicyDecision) && !ewkCertificatePolicyDecisionSuspended(certificatePolicyDecision))
59 ewk_certificate_policy_decision_allowed_set(certificatePolicyDecision, true);
67 static bool allowFileSystem(WKPageRef page, WKFrameRef frame, WKSecurityOriginRef origin, const void* clientInfo)
69 #if ENABLE(TIZEN_FILE_SYSTEM)
70 return ewkViewAllowFileSystem(static_cast<Evas_Object*>(const_cast<void*>(clientInfo)), origin);
76 void ewkViewTizenClientAttachClient(Evas_Object* ewkView)
78 EINA_SAFETY_ON_NULL_RETURN(ewkView);
80 WKPageTizenClient tizenClient = {
81 kWKPageTizenClientCurrentVersion,
82 ewkView, // clientInfo
84 decidePolicyForUserMediaPermissionRequest,
85 processJSBridgePlugin,
86 decidePolicyForCertificateError,
90 WKPageSetPageTizenClient(toAPI(ewk_view_page_get(ewkView)), &tizenClient);
93 #endif // #if OS(TIZEN)