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_private.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 #if ENABLE(TIZEN_DLOG_SUPPORT)
41 Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo));
42 Ewk_User_Media_Permission_Request* userMediaPermissionRequest = ewkUserMediaPermissionRequestCreate(ewkView, permissionRequest);
43 ewkViewRequestUserMediaPermission(ewkView, userMediaPermissionRequest);
47 static void processJSBridgePlugin(WKPageRef page, WKStringRef request, WKStringRef message, const void* clientInfo)
49 #if ENABLE(TIZEN_JSBRIDGE_PLUGIN)
50 ewkViewProcessJSBridgePlugin(static_cast<Evas_Object*>(const_cast<void*>(clientInfo)), request, message);
54 static bool decidePolicyForCertificateError(WKPageRef page, WKStringRef url, WKStringRef certificate, int error, const void* clientInfo)
56 #if ENABLE(TIZEN_CERTIFICATE_HANDLING)
57 Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo));
59 Ewk_Certificate_Policy_Decision* certificatePolicyDecision = ewkCertificatePolicyDecisionCreate(page, url, certificate, error);
60 ewkViewRequestCertificateConfirm(ewkView, certificatePolicyDecision);
62 if (!ewkCertificatePolicyDecisionDecided(certificatePolicyDecision) && !ewkCertificatePolicyDecisionSuspended(certificatePolicyDecision))
63 ewk_certificate_policy_decision_allowed_set(certificatePolicyDecision, true);
71 void ewkViewTizenClientAttachClient(Evas_Object* ewkView)
73 EINA_SAFETY_ON_NULL_RETURN(ewkView);
75 WKPageTizenClient tizenClient = {
76 kWKPageTizenClientCurrentVersion,
77 ewkView, // clientInfo
79 decidePolicyForUserMediaPermissionRequest,
80 processJSBridgePlugin,
81 decidePolicyForCertificateError
84 WKPageSetPageTizenClient(toAPI(ewk_view_page_get(ewkView)), &tizenClient);
87 #endif // #if OS(TIZEN)