summaryrefslogtreecommitdiff
path: root/fpdfsdk/src
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-02-27 13:48:38 -0800
committerTom Sepez <tsepez@chromium.org>2015-02-27 13:48:38 -0800
commit5b47dbfe85e8db4122089afa6d00264f1e973af2 (patch)
tree2414ade38cf9e0040a63e77dc4da9598b8139d9d /fpdfsdk/src
parent3d25502adc5ae37d1c3c74d367f16f770c465109 (diff)
downloadpdfium-5b47dbfe85e8db4122089afa6d00264f1e973af2.tar.xz
Remove unused IDS_ constants from pdfium.
Along the way, I noticed that one of these is used in a header file that isn't included anywhere and describes no actual code (JS_Console.h). Also add missing header guards, and IWYU to resources.h Also move a static function from a header to the new resources.cpp file. Also fix the grammar on some of the error messages. Most of these appear to be JS error messages destined for a JS error handler or (someday) a console (which can remain in english), and oddly, some appear to be about failed form validation, which smells user-facing. Also check that the message makes sense for the point the C++ code wants to use it, and reword accordingly. As it turns out, these currently don't make it back to JS due to the unimplemented JS_Error() function; this is an enabling step towards implementing it. R=thestig@chromium.org Review URL: https://codereview.chromium.org/955273003
Diffstat (limited to 'fpdfsdk/src')
-rw-r--r--fpdfsdk/src/javascript/resource.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/fpdfsdk/src/javascript/resource.cpp b/fpdfsdk/src/javascript/resource.cpp
new file mode 100644
index 0000000000..1c453dcda7
--- /dev/null
+++ b/fpdfsdk/src/javascript/resource.cpp
@@ -0,0 +1,47 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "../../include/javascript/resource.h"
+
+CFX_WideString JSGetStringFromID(CJS_Context* pContext, FX_UINT id)
+{
+ switch (id)
+ {
+ case IDS_STRING_JSALERT:
+ return L"Alert";
+ case IDS_STRING_JSPARAMERROR:
+ return L"Incorrect number of parameters passed to function.";
+ case IDS_STRING_JSAFNUMBER_KEYSTROKE:
+ return L"The input value is invalid.";
+ case IDS_STRING_JSPARAM_TOOLONG:
+ return L"The input value is too long.";
+ case IDS_STRING_JSPARSEDATE:
+ return L"The input value can't be parsed as a valid date/time (%s).";
+ case IDS_STRING_JSRANGE1:
+ 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:
+ return L"The input value must be greater than or equal to %s.";
+ case IDS_STRING_JSRANGE3:
+ return L"The input value must be less than or equal to %s.";
+ case IDS_STRING_NOTSUPPORT:
+ return L"Operation not supported.";
+ case IDS_STRING_JSBUSY:
+ return L"System is busy.";
+ case IDS_STRING_JSEVENT:
+ return L"Duplicate formfield event found.";
+ case IDS_STRING_RUN:
+ return L"Script ran successfully.";
+ case IDS_STRING_JSPRINT1:
+ return L"The second parameter can't be converted to a Date.";
+ case IDS_STRING_JSPRINT2:
+ return L"The second parameter is an invalid Date!";
+ case IDS_JSPARAM_INCORRECT:
+ return L"Global value not found.";
+ default:
+ return L"";
+ }
+}