_UserConfirmPopup::_UserConfirmPopup(void)
: __pUserPolicyData(null)
, __userConfirmMode(USER_CONFIRM_USERMEDIA)
+ , __sync(false)
, __pCheckButton(null)
{
}
result
-_UserConfirmPopup::Construct(_UserConfirmMode userConfirmMode, void* pEventInfo)
+_UserConfirmPopup::Construct(_UserConfirmMode userConfirmMode, void* pEventInfo, bool sync)
{
result r = E_SUCCESS;
SysTryReturnResult(NID_WEB_CTRL, pEventInfo, E_INVALID_ARG, "Invalid argument(s) is used. pPolicy is null.");
__pUserPolicyData = pEventInfo;
__userConfirmMode = userConfirmMode;
+ __sync = sync;
int popupMaxHeight = 2*pPopupData->labelDim.height + 2*pPopupData->btnDim.height + 6*pPopupData->sideMargin;
if (__userConfirmMode == USER_CONFIRM_GEOLOCATION)
SysLogException(NID_WEB_CTRL, r, "[%s] Propagating.", GetErrorMessage(r));
}
- delete this;
+ if (!__sync)
+ {
+ delete this;
+ }
}
message = L"Do you want to allow acccess to media?\n";
break;
}
+ case USER_PROTOCOL_HANDLER:
+ {
+ Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(__pUserPolicyData);
+ SysAssertf(pHandlerData, "Failed to request");
+
+ String target(ewk_custom_handlers_data_target_get(pHandlerData));
+ String baseUri(ewk_custom_handlers_data_base_url_get(pHandlerData));
+
+ message = baseUri + String(L" is asking to register ") + target + String(L" protocol handler.");
+ break;
+ }
+ case USER_CONTENT_HANDLER:
+ {
+ Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(__pUserPolicyData);
+ SysAssertf(pHandlerData, "Failed to request");
+
+ String target(ewk_custom_handlers_data_target_get(pHandlerData));
+ String baseUri(ewk_custom_handlers_data_base_url_get(pHandlerData));
+
+ message = String(baseUri) + String(L" is asking to register ") + String(target) + String(L" content handler.");
+ break;
+ }
case USER_CONFIRM_GEOLOCATION:
{
Ewk_Geolocation_Permission_Request* pGeoLocPermReq = reinterpret_cast< Ewk_Geolocation_Permission_Request* >(__pUserPolicyData);
message = _Utility::CreateOrigin(pSecurityOrigin);
message.Append("Requests your Location");
+ break;
}
default:
SysAssert(false);
ewk_user_media_permission_request_set(pPolicy, allow);
break;
}
+ case USER_PROTOCOL_HANDLER:
+ {
+ RegisterHandler(false, allow);
+ break;
+ }
+ case USER_CONTENT_HANDLER:
+ {
+ RegisterHandler(true, allow);
+ break;
+ }
case USER_CONFIRM_GEOLOCATION:
{
Ewk_Geolocation_Permission_Request* pPolicy = reinterpret_cast< Ewk_Geolocation_Permission_Request* >(__pUserPolicyData);
- ewk_geolocation_permission_request_set(pPolicy, allow);
if (__pCheckButton->IsSelected())
{
result r = AddGeolocationDb(pPolicy, static_cast < bool >(allow));
- SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
}
+CATCH:
+ ewk_geolocation_permission_request_set(pPolicy, allow);
+ break;
}
default:
SysAssert(false);
return E_SUCCESS;
}
+void
+_UserConfirmPopup::RegisterHandler(bool checkHandler, Eina_Bool allow)
+{
+ _DatabaseImpl db;
+ String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
+ String table;
+ int checkId = 0;
+
+ if(checkHandler == true)
+ {
+ table = CUSTOM_CONTENT_TABLE_NAME;
+ }
+ else
+ {
+ table = CUSTOM_PROTOCOL_TABLE_NAME;
+ }
+ Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(__pUserPolicyData);
+ SysAssertf(pHandlerData, "Failed to request");
+
+ String baseUri(ewk_custom_handlers_data_base_url_get(pHandlerData));
+ String uri = ewk_custom_handlers_data_url_get(pHandlerData);
+ String target = ewk_custom_handlers_data_target_get(pHandlerData);
+
+ result r = db.Construct(handlerPath, "r+", null);
+ SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ std::unique_ptr<DbEnumerator> pEnum(db.QueryN(L"Select id From " + table + L" Where baseUrl = '" + baseUri + L"' AND url = '" + uri + L"' AND mime = '" + target + L"'"));
+
+ if(pEnum.get())
+ {
+ pEnum->MoveNext();
+ pEnum->GetIntAt(0, checkId);
+
+ std::unique_ptr<DbStatement> pUpdateStmt(db.CreateStatementN(L"Update " + table + L" Set allow = (?) Where id = (?)"));
+ SysTryReturnVoidResult(NID_WEB_CTRL, pUpdateStmt.get(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ pUpdateStmt->BindInt(0, static_cast < int >(allow));
+ pUpdateStmt->BindInt(1, checkId);
+
+ db.BeginTransaction();
+
+ std::unique_ptr<DbEnumerator> pEnum(db.ExecuteStatementN(*pUpdateStmt));
+
+ db.CommitTransaction();
+
+ }
+ else
+ {
+ std::unique_ptr<DbStatement> pStmt(db.CreateStatementN(L"Insert Into " + table + L" (baseUrl, url, mime, allow) Values (?, ?, ?, ?)"));
+ SysTryReturnVoidResult(NID_WEB_CTRL, pStmt.get(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ pStmt->BindString(0, baseUri);
+ pStmt->BindString(1, uri);
+ pStmt->BindString(2, target);
+ pStmt->BindInt(3, static_cast < int >(allow));
+
+ db.BeginTransaction();
+
+ std::unique_ptr<DbEnumerator> pRegisterEnum(db.ExecuteStatementN(*pStmt));
+
+ db.CommitTransaction();
+ }
+}
+
}}} // Tizen::Web::Controls