• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_icon.h"
8 
9 const JSPropertySpec CJS_Icon::PropertySpecs[] = {
10     {"name", get_name_static, set_name_static}};
11 
12 int CJS_Icon::ObjDefnID = -1;
13 const char CJS_Icon::kName[] = "Icon";
14 
15 // static
GetObjDefnID()16 int CJS_Icon::GetObjDefnID() {
17   return ObjDefnID;
18 }
19 
20 // static
DefineJSObjects(CFXJS_Engine * pEngine)21 void CJS_Icon::DefineJSObjects(CFXJS_Engine* pEngine) {
22   ObjDefnID = pEngine->DefineObj(CJS_Icon::kName, FXJSOBJTYPE_DYNAMIC,
23                                  JSConstructor<CJS_Icon>, JSDestructor);
24   DefineProps(pEngine, ObjDefnID, PropertySpecs);
25 }
26 
CJS_Icon(v8::Local<v8::Object> pObject,CJS_Runtime * pRuntime)27 CJS_Icon::CJS_Icon(v8::Local<v8::Object> pObject, CJS_Runtime* pRuntime)
28     : CJS_Object(pObject, pRuntime) {}
29 
30 CJS_Icon::~CJS_Icon() = default;
31 
get_name(CJS_Runtime * pRuntime)32 CJS_Result CJS_Icon::get_name(CJS_Runtime* pRuntime) {
33   return CJS_Result::Success(pRuntime->NewString(m_swIconName.AsStringView()));
34 }
35 
set_name(CJS_Runtime * pRuntime,v8::Local<v8::Value> vp)36 CJS_Result CJS_Icon::set_name(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp) {
37   return CJS_Result::Failure(JSMessage::kReadOnlyError);
38 }
39