John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 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. |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 4 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | |
Dan Sinclair | f766ad2 | 2016-03-14 13:51:24 -0400 | [diff] [blame] | 7 | #include "fpdfsdk/javascript/Icon.h" |
Tom Sepez | 3745841 | 2015-10-06 11:33:46 -0700 | [diff] [blame] | 8 | |
Dan Sinclair | f766ad2 | 2016-03-14 13:51:24 -0400 | [diff] [blame] | 9 | #include "fpdfsdk/javascript/JS_Define.h" |
| 10 | #include "fpdfsdk/javascript/JS_Object.h" |
| 11 | #include "fpdfsdk/javascript/JS_Value.h" |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 12 | |
Tom Sepez | 04557b8 | 2017-02-16 09:43:10 -0800 | [diff] [blame] | 13 | JSConstSpec CJS_Icon::ConstSpecs[] = {{0, JSConstSpec::Number, 0, 0}}; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 14 | |
Tom Sepez | 04557b8 | 2017-02-16 09:43:10 -0800 | [diff] [blame] | 15 | JSPropertySpec CJS_Icon::PropertySpecs[] = { |
Tom Sepez | 4d5b8c5 | 2017-02-21 15:17:07 -0800 | [diff] [blame] | 16 | {"name", get_name_static, set_name_static}, |
Tom Sepez | 04557b8 | 2017-02-16 09:43:10 -0800 | [diff] [blame] | 17 | {0, 0, 0}}; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 18 | |
Tom Sepez | 04557b8 | 2017-02-16 09:43:10 -0800 | [diff] [blame] | 19 | JSMethodSpec CJS_Icon::MethodSpecs[] = {{0, 0}}; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 20 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 21 | IMPLEMENT_JS_CLASS(CJS_Icon, Icon) |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 22 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 23 | Icon::Icon(CJS_Object* pJSObject) |
Tom Sepez | 40e0a81 | 2017-02-23 13:07:36 -0800 | [diff] [blame] | 24 | : CJS_EmbedObj(pJSObject), m_swIconName(L"") {} |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 25 | |
| 26 | Icon::~Icon() {} |
| 27 | |
Dan Sinclair | 33d13f2 | 2017-10-23 09:44:30 -0400 | [diff] [blame^] | 28 | bool Icon::get_name(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError) { |
| 29 | vp->Set(pRuntime, m_swIconName); |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 30 | return true; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 31 | } |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 32 | |
| 33 | bool Icon::set_name(CJS_Runtime* pRuntime, |
Dan Sinclair | 33d13f2 | 2017-10-23 09:44:30 -0400 | [diff] [blame^] | 34 | const CJS_Value& vp, |
dan sinclair | cbe23db | 2017-10-19 14:29:33 -0400 | [diff] [blame] | 35 | WideString* sError) { |
| 36 | return false; |
| 37 | } |