diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-01-02 17:17:02 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-01-03 19:54:37 +0000 |
commit | c8fd3318a8deca3e1eabd6f7a9449ae4a0fa964d (patch) | |
tree | a5aedd888a3981f53722b7d65ea969d246f267c8 /fpdfsdk/fpdfxfa/cpdfxfa_context.cpp | |
parent | db194cf018069b930d0e3d5fc0242e14f70e8620 (diff) | |
download | pdfium-c8fd3318a8deca3e1eabd6f7a9449ae4a0fa964d.tar.xz |
Cleaning out params in CPDFXFA_Context
This CL cleans up some of the out params in CPDFXFA_Context. In the process
several of the strings returned by ::LoadString() are inlined in their
call sites and the defines removed.
BUG=pdfium:549
Change-Id: I41a7ceeba3962299eecd0cb714ddb03d28dbb0ea
Reviewed-on: https://pdfium-review.googlesource.com/2134
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdfxfa/cpdfxfa_context.cpp')
-rw-r--r-- | fpdfsdk/fpdfxfa/cpdfxfa_context.cpp | 116 |
1 files changed, 31 insertions, 85 deletions
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp index 7a0ffeb256..29888c314e 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp @@ -231,19 +231,20 @@ v8::Isolate* CPDFXFA_Context::GetJSERuntime() const { return runtime->GetIsolate(); } -void CPDFXFA_Context::GetAppName(CFX_WideString& wsName) { - if (m_pFormFillEnv) - wsName = m_pFormFillEnv->FFI_GetAppName(); +CFX_WideString CPDFXFA_Context::GetAppTitle() const { + return L"PDFium"; } -void CPDFXFA_Context::GetLanguage(CFX_WideString& wsLanguage) { - if (m_pFormFillEnv) - wsLanguage = m_pFormFillEnv->GetLanguage(); +CFX_WideString CPDFXFA_Context::GetAppName() { + return m_pFormFillEnv ? m_pFormFillEnv->FFI_GetAppName() : L""; } -void CPDFXFA_Context::GetPlatform(CFX_WideString& wsPlatform) { - if (m_pFormFillEnv) - wsPlatform = m_pFormFillEnv->GetPlatform(); +CFX_WideString CPDFXFA_Context::GetLanguage() { + return m_pFormFillEnv ? m_pFormFillEnv->GetLanguage() : L""; +} + +CFX_WideString CPDFXFA_Context::GetPlatform() { + return m_pFormFillEnv ? m_pFormFillEnv->GetPlatform() : L""; } void CPDFXFA_Context::Beep(uint32_t dwType) { @@ -357,101 +358,46 @@ bool CPDFXFA_Context::PutRequestURL(const CFX_WideString& wsURL, wsEncode.c_str()); } -void CPDFXFA_Context::LoadString(int32_t iStringID, CFX_WideString& wsString) { +CFX_WideString CPDFXFA_Context::LoadString(int32_t iStringID) { switch (iStringID) { - case XFA_IDS_ValidateFailed: - wsString = L"%s validation failed"; - return; - case XFA_IDS_CalcOverride: - wsString = L"Calculate Override"; - return; - case XFA_IDS_ModifyField: - wsString = L"Are you sure you want to modify this field?"; - return; - case XFA_IDS_NotModifyField: - wsString = L"You are not allowed to modify this field."; - return; - case XFA_IDS_AppName: - wsString = L"pdfium"; - return; - case XFA_IDS_Unable_TO_SET: - wsString = L"Unable to set "; - return; case XFA_IDS_INVAlID_PROP_SET: - wsString = L"Invalid property set operation."; - return; + return L"Invalid property set operation."; case XFA_IDS_NOT_DEFAUL_VALUE: - wsString = L" doesn't have a default property."; - return; + return L" doesn't have a default property."; case XFA_IDS_UNABLE_SET_LANGUAGE: - wsString = L"Unable to set language value."; - return; + return L"Unable to set language value."; case XFA_IDS_UNABLE_SET_NUMPAGES: - wsString = L"Unable to set numPages value."; - return; + return L"Unable to set numPages value."; case XFA_IDS_UNABLE_SET_PLATFORM: - wsString = L"Unable to set platform value."; - return; + return L"Unable to set platform value."; case XFA_IDS_UNABLE_SET_VARIATION: - wsString = L"Unable to set variation value."; - return; + return L"Unable to set variation value."; case XFA_IDS_UNABLE_SET_VERSION: - wsString = L"Unable to set version value."; - return; + return L"Unable to set version value."; case XFA_IDS_UNABLE_SET_READY: - wsString = L"Unable to set ready value."; - return; + return L"Unable to set ready value."; case XFA_IDS_COMPILER_ERROR: - wsString = L"Compiler error."; - return; + return L"Compiler error."; case XFA_IDS_DIVIDE_ZERO: - wsString = L"Divide by zero."; - return; + return L"Divide by zero."; case XFA_IDS_ACCESS_PROPERTY_IN_NOT_OBJECT: - wsString = - L"An attempt was made to reference property '%s' of a non-object in " - L"SOM expression %s."; - return; + return L"An attempt was made to reference property '%s' of a non-object " + L"in SOM expression %s."; case XFA_IDS_INDEX_OUT_OF_BOUNDS: - wsString = L"Index value is out of bounds."; - return; + return L"Index value is out of bounds."; case XFA_IDS_INCORRECT_NUMBER_OF_METHOD: - wsString = L"Incorrect number of parameters calling method '%s'."; - return; + return L"Incorrect number of parameters calling method '%s'."; case XFA_IDS_ARGUMENT_MISMATCH: - wsString = L"Argument mismatch in property or function argument."; - return; + return L"Argument mismatch in property or function argument."; case XFA_IDS_NOT_HAVE_PROPERTY: - wsString = L"'%s' doesn't have property '%s'."; - return; + return L"'%s' doesn't have property '%s'."; case XFA_IDS_VIOLATE_BOUNDARY: - wsString = - L"The element [%s] has violated its allowable number of occurrences."; - return; + return L"The element [%s] has violated its allowable number of " + L"occurrences."; case XFA_IDS_SERVER_DENY: - wsString = L"Server does not permit."; - return; - case XFA_IDS_ValidateLimit: - wsString = - L"Message limit exceeded. Remaining %d validation errors not " - L"reported."; - return; - case XFA_IDS_ValidateNullWarning: - wsString = - L"%s cannot be blank. To ignore validations for %s, click Ignore."; - return; - case XFA_IDS_ValidateNullError: - wsString = L"%s cannot be blank."; - return; - case XFA_IDS_ValidateWarning: - wsString = - L"The value you entered for %s is invalid. To ignore validations for " - L"%s, click Ignore."; - return; - case XFA_IDS_ValidateError: - wsString = L"The value you entered for %s is invalid."; - return; + return L"Server does not permit."; } + return L""; } IFWL_AdapterTimerMgr* CPDFXFA_Context::GetTimerMgr() { |