John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 1 | // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 4 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | |
Dan Sinclair | e0345a4 | 2017-10-30 20:20:42 +0000 | [diff] [blame^] | 7 | #ifndef FXJS_CJS_CONSOLE_H_ |
| 8 | #define FXJS_CJS_CONSOLE_H_ |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 9 | |
Dan Sinclair | 3ebd121 | 2016-03-09 09:59:23 -0500 | [diff] [blame] | 10 | #include <vector> |
| 11 | |
Dan Sinclair | e0345a4 | 2017-10-30 20:20:42 +0000 | [diff] [blame^] | 12 | #include "fxjs/JS_Define.h" |
Tom Sepez | 9a3f812 | 2015-04-07 15:35:48 -0700 | [diff] [blame] | 13 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 14 | class console : public CJS_EmbedObj { |
| 15 | public: |
Dan Sinclair | 85c8e7f | 2016-11-21 13:50:32 -0500 | [diff] [blame] | 16 | explicit console(CJS_Object* pJSObject); |
Lei Zhang | 2b1a2d5 | 2015-08-14 22:16:22 -0700 | [diff] [blame] | 17 | ~console() override; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 18 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 19 | public: |
Dan Sinclair | 8f524d6 | 2017-10-25 13:30:31 -0400 | [diff] [blame] | 20 | CJS_Return clear(CJS_Runtime* pRuntime, |
| 21 | const std::vector<v8::Local<v8::Value>>& params); |
| 22 | CJS_Return hide(CJS_Runtime* pRuntime, |
| 23 | const std::vector<v8::Local<v8::Value>>& params); |
| 24 | CJS_Return println(CJS_Runtime* pRuntime, |
| 25 | const std::vector<v8::Local<v8::Value>>& params); |
| 26 | CJS_Return show(CJS_Runtime* pRuntime, |
| 27 | const std::vector<v8::Local<v8::Value>>& params); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 28 | }; |
| 29 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 30 | class CJS_Console : public CJS_Object { |
| 31 | public: |
Dan Sinclair | bef4d3e | 2017-10-26 16:49:38 -0400 | [diff] [blame] | 32 | static void DefineJSObjects(CFXJS_Engine* pEngine); |
Dan Sinclair | ef29953 | 2017-10-26 16:48:30 -0400 | [diff] [blame] | 33 | |
Dan Sinclair | 85c8e7f | 2016-11-21 13:50:32 -0500 | [diff] [blame] | 34 | explicit CJS_Console(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {} |
Lei Zhang | 2b1a2d5 | 2015-08-14 22:16:22 -0700 | [diff] [blame] | 35 | ~CJS_Console() override {} |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 36 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 37 | JS_STATIC_METHOD(clear, console); |
| 38 | JS_STATIC_METHOD(hide, console); |
| 39 | JS_STATIC_METHOD(println, console); |
| 40 | JS_STATIC_METHOD(show, console); |
Dan Sinclair | ef29953 | 2017-10-26 16:48:30 -0400 | [diff] [blame] | 41 | |
| 42 | private: |
| 43 | static int ObjDefnID; |
Dan Sinclair | c94a793 | 2017-10-26 16:48:57 -0400 | [diff] [blame] | 44 | static const JSMethodSpec MethodSpecs[]; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 45 | }; |
| 46 | |
Dan Sinclair | e0345a4 | 2017-10-30 20:20:42 +0000 | [diff] [blame^] | 47 | #endif // FXJS_CJS_CONSOLE_H_ |