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

Side by Side Diff: fpdfsdk/src/javascript/JS_Object.cpp

Issue 1235393002: Tidy up CPDFDOC_Environment. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 5 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
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 "../../include/javascript/JavaScript.h" 7 #include "../../include/javascript/JavaScript.h"
8 #include "../../include/javascript/IJavaScript.h" 8 #include "../../include/javascript/IJavaScript.h"
9 #include "../../include/javascript/JS_Define.h" 9 #include "../../include/javascript/JS_Define.h"
10 #include "../../include/javascript/JS_Object.h" 10 #include "../../include/javascript/JS_Object.h"
11 // #include "../../include/javascript/JS_MsgBox.h"
12 // #include "../../include/javascript/JS_ResMgr.h"
13 #include "../../include/javascript/JS_Context.h" 11 #include "../../include/javascript/JS_Context.h"
14 12
15 JS_TIMER_MAPARRAY& GetTimeMap() 13 JS_TIMER_MAPARRAY& GetTimeMap()
16 { 14 {
17 // Leak the timer array at shutdown. 15 // Leak the timer array at shutdown.
18 static auto* timeMap = new JS_TIMER_MAPARRAY; 16 static auto* timeMap = new JS_TIMER_MAPARRAY;
19 return *timeMap; 17 return *timeMap;
20 } 18 }
21 19
22 int FXJS_MsgBox(CPDFDoc_Environment* pApp, CPDFSDK_PageView* pPageView, const FX _WCHAR* swMsg, const FX_WCHAR* swTitle, FX_UINT nType, FX_UINT nIcon) 20 int FXJS_MsgBox(CPDFDoc_Environment* pApp, CPDFSDK_PageView* pPageView, const FX _WCHAR* swMsg, const FX_WCHAR* swTitle, FX_UINT nType, FX_UINT nIcon)
23 { 21 {
24 » int nRet = 0; 22 » if (!pApp)
Lei Zhang 2015/07/16 17:05:06 kill the tab
Tom Sepez 2015/07/16 18:01:28 Untabified file.
23 return 0;
25 24
26 » if(pApp) 25 if (CPDFSDK_Document* pDoc = pApp->GetSDKDocument())
27 » { 26 pDoc->KillFocusAnnot();
28 » » CPDFSDK_Document* pDoc = pApp->GetCurrentDoc();
29 » » if(pDoc)
30 » » » pDoc->KillFocusAnnot();
31 » » nRet = pApp->JS_appAlert(swMsg, swTitle, nType, nIcon);
32 » }
33 27
34 » return nRet; 28 return pApp->JS_appAlert(swMsg, swTitle, nType, nIcon);
35 } 29 }
36 30
37 CPDFSDK_PageView* FXJS_GetPageView(IFXJS_Context* cc) 31 CPDFSDK_PageView* FXJS_GetPageView(IFXJS_Context* cc)
38 { 32 {
39 if (CJS_Context* pContext = (CJS_Context *)cc) 33 if (CJS_Context* pContext = (CJS_Context *)cc)
40 { 34 {
41 if (pContext->GetReaderDocument()) 35 if (pContext->GetReaderDocument())
42 return NULL; 36 return NULL;
43 } 37 }
44 return NULL; 38 return NULL;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 139
146 if (pContext->IsMsgBoxEnabled()) 140 if (pContext->IsMsgBoxEnabled())
147 { 141 {
148 CPDFDoc_Environment* pApp = pContext->GetReaderApp(); 142 CPDFDoc_Environment* pApp = pContext->GetReaderApp();
149 if(pApp) 143 if(pApp)
150 pApp->JS_appAlert(swMsg, NULL, 0, 3); 144 pApp->JS_appAlert(swMsg, NULL, 0, 3);
151 } 145 }
152 } 146 }
153 147
154 148
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698