#include "ewk_geolocation.h"
#if ENABLE(TIZEN_GEOLOCATION)
+#include "EwkViewImpl.h"
#include "WKAPICast.h"
#include "WKGeolocationManager.h"
#include "WKGeolocationPermissionRequest.h"
struct _Ewk_Geolocation_Permission_Request {
WKRetainPtr<WKGeolocationPermissionRequestRef> requestRef;
- Evas_Object* ewkView;
+ WKPageRef page;
Ewk_Security_Origin* origin;
bool isDecided;
bool isSuspended;
- _Ewk_Geolocation_Permission_Request(Evas_Object* ewkView, WKRetainPtr<WKGeolocationPermissionRequestRef> geolocationPermissionRequestRef, WKSecurityOriginRef originRef)
+ _Ewk_Geolocation_Permission_Request(WKPageRef pageRef, WKRetainPtr<WKGeolocationPermissionRequestRef> geolocationPermissionRequestRef, WKSecurityOriginRef originRef)
: requestRef(geolocationPermissionRequestRef)
- , ewkView(ewkView)
+ , page(pageRef)
, isDecided(false)
, isSuspended(false)
{
}
};
-Ewk_Geolocation_Permission_Request* ewkGeolocationCreatePermissionRequest(Evas_Object* ewkView, WKGeolocationPermissionRequestRef geolocationPermissionRequestRef, WKSecurityOriginRef originRef)
+Ewk_Geolocation_Permission_Request* ewkGeolocationCreatePermissionRequest(WKPageRef pageRef, WKGeolocationPermissionRequestRef geolocationPermissionRequestRef, WKSecurityOriginRef originRef)
{
- return new Ewk_Geolocation_Permission_Request(ewkView, geolocationPermissionRequestRef, originRef);
+ return new Ewk_Geolocation_Permission_Request(pageRef, geolocationPermissionRequestRef, originRef);
}
void ewkGeolocationDeletePermissionRequestList(Eina_List* requestList)
permissionRequest->isDecided = true;
- allow ? WKGeolocationPermissionRequestAllow(permissionRequest->requestRef.get()) : WKGeolocationPermissionRequestDeny(permissionRequest->requestRef.get());
-
- ewkViewDeleteGeolocationPermission(permissionRequest->ewkView, permissionRequest);
+ Evas_Object* ewkView = const_cast<Evas_Object*>(EwkViewImpl::viewFromPageViewMap(permissionRequest->page));
+ if (ewkView) {
+ allow ? WKGeolocationPermissionRequestAllow(permissionRequest->requestRef.get()) : WKGeolocationPermissionRequestDeny(permissionRequest->requestRef.get());
+ ewkViewDeleteGeolocationPermission(ewkView, permissionRequest);
+ }
delete permissionRequest;
return true;
typedef struct _Ewk_Geolocation_Permission_Data Ewk_Geolocation_Permission_Data;
-Ewk_Geolocation_Permission_Request* ewkGeolocationCreatePermissionRequest(Evas_Object* ewkView, WKGeolocationPermissionRequestRef, WKSecurityOriginRef);
+Ewk_Geolocation_Permission_Request* ewkGeolocationCreatePermissionRequest(WKPageRef, WKGeolocationPermissionRequestRef, WKSecurityOriginRef);
void ewkGeolocationDeletePermissionRequestList(Eina_List* requestList);
bool ewkGeolocationIsPermissionRequestSuspended(const Ewk_Geolocation_Permission_Request*);
bool ewkGeolocationIsPermissionRequestDecided(const Ewk_Geolocation_Permission_Request*);
return ewkViewRunOpenPanel(toPageUIClientEfl(clientInfo)->m_viewImpl->view(), parameters, listener);
}
-void PageUIClientEfl::decidePolicyForGeolocationPermissionRequest(WKPageRef, WKFrameRef, WKSecurityOriginRef origin, WKGeolocationPermissionRequestRef permissionRequest, const void* clientInfo)
+void PageUIClientEfl::decidePolicyForGeolocationPermissionRequest(WKPageRef page, WKFrameRef, WKSecurityOriginRef origin, WKGeolocationPermissionRequestRef permissionRequest, const void* clientInfo)
{
#if ENABLE(TIZEN_GEOLOCATION)
Evas_Object* ewkView = toPageUIClientEfl(clientInfo)->m_viewImpl->view();
- Ewk_Geolocation_Permission_Request* geolocationPermissionRequest = ewkGeolocationCreatePermissionRequest(ewkView, permissionRequest, origin);
+ Ewk_Geolocation_Permission_Request* geolocationPermissionRequest = ewkGeolocationCreatePermissionRequest(page, permissionRequest, origin);
ewkViewRequestGeolocationPermission(ewkView, geolocationPermissionRequest);
if(!ewkGeolocationIsPermissionRequestSuspended(geolocationPermissionRequest))