Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Unified Diff: fpdfsdk/javascript/app.cpp

Issue 2224073002: Remove MsgBox()/Alert() from CJS_EmbedObj. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Make CJS_Object::Alert() a helper function for public methods. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/javascript/PublicMethods.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/javascript/app.cpp
diff --git a/fpdfsdk/javascript/app.cpp b/fpdfsdk/javascript/app.cpp
index 755652d219ec35d79e0ff39305ac388a497ea2e2..50afd9a6c4e7ceb65ef2396778e3fc0315d0fdc0 100644
--- a/fpdfsdk/javascript/app.cpp
+++ b/fpdfsdk/javascript/app.cpp
@@ -403,6 +403,12 @@ FX_BOOL app::alert(IJS_Context* cc,
return FALSE;
}
+ CPDFDoc_Environment* pApp = pRuntime->GetReaderApp();
+ if (!pApp) {
+ vRet = 0;
+ return TRUE;
+ }
+
CFX_WideString swMsg;
if (newParams[0].GetType() == CJS_Value::VT_object) {
CJS_Array carray;
@@ -438,8 +444,10 @@ FX_BOOL app::alert(IJS_Context* cc,
swTitle = JSGetStringFromID(pContext, IDS_STRING_JSALERT);
pRuntime->BeginBlock();
- vRet = MsgBox(pRuntime->GetReaderApp(), swMsg.c_str(), swTitle.c_str(), iType,
- iIcon);
+ if (CPDFSDK_Document* pDoc = pApp->GetSDKDocument())
+ pDoc->KillFocusAnnot();
+
+ vRet = pApp->JS_appAlert(swMsg.c_str(), swTitle.c_str(), iType, iIcon);
pRuntime->EndBlock();
return TRUE;
}
« no previous file with comments | « fpdfsdk/javascript/PublicMethods.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698