diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-02-05 15:52:15 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-02-05 15:52:15 -0800 |
commit | e3dbe4db199586bee83f7db3ace142d4c71d0a18 (patch) | |
tree | 5b903a9de317429b99d35cb41a1640570fb9b5fc /fpdfsdk/include | |
parent | 219b3dab7e184bf8742f61527e37053b04903ff0 (diff) | |
download | pdfium-e3dbe4db199586bee83f7db3ace142d4c71d0a18.tar.xz |
Merge to master: Kill off some dodgy JS callbacks
Note that this work was done opposite the usual branch order, because I
didn't want to kill things in master that turned out to be in use in XFA.
Original Review URL: https://codereview.chromium.org/883393007
TBR=jam@chromium.org
Review URL: https://codereview.chromium.org/903893002
Diffstat (limited to 'fpdfsdk/include')
-rw-r--r-- | fpdfsdk/include/fsdk_baseform.h | 6 | ||||
-rw-r--r-- | fpdfsdk/include/fsdk_mgr.h | 78 | ||||
-rw-r--r-- | fpdfsdk/include/javascript/JS_Object.h | 22 | ||||
-rw-r--r-- | fpdfsdk/include/javascript/app.h | 3 |
4 files changed, 41 insertions, 68 deletions
diff --git a/fpdfsdk/include/fsdk_baseform.h b/fpdfsdk/include/fsdk_baseform.h index 073c99f199..915d4115d6 100644 --- a/fpdfsdk/include/fsdk_baseform.h +++ b/fpdfsdk/include/fsdk_baseform.h @@ -206,14 +206,8 @@ public: FX_BOOL SubmitFields(const CFX_WideString& csDestination, const CFX_PtrArray& fields, FX_BOOL bIncludeOrExclude, FX_BOOL bUrlEncoded); FX_BOOL SubmitForm(const CFX_WideString& sDestination, FX_BOOL bUrlEncoded); - FX_BOOL ImportFormFromFDFFile(const CFX_WideString& csFDFFileName, FX_BOOL bNotify); - FX_BOOL ExportFormToFDFFile(const CFX_WideString& sFDFFileName); FX_BOOL ExportFormToFDFTextBuf(CFX_ByteTextBuf& textBuf); - FX_BOOL ExportFieldsToFDFFile(const CFX_WideString& sFDFFileName, const CFX_PtrArray& fields, - FX_BOOL bIncludeOrExclude); FX_BOOL ExportFieldsToFDFTextBuf(const CFX_PtrArray& fields,FX_BOOL bIncludeOrExclude, CFX_ByteTextBuf& textBuf); - FX_BOOL ExportFormToTxtFile(const CFX_WideString& sTxtFileName); - FX_BOOL ImportFormFromTxtFile(const CFX_WideString& sTxtFileName); CFX_WideString GetTemporaryFileName(const CFX_WideString& sFileExt); private: diff --git a/fpdfsdk/include/fsdk_mgr.h b/fpdfsdk/include/fsdk_mgr.h index a6f990c36f..5687f5628b 100644 --- a/fpdfsdk/include/fsdk_mgr.h +++ b/fpdfsdk/include/fsdk_mgr.h @@ -1,7 +1,7 @@ // 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 #ifndef _FPDFSDK_MGR_H @@ -41,14 +41,14 @@ public: void FFI_Invalidate(FPDF_PAGE page, double left, double top, double right, double bottom) { - if (m_pInfo && m_pInfo->FFI_Invalidate) + if (m_pInfo && m_pInfo->FFI_Invalidate) { m_pInfo->FFI_Invalidate(m_pInfo, page, left, top, right, bottom); } } void FFI_OutputSelectedRect(FPDF_PAGE page, double left, double top, double right, double bottom) { - if (m_pInfo && m_pInfo->FFI_OutputSelectedRect) + if (m_pInfo && m_pInfo->FFI_OutputSelectedRect) { m_pInfo->FFI_OutputSelectedRect(m_pInfo, page, left, top, right, bottom); } @@ -56,7 +56,7 @@ public: void FFI_SetCursor(int nCursorType) { - if (m_pInfo && m_pInfo->FFI_SetCursor) + if (m_pInfo && m_pInfo->FFI_SetCursor) { m_pInfo->FFI_SetCursor(m_pInfo, nCursorType); } @@ -64,16 +64,16 @@ public: int FFI_SetTimer(int uElapse, TimerCallback lpTimerFunc) { - if (m_pInfo && m_pInfo->FFI_SetTimer) + if (m_pInfo && m_pInfo->FFI_SetTimer) { return m_pInfo->FFI_SetTimer(m_pInfo, uElapse, lpTimerFunc); } return -1; } - + void FFI_KillTimer(int nTimerID) { - if (m_pInfo && m_pInfo->FFI_KillTimer) + if (m_pInfo && m_pInfo->FFI_KillTimer) { m_pInfo->FFI_KillTimer(m_pInfo, nTimerID); } @@ -106,7 +106,7 @@ public: FX_BOOL FFI_IsSHIFTKeyDown(FX_DWORD nFlag) { - + return (nFlag & FWL_EVENTFLAG_ShiftKey) != 0; } FX_BOOL FFI_IsCTRLKeyDown(FX_DWORD nFlag) @@ -152,7 +152,7 @@ public: FPDF_WIDESTRING pTitle = (FPDF_WIDESTRING)bsTitle.GetBuffer(bsTitle.GetLength()); FPDF_WIDESTRING pDefault = (FPDF_WIDESTRING)bsDefault.GetBuffer(bsDefault.GetLength()); FPDF_WIDESTRING pLabel = (FPDF_WIDESTRING)bsLabel.GetBuffer(bsLabel.GetLength()); - int ret = m_pInfo->m_pJsPlatform->app_response(m_pInfo->m_pJsPlatform, pQuestion, pTitle, + int ret = m_pInfo->m_pJsPlatform->app_response(m_pInfo->m_pJsPlatform, pQuestion, pTitle, pDefault, pLabel, bPassword, response, length); bsQuestion.ReleaseBuffer(); bsTitle.ReleaseBuffer(); @@ -259,19 +259,6 @@ public: bsMsg.ReleaseBuffer(); } } - CFX_WideString JS_appbrowseForDoc(FPDF_BOOL bSave, FX_LPCWSTR cFilenameInit) - { - //to do.... - return L""; -// if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->app_browseForDoc) -// { -// CFX_ByteString bsFilenameInit = CFX_WideString(cFilenameInit).UTF16LE_Encode(); -// FPDF_WIDESTRING pFileNameInit = (FPDF_WIDESTRING)bsFilenameInit.GetBuffer(bsFilenameInit.GetLength()); -// -// m_pInfo->m_pJsPlatform->app_browseForDoc(m_pInfo->m_pJsPlatform, pFileNameInit); -// bsFilenameInit.ReleaseBuffer(); -// } - } void JS_docprint(FPDF_BOOL bUI , int nStart, int nEnd, FPDF_BOOL bSilent ,FPDF_BOOL bShrinkToFit,FPDF_BOOL bPrintAsImage ,FPDF_BOOL bReverse ,FPDF_BOOL bAnnotations) { @@ -348,17 +335,16 @@ public: public: FX_BOOL IsJSInitiated(); -public: +public: void SetCurrentDoc(CPDFSDK_Document* pFXDoc) {m_pSDKDoc = pFXDoc;} CPDFSDK_Document* GetCurrentDoc(); CPDF_Document* GetPDFDocument() {return m_pPDFDoc;} // CPDFSDK_Document* GetDocument(int nIndex); // int CountDocuments() {return m_docMap.GetCount();} - CPDFSDK_Document* OpenDocument(CFX_WideString &fileName); - CPDFSDK_Document* OpenMemPDFDoc(CPDF_Document* pNewDoc, CFX_WideString &fileName); - FX_BOOL OpenURL(CFX_WideString &filePath); - + CPDFSDK_Document* OpenDocument(CFX_WideString &fileName){return NULL;} + CPDFSDK_Document* OpenMemPDFDoc(CPDF_Document* pNewDoc, CFX_WideString &fileName){return NULL;} + CFX_ByteString GetAppName() {return "";} @@ -425,7 +411,7 @@ public: CPDFSDK_Annot* GetFocusAnnot();//{return NULL;} IFXJS_Runtime * GetJsRuntime(); - + FX_BOOL SetFocusAnnot(CPDFSDK_Annot* pAnnot, FX_UINT nFlag = 0);//{return FALSE;} FX_BOOL KillFocusAnnot(FX_UINT nFlag = 0); @@ -441,7 +427,7 @@ public: FX_BOOL GetChangeMark() {return m_bChangeMask;} void SetChangeMark() {m_bChangeMask = TRUE;} void ClearChangeMark() {m_bChangeMask= FALSE;} -// FX_BOOL GetChangeMark(){return FALSE;}//IsAnnotModified()||IsFormModified() || IsWidgetModified()|| m_nChangeMark>0 ;} +// FX_BOOL GetChangeMark(){return FALSE;}//IsAnnotModified()||IsFormModified() || IsWidgetModified()|| m_nChangeMark>0 ;} // void ClearChangeMark(){} CFX_WideString GetPath() ; CPDF_Page* GetPage(int nIndex); @@ -478,14 +464,13 @@ public: CPDFSDK_Annot* AddAnnot(CPDF_Dictionary * pDict); CPDFSDK_Annot* AddAnnot(FX_LPCSTR lpSubType,CPDF_Dictionary * pDict); CPDFSDK_Annot* AddAnnot(CPDF_Annot * pPDFAnnot); - FX_BOOL DeleteAnnot(CPDFSDK_Annot* pAnnot); - + FX_BOOL DeleteAnnot(CPDFSDK_Annot* pAnnot); int CountAnnots(); CPDFSDK_Annot* GetAnnot(int nIndex); CPDFSDK_Annot* GetAnnotByDict(CPDF_Dictionary * pDict); CPDF_Page* GetPDFPage(){return m_page;} CPDF_Document* GetPDFDocument(); - CPDFSDK_Document* GetSDKDocument() {return m_pSDKDoc;} + CPDFSDK_Document* GetSDKDocument() {return m_pSDKDoc;} FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_UINT nFlag); FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_UINT nFlag); FX_BOOL OnChar(int nChar, FX_UINT nFlag); @@ -529,28 +514,28 @@ private: template<class TYPE> class CGW_ArrayTemplate : public CFX_ArrayTemplate<TYPE> { -public: +public: CGW_ArrayTemplate(){} virtual ~CGW_ArrayTemplate(){} - + typedef int (*LP_COMPARE)(TYPE p1, TYPE p2); - + void Sort(LP_COMPARE pCompare, FX_BOOL bAscent = TRUE) { int nSize = this->GetSize(); QuickSort(0, nSize -1, bAscent, pCompare); } - + private: void QuickSort(FX_UINT nStartPos, FX_UINT nStopPos, FX_BOOL bAscend, LP_COMPARE pCompare) { if (nStartPos >= nStopPos) return; - + if ((nStopPos - nStartPos) == 1) { TYPE Value1 = this->GetAt(nStartPos); TYPE Value2 = this->GetAt(nStopPos); - + int iGreate = (*pCompare)(Value1, Value2); if ((bAscend && iGreate > 0) || (!bAscend && iGreate < 0)) { @@ -559,16 +544,16 @@ private: } return; } - + FX_UINT m = nStartPos + (nStopPos - nStartPos) / 2; FX_UINT i = nStartPos; - + TYPE Value = this->GetAt(m); - + while (i < m) { TYPE temp = this->GetAt(i); - + int iGreate = (*pCompare)(temp, Value); if ((bAscend && iGreate > 0) || (!bAscend && iGreate < 0)) { @@ -581,13 +566,13 @@ private: i++; } } - + FX_UINT j = nStopPos; - + while (j > m) { TYPE temp = this->GetAt(j); - + int iGreate = (*pCompare)(temp, Value); if ((bAscend && iGreate < 0) || (!bAscend && iGreate > 0)) { @@ -600,7 +585,7 @@ private: j--; } } - + if (nStartPos < m) QuickSort(nStartPos, m, bAscend, pCompare); if (nStopPos > m) QuickSort(m, nStopPos, bAscend, pCompare); } @@ -608,4 +593,3 @@ private: #endif //_FPDFSDK_MGR_H - diff --git a/fpdfsdk/include/javascript/JS_Object.h b/fpdfsdk/include/javascript/JS_Object.h index 2351b096f3..dbf7da68a4 100644 --- a/fpdfsdk/include/javascript/JS_Object.h +++ b/fpdfsdk/include/javascript/JS_Object.h @@ -1,7 +1,7 @@ // 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 #ifndef _JS_OBJECT_H_ @@ -28,10 +28,8 @@ public: CPDFSDK_PageView * JSGetPageView(IFXJS_Context* cc); int MsgBox(CPDFDoc_Environment* pApp, CPDFSDK_PageView* pPageView, FX_LPCWSTR swMsg, FX_LPCWSTR swTitle = NULL, FX_UINT nType = 0, FX_UINT nIcon = 0); void Alert(CJS_Context* pContext, FX_LPCWSTR swMsg); - FX_BOOL IsSafeMode(IFXJS_Context* cc); protected: - CJS_Object* m_pJSObject; }; @@ -40,7 +38,7 @@ class CJS_Object : public CFX_Object public: CJS_Object(JSFXObject pObject); virtual ~CJS_Object(void); - + void MakeWeak(); virtual FX_BOOL IsType(FX_LPCSTR sClassName){return TRUE;}; @@ -141,9 +139,9 @@ public: } int Find(FX_UINT nIndex) - { + { for (int i=0,sz=m_Array.GetSize(); i<sz; i++) - { + { if (JS_TIMER_MAP * pMap = m_Array.GetAt(i)) { if (pMap->nID == nIndex) @@ -165,8 +163,8 @@ class CJS_Timer { public: CJS_Timer(CJS_EmbedObj * pObj,CPDFDoc_Environment* pApp): - m_nTimerID(0), - m_pEmbedObj(pObj), + m_nTimerID(0), + m_pEmbedObj(pObj), m_bProcessing(FALSE), m_dwStartTime(0), m_dwTimeOut(0), @@ -176,7 +174,7 @@ public: m_pApp(pApp) { } - + virtual ~CJS_Timer() { KillJSTimer(); @@ -184,7 +182,7 @@ public: public: FX_UINT SetJSTimer(FX_UINT nElapse) - { + { if (m_nTimerID)KillJSTimer(); IFX_SystemHandler* pHandler = m_pApp->GetSysHandler(); m_nTimerID = pHandler->SetTimer(nElapse,TimerProc); @@ -238,7 +236,7 @@ public: { m_pRuntime = pRuntime; } - + CJS_Runtime* GetRuntime() const { return m_pRuntime; @@ -272,7 +270,7 @@ public: }; private: - FX_UINT m_nTimerID; + FX_UINT m_nTimerID; CJS_EmbedObj* m_pEmbedObj; FX_BOOL m_bProcessing; diff --git a/fpdfsdk/include/javascript/app.h b/fpdfsdk/include/javascript/app.h index 671b3581a5..1c95bf430d 100644 --- a/fpdfsdk/include/javascript/app.h +++ b/fpdfsdk/include/javascript/app.h @@ -160,9 +160,6 @@ private: public: static CFX_WideString SysPathToPDFPath(const CFX_WideString& sOldPath); - static CFX_WideString PDFPathToSysPath(const CFX_WideString& sOldPath); - static CFX_WideString RelativePathToSysPath(const CFX_WideString& sOldPath, const CFX_WideString& sFilePath); - private: |