From 79db609948b01d7a27824b74acc4bd22c8bfd17b Mon Sep 17 00:00:00 2001 From: dsinclair Date: Wed, 14 Sep 2016 07:27:21 -0700 Subject: Rename CPDFDoc_Environment to CPDFSDK_Environment CPDFDoc_Environment does not fit with the general naming scheme of the rest of the files in fpdfsdk. This CL updates the naming to CPDFSDK_Environment to better fit with the surrounding files. Review-Url: https://codereview.chromium.org/2333413003 --- fpdfsdk/javascript/Document.cpp | 12 ++++++------ fpdfsdk/javascript/Field.cpp | 6 +++--- fpdfsdk/javascript/JS_GlobalData.cpp | 2 +- fpdfsdk/javascript/JS_GlobalData.h | 4 ++-- fpdfsdk/javascript/JS_Object.h | 2 +- fpdfsdk/javascript/JS_Runtime_Stub.cpp | 2 +- fpdfsdk/javascript/PublicMethods.cpp | 4 ++-- fpdfsdk/javascript/app.cpp | 28 ++++++++++++++-------------- fpdfsdk/javascript/cjs_context.cpp | 2 +- fpdfsdk/javascript/cjs_context.h | 4 ++-- fpdfsdk/javascript/cjs_runtime.cpp | 6 +++--- fpdfsdk/javascript/cjs_runtime.h | 6 +++--- fpdfsdk/javascript/global.cpp | 2 +- fpdfsdk/javascript/global.h | 4 ++-- fpdfsdk/javascript/ijs_runtime.h | 4 ++-- 15 files changed, 44 insertions(+), 44 deletions(-) (limited to 'fpdfsdk/javascript') diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp index cbf155abf1..9fc99f5e10 100644 --- a/fpdfsdk/javascript/Document.cpp +++ b/fpdfsdk/javascript/Document.cpp @@ -15,9 +15,9 @@ #include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" #include "core/fpdfdoc/include/cpdf_interform.h" #include "core/fpdfdoc/include/cpdf_nametree.h" -#include "fpdfsdk/include/cpdfdoc_environment.h" #include "fpdfsdk/include/cpdfsdk_annotiterator.h" #include "fpdfsdk/include/cpdfsdk_document.h" +#include "fpdfsdk/include/cpdfsdk_environment.h" #include "fpdfsdk/include/cpdfsdk_interform.h" #include "fpdfsdk/include/cpdfsdk_pageview.h" #include "fpdfsdk/include/cpdfsdk_widget.h" @@ -224,7 +224,7 @@ FX_BOOL Document::pageNum(IJS_Context* cc, int iPageNum = 0; vp >> iPageNum; - CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); + CPDFSDK_Environment* pEnv = m_pDocument->GetEnv(); if (iPageNum >= 0 && iPageNum < iPageCount) { pEnv->JS_docgotoPage(iPageNum); } else if (iPageNum >= iPageCount) { @@ -407,7 +407,7 @@ FX_BOOL Document::mailForm(IJS_Context* cc, return FALSE; pRuntime->BeginBlock(); - CPDFDoc_Environment* pEnv = pContext->GetReaderApp(); + CPDFSDK_Environment* pEnv = pContext->GetReaderApp(); pEnv->JS_docmailForm(textBuf.GetBuffer(), textBuf.GetLength(), bUI, cTo.c_str(), cSubject.c_str(), cCc.c_str(), cBcc.c_str(), cMsg.c_str()); @@ -476,7 +476,7 @@ FX_BOOL Document::print(IJS_Context* cc, bAnnotations = params[7].ToBool(pRuntime); } - if (CPDFDoc_Environment* pEnv = m_pDocument->GetEnv()) { + if (CPDFSDK_Environment* pEnv = m_pDocument->GetEnv()) { pEnv->JS_docprint(bUI, nStart, nEnd, bSilent, bShrinkToFit, bPrintAsImage, bReverse, bAnnotations); return TRUE; @@ -755,7 +755,7 @@ FX_BOOL Document::mailDoc(IJS_Context* cc, } pRuntime->BeginBlock(); - CPDFDoc_Environment* pEnv = pRuntime->GetReaderApp(); + CPDFSDK_Environment* pEnv = pRuntime->GetReaderApp(); pEnv->JS_docmailForm(nullptr, 0, bUI, cTo.c_str(), cSubject.c_str(), cCc.c_str(), cBcc.c_str(), cMsg.c_str()); pRuntime->EndBlock(); @@ -1694,7 +1694,7 @@ FX_BOOL Document::gotoNamedDest(IJS_Context* cc, } pRuntime->BeginBlock(); - CPDFDoc_Environment* pApp = m_pDocument->GetEnv(); + CPDFSDK_Environment* pApp = m_pDocument->GetEnv(); pApp->FFI_DoGoToAction(dest.GetPageIndex(pDocument), dest.GetZoomMode(), scrollPositionArray.get(), scrollPositionArraySize); pRuntime->EndBlock(); diff --git a/fpdfsdk/javascript/Field.cpp b/fpdfsdk/javascript/Field.cpp index 0803cfa138..33c724095c 100644 --- a/fpdfsdk/javascript/Field.cpp +++ b/fpdfsdk/javascript/Field.cpp @@ -15,8 +15,8 @@ #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fpdfdoc/include/cpdf_interform.h" -#include "fpdfsdk/include/cpdfdoc_environment.h" #include "fpdfsdk/include/cpdfsdk_document.h" +#include "fpdfsdk/include/cpdfsdk_environment.h" #include "fpdfsdk/include/cpdfsdk_interform.h" #include "fpdfsdk/include/cpdfsdk_pageview.h" #include "fpdfsdk/include/cpdfsdk_widget.h" @@ -2835,7 +2835,7 @@ FX_BOOL Field::browseForFileToSubmit(IJS_Context* cc, return FALSE; CPDF_FormField* pFormField = FieldArray[0]; - CPDFDoc_Environment* pApp = m_pDocument->GetEnv(); + CPDFSDK_Environment* pApp = m_pDocument->GetEnv(); if ((pFormField->GetFieldFlags() & FIELDFLAG_FILESELECT) && (pFormField->GetFieldType() == FIELDTYPE_TEXTFIELD)) { CFX_WideString wsFileName = pApp->JS_fieldBrowse(); @@ -3202,7 +3202,7 @@ FX_BOOL Field::setFocus(IJS_Context* cc, if (nCount == 1) { pWidget = pInterForm->GetWidget(pFormField->GetControl(0), false); } else { - CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); + CPDFSDK_Environment* pEnv = m_pDocument->GetEnv(); UnderlyingPageType* pPage = UnderlyingFromFPDFPage( pEnv->FFI_GetCurrentPage(m_pDocument->GetUnderlyingDocument())); if (!pPage) diff --git a/fpdfsdk/javascript/JS_GlobalData.cpp b/fpdfsdk/javascript/JS_GlobalData.cpp index d1268b042f..eff785353f 100644 --- a/fpdfsdk/javascript/JS_GlobalData.cpp +++ b/fpdfsdk/javascript/JS_GlobalData.cpp @@ -40,7 +40,7 @@ CJS_GlobalData* g_pInstance = nullptr; } // namespace // static -CJS_GlobalData* CJS_GlobalData::GetRetainedInstance(CPDFDoc_Environment* pApp) { +CJS_GlobalData* CJS_GlobalData::GetRetainedInstance(CPDFSDK_Environment* pApp) { if (!g_pInstance) { g_pInstance = new CJS_GlobalData(); } diff --git a/fpdfsdk/javascript/JS_GlobalData.h b/fpdfsdk/javascript/JS_GlobalData.h index d901ec58b3..cda8533fad 100644 --- a/fpdfsdk/javascript/JS_GlobalData.h +++ b/fpdfsdk/javascript/JS_GlobalData.h @@ -13,7 +13,7 @@ #include "core/fxcrt/include/fx_basic.h" #include "fpdfsdk/javascript/JS_KeyValue.h" -class CPDFDoc_Environment; +class CPDFSDK_Environment; class CJS_GlobalData_Element { public: @@ -26,7 +26,7 @@ class CJS_GlobalData_Element { class CJS_GlobalData { public: - static CJS_GlobalData* GetRetainedInstance(CPDFDoc_Environment* pApp); + static CJS_GlobalData* GetRetainedInstance(CPDFSDK_Environment* pApp); void Release(); void SetGlobalVariableNumber(const CFX_ByteString& propname, double dData); diff --git a/fpdfsdk/javascript/JS_Object.h b/fpdfsdk/javascript/JS_Object.h index 3b2407171c..ede64a7e20 100644 --- a/fpdfsdk/javascript/JS_Object.h +++ b/fpdfsdk/javascript/JS_Object.h @@ -16,7 +16,7 @@ class CJS_Context; class CJS_Object; -class CPDFDoc_Environment; +class CPDFSDK_Environment; class CJS_EmbedObj { public: diff --git a/fpdfsdk/javascript/JS_Runtime_Stub.cpp b/fpdfsdk/javascript/JS_Runtime_Stub.cpp index 2b4a624c0e..2c7eda8a7e 100644 --- a/fpdfsdk/javascript/JS_Runtime_Stub.cpp +++ b/fpdfsdk/javascript/JS_Runtime_Stub.cpp @@ -163,6 +163,6 @@ void IJS_Runtime::Initialize(unsigned int slot, void* isolate) {} void IJS_Runtime::Destroy() {} // static -IJS_Runtime* IJS_Runtime::Create(CPDFDoc_Environment* pEnv) { +IJS_Runtime* IJS_Runtime::Create(CPDFSDK_Environment* pEnv) { return new CJS_RuntimeStub; } diff --git a/fpdfsdk/javascript/PublicMethods.cpp b/fpdfsdk/javascript/PublicMethods.cpp index 5a793f4270..435c383b34 100644 --- a/fpdfsdk/javascript/PublicMethods.cpp +++ b/fpdfsdk/javascript/PublicMethods.cpp @@ -11,8 +11,8 @@ #include "core/fpdfdoc/include/cpdf_interform.h" #include "core/fxcrt/include/fx_ext.h" -#include "fpdfsdk/include/cpdfdoc_environment.h" #include "fpdfsdk/include/cpdfsdk_document.h" +#include "fpdfsdk/include/cpdfsdk_environment.h" #include "fpdfsdk/include/cpdfsdk_interform.h" #include "fpdfsdk/javascript/Field.h" #include "fpdfsdk/javascript/JS_Define.h" @@ -80,7 +80,7 @@ CFX_WideString StrTrim(const CFX_WideString& pStr) { } void AlertIfPossible(CJS_Context* pContext, const FX_WCHAR* swMsg) { - CPDFDoc_Environment* pApp = pContext->GetReaderApp(); + CPDFSDK_Environment* pApp = pContext->GetReaderApp(); if (pApp) pApp->JS_appAlert(swMsg, nullptr, 0, 3); } diff --git a/fpdfsdk/javascript/app.cpp b/fpdfsdk/javascript/app.cpp index 5e708de9ea..0f11609fe7 100644 --- a/fpdfsdk/javascript/app.cpp +++ b/fpdfsdk/javascript/app.cpp @@ -9,8 +9,8 @@ #include #include -#include "fpdfsdk/include/cpdfdoc_environment.h" #include "fpdfsdk/include/cpdfsdk_document.h" +#include "fpdfsdk/include/cpdfsdk_environment.h" #include "fpdfsdk/include/cpdfsdk_interform.h" #include "fpdfsdk/javascript/Document.h" #include "fpdfsdk/javascript/JS_Define.h" @@ -25,7 +25,7 @@ class GlobalTimer { public: GlobalTimer(app* pObj, - CPDFDoc_Environment* pApp, + CPDFSDK_Environment* pApp, CJS_Runtime* pRuntime, int nType, const CFX_WideString& script, @@ -55,11 +55,11 @@ class GlobalTimer { const uint32_t m_dwTimeOut; const CFX_WideString m_swJScript; CJS_Runtime::ObservedPtr m_pRuntime; - CPDFDoc_Environment* const m_pApp; + CPDFSDK_Environment* const m_pApp; }; GlobalTimer::GlobalTimer(app* pObj, - CPDFDoc_Environment* pApp, + CPDFSDK_Environment* pApp, CJS_Runtime* pRuntime, int nType, const CFX_WideString& script, @@ -217,7 +217,7 @@ FX_BOOL app::activeDocs(IJS_Context* cc, return FALSE; CJS_Context* pContext = (CJS_Context*)cc; - CPDFDoc_Environment* pApp = pContext->GetReaderApp(); + CPDFSDK_Environment* pApp = pContext->GetReaderApp(); CJS_Runtime* pRuntime = pContext->GetJSRuntime(); CPDFSDK_Document* pCurDoc = pContext->GetReaderDocument(); CJS_Array aDocs; @@ -255,7 +255,7 @@ FX_BOOL app::calculate(IJS_Context* cc, m_bCalculate = (FX_BOOL)bVP; CJS_Context* pContext = (CJS_Context*)cc; - CPDFDoc_Environment* pApp = pContext->GetReaderApp(); + CPDFSDK_Environment* pApp = pContext->GetReaderApp(); if (CPDFSDK_Document* pDoc = pApp->GetSDKDocument()) pDoc->GetInterForm()->EnableCalculate((FX_BOOL)m_bCalculate); } else { @@ -321,7 +321,7 @@ FX_BOOL app::platform(IJS_Context* cc, if (!vp.IsGetting()) return FALSE; #ifdef PDF_ENABLE_XFA - CPDFDoc_Environment* pEnv = + CPDFSDK_Environment* pEnv = static_cast(cc)->GetJSRuntime()->GetReaderApp(); if (!pEnv) return FALSE; @@ -341,7 +341,7 @@ FX_BOOL app::language(IJS_Context* cc, if (!vp.IsGetting()) return FALSE; #ifdef PDF_ENABLE_XFA - CPDFDoc_Environment* pEnv = + CPDFSDK_Environment* pEnv = static_cast(cc)->GetJSRuntime()->GetReaderApp(); if (!pEnv) return FALSE; @@ -358,7 +358,7 @@ FX_BOOL app::language(IJS_Context* cc, // creates a new fdf object that contains no data // comment: need reader support // note: -// CFDF_Document * CPDFDoc_Environment::NewFDF(); +// CFDF_Document * CPDFSDK_Environment::NewFDF(); FX_BOOL app::newFDF(IJS_Context* cc, const std::vector& params, CJS_Value& vRet, @@ -369,7 +369,7 @@ FX_BOOL app::newFDF(IJS_Context* cc, // comment:need reader support // note: as defined in js reference, the proto of this function's fourth // parmeters, how old an fdf document while do not show it. -// CFDF_Document * CPDFDoc_Environment::OpenFDF(string strPath,bool bUserConv); +// CFDF_Document * CPDFSDK_Environment::OpenFDF(string strPath,bool bUserConv); FX_BOOL app::openFDF(IJS_Context* cc, const std::vector& params, @@ -391,7 +391,7 @@ FX_BOOL app::alert(IJS_Context* cc, return FALSE; } - CPDFDoc_Environment* pApp = pRuntime->GetReaderApp(); + CPDFSDK_Environment* pApp = pRuntime->GetReaderApp(); if (!pApp) { vRet = CJS_Value(pRuntime, 0); return TRUE; @@ -447,7 +447,7 @@ FX_BOOL app::beep(IJS_Context* cc, CFX_WideString& sError) { if (params.size() == 1) { CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); - CPDFDoc_Environment* pEnv = pRuntime->GetReaderApp(); + CPDFSDK_Environment* pEnv = pRuntime->GetReaderApp(); pEnv->JS_appBeep(params[0].ToInt(pRuntime)); return TRUE; } @@ -492,7 +492,7 @@ FX_BOOL app::setInterval(IJS_Context* cc, } uint32_t dwInterval = params.size() > 1 ? params[1].ToInt(pRuntime) : 1000; - CPDFDoc_Environment* pApp = pRuntime->GetReaderApp(); + CPDFSDK_Environment* pApp = pRuntime->GetReaderApp(); GlobalTimer* timerRef = new GlobalTimer(this, pApp, pRuntime, 0, script, dwInterval, 0); @@ -526,7 +526,7 @@ FX_BOOL app::setTimeOut(IJS_Context* cc, } uint32_t dwTimeOut = params.size() > 1 ? params[1].ToInt(pRuntime) : 1000; - CPDFDoc_Environment* pApp = pRuntime->GetReaderApp(); + CPDFSDK_Environment* pApp = pRuntime->GetReaderApp(); GlobalTimer* timerRef = new GlobalTimer(this, pApp, pRuntime, 1, script, dwTimeOut, dwTimeOut); diff --git a/fpdfsdk/javascript/cjs_context.cpp b/fpdfsdk/javascript/cjs_context.cpp index 87b8b43975..4a6e4d3a64 100644 --- a/fpdfsdk/javascript/cjs_context.cpp +++ b/fpdfsdk/javascript/cjs_context.cpp @@ -21,7 +21,7 @@ CPDFSDK_Document* CJS_Context::GetReaderDocument() { return m_pRuntime->GetReaderDocument(); } -CPDFDoc_Environment* CJS_Context::GetReaderApp() { +CPDFSDK_Environment* CJS_Context::GetReaderApp() { return m_pRuntime->GetReaderApp(); } diff --git a/fpdfsdk/javascript/cjs_context.h b/fpdfsdk/javascript/cjs_context.h index 49ba42c6d1..03403de6b3 100644 --- a/fpdfsdk/javascript/cjs_context.h +++ b/fpdfsdk/javascript/cjs_context.h @@ -15,7 +15,7 @@ class CJS_EventHandler; class CJS_Runtime; -class CPDFDoc_Environment; +class CPDFSDK_Environment; class CJS_Context : public IJS_Context { public: @@ -125,7 +125,7 @@ class CJS_Context : public IJS_Context { CJS_Runtime* GetJSRuntime() const { return m_pRuntime; } CJS_EventHandler* GetEventHandler() const { return m_pEventHandler.get(); } - CPDFDoc_Environment* GetReaderApp(); + CPDFSDK_Environment* GetReaderApp(); CPDFSDK_Document* GetReaderDocument(); private: diff --git a/fpdfsdk/javascript/cjs_runtime.cpp b/fpdfsdk/javascript/cjs_runtime.cpp index e35ee5bc54..1afde804ca 100644 --- a/fpdfsdk/javascript/cjs_runtime.cpp +++ b/fpdfsdk/javascript/cjs_runtime.cpp @@ -8,7 +8,7 @@ #include -#include "fpdfsdk/include/cpdfdoc_environment.h" +#include "fpdfsdk/include/cpdfsdk_environment.h" #include "fpdfsdk/javascript/Annot.h" #include "fpdfsdk/javascript/Consts.h" #include "fpdfsdk/javascript/Document.h" @@ -47,7 +47,7 @@ void IJS_Runtime::Destroy() { } // static -IJS_Runtime* IJS_Runtime::Create(CPDFDoc_Environment* pEnv) { +IJS_Runtime* IJS_Runtime::Create(CPDFSDK_Environment* pEnv) { return new CJS_Runtime(pEnv); } @@ -63,7 +63,7 @@ CJS_Runtime* CJS_Runtime::CurrentRuntimeFromIsolate(v8::Isolate* pIsolate) { CFXJS_Engine::CurrentEngineFromIsolate(pIsolate)); } -CJS_Runtime::CJS_Runtime(CPDFDoc_Environment* pApp) +CJS_Runtime::CJS_Runtime(CPDFSDK_Environment* pApp) : m_pApp(pApp), m_pDocument(nullptr), m_bBlocking(false), diff --git a/fpdfsdk/javascript/cjs_runtime.h b/fpdfsdk/javascript/cjs_runtime.h index 5157c416ad..12f902d7df 100644 --- a/fpdfsdk/javascript/cjs_runtime.h +++ b/fpdfsdk/javascript/cjs_runtime.h @@ -30,7 +30,7 @@ class CJS_Runtime : public IJS_Runtime, static CJS_Runtime* FromContext(const IJS_Context* cc); static CJS_Runtime* CurrentRuntimeFromIsolate(v8::Isolate* pIsolate); - explicit CJS_Runtime(CPDFDoc_Environment* pApp); + explicit CJS_Runtime(CPDFSDK_Environment* pApp); ~CJS_Runtime() override; // IJS_Runtime @@ -42,7 +42,7 @@ class CJS_Runtime : public IJS_Runtime, int ExecuteScript(const CFX_WideString& script, CFX_WideString* info) override; - CPDFDoc_Environment* GetReaderApp() const { return m_pApp; } + CPDFSDK_Environment* GetReaderApp() const { return m_pApp; } // Returns true if the event isn't already found in the set. bool AddEventToSet(const FieldEvent& event); @@ -63,7 +63,7 @@ class CJS_Runtime : public IJS_Runtime, void DefineJSObjects(); std::vector> m_ContextArray; - CPDFDoc_Environment* const m_pApp; + CPDFSDK_Environment* const m_pApp; CPDFSDK_Document* m_pDocument; bool m_bBlocking; bool m_isolateManaged; diff --git a/fpdfsdk/javascript/global.cpp b/fpdfsdk/javascript/global.cpp index c0330f3a14..42ae8d54ce 100644 --- a/fpdfsdk/javascript/global.cpp +++ b/fpdfsdk/javascript/global.cpp @@ -56,7 +56,7 @@ JSGlobalAlternate::~JSGlobalAlternate() { m_pGlobalData->Release(); } -void JSGlobalAlternate::Initial(CPDFDoc_Environment* pApp) { +void JSGlobalAlternate::Initial(CPDFSDK_Environment* pApp) { m_pApp = pApp; m_pGlobalData = CJS_GlobalData::GetRetainedInstance(pApp); UpdateGlobalPersistentVariables(); diff --git a/fpdfsdk/javascript/global.h b/fpdfsdk/javascript/global.h index 6604d9bad8..165cf3a443 100644 --- a/fpdfsdk/javascript/global.h +++ b/fpdfsdk/javascript/global.h @@ -47,7 +47,7 @@ class JSGlobalAlternate : public CJS_EmbedObj { FX_BOOL DelProperty(IJS_Context* cc, const FX_WCHAR* propname, CFX_WideString& sError); - void Initial(CPDFDoc_Environment* pApp); + void Initial(CPDFSDK_Environment* pApp); private: void UpdateGlobalPersistentVariables(); @@ -68,7 +68,7 @@ class JSGlobalAlternate : public CJS_EmbedObj { std::map m_mapGlobal; CFX_WideString m_sFilePath; CJS_GlobalData* m_pGlobalData; - CPDFDoc_Environment* m_pApp; + CPDFSDK_Environment* m_pApp; }; class CJS_Global : public CJS_Object { diff --git a/fpdfsdk/javascript/ijs_runtime.h b/fpdfsdk/javascript/ijs_runtime.h index 3dcfa372de..ee024fe2fd 100644 --- a/fpdfsdk/javascript/ijs_runtime.h +++ b/fpdfsdk/javascript/ijs_runtime.h @@ -14,7 +14,7 @@ #include "fxjs/include/fxjse.h" #endif // PDF_ENABLE_XFA -class CPDFDoc_Environment; +class CPDFSDK_Environment; class CPDFSDK_Document; class IJS_Context; @@ -23,7 +23,7 @@ class IJS_Runtime { public: static void Initialize(unsigned int slot, void* isolate); static void Destroy(); - static IJS_Runtime* Create(CPDFDoc_Environment* pEnv); + static IJS_Runtime* Create(CPDFSDK_Environment* pEnv); virtual ~IJS_Runtime() {} virtual IJS_Context* NewContext() = 0; -- cgit v1.2.3