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 "fxjs/cjs_console.h"
8 
9 #include <vector>
10 
11 #include "fxjs/cjs_event_context.h"
12 #include "fxjs/cjs_eventrecorder.h"
13 #include "fxjs/cjs_object.h"
14 #include "fxjs/js_define.h"
15 
16 const JSMethodSpec CJS_Console::MethodSpecs[] = {{"clear", clear_static},
17                                                  {"hide", hide_static},
18                                                  {"println", println_static},
19                                                  {"show", show_static}};
20 
21 int CJS_Console::ObjDefnID = -1;
22 const char CJS_Console::kName[] = "console";
23 
24 // static
GetObjDefnID()25 int CJS_Console::GetObjDefnID() {
26   return ObjDefnID;
27 }
28 
29 // static
DefineJSObjects(CFXJS_Engine * pEngine)30 void CJS_Console::DefineJSObjects(CFXJS_Engine* pEngine) {
31   ObjDefnID = pEngine->DefineObj(CJS_Console::kName, FXJSOBJTYPE_STATIC,
32                                  JSConstructor<CJS_Console>, JSDestructor);
33   DefineMethods(pEngine, ObjDefnID, MethodSpecs);
34 }
35 
CJS_Console(v8::Local<v8::Object> pObject,CJS_Runtime * pRuntime)36 CJS_Console::CJS_Console(v8::Local<v8::Object> pObject, CJS_Runtime* pRuntime)
37     : CJS_Object(pObject, pRuntime) {}
38 
39 CJS_Console::~CJS_Console() = default;
40 
clear(CJS_Runtime * pRuntime,const std::vector<v8::Local<v8::Value>> & params)41 CJS_Result CJS_Console::clear(CJS_Runtime* pRuntime,
42                               const std::vector<v8::Local<v8::Value>>& params) {
43   return CJS_Result::Success();
44 }
45 
hide(CJS_Runtime * pRuntime,const std::vector<v8::Local<v8::Value>> & params)46 CJS_Result CJS_Console::hide(CJS_Runtime* pRuntime,
47                              const std::vector<v8::Local<v8::Value>>& params) {
48   return CJS_Result::Success();
49 }
50 
println(CJS_Runtime * pRuntime,const std::vector<v8::Local<v8::Value>> & params)51 CJS_Result CJS_Console::println(
52     CJS_Runtime* pRuntime,
53     const std::vector<v8::Local<v8::Value>>& params) {
54   return CJS_Result::Success();
55 }
56 
show(CJS_Runtime * pRuntime,const std::vector<v8::Local<v8::Value>> & params)57 CJS_Result CJS_Console::show(CJS_Runtime* pRuntime,
58                              const std::vector<v8::Local<v8::Value>>& params) {
59   return CJS_Result::Success();
60 }
61