--- /dev/null
+#include "atom/browser/api/atom_api_pwrt.h"
+
+#include "atom/browser/browser.h"
+#include "native_mate/dictionary.h"
+#include "base/logging.h"
+
+#include "atom/common/node_includes.h"
+
+namespace atom {
+
+namespace api {
+
+PWRT::PWRT(v8::Isolate* isolate) {
+ LOG(DEBUG) << "PWRT::PWRT";
+ Init(isolate);
+}
+
+PWRT::~PWRT() {
+ LOG(DEBUG) << "PWRT::~PWRT";
+}
+
+std::string PWRT::GetMessage() {
+ LOG(DEBUG) << "PWRT::GetMessage";
+ return "message from C++";
+}
+
+// static
+mate::Handle<PWRT> PWRT::Create(v8::Isolate* isolate) {
+ LOG(DEBUG) << "PWRT::Create";
+ return mate::CreateHandle(isolate, new PWRT(isolate));
+}
+
+// static
+void PWRT::BuildPrototype(
+ v8::Isolate* isolate, v8::Local<v8::FunctionTemplate> prototype) {
+ LOG(DEBUG) << "PWRT::BuildPrototype";
+ prototype->SetClassName(mate::StringToV8(isolate, "PWRT"));
+ // TODO: Needs adding necessary interface methods
+ mate::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
+ .SetMethod("getMessage", &PWRT::GetMessage);
+}
+
+} // namespace api
+
+} // namespace atom
+
+
+namespace {
+
+void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
+ v8::Local<v8::Context> context, void* priv) {
+ LOG(DEBUG) << "PWRT::Initialize";
+ v8::Isolate* isolate = context->GetIsolate();
+ mate::Dictionary dict(isolate, exports);
+ // TODO: Expose this attribute only for Tizen web apps
+ dict.Set("pwrt", atom::api::PWRT::Create(isolate));
+}
+
+} // namespace
+
+NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_pwrt, Initialize)
--- /dev/null
+#ifndef ATOM_BROWSER_API_ATOM_API_PWRT_H_
+#define ATOM_BROWSER_API_ATOM_API_PWRT_H_
+
+#include "atom/browser/api/trackable_object.h"
+#include "base/compiler_specific.h"
+#include "native_mate/handle.h"
+
+namespace atom {
+
+namespace api {
+
+class PWRT : public mate::TrackableObject<PWRT> {
+ public:
+ static mate::Handle<PWRT> Create(v8::Isolate* isolate);
+
+ static void BuildPrototype(v8::Isolate* isolate,
+ v8::Local<v8::FunctionTemplate> prototype);
+
+ std::string GetMessage();
+
+ protected:
+ explicit PWRT(v8::Isolate* isolate);
+ ~PWRT() override;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(PWRT);
+};
+
+} // namespace api
+
+} // namespace atom
+
+#endif // ATOM_BROWSER_API_ATOM_API_PWRT_H_
REFERENCE_MODULE(atom_browser_power_monitor);
REFERENCE_MODULE(atom_browser_power_save_blocker);
REFERENCE_MODULE(atom_browser_protocol);
+REFERENCE_MODULE(atom_browser_pwrt);
REFERENCE_MODULE(atom_browser_render_process_preferences);
REFERENCE_MODULE(atom_browser_session);
REFERENCE_MODULE(atom_browser_system_preferences);
'lib/browser/api/power-monitor.js',
'lib/browser/api/power-save-blocker.js',
'lib/browser/api/protocol.js',
+ 'lib/browser/api/pwrt.js',
'lib/browser/api/screen.js',
'lib/browser/api/session.js',
'lib/browser/api/system-preferences.js',
'atom/browser/api/atom_api_power_save_blocker.h',
'atom/browser/api/atom_api_protocol.cc',
'atom/browser/api/atom_api_protocol.h',
+ 'atom/browser/api/atom_api_pwrt.cc',
+ 'atom/browser/api/atom_api_pwrt.h',
'atom/browser/api/atom_api_render_process_preferences.cc',
'atom/browser/api/atom_api_render_process_preferences.h',
'atom/browser/api/atom_api_screen.cc',
{name: 'Tray', file: 'tray'},
{name: 'webContents', file: 'web-contents'},
// The internal modules, invisible unless you know their names.
- {name: 'NavigationController', file: 'navigation-controller', private: true}
+ {name: 'NavigationController', file: 'navigation-controller', private: true},
+ {name: 'pwrt', file: 'pwrt', private: true}
]
--- /dev/null
+const {pwrt} = process.atomBinding('pwrt');
+
+module.exports = pwrt