#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;