result
-_UserConfirmPopup::Construct(_UserConfirmMode userConfirmMode, void* pEventInfo, bool sync)
+_UserConfirmPopup::Construct(_UserConfirmMode userConfirmMode, void* pEventInfo, Tizen::Base::String msg, bool sync)
{
result r = E_SUCCESS;
SysTryReturnResult(NID_WEB_CTRL, pEventInfo, E_INVALID_ARG, "Invalid argument(s) is used. pPolicy is null.");
- SysTryReturnResult(NID_WEB_CTRL, userConfirmMode >= USER_CONFIRM_USERMEDIA && userConfirmMode <= USER_CONFIRM_GEOLOCATION, E_INVALID_ARG,
+ SysTryReturnResult(NID_WEB_CTRL, userConfirmMode >= USER_CONFIRM_USERMEDIA && userConfirmMode <= USER_CONFIRM_INDEXED_DB_QUOTA_EXCEDED, E_INVALID_ARG,
"Invalid userConfirmMode is used. [%d]", userConfirmMode);
_WebPopupData* pPopupData = _WebPopup::GetPopupData();
__pUserPolicyData = pEventInfo;
__userConfirmMode = userConfirmMode;
__sync = sync;
+ __defMsg = msg;
int popupMaxHeight = 2*pPopupData->labelDim.height + 2*pPopupData->btnDim.height + 6*pPopupData->sideMargin;
if (__userConfirmMode == USER_CONFIRM_GEOLOCATION)
message.Append(" Requests your Location");
break;
}
+ case USER_CONFIRM_APP_CACHE:
+ //fall through
+ case USER_CONFIRM_DB_QUOTA_EXCEDED:
+ //fall through
+ case USER_CONFIRM_LOCAL_FS_QUOTA_EXCEDED:
+ //fall through
+ case USER_CONFIRM_INDEXED_DB_QUOTA_EXCEDED:
+ message = __defMsg;
+ break;
+
default:
SysAssert(false);
}
ewk_geolocation_permission_request_set(pPolicy, allow);
break;
}
+ case USER_CONFIRM_APP_CACHE:
+ {
+ Evas_Object *pObj = reinterpret_cast< Evas_Object* >(__pUserPolicyData);
+ ewk_view_application_cache_permission_reply(pObj, allow);
+ break;
+ }
+
+ case USER_CONFIRM_DB_QUOTA_EXCEDED:
+ {
+ Evas_Object *pObj = reinterpret_cast< Evas_Object* >(__pUserPolicyData);
+ ewk_view_exceeded_database_quota_reply(pObj, allow);
+ break;
+ }
+
+ case USER_CONFIRM_LOCAL_FS_QUOTA_EXCEDED:
+ {
+ Evas_Object *pObj = reinterpret_cast< Evas_Object* >(__pUserPolicyData);
+ ewk_view_exceeded_local_file_system_quota_reply(pObj, allow);
+ break;
+ }
+
+ case USER_CONFIRM_INDEXED_DB_QUOTA_EXCEDED:
+ {
+ Evas_Object *pObj = reinterpret_cast< Evas_Object* >(__pUserPolicyData);
+ ewk_view_exceeded_indexed_database_quota_reply(pObj, allow);
+ break;
+ }
+
default:
SysAssert(false);
}
}
+Eina_Bool
+OnApplicationCachePermissionRequested(Evas_Object* pView, Ewk_Security_Origin* pSecOrigin, void* pUserData)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ SysAssertf(pImpl , "Failed to request");
+
+ const char* pHostName = ewk_security_origin_host_get(pSecOrigin);
+ String msg;
+ result r = msg.Format(256, L"Allow %s to use offline application cache?", pHostName);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pImpl->ShowUserConfirmPopup(USER_CONFIRM_APP_CACHE, pView, msg);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return EINA_TRUE;
+}
+
+
+Eina_Bool OnIndexedDatabaseQuotaExceeded(Evas_Object* pView, Ewk_Security_Origin* pSecOrigin, long long currentQuota, void* pUserData)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ SysAssertf(pImpl , "Failed to request");
+
+ const char* pHostName = ewk_security_origin_host_get(pSecOrigin);
+ String msg;
+ result r = msg.Format(512, L"%s Used %lld of storage. Allow %s to use upto 2GB of indexed db?", pHostName, currentQuota, pHostName);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pImpl->ShowUserConfirmPopup(USER_CONFIRM_INDEXED_DB_QUOTA_EXCEDED, pView, msg);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return EINA_TRUE;
+}
+
+
+Eina_Bool OnDatabaseQuotaExceeded(Evas_Object* pView, Ewk_Security_Origin* pSecOrigin, const char* database_name, unsigned long long expectedQuota, void* pUserData)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ SysAssertf(pImpl , "Failed to request");
+
+ const char* pHostName = ewk_security_origin_host_get(pSecOrigin);
+ String msg;
+ result r = msg.Format(512, L"Allow %s to open %s use upto %lld of web database?", pHostName, database_name, expectedQuota);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pImpl->ShowUserConfirmPopup(USER_CONFIRM_DB_QUOTA_EXCEDED, pView, msg);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return EINA_TRUE;
+}
+
+
+Eina_Bool OnLocalFileSystemQuotaExceeded(Evas_Object* pView, Ewk_Security_Origin* pSecOrigin, long long currentQuota, void* pUserData)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ SysAssertf(pImpl , "Failed to request");
+
+ const char* pHostName = ewk_security_origin_host_get(pSecOrigin);
+ String msg;
+ result r = msg.Format(512, L"%s Used %lld of storgae. Allow %s to use upto 2GB of file system?", pHostName, currentQuota, pHostName);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pImpl->ShowUserConfirmPopup(USER_CONFIRM_LOCAL_FS_QUOTA_EXCEDED, pView, msg);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return EINA_TRUE;
+}
+
+
void
OnProtocolHandlerRegistrationRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
{
SysAssertf(pContext, "Failed to get webkit instance.");
ewk_context_did_start_download_callback_set(pContext, OnDidStartDownloadCallback, const_cast< _WebImpl* >(this));
ewk_context_vibration_client_callbacks_set(pContext, OnVibrationRequested, OnVibrationCanceled, const_cast< _WebImpl* >(this));
+ ewk_view_application_cache_permission_callback_set(pWebNativeNode, OnApplicationCachePermissionRequested, const_cast< _WebImpl* >(this));
+ ewk_view_exceeded_indexed_database_quota_callback_set(pWebNativeNode, OnIndexedDatabaseQuotaExceeded, const_cast< _WebImpl* >(this));
+ ewk_view_exceeded_database_quota_callback_set(pWebNativeNode, OnDatabaseQuotaExceeded, const_cast< _WebImpl* >(this));
+ ewk_view_exceeded_local_file_system_quota_callback_set(pWebNativeNode, OnLocalFileSystemQuotaExceeded, const_cast< _WebImpl* >(this));
evas_object_event_callback_add(pWebNativeNode, EVAS_CALLBACK_FOCUS_IN, OnWebNativeNodeFocusGained, this);
}
evas_object_smart_callback_del(pWebNativeNode, "text,style,state", OnWebPageBlockSelected);
+ ewk_view_application_cache_permission_callback_set(pWebNativeNode, null, null);
+ ewk_view_exceeded_indexed_database_quota_callback_set(pWebNativeNode, null, null);
+ ewk_view_exceeded_database_quota_callback_set(pWebNativeNode, null, null);
+ ewk_view_exceeded_local_file_system_quota_callback_set(pWebNativeNode, null, null);
+
ewk_view_open_panel_callback_set(null, null, null);
Ewk_Context* pContext = ewk_view_context_get(pWebNativeNode);
SysAssertf(pContext, "Failed to get webkit instance.");
}
result
-_WebImpl::ShowUserConfirmPopup(_UserConfirmMode userConfirmMode, void* pPolicy)
+_WebImpl::ShowUserConfirmPopup(_UserConfirmMode userConfirmMode, void* pPolicy, String msg)
{
result r = E_SUCCESS;
std::unique_ptr<_UserConfirmPopup> pUserConfirmPopup(new (std::nothrow) _UserConfirmPopup());
SysTryReturnResult(NID_WEB_CTRL, pUserConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
- r = pUserConfirmPopup->Construct(userConfirmMode, pPolicy, true);
+ r = pUserConfirmPopup->Construct(userConfirmMode, pPolicy, msg, true);
SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
__pUserConfirmPopup = std::move(pUserConfirmPopup);
}
result
-_WebImpl::ShowUserConfirmPopupAsync(_UserConfirmMode userConfirmMode, void* pPolicy)
+_WebImpl::ShowUserConfirmPopupAsync(_UserConfirmMode userConfirmMode, void* pPolicy, String msg)
{
result r = E_SUCCESS;
std::unique_ptr<_UserConfirmPopup> pUserConfirmPopup(new (std::nothrow) _UserConfirmPopup());
SysTryReturnResult(NID_WEB_CTRL, pUserConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
- r = pUserConfirmPopup->Construct(userConfirmMode, pPolicy, false);
+ r = pUserConfirmPopup->Construct(userConfirmMode, pPolicy, msg, false);
SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
__pUserConfirmPopup = std::move(pUserConfirmPopup);