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

Side by Side Diff: fpdfsdk/javascript/JS_Object.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 unified diff | Download patch
« no previous file with comments | « fpdfsdk/javascript/JS_Object.h ('k') | fpdfsdk/javascript/PublicMethods.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "fpdfsdk/javascript/JS_Object.h" 7 #include "fpdfsdk/javascript/JS_Object.h"
8 8
9 #include "fpdfsdk/include/fsdk_mgr.h" 9 #include "fpdfsdk/include/fsdk_mgr.h"
10 #include "fpdfsdk/javascript/JS_Define.h" 10 #include "fpdfsdk/javascript/JS_Define.h"
11 #include "fpdfsdk/javascript/cjs_context.h" 11 #include "fpdfsdk/javascript/cjs_context.h"
12 12
13 CJS_EmbedObj::CJS_EmbedObj(CJS_Object* pJSObject) : m_pJSObject(pJSObject) {} 13 CJS_EmbedObj::CJS_EmbedObj(CJS_Object* pJSObject) : m_pJSObject(pJSObject) {}
14 14
15 CJS_EmbedObj::~CJS_EmbedObj() { 15 CJS_EmbedObj::~CJS_EmbedObj() {
16 m_pJSObject = nullptr; 16 m_pJSObject = nullptr;
17 } 17 }
18 18
19 int CJS_EmbedObj::MsgBox(CPDFDoc_Environment* pApp,
20 const FX_WCHAR* swMsg,
21 const FX_WCHAR* swTitle,
22 FX_UINT nType,
23 FX_UINT nIcon) {
24 if (!pApp)
25 return 0;
26
27 if (CPDFSDK_Document* pDoc = pApp->GetSDKDocument())
28 pDoc->KillFocusAnnot();
29
30 return pApp->JS_appAlert(swMsg, swTitle, nType, nIcon);
31 }
32
33 void CJS_EmbedObj::Alert(CJS_Context* pContext, const FX_WCHAR* swMsg) {
34 CJS_Object::Alert(pContext, swMsg);
35 }
36
37 void FreeObject(const v8::WeakCallbackInfo<CJS_Object>& data) { 19 void FreeObject(const v8::WeakCallbackInfo<CJS_Object>& data) {
38 CJS_Object* pJSObj = data.GetParameter(); 20 CJS_Object* pJSObj = data.GetParameter();
39 pJSObj->ExitInstance(); 21 pJSObj->ExitInstance();
40 delete pJSObj; 22 delete pJSObj;
41 FXJS_FreePrivate(data.GetInternalField(0)); 23 FXJS_FreePrivate(data.GetInternalField(0));
42 } 24 }
43 25
44 void DisposeObject(const v8::WeakCallbackInfo<CJS_Object>& data) { 26 void DisposeObject(const v8::WeakCallbackInfo<CJS_Object>& data) {
45 CJS_Object* pJSObj = data.GetParameter(); 27 CJS_Object* pJSObj = data.GetParameter();
46 pJSObj->Dispose(); 28 pJSObj->Dispose();
(...skipping 12 matching lines...) Expand all
59 v8::WeakCallbackType::kInternalFields); 41 v8::WeakCallbackType::kInternalFields);
60 } 42 }
61 43
62 void CJS_Object::Dispose() { 44 void CJS_Object::Dispose() {
63 m_pV8Object.Reset(); 45 m_pV8Object.Reset();
64 } 46 }
65 47
66 void CJS_Object::InitInstance(IJS_Runtime* pIRuntime) {} 48 void CJS_Object::InitInstance(IJS_Runtime* pIRuntime) {}
67 49
68 void CJS_Object::ExitInstance() {} 50 void CJS_Object::ExitInstance() {}
69
70 void CJS_Object::Alert(CJS_Context* pContext, const FX_WCHAR* swMsg) {
71 CPDFDoc_Environment* pApp = pContext->GetReaderApp();
72 if (pApp)
73 pApp->JS_appAlert(swMsg, nullptr, 0, 3);
74 }
OLDNEW
« no previous file with comments | « fpdfsdk/javascript/JS_Object.h ('k') | fpdfsdk/javascript/PublicMethods.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698