Update change log and spec for wrt-plugins-tizen_0.4.70
[framework/web/wrt-plugins-tizen.git] / src / Calendar / plugin_initializer.cpp
index 9d3f423..da0e489 100755 (executable)
 
 #include <TimeTracer.h>
 #include <GlobalContextManager.h>
+#include <JSStringRefWrapper.h>
+#include <Security.h>
 #include <Logger.h>
 
+#include "plugin_config.h"
+
+namespace DeviceAPI {
+namespace Calendar {
+
+using namespace WrtDeviceApis;
+using namespace WrtDeviceApis::Commons;
+
+AceSecurityStatus calendarAceCheckAccessFunction(const char* functionName)
+{
+       return CALENDAR_CHECK_ACCESS(functionName);
+}
+
+DEFINE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor);
+
+DEFINE_SECURITY_ACCESSOR_SETTER(AceCheckerCalendarSetter, CalendarManagerPrivObject, gSecurityAccessor);
+DEFINE_JSOBJECT_SECURITY_ACCESSOR_SETTER(AceCheckerCalendarConstructorSetter, gSecurityAccessor);
+
 namespace Options{
 class_definition_options_t CalendarOptions =
 {
     JS_CLASS,
     CREATE_INSTANCE,
-    NONE_NOTICE,
+    ALWAYS_NOTICE,
     USE_OVERLAYED, //ignored
-    NULL,
+    AceCheckerCalendarSetter,
     NULL
 };
 
 class_definition_options_t CalendarInterfaceOptions = {
     JS_INTERFACE,
     CREATE_INSTANCE,
-    NONE_NOTICE,
+    ALWAYS_NOTICE,
     USE_OVERLAYED, //ignored
-    NULL, // JSWidget::acquireGlobalContext,
+    AceCheckerCalendarConstructorSetter, // JSWidget::acquireGlobalContext,
     NULL,
     NULL
 };
 }
 
-namespace DeviceAPI {
-namespace Calendar {
-
-using namespace WrtDeviceApis;
-using namespace WrtDeviceApis::Commons;
-
 void on_widget_start_callback(int widgetId)
 {
     LoggerD("[Tizen\\Calendar] on_widget_start_callback (" << widgetId << ")");
@@ -69,6 +83,8 @@ void on_widget_start_callback(int widgetId)
        } Catch (Exception) {
                LoggerE("WrtAccess initialization failed");
        }
+
+       INITAILIZE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor, calendarAceCheckAccessFunction);
 }
 
 void on_widget_stop_callback(int widgetId)
@@ -81,6 +97,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)