result
-_UserConfirmPopup::Construct(_UserConfirmMode userConfirmMode, void* pEventInfo, bool sync)
+_UserConfirmPopup::Construct(_UserConfirmMode userConfirmMode, void* pEventInfo, bool sync, String msg)
{
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_NOTIFICATION, E_INVALID_ARG,
+ SysTryReturnResult(NID_WEB_CTRL, userConfirmMode >= USER_CONFIRM_USERMEDIA && userConfirmMode <= USER_SCRIPT_ALERT, E_INVALID_ARG,
"Invalid userConfirmMode is used. [%d]", userConfirmMode);
_WebPopupData* pPopupData = _WebPopup::GetPopupData();
__userConfirmMode = userConfirmMode;
__sync = sync;
+ bool hasTitle = true;
int popupMaxHeight = 2*pPopupData->labelDim.height + 2*pPopupData->btnDim.height + 6*pPopupData->sideMargin;
+
if (__userConfirmMode == USER_CONFIRM_GEOLOCATION)
{
popupMaxHeight += pPopupData->checkDim.height;
}
- r = _WebPopup::Construct(true, Dimension(pPopupData->popupDim.width, popupMaxHeight));
+ if (__userConfirmMode == USER_SCRIPT_ALERT)
+ {
+ popupMaxHeight -= pPopupData->labelDim.height;
+ hasTitle = false;
+ }
+
+ r = _WebPopup::Construct(hasTitle, Dimension(pPopupData->popupDim.width, popupMaxHeight));
SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
- SetTitleText("Security Warning");
+ if (userConfirmMode != USER_SCRIPT_ALERT)
+ {
+ SetTitleText("Security Warning");
+ }
Rectangle rect(0, 0, 0, 0);
std::unique_ptr<Label> pLabel(new (std::nothrow) Label());
SysTryReturnResult(NID_WEB_CTRL, pLabel.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
- String message = GetMessageFromPolicy();
+ String message = L"";
+ if (userConfirmMode == USER_SCRIPT_ALERT)
+ {
+ message = msg;
+ }
+ else
+ {
+ message = GetMessageFromPolicy();
+ }
r = pLabel->Construct(rect, message);
SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
ArrayList idList;
r = idList.Construct();
SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
- idList.Add(*(new Integer(ID_BUTTON_USER_ALLOW)));
- idList.Add(*(new Integer(ID_BUTTON_USER_CANCEL)));
ArrayList titleList;
r = titleList.Construct();
SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
- titleList.Add(*(new String(L"Allow")));
- titleList.Add(*(new String(L"Cancel")));
+
+ idList.Add(*(new Integer(ID_BUTTON_USER_ALLOW)));
+ if (userConfirmMode == USER_SCRIPT_ALERT)
+ {
+ titleList.Add(*(new String(L"OK")));
+ }
+ else
+ {
+ idList.Add(*(new Integer(ID_BUTTON_USER_CANCEL)));
+ titleList.Add(*(new String(L"Allow")));
+ titleList.Add(*(new String(L"Cancel")));
+ }
r = CreateAndAddButtons(idList, titleList, pButtonPanel);
SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
ewk_notification_permission_request_set(pPermissionRequest, allow);
break;
}
+ case USER_SCRIPT_ALERT:
+ {
+ Evas_Object* pView = reinterpret_cast< Evas_Object* >(__pUserPolicyData);
+ ewk_view_javascript_alert_reply(pView);
+ break;
+ }
default:
SysAssert(false);
}
{
SysLog(NID_WEB_CTRL, "The current value of message is %s", pMessage);
- result r = E_SUCCESS;
_WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
String msg(pMessage);
- MessageBox messageBox;
- r = messageBox.Construct(L"", msg, MSGBOX_STYLE_OK);
- SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
-
- int modalResult = 0;
-
- messageBox.SetOwner(&pImpl->GetPublic());
-
- r = messageBox.ShowAndWait(modalResult);
- SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+ result r = pImpl->ShowUserConfirmPopupAsync(USER_SCRIPT_ALERT, pView, msg);
+ SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ return EINA_TRUE;
+CATCH:
ewk_view_javascript_alert_reply(pView);
-
return EINA_TRUE;
}
}
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, false, msg);
SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
__pUserConfirmPopup = std::move(pUserConfirmPopup);