Update change log and spec for wrt-plugins-tizen_0.4.70
[framework/web/wrt-plugins-tizen.git] / src / Filesystem / plugin_initializer.cpp
index 16b2b46..fc64952 100644 (file)
 #include <Commons/WrtAccess/WrtAccess.h>
 #include <Commons/plugin_initializer_def.h>
 #include <TimeTracer.h>
+#include <Security.h>
 #include "JSFilesystemManager.h"
 #include "JSFile.h"
 #include "JSFilestream.h"
 #include "FilesystemAsyncCallbackManager.h"
 #include "FilesystemListenerManager.h"
+#include "plugin_config.h"
+
 #include <Logger.h>
 
 using namespace WrtDeviceApis;
@@ -31,6 +34,26 @@ using namespace WrtDeviceApis::Commons;
 namespace DeviceAPI {
 namespace Filesystem {
 
+AceSecurityStatus filesystemAceCheckAccessFunction(const char* functionName)
+{      
+       return FILESYSTEM_CHECK_ACCESS(functionName);
+}
+
+DEFINE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor);    
+
+DEFINE_SECURITY_ACCESSOR_SETTER(AceCheckerFilesystemSetter, JSFilesystemManager::PrivateObject, gSecurityAccessor);    
+DEFINE_JSOBJECT_SECURITY_ACCESSOR_SETTER(AceCheckerFilesystemConstructorSetter, gSecurityAccessor);
+
+class_definition_options_t FilesystemOptions =
+{      
+    JS_CLASS,  
+    CREATE_INSTANCE,   
+    ALWAYS_NOTICE,     
+    USE_OVERLAYED, //ignored   
+    AceCheckerFilesystemSetter,        
+    NULL       
+};     
+
 void on_widget_start_callback(int widgetId)
 {
        TIME_TRACER_INIT();
@@ -39,6 +62,7 @@ void on_widget_start_callback(int widgetId)
        } Catch (Commons::Exception) {
                LoggerE("WrtAccess initialization failed");
        }
+       INITAILIZE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor, filesystemAceCheckAccessFunction);
 }
 
 void on_widget_stop_callback(int widgetId)
@@ -50,6 +74,7 @@ void on_widget_stop_callback(int widgetId)
        } Catch (Commons::Exception) {
                LoggerE("WrtAccess deinitialization failed");
        }
+       FINALIZE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor);
 }
 
 void on_frame_unload_callback(const void * context)
@@ -75,7 +100,7 @@ PLUGIN_CLASS_MAP_BEGIN
 PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
         "filesystem",
         (js_class_template_getter)DeviceAPI::Filesystem::JSFilesystemManager::getClassRef,
-        NULL)
+        &FilesystemOptions)
 PLUGIN_CLASS_MAP_END
 
 #undef FILESYSTEM