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 | efbc191 | 2016-02-17 16:54:43 -0500 | [diff] [blame^] | 7 | #include "fpdfsdk/src/javascript/console.h" |
Tom Sepez | 3745841 | 2015-10-06 11:33:46 -0700 | [diff] [blame] | 8 | |
Dan Sinclair | efbc191 | 2016-02-17 16:54:43 -0500 | [diff] [blame^] | 9 | #include "fpdfsdk/src/javascript/JS_Context.h" |
| 10 | #include "fpdfsdk/src/javascript/JS_Define.h" |
| 11 | #include "fpdfsdk/src/javascript/JS_EventHandler.h" |
| 12 | #include "fpdfsdk/src/javascript/JS_Object.h" |
| 13 | #include "fpdfsdk/src/javascript/JS_Value.h" |
Lei Zhang | bde53d2 | 2015-11-12 22:21:30 -0800 | [diff] [blame] | 14 | #include "fpdfsdk/include/javascript/IJavaScript.h" |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 15 | |
| 16 | /* ------------------------ console ------------------------ */ |
| 17 | |
| 18 | BEGIN_JS_STATIC_CONST(CJS_Console) |
| 19 | END_JS_STATIC_CONST() |
| 20 | |
| 21 | BEGIN_JS_STATIC_PROP(CJS_Console) |
| 22 | END_JS_STATIC_PROP() |
| 23 | |
| 24 | BEGIN_JS_STATIC_METHOD(CJS_Console) |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 25 | JS_STATIC_METHOD_ENTRY(clear) |
| 26 | JS_STATIC_METHOD_ENTRY(hide) |
| 27 | JS_STATIC_METHOD_ENTRY(println) |
| 28 | JS_STATIC_METHOD_ENTRY(show) |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 29 | END_JS_STATIC_METHOD() |
| 30 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 31 | IMPLEMENT_JS_CLASS(CJS_Console, console) |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 32 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 33 | console::console(CJS_Object* pJSObject) : CJS_EmbedObj(pJSObject) {} |
| 34 | |
| 35 | console::~console() {} |
| 36 | |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 37 | FX_BOOL console::clear(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 38 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 39 | CJS_Value& vRet, |
| 40 | CFX_WideString& sError) { |
| 41 | return TRUE; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 42 | } |
| 43 | |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 44 | FX_BOOL console::hide(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 45 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 46 | CJS_Value& vRet, |
| 47 | CFX_WideString& sError) { |
| 48 | return TRUE; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 49 | } |
| 50 | |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 51 | FX_BOOL console::println(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 52 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 53 | CJS_Value& vRet, |
| 54 | CFX_WideString& sError) { |
| 55 | if (params.size() < 1) { |
| 56 | return FALSE; |
| 57 | } |
| 58 | return TRUE; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 59 | } |
| 60 | |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 61 | FX_BOOL console::show(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 62 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 63 | CJS_Value& vRet, |
| 64 | CFX_WideString& sError) { |
| 65 | return TRUE; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 66 | } |