• 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_manifest.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_manifest.h"
15 
16 const CJX_MethodSpec CJX_Manifest::MethodSpecs[] = {
17     {"evaluate", evaluate_static}};
18 
CJX_Manifest(CXFA_Manifest * manifest)19 CJX_Manifest::CJX_Manifest(CXFA_Manifest* manifest) : CJX_Node(manifest) {
20   DefineMethods(MethodSpecs);
21 }
22 
~CJX_Manifest()23 CJX_Manifest::~CJX_Manifest() {}
24 
DynamicTypeIs(TypeTag eType) const25 bool CJX_Manifest::DynamicTypeIs(TypeTag eType) const {
26   return eType == static_type__ || ParentType__::DynamicTypeIs(eType);
27 }
28 
evaluate(CFX_V8 * runtime,const std::vector<v8::Local<v8::Value>> & params)29 CJS_Result CJX_Manifest::evaluate(
30     CFX_V8* runtime,
31     const std::vector<v8::Local<v8::Value>>& params) {
32   if (!params.empty())
33     return CJS_Result::Failure(JSMessage::kParamError);
34 
35   return CJS_Result::Success(
36       runtime->NewBoolean(GetXFANode()->IsWidgetReady()));
37 }
38