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_user_media.h"
23 #if ENABLE(TIZEN_MEDIA_STREAM)
24 #include "WKAPICast.h"
25 #include "WKUserMediaPermissionRequest.h"
26 #include "WKRetainPtr.h"
27 #include "ewk_view_private.h"
29 struct _Ewk_User_Media_Permission_Request {
30 WKRetainPtr<WKUserMediaPermissionRequestRef> requestRef;
35 _Ewk_User_Media_Permission_Request(Evas_Object* ewkView, WKRetainPtr<WKUserMediaPermissionRequestRef> userMediaPermissionRequestRef)
36 : requestRef(userMediaPermissionRequestRef)
43 Ewk_User_Media_Permission_Request* ewkUserMediaPermissionRequestCreate(Evas_Object* ewkView, WKUserMediaPermissionRequestRef userMediaPermissionRequestRef)
45 return new Ewk_User_Media_Permission_Request(ewkView, userMediaPermissionRequestRef);
48 void ewkUserMediaDeletePermissionRequestList(Eina_List* requestList)
51 EINA_LIST_FREE(requestList, data)
52 delete (static_cast<Ewk_User_Media_Permission_Request*>(data));
55 bool ewkUserMediaPermissionRequestDecided(Ewk_User_Media_Permission_Request* permissionRequest)
57 return permissionRequest->isDecided;
60 bool ewkUserMediaPermissionRequestSuspended(Ewk_User_Media_Permission_Request* permissionRequest)
62 return permissionRequest->isSuspended;
66 Eina_Bool ewk_user_media_permission_request_suspend(Ewk_User_Media_Permission_Request* permissionRequest)
68 #if ENABLE(TIZEN_MEDIA_STREAM)
69 EINA_SAFETY_ON_NULL_RETURN_VAL(permissionRequest, false);
70 EINA_SAFETY_ON_NULL_RETURN_VAL(permissionRequest->requestRef, false);
72 permissionRequest->isSuspended = true;
76 UNUSED_PARAM(permissionRequest);
81 void ewk_user_media_permission_request_set(Ewk_User_Media_Permission_Request* permissionRequest, Eina_Bool allowed)
83 #if ENABLE(TIZEN_MEDIA_STREAM)
84 #if ENABLE(TIZEN_DLOG_SUPPORT)
85 TIZEN_LOGI("Allowed : %d", allowed);
87 EINA_SAFETY_ON_NULL_RETURN(permissionRequest);
89 permissionRequest->isDecided = true;
92 WKUserMediaPermissionRequestAllow(permissionRequest->requestRef.get());
94 WKUserMediaPermissionRequestDeny(permissionRequest->requestRef.get());
96 ewkViewDeleteUserMediaPermissionRequest(permissionRequest->ewkView, permissionRequest);
97 delete permissionRequest;
99 UNUSED_PARAM(permissionRequest);
100 UNUSED_PARAM(allowed);