#include <string>
#include <sstream>
#include <dpl/log/secure_log.h>
+#include <dpl/unused.h>
#include <dpl/assert.h>
#include <wrt-commons/security-origin-dao/security_origin_dao_types.h>
#include <wrt-commons/security-origin-dao/security_origin_dao.h>
void askUserForWebStorageCreatePermission(
Evas_Object* window,
PermissionData* data);
+void setPermissionResult(PermissionData* permData, Result result);
static void popupCallback(void* data, Evas_Object* obj, void* eventInfo);
+static void eaKeyCallback(void* data, Evas_Object* obj, void* eventInfo);
void askUserForWebStorageCreatePermission(
Evas_Object* window,
body.c_str(),
WRT_BODY_REMEMBER_PREFERENCE,
popupCallback,
- NULL,
+ eaKeyCallback,
data);
if (popup == NULL) {
}
}
-void popupCallback(void* data, Evas_Object* obj, void* /*eventInfo*/)
+void setPermissionResult(PermissionData* permData, Result result)
{
- Assert(data);
- PermissionData* permData = static_cast<PermissionData*>(data);
+ Assert(permData);
WebStoragePermissionData* webStoragePermissionData =
static_cast<WebStoragePermissionData*>(permData->m_data);
- Evas_Object* ewkView =
- static_cast<Evas_Object*>(webStoragePermissionData->m_ewkView);
- Evas_Object* popup = getPopup(obj);
- Result result = getResult(obj);
- _D("result : %d", result);
if (result != RESULT_UNKNOWN) {
- permData->m_originDao->setSecurityOriginData(permData->m_originData,
- result);
+ permData->m_originDao->setSecurityOriginData(permData->m_originData, result);
}
- Eina_Bool ret =
- (result == RESULT_ALLOW_ALWAYS || result == RESULT_ALLOW_ONCE) ?
- EINA_TRUE : EINA_FALSE;
- webStoragePermissionData->m_replyEAPI(ewkView, ret);
+ Eina_Bool ret = (result == RESULT_ALLOW_ALWAYS || result == RESULT_ALLOW_ONCE) ? EINA_TRUE : EINA_FALSE;
+ webStoragePermissionData->m_replyEAPI(webStoragePermissionData->m_ewkView, ret);
+}
+
+void popupCallback(void* data, Evas_Object* obj, void* eventInfo)
+{
+ Assert(data);
+ Assert(obj);
+ DPL_UNUSED_PARAM(eventInfo);
+
+ PermissionData* permData = static_cast<PermissionData*>(data);
+ setPermissionResult(permData, getResult(obj));
+ WebStoragePermissionData* webStoragePermissionData =
+ static_cast<WebStoragePermissionData*>(permData->m_data);
delete webStoragePermissionData;
delete permData;
+
+ Evas_Object* popup = getPopup(obj);
evas_object_hide(popup);
evas_object_del(popup);
}
+
+void eaKeyCallback(void* data, Evas_Object* obj, void* eventInfo)
+{
+ _D("called");
+
+ Assert(data);
+ Assert(obj);
+
+ DPL_UNUSED_PARAM(eventInfo);
+
+ PermissionData* permData = static_cast<PermissionData*>(data);
+ setPermissionResult(permData, RESULT_DENY_ONCE);
+
+ WebStoragePermissionData* webStoragePermissionData =
+ static_cast<WebStoragePermissionData*>(permData->m_data);
+ delete webStoragePermissionData;
+ delete permData;
+
+ evas_object_hide(obj);
+ evas_object_del(obj);
+}
} // namespace
void WebStorageSupport::createPermissionRequest(