diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-02-27 13:48:38 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-02-27 13:48:38 -0800 |
commit | 5b47dbfe85e8db4122089afa6d00264f1e973af2 (patch) | |
tree | 2414ade38cf9e0040a63e77dc4da9598b8139d9d /fpdfsdk/include/javascript/resource.h | |
parent | 3d25502adc5ae37d1c3c74d367f16f770c465109 (diff) | |
download | pdfium-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/include/javascript/resource.h')
-rw-r--r-- | fpdfsdk/include/javascript/resource.h | 99 |
1 files changed, 11 insertions, 88 deletions
diff --git a/fpdfsdk/include/javascript/resource.h b/fpdfsdk/include/javascript/resource.h index 710cc50754..058b5fd893 100644 --- a/fpdfsdk/include/javascript/resource.h +++ b/fpdfsdk/include/javascript/resource.h @@ -1,110 +1,33 @@ // 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 -#define IDD_JS_MSGBOX 25600 -#define IDD_RESPONSE 25601 -#define IDC_JS_MSG_TEXT 25602 -#define ID_JS_MSG_OK 25603 -#define ID_JS_MSG_CANCEL 25604 -#define IDC_JS_MSG_ICON 25605 -#define ID_JS_MSG_YES 25606 -#define ID_JS_MSG_NO 25607 -#define IDC_JS_QUESTION 25608 -#define ID_JS_OK 25609 -#define ID_JS_CANCEL 25610 -#define IDC_JS_ANSWER 25611 -#define IDC_JS_EDIT 25612 +#ifndef FPDFSDK_INCLUDE_JAVASCRIPT_RESOURCE_H_ +#define FPDFSDK_INCLUDE_JAVASCRIPT_RESOURCE_H_ + +#include "../../../core/include/fxcrt/fx_basic.h" // For CFX_WideString. +#include "../fsdk_define.h" // For FX_UINT. + +class CJS_Context; + #define IDS_STRING_JSALERT 25613 #define IDS_STRING_JSPARAMERROR 25614 #define IDS_STRING_JSAFNUMBER_KEYSTROKE 25615 -#define IDS_STRING_JSINPUTERROR 25616 #define IDS_STRING_JSPARAM_TOOLONG 25617 #define IDS_STRING_JSPARSEDATE 25618 #define IDS_STRING_JSRANGE1 25619 #define IDS_STRING_JSRANGE2 25620 #define IDS_STRING_JSRANGE3 25621 -#define IDS_STRING_JSRANGE4 25622 -#define IDS_STRING_FILEOPENFAIL 25623 -#define IDS_STRING_JSATTENTION 25624 -#define IDS_STRING_JSSUBMITS 25625 -#define IDS_STRING_JSSUBMITF 25626 #define IDS_STRING_NOTSUPPORT 25627 #define IDS_STRING_JSBUSY 25628 #define IDS_STRING_JSEVENT 25629 #define IDS_STRING_RUN 25630 -#define IDS_STRING_UNHANDLED 25631 #define IDS_STRING_JSPRINT1 25632 #define IDS_STRING_JSPRINT2 25633 -#define IDS_STRING_LAUNCHURL 25634 #define IDS_JSPARAM_INCORRECT 25635 -#define IDD_JS_CONSOLE 25636 -#define IDS_STRING_SAFEMODEL 25636 -#define IDC_EDTSCRIPT 25637 -#define IDC_BTNCLEAR 25638 -#define IDC_EDTOUTPUT 25639 -#define IDC_CHECK_TIPS 25640 -#define IDC_BTNRUN 25641 - - - -static CFX_WideString JSGetStringFromID(CJS_Context* pContext, FX_UINT ID) -{ - switch(ID) - { - case IDS_STRING_JSALERT: - return L"Alert"; - case IDS_STRING_JSPARAMERROR: - return L"The amount of parameters is not correct !"; - case IDS_STRING_JSAFNUMBER_KEYSTROKE: - return L"The input value is invalid."; - case IDS_STRING_JSINPUTERROR: - return L"Input error !"; - case IDS_STRING_JSPARAM_TOOLONG: - return L"The value you are going to input is too long."; - case IDS_STRING_JSPARSEDATE: - return L"The input string can't be parsed to a valid date time (%s)."; - case IDS_STRING_JSRANGE1: - return L"Invalid value: must be greater or equal to %s and less than or equal to %s."; - case IDS_STRING_JSRANGE2: - return L"Invalid value: must be greater or equal to %s."; - case IDS_STRING_JSRANGE3: - return L"Invalid value: must be less than or equal to %s."; - case IDS_STRING_JSRANGE4: - return L"Range Error"; - case IDS_STRING_FILEOPENFAIL: - return L"Opening file failed."; - case IDS_STRING_JSATTENTION: - return L"Attention"; - case IDS_STRING_JSSUBMITS: - return L"Submit form successfully!"; - case IDS_STRING_JSSUBMITF: - return L"Submit form failed!"; - case IDS_STRING_NOTSUPPORT: - return L"Not supported."; - case IDS_STRING_JSBUSY: - return L"System is busy!"; - case IDS_STRING_JSEVENT: - return L"The event of the formfield exists!"; - case IDS_STRING_RUN: - return L"It runs successfully."; - case IDS_STRING_UNHANDLED: - return L"An unhandled error!"; - case IDS_STRING_JSPRINT1: - return L"The second parameter can't convert to Date!"; - case IDS_STRING_JSPRINT2: - return L"The second parameter isn't a valid Date!"; - case IDS_STRING_LAUNCHURL: - return L"The Document is trying to connect to \r\n%s\r\nIf you trust the site, choose OK. If you don't trust the site, choose Cancel."; - case IDS_JSPARAM_INCORRECT: - return L"The parameter you inputted is incorrect!"; - case IDS_STRING_SAFEMODEL: - return L"Secure reading mode"; - default: - return L""; - } -} +CFX_WideString JSGetStringFromID(CJS_Context* pContext, FX_UINT id); +#endif // FPDFSDK_INCLUDE_JAVASCRIPT_RESOURCE_H_ |