Update change log and spec for wrt-plugins-tizen_0.4.70
[framework/web/wrt-plugins-tizen.git] / src / Power / plugin_initializer.cpp
old mode 100644 (file)
new mode 100755 (executable)
index 2e9cdb3..be0e6a3
@@ -23,6 +23,8 @@
 #include "JSPowerManager.h"
 #include <GlobalContextManager.h>
 #include <TimeTracer.h>
+#include <Security.h>
+#include "plugin_config.h"
 
 namespace DeviceAPI {
 namespace Power {
@@ -31,6 +33,28 @@ using namespace WrtDeviceApis;
 using namespace WrtDeviceApis::Commons;
 using namespace DeviceAPI::Common;
 
+AceSecurityStatus powerAceCheckAccessFunction(const char* functionName)
+{
+    return POWER_CHECK_ACCESS(functionName);
+}
+
+DEFINE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor);
+
+DEFINE_SECURITY_ACCESSOR_SETTER(AceCheckerPowerSetter,
+                                DeviceAPI::Power::PowerManagerPriv,
+                                gSecurityAccessor);
+
+class_definition_options_t ClassOptions =
+{
+    JS_CLASS,
+    NONE,
+    ALWAYS_NOTICE,
+    IGNORED,
+    AceCheckerPowerSetter,
+    NULL,
+    NULL
+};
+
 void on_widget_start_callback(int widgetId)
 {
     LoggerD("[Tizen\\Power] on_widget_start_callback (" << widgetId << ")");
@@ -41,6 +65,8 @@ void on_widget_start_callback(int widgetId)
        } Catch (Exception) {
                LoggerE("WrtAccess initialization failed");
        }
+
+    INITAILIZE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor, powerAceCheckAccessFunction);
 }
 
 void on_widget_stop_callback(int widgetId)
@@ -54,6 +80,8 @@ void on_widget_stop_callback(int widgetId)
        } Catch (Exception) {
                LoggerE("WrtAccess deinitialization failed");
        }
+
+    FINALIZE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor);
 }
 
 void on_frame_load_callback(const void * context)
@@ -78,7 +106,7 @@ PLUGIN_CLASS_MAP_BEGIN
 PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
         "power",
         (js_class_template_getter)JSPowerManager::getClassRef,
-        NULL)
+        &ClassOptions)
 PLUGIN_CLASS_MAP_END
 
 }