summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript/js_resources.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-10-30 19:18:54 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-10-30 19:18:54 +0000
commit3de090d52aa629f3bbded16ce7069a8b25bbbc46 (patch)
treed751faca6a7f0fdf462cb4c092f5fc5a199e73b2 /fpdfsdk/javascript/js_resources.cpp
parentd2d4df84d3c2f0466d9ad60ee52fa7cc3915ebe4 (diff)
downloadpdfium-3de090d52aa629f3bbded16ce7069a8b25bbbc46.tar.xz
Move resource to js_resource
This CL moves the resource.{cpp|h} files to js_resources.{cpp|h}. Change-Id: I6a9ccb7e0819f40edf4a91e7839a92657d5d39d7 Reviewed-on: https://pdfium-review.googlesource.com/17045 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/javascript/js_resources.cpp')
-rw-r--r--fpdfsdk/javascript/js_resources.cpp68
1 files changed, 68 insertions, 0 deletions
diff --git a/fpdfsdk/javascript/js_resources.cpp b/fpdfsdk/javascript/js_resources.cpp
new file mode 100644
index 0000000000..39f59a6a63
--- /dev/null
+++ b/fpdfsdk/javascript/js_resources.cpp
@@ -0,0 +1,68 @@
+// Copyright 2017 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 "fpdfsdk/javascript/js_resources.h"
+
+WideString JSGetStringFromID(uint32_t 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_JSNOTSUPPORT:
+ 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_STRING_JSNOGLOBAL:
+ return L"Global value not found.";
+ case IDS_STRING_JSREADONLY:
+ return L"Cannot assign to readonly property.";
+ case IDS_STRING_JSTYPEERROR:
+ return L"Incorrect parameter type.";
+ case IDS_STRING_JSVALUEERROR:
+ return L"Incorrect parameter value.";
+ case IDS_STRING_JSNOPERMISSION:
+ return L"Permission denied.";
+ case IDS_STRING_JSBADOBJECT:
+ return L"Object no longer exists.";
+ default:
+ return L"";
+ }
+}
+
+WideString JSFormatErrorString(const char* class_name,
+ const char* property_name,
+ const WideString& details) {
+ WideString result = WideString::FromLocal(class_name);
+ if (property_name) {
+ result += L".";
+ result += WideString::FromLocal(property_name);
+ }
+ result += L": ";
+ result += details;
+ return result;
+}