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

Side by Side Diff: fpdfsdk/javascript/JS_Object.h

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 | « no previous file | fpdfsdk/javascript/JS_Object.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 #ifndef FPDFSDK_JAVASCRIPT_JS_OBJECT_H_ 7 #ifndef FPDFSDK_JAVASCRIPT_JS_OBJECT_H_
8 #define FPDFSDK_JAVASCRIPT_JS_OBJECT_H_ 8 #define FPDFSDK_JAVASCRIPT_JS_OBJECT_H_
9 9
10 #include <map> 10 #include <map>
11 #include <memory> 11 #include <memory>
12 12
13 #include "fpdfsdk/include/fsdk_define.h" 13 #include "fpdfsdk/include/fsdk_define.h"
14 #include "fpdfsdk/javascript/cjs_runtime.h" 14 #include "fpdfsdk/javascript/cjs_runtime.h"
15 #include "fxjs/include/fxjs_v8.h" 15 #include "fxjs/include/fxjs_v8.h"
16 16
17 class CJS_Context; 17 class CJS_Context;
18 class CJS_Object; 18 class CJS_Object;
19 class CPDFDoc_Environment; 19 class CPDFDoc_Environment;
20 20
21 class CJS_EmbedObj { 21 class CJS_EmbedObj {
22 public: 22 public:
23 explicit CJS_EmbedObj(CJS_Object* pJSObject); 23 explicit CJS_EmbedObj(CJS_Object* pJSObject);
24 virtual ~CJS_EmbedObj(); 24 virtual ~CJS_EmbedObj();
25 25
26 CJS_Object* GetJSObject() const { return m_pJSObject; } 26 CJS_Object* GetJSObject() const { return m_pJSObject; }
27 27
28 int MsgBox(CPDFDoc_Environment* pApp,
29 const FX_WCHAR* swMsg,
30 const FX_WCHAR* swTitle,
31 FX_UINT nType,
32 FX_UINT nIcon);
33 void Alert(CJS_Context* pContext, const FX_WCHAR* swMsg);
34
35 protected: 28 protected:
36 CJS_Object* m_pJSObject; 29 CJS_Object* m_pJSObject;
37 }; 30 };
38 31
39 class CJS_Object { 32 class CJS_Object {
40 public: 33 public:
41 explicit CJS_Object(v8::Local<v8::Object> pObject); 34 explicit CJS_Object(v8::Local<v8::Object> pObject);
42 virtual ~CJS_Object(); 35 virtual ~CJS_Object();
43 36
44 void MakeWeak(); 37 void MakeWeak();
45 void Dispose(); 38 void Dispose();
46 39
47 virtual void InitInstance(IJS_Runtime* pIRuntime); 40 virtual void InitInstance(IJS_Runtime* pIRuntime);
48 virtual void ExitInstance(); 41 virtual void ExitInstance();
49 42
50 v8::Local<v8::Object> ToV8Object() { return m_pV8Object.Get(m_pIsolate); } 43 v8::Local<v8::Object> ToV8Object() { return m_pV8Object.Get(m_pIsolate); }
51 44
52 // Takes ownership of |pObj|. 45 // Takes ownership of |pObj|.
53 void SetEmbedObject(CJS_EmbedObj* pObj) { m_pEmbedObj.reset(pObj); } 46 void SetEmbedObject(CJS_EmbedObj* pObj) { m_pEmbedObj.reset(pObj); }
54 CJS_EmbedObj* GetEmbedObject() const { return m_pEmbedObj.get(); } 47 CJS_EmbedObj* GetEmbedObject() const { return m_pEmbedObj.get(); }
55 48
56 static void Alert(CJS_Context* pContext, const FX_WCHAR* swMsg); 49 v8::Isolate* GetIsolate() const { return m_pIsolate; }
57
58 v8::Isolate* GetIsolate() { return m_pIsolate; }
59 50
60 protected: 51 protected:
61 std::unique_ptr<CJS_EmbedObj> m_pEmbedObj; 52 std::unique_ptr<CJS_EmbedObj> m_pEmbedObj;
62 v8::Global<v8::Object> m_pV8Object; 53 v8::Global<v8::Object> m_pV8Object;
63 v8::Isolate* m_pIsolate; 54 v8::Isolate* m_pIsolate;
64 }; 55 };
65 56
66 57
67 #endif // FPDFSDK_JAVASCRIPT_JS_OBJECT_H_ 58 #endif // FPDFSDK_JAVASCRIPT_JS_OBJECT_H_
OLDNEW
« no previous file with comments | « no previous file | fpdfsdk/javascript/JS_Object.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698