summaryrefslogtreecommitdiff
path: root/fxjs/xfa
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2018-06-21 21:09:54 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-06-21 21:09:54 +0000
commitc3cc2ab66d3d8f52dea8083abb6775115e17af7d (patch)
tree227eb764e7ee1f674f9ac992ec6620e4e57e2b01 /fxjs/xfa
parentaaaf9877478d7add8a74b4db74d97ca19ce1c47e (diff)
downloadpdfium-c3cc2ab66d3d8f52dea8083abb6775115e17af7d.tar.xz
Clean up constant values for JS alert and beep
Define constant values in the public API for the valid values of alert button type, alert icon type, and beep type. Replace various magic numbers through out the code base using these values. Also replace the XFA specific versions with an enum class that is guaranteed to have the same values, instead of #defines that just happen to. This CL does not attempt to add error checking on these values, since it currently doesn't exist so adding it may cause regressions. Change-Id: Ief3aee2a4ad419691c18fc1dba8b984ad222141b Reviewed-on: https://pdfium-review.googlesource.com/35730 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fxjs/xfa')
-rw-r--r--fxjs/xfa/cjx_hostpseudomodel.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/fxjs/xfa/cjx_hostpseudomodel.cpp b/fxjs/xfa/cjx_hostpseudomodel.cpp
index 6dd160639a..37bc99ad47 100644
--- a/fxjs/xfa/cjx_hostpseudomodel.cpp
+++ b/fxjs/xfa/cjx_hostpseudomodel.cpp
@@ -502,18 +502,18 @@ CJS_Return CJX_HostPseudoModel::messageBox(
if (params.size() >= 2)
title = runtime->ToWideString(params[1]);
- uint32_t messageType = XFA_MBICON_Error;
+ uint32_t messageType = static_cast<uint32_t>(AlertIcon::kDefault);
if (params.size() >= 3) {
messageType = runtime->ToInt32(params[2]);
- if (messageType > XFA_MBICON_Status)
- messageType = XFA_MBICON_Error;
+ if (messageType > static_cast<uint32_t>(AlertIcon::kStatus))
+ messageType = static_cast<uint32_t>(AlertIcon::kDefault);
}
- uint32_t buttonType = XFA_MB_OK;
+ uint32_t buttonType = static_cast<uint32_t>(AlertButton::kDefault);
if (params.size() >= 4) {
buttonType = runtime->ToInt32(params[3]);
- if (buttonType > XFA_MB_YesNoCancel)
- buttonType = XFA_MB_OK;
+ if (buttonType > static_cast<uint32_t>(AlertButton::kYesNoCancel))
+ buttonType = static_cast<uint32_t>(AlertButton::kDefault);
}
int32_t iValue = pNotify->GetAppProvider()->MsgBox(message, title,