Remove pointless CPDFSDK_PageView usage in CJS_Object / CJS_EmbedObj.
authorLei Zhang <thestig@chromium.org>
Mon, 5 Oct 2015 03:41:53 +0000 (20:41 -0700)
committerLei Zhang <thestig@chromium.org>
Mon, 5 Oct 2015 03:41:53 +0000 (20:41 -0700)
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1374723004 .

fpdfsdk/include/javascript/JS_Object.h
fpdfsdk/src/javascript/JS_Object.cpp
fpdfsdk/src/javascript/app.cpp

index 337da7b..6116a83 100644 (file)
@@ -17,7 +17,6 @@
 #include "../jsapi/fxjs_v8.h"
 #include "JS_Runtime.h"
 
-class CPDFSDK_PageView;
 class CJS_Context;
 class CJS_Object;
 class CJS_Timer;
@@ -31,13 +30,11 @@ class CJS_EmbedObj {
 
   CJS_Object* GetJSObject() const { return m_pJSObject; }
 
-  CPDFSDK_PageView* JSGetPageView(IFXJS_Context* cc);
   int MsgBox(CPDFDoc_Environment* pApp,
-             CPDFSDK_PageView* pPageView,
              const FX_WCHAR* swMsg,
-             const FX_WCHAR* swTitle = NULL,
-             FX_UINT nType = 0,
-             FX_UINT nIcon = 0);
+             const FX_WCHAR* swTitle,
+             FX_UINT nType,
+             FX_UINT nIcon);
   void Alert(CJS_Context* pContext, const FX_WCHAR* swMsg);
 
  protected:
@@ -64,13 +61,11 @@ class CJS_Object {
   void SetEmbedObject(CJS_EmbedObj* pObj) { m_pEmbedObj.reset(pObj); }
   CJS_EmbedObj* GetEmbedObject() const { return m_pEmbedObj.get(); }
 
-  static CPDFSDK_PageView* JSGetPageView(IFXJS_Context* cc);
   static int MsgBox(CPDFDoc_Environment* pApp,
-                    CPDFSDK_PageView* pPageView,
                     const FX_WCHAR* swMsg,
-                    const FX_WCHAR* swTitle = NULL,
-                    FX_UINT nType = 0,
-                    FX_UINT nIcon = 0);
+                    const FX_WCHAR* swTitle,
+                    FX_UINT nType,
+                    FX_UINT nIcon);
   static void Alert(CJS_Context* pContext, const FX_WCHAR* swMsg);
 
   v8::Isolate* GetIsolate() { return m_pIsolate; }
index 7520a99..952f4b5 100644 (file)
@@ -4,14 +4,15 @@
 
 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
 
-#include "../../include/javascript/JavaScript.h"
 #include "../../include/javascript/IJavaScript.h"
+#include "../../include/javascript/JS_Context.h"
 #include "../../include/javascript/JS_Define.h"
 #include "../../include/javascript/JS_Object.h"
-#include "../../include/javascript/JS_Context.h"
+#include "../../include/javascript/JavaScript.h"
+
+namespace {
 
 int FXJS_MsgBox(CPDFDoc_Environment* pApp,
-                CPDFSDK_PageView* pPageView,
                 const FX_WCHAR* swMsg,
                 const FX_WCHAR* swTitle,
                 FX_UINT nType,
@@ -25,13 +26,7 @@ int FXJS_MsgBox(CPDFDoc_Environment* pApp,
   return pApp->JS_appAlert(swMsg, swTitle, nType, nIcon);
 }
 
-CPDFSDK_PageView* FXJS_GetPageView(IFXJS_Context* cc) {
-  if (CJS_Context* pContext = (CJS_Context*)cc) {
-    if (pContext->GetReaderDocument())
-      return NULL;
-  }
-  return NULL;
-}
+}  // namespace
 
 CJS_EmbedObj::CJS_EmbedObj(CJS_Object* pJSObject) : m_pJSObject(pJSObject) {}
 
@@ -39,17 +34,12 @@ CJS_EmbedObj::~CJS_EmbedObj() {
   m_pJSObject = NULL;
 }
 
-CPDFSDK_PageView* CJS_EmbedObj::JSGetPageView(IFXJS_Context* cc) {
-  return FXJS_GetPageView(cc);
-}
-
 int CJS_EmbedObj::MsgBox(CPDFDoc_Environment* pApp,
-                         CPDFSDK_PageView* pPageView,
                          const FX_WCHAR* swMsg,
                          const FX_WCHAR* swTitle,
                          FX_UINT nType,
                          FX_UINT nIcon) {
-  return FXJS_MsgBox(pApp, pPageView, swMsg, swTitle, nType, nIcon);
+  return FXJS_MsgBox(pApp, swMsg, swTitle, nType, nIcon);
 }
 
 void CJS_EmbedObj::Alert(CJS_Context* pContext, const FX_WCHAR* swMsg) {
@@ -86,17 +76,12 @@ void CJS_Object::Dispose() {
   m_pV8Object.Reset();
 }
 
-CPDFSDK_PageView* CJS_Object::JSGetPageView(IFXJS_Context* cc) {
-  return FXJS_GetPageView(cc);
-}
-
 int CJS_Object::MsgBox(CPDFDoc_Environment* pApp,
-                       CPDFSDK_PageView* pPageView,
                        const FX_WCHAR* swMsg,
                        const FX_WCHAR* swTitle,
                        FX_UINT nType,
                        FX_UINT nIcon) {
-  return FXJS_MsgBox(pApp, pPageView, swMsg, swTitle, nType, nIcon);
+  return FXJS_MsgBox(pApp, swMsg, swTitle, nType, nIcon);
 }
 
 void CJS_Object::Alert(CJS_Context* pContext, const FX_WCHAR* swMsg) {
index 067ae10..12f164e 100644 (file)
@@ -346,8 +346,8 @@ FX_BOOL app::alert(IFXJS_Context* cc,
   CJS_Runtime* pRuntime = pContext->GetJSRuntime();
   ASSERT(pRuntime != NULL);
   pRuntime->BeginBlock();
-  vRet = MsgBox(pRuntime->GetReaderApp(), JSGetPageView(cc), swMsg.c_str(),
-                swTitle.c_str(), iType, iIcon);
+  vRet = MsgBox(pRuntime->GetReaderApp(), swMsg.c_str(), swTitle.c_str(), iType,
+                iIcon);
   pRuntime->EndBlock();
 
   return TRUE;