summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-07-21 13:29:55 -0700
committerCommit bot <commit-bot@chromium.org>2016-07-21 13:29:55 -0700
commit1d3348ce0092d6d2a40de5f8433c0d0c16a1e12e (patch)
tree9d4f456e15a533fb49b2a9bdc6a38e47ad1210dc
parent9ca2b09126b80c03655f0eee1f02e1b2d0a18230 (diff)
downloadpdfium-1d3348ce0092d6d2a40de5f8433c0d0c16a1e12e.tar.xz
Remove EnableMessageBox() / IsMessageBoxEnabled()
It's always enabled. Also inline FXJS_MsgBox since it only has one caller. Review-Url: https://codereview.chromium.org/2167343002
-rw-r--r--fpdfsdk/javascript/JS_Object.cpp34
-rw-r--r--fpdfsdk/javascript/JS_Runtime_Stub.cpp1
-rw-r--r--fpdfsdk/javascript/cjs_context.cpp6
-rw-r--r--fpdfsdk/javascript/cjs_context.h3
-rw-r--r--fpdfsdk/javascript/ijs_context.h2
5 files changed, 11 insertions, 35 deletions
diff --git a/fpdfsdk/javascript/JS_Object.cpp b/fpdfsdk/javascript/JS_Object.cpp
index 8a4dc0fa33..b0a307beb1 100644
--- a/fpdfsdk/javascript/JS_Object.cpp
+++ b/fpdfsdk/javascript/JS_Object.cpp
@@ -10,24 +10,6 @@
#include "fpdfsdk/javascript/JS_Define.h"
#include "fpdfsdk/javascript/cjs_context.h"
-namespace {
-
-int FXJS_MsgBox(CPDFDoc_Environment* pApp,
- const FX_WCHAR* swMsg,
- const FX_WCHAR* swTitle,
- FX_UINT nType,
- FX_UINT nIcon) {
- if (!pApp)
- return 0;
-
- if (CPDFSDK_Document* pDoc = pApp->GetSDKDocument())
- pDoc->KillFocusAnnot();
-
- return pApp->JS_appAlert(swMsg, swTitle, nType, nIcon);
-}
-
-} // namespace
-
CJS_EmbedObj::CJS_EmbedObj(CJS_Object* pJSObject) : m_pJSObject(pJSObject) {}
CJS_EmbedObj::~CJS_EmbedObj() {
@@ -39,7 +21,13 @@ int CJS_EmbedObj::MsgBox(CPDFDoc_Environment* pApp,
const FX_WCHAR* swTitle,
FX_UINT nType,
FX_UINT nIcon) {
- return FXJS_MsgBox(pApp, swMsg, swTitle, nType, nIcon);
+ if (!pApp)
+ return 0;
+
+ if (CPDFSDK_Document* pDoc = pApp->GetSDKDocument())
+ pDoc->KillFocusAnnot();
+
+ return pApp->JS_appAlert(swMsg, swTitle, nType, nIcon);
}
void CJS_EmbedObj::Alert(CJS_Context* pContext, const FX_WCHAR* swMsg) {
@@ -80,11 +68,9 @@ void CJS_Object::InitInstance(IJS_Runtime* pIRuntime) {}
void CJS_Object::ExitInstance() {}
void CJS_Object::Alert(CJS_Context* pContext, const FX_WCHAR* swMsg) {
- if (pContext->IsMsgBoxEnabled()) {
- CPDFDoc_Environment* pApp = pContext->GetReaderApp();
- if (pApp)
- pApp->JS_appAlert(swMsg, nullptr, 0, 3);
- }
+ CPDFDoc_Environment* pApp = pContext->GetReaderApp();
+ if (pApp)
+ pApp->JS_appAlert(swMsg, nullptr, 0, 3);
}
CJS_Timer::CJS_Timer(CJS_EmbedObj* pObj,
diff --git a/fpdfsdk/javascript/JS_Runtime_Stub.cpp b/fpdfsdk/javascript/JS_Runtime_Stub.cpp
index 39c191af70..109be0acd6 100644
--- a/fpdfsdk/javascript/JS_Runtime_Stub.cpp
+++ b/fpdfsdk/javascript/JS_Runtime_Stub.cpp
@@ -116,7 +116,6 @@ class CJS_ContextStub final : public IJS_Context {
void OnBatchExec(CPDFSDK_Document* pTarget) override {}
void OnConsole_Exec() override {}
void OnExternal_Exec() override {}
- void EnableMessageBox(FX_BOOL bEnable) override {}
};
class CJS_RuntimeStub final : public IJS_Runtime {
diff --git a/fpdfsdk/javascript/cjs_context.cpp b/fpdfsdk/javascript/cjs_context.cpp
index 3833b166b6..406339d7af 100644
--- a/fpdfsdk/javascript/cjs_context.cpp
+++ b/fpdfsdk/javascript/cjs_context.cpp
@@ -11,7 +11,7 @@
#include "fpdfsdk/javascript/resource.h"
CJS_Context::CJS_Context(CJS_Runtime* pRuntime)
- : m_pRuntime(pRuntime), m_bBusy(FALSE), m_bMsgBoxEnable(TRUE) {
+ : m_pRuntime(pRuntime), m_bBusy(FALSE) {
m_pEventHandler = new CJS_EventHandler(this);
}
@@ -268,10 +268,6 @@ void CJS_Context::OnExternal_Exec() {
m_pEventHandler->OnExternal_Exec();
}
-void CJS_Context::EnableMessageBox(FX_BOOL bEnable) {
- m_bMsgBoxEnable = bEnable;
-}
-
void CJS_Context::OnBatchExec(CPDFSDK_Document* pTarget) {
m_pEventHandler->OnBatchExec(pTarget);
}
diff --git a/fpdfsdk/javascript/cjs_context.h b/fpdfsdk/javascript/cjs_context.h
index 84fdf1d3e1..cccdbc7669 100644
--- a/fpdfsdk/javascript/cjs_context.h
+++ b/fpdfsdk/javascript/cjs_context.h
@@ -119,9 +119,7 @@ class CJS_Context : public IJS_Context {
void OnBatchExec(CPDFSDK_Document* pTarget) override;
void OnConsole_Exec() override;
void OnExternal_Exec() override;
- void EnableMessageBox(FX_BOOL bEnable) override;
- FX_BOOL IsMsgBoxEnabled() const { return m_bMsgBoxEnable; }
CJS_Runtime* GetJSRuntime() const { return m_pRuntime; }
CJS_EventHandler* GetEventHandler() const { return m_pEventHandler; }
@@ -132,7 +130,6 @@ class CJS_Context : public IJS_Context {
CJS_Runtime* m_pRuntime;
CJS_EventHandler* m_pEventHandler;
FX_BOOL m_bBusy;
- FX_BOOL m_bMsgBoxEnable;
};
#endif // FPDFSDK_JAVASCRIPT_CJS_CONTEXT_H_
diff --git a/fpdfsdk/javascript/ijs_context.h b/fpdfsdk/javascript/ijs_context.h
index 365533c091..587ff8110c 100644
--- a/fpdfsdk/javascript/ijs_context.h
+++ b/fpdfsdk/javascript/ijs_context.h
@@ -125,8 +125,6 @@ class IJS_Context {
virtual void OnConsole_Exec() = 0;
virtual void OnExternal_Exec() = 0;
- virtual void EnableMessageBox(FX_BOOL bEnable) = 0;
-
protected:
virtual ~IJS_Context() {}
};