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