• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2017 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/xfa/cjx_desc.h"
8 
9 #include <vector>
10 
11 #include "fxjs/cfx_v8.h"
12 #include "fxjs/js_resources.h"
13 #include "fxjs/xfa/cfxjse_value.h"
14 #include "xfa/fxfa/parser/cxfa_desc.h"
15 
16 const CJX_MethodSpec CJX_Desc::MethodSpecs[] = {{"metadata", metadata_static}};
17 
CJX_Desc(CXFA_Desc * desc)18 CJX_Desc::CJX_Desc(CXFA_Desc* desc) : CJX_Node(desc) {
19   DefineMethods(MethodSpecs);
20 }
21 
~CJX_Desc()22 CJX_Desc::~CJX_Desc() {}
23 
DynamicTypeIs(TypeTag eType) const24 bool CJX_Desc::DynamicTypeIs(TypeTag eType) const {
25   return eType == static_type__ || ParentType__::DynamicTypeIs(eType);
26 }
27 
metadata(CFX_V8 * runtime,const std::vector<v8::Local<v8::Value>> & params)28 CJS_Result CJX_Desc::metadata(CFX_V8* runtime,
29                               const std::vector<v8::Local<v8::Value>>& params) {
30   if (params.size() != 0 && params.size() != 1)
31     return CJS_Result::Failure(JSMessage::kParamError);
32 
33   return CJS_Result::Success(runtime->NewString(""));
34 }
35