1 #include "atom/browser/api/atom_api_pwrt.h"
3 #include "atom/browser/browser.h"
4 #include "native_mate/dictionary.h"
5 #include "base/logging.h"
7 #include "atom/common/node_includes.h"
13 PWRT::PWRT(v8::Isolate* isolate) {
14 LOG(INFO) << "PWRT::PWRT";
19 LOG(INFO) << "PWRT::~PWRT";
22 std::string PWRT::GetMessage() {
23 LOG(INFO) << "PWRT::GetMessage";
24 return "message from C++";
28 mate::Handle<PWRT> PWRT::Create(v8::Isolate* isolate) {
29 LOG(INFO) << "PWRT::Create";
30 return mate::CreateHandle(isolate, new PWRT(isolate));
34 void PWRT::BuildPrototype(
35 v8::Isolate* isolate, v8::Local<v8::FunctionTemplate> prototype) {
36 LOG(INFO) << "PWRT::BuildPrototype";
37 prototype->SetClassName(mate::StringToV8(isolate, "PWRT"));
38 // TODO: Needs adding necessary interface methods
39 mate::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
40 .SetMethod("getMessage", &PWRT::GetMessage);
50 void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
51 v8::Local<v8::Context> context, void* priv) {
52 LOG(INFO) << "PWRT::Initialize";
53 v8::Isolate* isolate = context->GetIsolate();
54 mate::Dictionary dict(isolate, exports);
55 // TODO: Expose this attribute only for Tizen web apps
56 dict.Set("pwrt", atom::api::PWRT::Create(isolate));
61 NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_pwrt, Initialize)