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.
4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7 #include "fpdfsdk/javascript/console.h"
8
9 #include <vector>
10
11 #include "fpdfsdk/javascript/JS_Define.h"
12 #include "fpdfsdk/javascript/JS_EventHandler.h"
13 #include "fpdfsdk/javascript/JS_Object.h"
14 #include "fpdfsdk/javascript/JS_Value.h"
15 #include "fpdfsdk/javascript/cjs_event_context.h"
16
17 JSConstSpec CJS_Console::ConstSpecs[] = {{0, JSConstSpec::Number, 0, 0}};
18
19 JSPropertySpec CJS_Console::PropertySpecs[] = {{0, 0, 0}};
20
21 JSMethodSpec CJS_Console::MethodSpecs[] = {{"clear", clear_static},
22 {"hide", hide_static},
23 {"println", println_static},
24 {"show", show_static},
25 {0, 0}};
26
IMPLEMENT_JS_CLASS(CJS_Console,console)27 IMPLEMENT_JS_CLASS(CJS_Console, console)
28
29 console::console(CJS_Object* pJSObject) : CJS_EmbedObj(pJSObject) {}
30
~console()31 console::~console() {}
32
clear(CJS_Runtime * pRuntime,const std::vector<CJS_Value> & params,CJS_Value & vRet,CFX_WideString & sError)33 bool console::clear(CJS_Runtime* pRuntime,
34 const std::vector<CJS_Value>& params,
35 CJS_Value& vRet,
36 CFX_WideString& sError) {
37 return true;
38 }
39
hide(CJS_Runtime * pRuntime,const std::vector<CJS_Value> & params,CJS_Value & vRet,CFX_WideString & sError)40 bool console::hide(CJS_Runtime* pRuntime,
41 const std::vector<CJS_Value>& params,
42 CJS_Value& vRet,
43 CFX_WideString& sError) {
44 return true;
45 }
46
println(CJS_Runtime * pRuntime,const std::vector<CJS_Value> & params,CJS_Value & vRet,CFX_WideString & sError)47 bool console::println(CJS_Runtime* pRuntime,
48 const std::vector<CJS_Value>& params,
49 CJS_Value& vRet,
50 CFX_WideString& sError) {
51 if (params.size() < 1) {
52 return false;
53 }
54 return true;
55 }
56
show(CJS_Runtime * pRuntime,const std::vector<CJS_Value> & params,CJS_Value & vRet,CFX_WideString & sError)57 bool console::show(CJS_Runtime* pRuntime,
58 const std::vector<CJS_Value>& params,
59 CJS_Value& vRet,
60 CFX_WideString& sError) {
61 return true;
62 }
63