blob: 29fde8a6c5058dcaa881904278c619acafaf6e86 [file] [log] [blame]
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001// 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.
Lei Zhanga6d9f0e2015-06-13 00:48:38 -07004
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07005// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
Dan Sinclaire0345a42017-10-30 20:20:42 +00007#include "fxjs/cjs_icon.h"
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07008
Dan Sinclairc94a7932017-10-26 16:48:57 -04009const JSPropertySpec CJS_Icon::PropertySpecs[] = {
Dan Sinclair909fa2d2017-12-12 01:53:28 +000010 {"name", get_name_static, set_name_static}};
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070011
Dan Sinclairef299532017-10-26 16:48:30 -040012int CJS_Icon::ObjDefnID = -1;
Dan Sinclairf7435522018-02-05 22:27:22 +000013const char CJS_Icon::kName[] = "Icon";
Dan Sinclair89d26c82017-10-26 12:21:28 -040014
Dan Sinclairef299532017-10-26 16:48:30 -040015// static
16int CJS_Icon::GetObjDefnID() {
17 return ObjDefnID;
18}
19
20// static
Dan Sinclairbef4d3e2017-10-26 16:49:38 -040021void CJS_Icon::DefineJSObjects(CFXJS_Engine* pEngine) {
Dan Sinclairf7435522018-02-05 22:27:22 +000022 ObjDefnID = pEngine->DefineObj(CJS_Icon::kName, FXJSOBJTYPE_DYNAMIC,
Dan Sinclair998fee32018-02-05 21:43:19 +000023 JSConstructor<CJS_Icon>, JSDestructor);
Tom Sepez8b4ddeb2018-06-11 15:55:17 +000024 DefineProps(pEngine, ObjDefnID, PropertySpecs);
Dan Sinclair89d26c82017-10-26 12:21:28 -040025}
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070026
Tom Sepez36aae4f2018-06-04 19:44:37 +000027CJS_Icon::CJS_Icon(v8::Local<v8::Object> pObject, CJS_Runtime* pRuntime)
28 : CJS_Object(pObject, pRuntime) {}
Dan Sinclair998fee32018-02-05 21:43:19 +000029
Dan Sinclairf7435522018-02-05 22:27:22 +000030CJS_Icon::~CJS_Icon() = default;
Nico Weber9d8ec5a2015-08-04 13:00:21 -070031
Tom Sepez3a6d0582018-08-17 19:28:52 +000032CJS_Result CJS_Icon::get_name(CJS_Runtime* pRuntime) {
33 return CJS_Result::Success(pRuntime->NewString(m_swIconName.AsStringView()));
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070034}
dan sinclaircbe23db2017-10-19 14:29:33 -040035
Tom Sepez3a6d0582018-08-17 19:28:52 +000036CJS_Result CJS_Icon::set_name(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp) {
37 return CJS_Result::Failure(JSMessage::kNotSupportedError);
dan sinclaircbe23db2017-10-19 14:29:33 -040038}