summaryrefslogtreecommitdiff
path: root/fxjs/js_resources.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-10-30 21:19:42 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-10-30 21:19:42 +0000
commitd6e9cfaab0555c34783dd05261329866b4da1b9f (patch)
treef123e3ee82017c1e14a07306f54381ea9bf2966c /fxjs/js_resources.cpp
parentcaee9596e926a41a23fa0ddebd10d509db4b23ab (diff)
downloadpdfium-d6e9cfaab0555c34783dd05261329866b4da1b9f.tar.xz
Convert JS resource into enum classchromium/3254
This CL converts the #defines into an enum class. Change-Id: I895e29e1d46a7a82d7be896f5776eb00d28559f5 Reviewed-on: https://pdfium-review.googlesource.com/17091 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fxjs/js_resources.cpp')
-rw-r--r--fxjs/js_resources.cpp48
1 files changed, 24 insertions, 24 deletions
diff --git a/fxjs/js_resources.cpp b/fxjs/js_resources.cpp
index c7ed06f274..b23103ab76 100644
--- a/fxjs/js_resources.cpp
+++ b/fxjs/js_resources.cpp
@@ -6,52 +6,52 @@
#include "fxjs/js_resources.h"
-WideString JSGetStringFromID(uint32_t id) {
- switch (id) {
- case IDS_STRING_JSALERT:
+WideString JSGetStringFromID(JSMessage msg) {
+ switch (msg) {
+ case JSMessage::kAlert:
return L"Alert";
- case IDS_STRING_JSPARAMERROR:
+ case JSMessage::kParamError:
return L"Incorrect number of parameters passed to function.";
- case IDS_STRING_JSAFNUMBER_KEYSTROKE:
+ case JSMessage::kInvalidInputError:
return L"The input value is invalid.";
- case IDS_STRING_JSPARAM_TOOLONG:
+ case JSMessage::kParamTooLongError:
return L"The input value is too long.";
- case IDS_STRING_JSPARSEDATE:
+ case JSMessage::kParseDateError:
return L"The input value can't be parsed as a valid date/time (%s).";
- case IDS_STRING_JSRANGE1:
+ case JSMessage::kRangeBetweenError:
return L"The input value must be greater than or equal to %s"
L" and less than or equal to %s.";
- case IDS_STRING_JSRANGE2:
+ case JSMessage::kRangeGreaterError:
return L"The input value must be greater than or equal to %s.";
- case IDS_STRING_JSRANGE3:
+ case JSMessage::kRangeLessError:
return L"The input value must be less than or equal to %s.";
- case IDS_STRING_JSNOTSUPPORT:
+ case JSMessage::kNotSupportedError:
return L"Operation not supported.";
- case IDS_STRING_JSBUSY:
+ case JSMessage::kBusyError:
return L"System is busy.";
- case IDS_STRING_JSEVENT:
+ case JSMessage::kDuplicateEventError:
return L"Duplicate formfield event found.";
- case IDS_STRING_RUN:
+ case JSMessage::kRunSuccess:
return L"Script ran successfully.";
- case IDS_STRING_JSPRINT1:
+ case JSMessage::kSecondParamNotDateError:
return L"The second parameter can't be converted to a Date.";
- case IDS_STRING_JSPRINT2:
+ case JSMessage::kSecondParamInvalidDateError:
return L"The second parameter is an invalid Date!";
- case IDS_STRING_JSNOGLOBAL:
+ case JSMessage::kGlobalNotFoundError:
return L"Global value not found.";
- case IDS_STRING_JSREADONLY:
+ case JSMessage::kReadOnlyError:
return L"Cannot assign to readonly property.";
- case IDS_STRING_JSTYPEERROR:
+ case JSMessage::kTypeError:
return L"Incorrect parameter type.";
- case IDS_STRING_JSVALUEERROR:
+ case JSMessage::kValueError:
return L"Incorrect parameter value.";
- case IDS_STRING_JSNOPERMISSION:
+ case JSMessage::kPermissionError:
return L"Permission denied.";
- case IDS_STRING_JSBADOBJECT:
+ case JSMessage::kBadObjectError:
return L"Object no longer exists.";
- default:
- return L"";
}
+ NOTREACHED();
+ return L"";
}
WideString JSFormatErrorString(const char* class_name,