Update change log and spec for wrt-plugins-tizen_0.4.70
[framework/web/wrt-plugins-tizen.git] / src / Application / plugin_initializer.cpp
index 49c7a2f..ec3177c 100644 (file)
 #include <sys/types.h>
 #include <unistd.h>
 #include <TimeTracer.h>
+#include <Security.h>
 
 #include "JSApplicationManager.h"
 #include "JSApplicationControl.h"
 #include "ApplicationAsyncCallbackManager.h"
 #include "ApplicationListenerManager.h"
 #include "AppManagerWrapper.h"
+#include "plugin_config.h"
 #include <Logger.h>
 
 using namespace WrtDeviceApis;
@@ -37,8 +39,28 @@ using namespace WrtDeviceApis::Commons;
 namespace DeviceAPI {
 namespace Application {
 
+AceSecurityStatus applicationAceCheckAccessFunction(const char* functionName)
+{
+    return APPLICATION_CHECK_ACCESS(functionName);
+}
+
+DEFINE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor);
+
+DEFINE_SECURITY_ACCESSOR_SETTER(AceCheckerApplicationSetter, ApplicationController, gSecurityAccessor);
+
 class_definition_options_t ApplicationOptions =
 {
+    JS_CLASS,
+    NONE,
+    ALWAYS_NOTICE,
+    IGNORED,
+    AceCheckerApplicationSetter,
+    NULL,
+    NULL
+};
+
+class_definition_options_t ApplicationConstructorOptions =
+{
     JS_INTERFACE,
     CREATE_INSTANCE,
     NONE_NOTICE,
@@ -60,6 +82,8 @@ void on_widget_start_callback(int widgetId) {
     } Catch(WrtDeviceApis::Commons::Exception) {
         LoggerE("WrtAccess initialization failed");
     }  
+
+    INITAILIZE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor, applicationAceCheckAccessFunction);
 }
 
 void on_widget_stop_callback(int widgetId) {
@@ -73,6 +97,8 @@ void on_widget_stop_callback(int widgetId) {
     } Catch(WrtDeviceApis::Commons::Exception) {
         LoggerE("WrtAccess deinitialization failed");
     }  
+
+    FINALIZE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor);
 }
 
 void on_frame_load_callback(const void * context)
@@ -98,21 +124,21 @@ PLUGIN_CLASS_MAP_BEGIN
                WRT_JS_EXTENSION_OBJECT_TIZEN,
                "application",
                (js_class_template_getter)DeviceAPI::Application::JSApplicationManager::getClassRef,
-               NULL)
+               &ApplicationOptions)
 
        PLUGIN_CLASS_MAP_ADD_INTERFACE(
                WRT_JS_EXTENSION_OBJECT_TIZEN,
                TIZEN_INTERFACE_APPLICATION_CONTROL,
                (js_class_template_getter)DeviceAPI::Application::JSApplicationControl::getClassRef,
                reinterpret_cast<js_class_constructor_cb_t>(JSApplicationControl::constructor),
-               &ApplicationOptions)
+               &ApplicationConstructorOptions)
 
        PLUGIN_CLASS_MAP_ADD_INTERFACE(
                WRT_JS_EXTENSION_OBJECT_TIZEN,
                TIZEN_INTERFACE_APPLICATION_CONTROL_DATA,
                (js_class_template_getter)DeviceAPI::Application::JSApplicationControlData::getClassRef,
                reinterpret_cast<js_class_constructor_cb_t>(JSApplicationControlData::constructor),
-               &ApplicationOptions)
+               &ApplicationConstructorOptions)
 
 PLUGIN_CLASS_MAP_END