OLD | NEW |
1 #include <AdblockPlus/AppInfo.h> | 1 #include <AdblockPlus/AppInfo.h> |
| 2 #include <AdblockPlus/JsValue.h> |
2 | 3 |
3 #include "AppInfoJsObject.h" | 4 #include "AppInfoJsObject.h" |
4 #include "Utils.h" | 5 #include "Utils.h" |
5 | 6 |
6 using namespace AdblockPlus; | 7 using namespace AdblockPlus; |
7 | 8 |
8 v8::Handle<v8::ObjectTemplate> AppInfoJsObject::Create(const AppInfo& appInfo) | 9 JsValuePtr AppInfoJsObject::Setup(JsEngine& jsEngine, const AppInfo& appInfo, |
| 10 JsValuePtr obj) |
9 { | 11 { |
10 v8::HandleScope handleScope; | 12 obj->SetProperty("id", appInfo.id); |
11 const v8::Handle<v8::ObjectTemplate> infoObject = v8::ObjectTemplate::New(); | 13 obj->SetProperty("version", appInfo.version); |
12 infoObject->Set(v8::String::New("id"), Utils::ToV8String(appInfo.id)); | 14 obj->SetProperty("name", appInfo.name); |
13 infoObject->Set(v8::String::New("version"), | 15 obj->SetProperty("platform", appInfo.platform); |
14 Utils::ToV8String(appInfo.version)); | 16 return obj; |
15 infoObject->Set(v8::String::New("name"), Utils::ToV8String(appInfo.name)); | |
16 infoObject->Set(v8::String::New("platform"), | |
17 Utils::ToV8String(appInfo.platform)); | |
18 return handleScope.Close(infoObject); | |
19 } | 17 } |
OLD | NEW |