Home | History | Annotate | Download | only in xfa
      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/cfxjse_value.h"
     12 #include "fxjs/js_resources.h"
     13 #include "xfa/fxfa/parser/cxfa_desc.h"
     14 
     15 const CJX_MethodSpec CJX_Desc::MethodSpecs[] = {{"metadata", metadata_static}};
     16 
     17 CJX_Desc::CJX_Desc(CXFA_Desc* desc) : CJX_Node(desc) {
     18   DefineMethods(MethodSpecs, FX_ArraySize(MethodSpecs));
     19 }
     20 
     21 CJX_Desc::~CJX_Desc() {}
     22 
     23 CJS_Return CJX_Desc::metadata(CJS_V8* runtime,
     24                               const std::vector<v8::Local<v8::Value>>& params) {
     25   if (params.size() != 0 && params.size() != 1)
     26     return CJS_Return(JSGetStringFromID(JSMessage::kParamError));
     27   return CJS_Return(runtime->NewString(""));
     28 }
     29 
     30 void CJX_Desc::use(CFXJSE_Value* pValue,
     31                    bool bSetting,
     32                    XFA_Attribute eAttribute) {
     33   Script_Attribute_String(pValue, bSetting, eAttribute);
     34 }
     35 
     36 void CJX_Desc::usehref(CFXJSE_Value* pValue,
     37                        bool bSetting,
     38                        XFA_Attribute eAttribute) {
     39   Script_Attribute_String(pValue, bSetting, eAttribute);
     40 }
     41