+
+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();
+ }
+}
+
+bool
+_UserConfirmPopup::OnKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
+{
+ return false;
+}
+
+bool
+_UserConfirmPopup::OnKeyReleased(Control& source, const KeyEventInfo& keyEventInfo)
+{
+ result r = E_SUCCESS;
+ if ((keyEventInfo.GetKeyCode() == KEY_ESC || keyEventInfo.GetKeyCode() == KEY_BACK) && source.GetShowState() == true)
+ {
+ HandleUserAction(EINA_FALSE);
+ r = HidePopup();
+
+ if (IsFailed(r))
+ {
+ SysLogException(NID_WEB_CTRL, r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+
+ switch (__userConfirmMode)
+ {
+ case USER_CONFIRM_USERMEDIA:
+ {
+ __pImpl->SendUserEvent(ID_USER_CONFIRM_USERMEDIA_CLOSE, null);
+ break;
+ }
+ case USER_CONFIRM_GEOLOCATION:
+ {
+ __pImpl->SendUserEvent(ID_USER_CONFIRM_GEOLOCATION_CLOSE, null);
+ break;
+ }
+ case USER_CONFIRM_NOTIFICATION:
+ {
+ __pImpl->SendUserEvent(ID_USER_CONFIRM_NOTIFICATION_CLOSE, null);
+ break;
+ }
+ case USER_SCRIPT_ALERT:
+ {
+ __pImpl->SendUserEvent(ID_USER_SCRIPT_ALERT_CLOSE, null);
+ break;
+ }
+ case USER_SCRIPT_CONFIRM:
+ {
+ __pImpl->SendUserEvent(ID_USER_SCRIPT_CONFIRM_CLOSE, null);
+ break;
+ }
+ case USER_BEFORE_UNLOAD_CONFIRM:
+ {
+ __pImpl->SendUserEvent(ID_USER_BEFORE_UNLOAD_CONFIRM_CLOSE, null);
+ break;
+ }
+ case USER_PROTOCOL_HANDLER:
+ case USER_CONTENT_HANDLER:
+ case USER_CONFIRM_APP_CACHE:
+ case USER_CONFIRM_DB_QUOTA_EXCEDED:
+ case USER_CONFIRM_LOCAL_FS_QUOTA_EXCEDED:
+ case USER_CONFIRM_INDEXED_DB_QUOTA_EXCEDED:
+ break;
+ default:
+ SysAssert(false);
+ }
+ }
+ return false;
+}
+
+bool
+_UserConfirmPopup::OnPreviewKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
+{
+ return false;
+}
+
+bool
+_UserConfirmPopup::OnPreviewKeyReleased(Control& source, const KeyEventInfo& keyEventInfo)
+{
+ return false;
+}
+
+bool
+_UserConfirmPopup::TranslateKeyEventInfo(Control& source, KeyEventInfo& keyEventInfo)
+{
+ return false;
+}
+
+