Revert "Update change log and spec for wrt-plugins-tizen_0.4.70"
authorSoo-Hyun Choi <sh9.choi@samsung.com>
Tue, 22 Oct 2013 12:26:42 +0000 (21:26 +0900)
committerSoo-Hyun Choi <sh9.choi@samsung.com>
Tue, 22 Oct 2013 12:26:42 +0000 (21:26 +0900)
This reverts commit 1fc2fe44e63ed2fe699feaa2f7b8d70d928fd1e1.

Conflicts:
packaging/wrt-plugins-tizen.spec
pkgconfigs/wrt-plugins-tizen-application.pc.in
pkgconfigs/wrt-plugins-tizen-contact.pc.in
pkgconfigs/wrt-plugins-tizen-filesystem.pc.in

Change-Id: I2849388f44ee9d3f5aec40cb534e8f9c28509804

200 files changed:
packaging/wrt-plugins-tizen.spec
pkgconfigs/wrt-plugins-tizen-application.pc.in
pkgconfigs/wrt-plugins-tizen-contact.pc.in
src/Alarm/CMakeLists.txt
src/Alarm/JSAlarmAbsolute.cpp
src/Alarm/JSAlarmManager.cpp
src/Alarm/JSAlarmRelative.cpp
src/Alarm/plugin_config.cpp
src/Alarm/plugin_config.h
src/Alarm/plugin_config_impl.h [deleted file]
src/Alarm/plugin_initializer.cpp
src/Application/AppManagerWrapper.cpp
src/Application/ApplicationController.cpp
src/Application/ApplicationController.h
src/Application/ApplicationManager.cpp
src/Application/CMakeLists.txt
src/Application/JSApplicationManager.cpp
src/Application/JSApplicationManager.h
src/Application/plugin_config.cpp
src/Application/plugin_config.h
src/Application/plugin_config_impl.h [deleted file]
src/Application/plugin_initializer.cpp
src/Bluetooth/BluetoothAdapter.cpp
src/Bluetooth/BluetoothAdapter.h
src/Bluetooth/BluetoothClass.cpp
src/Bluetooth/BluetoothClass.h
src/Bluetooth/BluetoothDevice.cpp
src/Bluetooth/BluetoothDevice.h
src/Bluetooth/BluetoothHealthApplication.cpp
src/Bluetooth/BluetoothHealthApplication.h
src/Bluetooth/BluetoothHealthChannel.cpp
src/Bluetooth/BluetoothHealthChannel.h
src/Bluetooth/BluetoothHealthProfileHandler.cpp
src/Bluetooth/BluetoothHealthProfileHandler.h
src/Bluetooth/BluetoothServiceHandler.cpp
src/Bluetooth/BluetoothServiceHandler.h
src/Bluetooth/BluetoothSocket.cpp
src/Bluetooth/BluetoothSocket.h
src/Bluetooth/JSBluetoothAdapter.cpp
src/Bluetooth/JSBluetoothAdapter.h
src/Bluetooth/JSBluetoothClass.cpp
src/Bluetooth/JSBluetoothClass.h
src/Bluetooth/JSBluetoothDevice.cpp
src/Bluetooth/JSBluetoothDevice.h
src/Bluetooth/JSBluetoothHealthApplication.cpp
src/Bluetooth/JSBluetoothHealthApplication.h
src/Bluetooth/JSBluetoothHealthChannel.cpp
src/Bluetooth/JSBluetoothHealthProfileHandler.cpp
src/Bluetooth/JSBluetoothManager.cpp
src/Bluetooth/JSBluetoothManager.h
src/Bluetooth/JSBluetoothServiceHandler.cpp
src/Bluetooth/JSBluetoothSocket.cpp
src/Bluetooth/plugin_config.h
src/Bluetooth/plugin_config_impl.h [deleted file]
src/Bluetooth/plugin_initializer.cpp
src/Calendar/CMakeLists.txt
src/Calendar/CalendarConverter.cpp
src/Calendar/CalendarConverter.h
src/Calendar/CalendarMultiCallback.h
src/Calendar/CalendarResponseDispatcher.cpp
src/Calendar/IEventAddEvents.h
src/Calendar/IEventExpandEventRecurrence.h
src/Calendar/IEventFindEvents.h
src/Calendar/IEventGetCalendars.h
src/Calendar/JSCalendar.cpp
src/Calendar/JSCalendar.h
src/Calendar/JSCalendarEvent.cpp
src/Calendar/JSCalendarEvent.h
src/Calendar/JSCalendarItemProperties.cpp
src/Calendar/JSCalendarItemProperties.h
src/Calendar/JSCalendarManager.cpp
src/Calendar/JSCalendarManager.h
src/Calendar/JSCalendarTask.cpp
src/Calendar/JSCalendarTask.h
src/Calendar/plugin_config.cpp
src/Calendar/plugin_config.h
src/Calendar/plugin_config_impl.h [deleted file]
src/Calendar/plugin_initializer.cpp
src/Callhistory/CMakeLists.txt
src/Callhistory/CallHistoryAsyncCallbackManager.cpp
src/Callhistory/CallHistoryAsyncCallbackManager.h
src/Callhistory/CallHistoryListenerManager.cpp
src/Callhistory/CallHistoryListenerManager.h
src/Callhistory/JSCallHistory.cpp
src/Callhistory/JSCallHistory.h
src/Callhistory/JSCallHistoryEntry.cpp
src/Callhistory/ResponseDispatcher.cpp
src/Callhistory/plugin_config.cpp
src/Callhistory/plugin_config.h
src/Callhistory/plugin_config_impl.h [deleted file]
src/Callhistory/plugin_initializer.cpp
src/Contact/AddressBookController.cpp
src/Contact/AddressBookController.h
src/Contact/CMakeLists.txt
src/Contact/ContactConverter.cpp
src/Contact/ContactConverter.h
src/Contact/ContactManagerController.cpp
src/Contact/ContactManagerController.h
src/Contact/JSAddressBook.cpp
src/Contact/JSContact.cpp
src/Contact/JSContactManager.cpp
src/Contact/JSPerson.cpp
src/Contact/JSPerson.h
src/Contact/plugin_config.cpp
src/Contact/plugin_config.h
src/Contact/plugin_config_impl.h [deleted file]
src/Contact/plugin_initializer.cpp
src/Content/JSContentManager.cpp
src/Content/JSContentManager.h
src/Content/plugin_config.h
src/Content/plugin_config_impl.h [deleted file]
src/Content/plugin_initializer.cpp
src/Download/CMakeLists.txt
src/Filesystem/CMakeLists.txt
src/Filesystem/Converter.cpp
src/Filesystem/Converter.h
src/Filesystem/EventCopy.h
src/Filesystem/EventGetStorage.h
src/Filesystem/EventListNodes.h
src/Filesystem/EventListStorages.h
src/Filesystem/EventMove.h
src/Filesystem/EventOpen.h
src/Filesystem/EventReadText.h
src/Filesystem/EventRemove.h
src/Filesystem/EventResolve.h
src/Filesystem/JSFile.cpp
src/Filesystem/JSFile.h
src/Filesystem/JSFilestream.cpp
src/Filesystem/JSFilestream.h
src/Filesystem/JSFilesystemManager.cpp
src/Filesystem/JSFilesystemManager.h
src/Filesystem/JSStorage.h
src/Filesystem/ResponseDispatcher.cpp
src/Filesystem/plugin_config.cpp
src/Filesystem/plugin_config.h
src/Filesystem/plugin_config_impl.h [deleted file]
src/Filesystem/plugin_initializer.cpp
src/Messaging/AttachmentFactory.cpp [changed mode: 0755->0644]
src/Messaging/Attachments.cpp [changed mode: 0755->0644]
src/Messaging/BinarySms.cpp [changed mode: 0755->0644]
src/Messaging/CMakeLists.txt
src/Messaging/CallbackNumber.cpp [changed mode: 0755->0644]
src/Messaging/ConversationFilterValidator.cpp [changed mode: 0755->0644]
src/Messaging/ConversationQueryGenerator.cpp [changed mode: 0755->0644]
src/Messaging/DBus/Connection.cpp [changed mode: 0755->0644]
src/Messaging/EmailUtils.cpp [changed mode: 0755->0644]
src/Messaging/EventGetMessagingService.h
src/Messaging/FolderQueryGenerator.cpp [changed mode: 0755->0644]
src/Messaging/IAttachment.cpp [changed mode: 0755->0644]
src/Messaging/IBinarySms.cpp [changed mode: 0755->0644]
src/Messaging/IEmail.cpp [changed mode: 0755->0644]
src/Messaging/IMessage.cpp [changed mode: 0755->0644]
src/Messaging/IMessagingService.cpp [changed mode: 0755->0644]
src/Messaging/IMms.cpp [changed mode: 0755->0644]
src/Messaging/ISms.cpp [changed mode: 0755->0644]
src/Messaging/JSConversation.cpp [changed mode: 0755->0644]
src/Messaging/JSMessage.h [changed mode: 0755->0644]
src/Messaging/JSMessagingService.cpp
src/Messaging/JSMessagingService.h
src/Messaging/JSMessagingServiceManager.cpp
src/Messaging/JSMessagingServiceManager.h
src/Messaging/JSMessagingStorage.cpp
src/Messaging/JSMessagingStorage.h
src/Messaging/MessagingController.cpp
src/Messaging/config.xml
src/Messaging/log.h [changed mode: 0755->0644]
src/Messaging/plugin_config.cpp
src/Messaging/plugin_config.h
src/Messaging/plugin_config_impl.h [deleted file]
src/Messaging/plugin_initializer.cpp [changed mode: 0755->0644]
src/NFC/EventNFCChangedPrivateData.h
src/NFC/JSNFCAdapter.cpp
src/NFC/JSNFCAdapter.h
src/NFC/JSNFCManager.cpp
src/NFC/JSNFCManager.h
src/NFC/JSNFCTag.cpp
src/NFC/JSNFCTag.h
src/NFC/JSNFCTarget.cpp
src/NFC/JSNFCTarget.h
src/NFC/JSNdefMessage.cpp
src/NFC/JSNdefRecord.cpp
src/NFC/NFCStaticController.cpp
src/NFC/plugin_config.cpp
src/NFC/plugin_config.h
src/NFC/plugin_config_impl.h [deleted file]
src/NFC/plugin_initializer.cpp [changed mode: 0755->0644]
src/Notification/CMakeLists.txt
src/Package/PackageManager.cpp
src/Power/JSPowerManager.cpp [changed mode: 0755->0644]
src/Power/JSPowerManager.h
src/Power/plugin_config.cpp
src/Power/plugin_config.h
src/Power/plugin_config_impl.h [deleted file]
src/Power/plugin_initializer.cpp [changed mode: 0755->0644]
src/Power/test/CMakeLists.txt [new file with mode: 0755]
src/Power/test/TestEngine.js [new file with mode: 0755]
src/Power/test/TestPower.js [new file with mode: 0755]
src/Power/test/main.cpp [new file with mode: 0755]
src/Push/CMakeLists.txt
src/SystemSetting/CMakeLists.txt

index 7f898b9..286f6a9 100755 (executable)
@@ -9,7 +9,7 @@
 %bcond_with wrt_option_msg_port
 Name:       wrt-plugins-tizen
 Summary:    JavaScript plugins for WebRuntime
-Version:    0.4.70
+Version:    0.4.69
 Release:    3
 Group:      Development/Libraries
 License:    Apache License, Version 2.0
index d67768c..60cc46f 100644 (file)
@@ -9,5 +9,5 @@ Name: wrt-plugins-tizen-${module_name}
 Description: wrt-plugins-tizen-${module_name}
 Version: @CMAKE_PROJECT_VERSION@
 Requires: capi-appfw-app-manager capi-appfw-application capi-appfw-package-manager pkgmgr pkgmgr-info
-Libs: -L${libdir} -lwrt-plugins-tizen-${module_name}-impl
+Libs: -L${libdir} -lwrt-plugins-tizen-${module_name}-impl -lwrt-plugins-tizen-${module_name}-config
 Cflags: -I${includedir}/${module_name}
index 7377b7f..6116b8c 100755 (executable)
@@ -9,5 +9,5 @@ Name: wrt-plugins-tizen-${module_name}
 Description: wrt-plugins-tizen-${module_name}
 Version: @CMAKE_PROJECT_VERSION@
 Requires: contacts-service2 libpcrecpp
-Libs: -L${libdir} -lwrt-plugins-tizen-${module_name}-impl
+Libs: -L${libdir} -lwrt-plugins-tizen-${module_name}-impl -lwrt-plugins-tizen-${module_name}-config
 Cflags: -I${includedir}/${module_name}
index 39ab2c7..e3ce625 100644 (file)
@@ -49,6 +49,7 @@ ADD_LIBRARY(${TARGET_NAME} SHARED ${SRCS})
 
 TARGET_LINK_LIBRARIES(${TARGET_NAME}
        ${TARGET_IMPL_NAME}
+       "-Wl,--no-as-needed" ${application_config}
 )
 
 INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
index 2d0baa0..e0f8507 100644 (file)
 #include <JSUtil.h>
 
 #include <TimeTracer.h>
+#include "plugin_config.h"
 #include "JSAlarmAbsolute.h"
 #include "JSAlarmManager.h"
 #include <Export.h>
 #include <Logger.h>
 
-#define ALARM_FUNCTION_API_GET_NEXT_SCHEDULED_DATE "getNextScheduledDate"
-
 namespace DeviceAPI {
 namespace Alarm {
 
index 8a98586..e572cc4 100644 (file)
@@ -28,7 +28,6 @@
 
 #include <ArgumentValidator.h>
 #include <JSUtil.h>
-#include <Security.h>
 
 #include <SecurityExceptions.h>
 #include <Commons/Exception.h>
@@ -40,7 +39,7 @@
 
 #include <ail.h>
 
-#include "plugin_config_impl.h"
+#include "plugin_config.h"
 #include "AlarmConverter.h"
 #include "JSAlarmAbsolute.h"
 #include "AlarmAbsolute.h"
@@ -124,15 +123,10 @@ JSContextRef JSAlarmManager::gContext = NULL;
 void JSAlarmManager::initialize(JSContextRef ctx, JSObjectRef object) 
 {
     gContext = ctx;
-
-    SecurityAccessor *priv = new SecurityAccessor();
-       JSObjectSetPrivate(object, static_cast<void*>(priv));
 }
 
 void JSAlarmManager::finalize(JSObjectRef object) 
 {
-       SecurityAccessor *priv = static_cast<SecurityAccessor*>(JSObjectGetPrivate(object));
-       delete priv;
 }
 
 JSValueRef JSAlarmManager::add(JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
@@ -145,14 +139,9 @@ JSValueRef JSAlarmManager::add(JSContextRef ctx, JSObjectRef object, JSObjectRef
     std::string applicationId;
     std::string page;
 
-    SecurityAccessor *thisPriv = static_cast<SecurityAccessor*>(JSObjectGetPrivate(thisObject));
-    if (!thisPriv) {
-        LoggerE("private object is null");
-        return JSWebAPIErrorFactory::postException(ctx, exception,
-                JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
-    }
     TIME_TRACER_ITEM_BEGIN("(add)ace_check", 0);
-    TIZEN_CHECK_ACCESS(ctx, exception, thisPriv, ALARM_FUNCTION_API_ADD);
+    AceSecurityStatus status = ALARM_CHECK_ACCESS(ALARM_FUNCTION_API_ADD);
+    TIZEN_SYNC_ACCESS_HANDLER(status, ctx, exception);
     TIME_TRACER_ITEM_END("(add)ace_check", 0);
 
     try {
@@ -284,14 +273,9 @@ JSValueRef JSAlarmManager::add(JSContextRef ctx, JSObjectRef object, JSObjectRef
 JSValueRef JSAlarmManager::remove(JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
 {
     TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
-    SecurityAccessor *thisPriv = static_cast<SecurityAccessor*>(JSObjectGetPrivate(thisObject));
-    if (!thisPriv) {
-        LoggerE("private object is null");
-        return JSWebAPIErrorFactory::postException(ctx, exception,
-                JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
-    }
     TIME_TRACER_ITEM_BEGIN("(add)ace_check", 0);
-    TIZEN_CHECK_ACCESS(ctx, exception, thisPriv, ALARM_FUNCTION_API_REMOVE);
+    AceSecurityStatus status = ALARM_CHECK_ACCESS(ALARM_FUNCTION_API_REMOVE);
+    TIZEN_SYNC_ACCESS_HANDLER(status, ctx, exception);
     TIME_TRACER_ITEM_END("(add)ace_check", 0);
     
     try {
@@ -328,14 +312,9 @@ JSValueRef JSAlarmManager::remove(JSContextRef ctx, JSObjectRef object, JSObject
 JSValueRef JSAlarmManager::removeAll(JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
 {
     TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
-    SecurityAccessor *thisPriv = static_cast<SecurityAccessor*>(JSObjectGetPrivate(thisObject));
-    if (!thisPriv) {
-        LoggerE("private object is null");
-        return JSWebAPIErrorFactory::postException(ctx, exception,
-                JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
-    }
     TIME_TRACER_ITEM_BEGIN("(add)ace_check", 0);
-    TIZEN_CHECK_ACCESS(ctx, exception, thisPriv, ALARM_FUNCTION_API_REMOVE_ALL);
+    AceSecurityStatus status = ALARM_CHECK_ACCESS(ALARM_FUNCTION_API_REMOVE_ALL);
+    TIZEN_SYNC_ACCESS_HANDLER(status, ctx, exception);
     TIME_TRACER_ITEM_END("(add)ace_check", 0);
 
     TIME_TRACER_ITEM_BEGIN("(removeAll)alarm_cancel_all", 0);
index 1f509c9..e345cca 100644 (file)
@@ -26,6 +26,8 @@
 #include <JSWebAPIErrorFactory.h>
 #include <SecurityExceptions.h>
 
+#include "plugin_config.h"
+
 #include "AlarmRelative.h"
 #include "AlarmConverter.h"
 #include "JSAlarmRelative.h"
@@ -39,8 +41,6 @@
 #include <Export.h>
 #include <Logger.h>
 
-#define ALARM_FUNCTION_API_GET_REMAINING_SECONDS "getRemainingSeconds"
-
 namespace DeviceAPI {
 namespace Alarm {
 
index 8c41500..856b58a 100755 (executable)
@@ -23,7 +23,6 @@
 #include <dpl/exception.h>
 #include <map>
 
-#include "plugin_config_impl.h"
 #include "plugin_config.h"
 
 #define ALARM_FEATURE_API "http://tizen.org/privilege/alarm"
@@ -40,8 +39,12 @@ static FunctionMapping createAlarmFunctions();
 static FunctionMapping AlarmFunctions =
     createAlarmFunctions();
 
+#pragma GCC visibility push(default)
+
 DEFINE_FUNCTION_GETTER(Alarm, AlarmFunctions);
 
+#pragma GCC visibility pop
+
 static FunctionMapping createAlarmFunctions()
 {
     /**
index 3bc1f15..796e37b 100755 (executable)
@@ -1,36 +1,44 @@
-//
-// Tizen Web Device API
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#ifndef _ALARM_PLUGIN_CONFIG_H_
-#define _ALARM_PLUGIN_CONFIG_H_
-
-#include <string>
-#include <Commons/FunctionDeclaration.h>
-
-namespace DeviceAPI {
-namespace Alarm {
-
-DECLARE_FUNCTION_GETTER(Alarm);
-
-#define ALARM_CHECK_ACCESS(functionName)                     \
-    aceCheckAccess<AceFunctionGetter, DefaultArgsVerifier<> >(                \
-        getAlarmFunctionData,           \
-        functionName)
-}
-}
-#endif
-
+//\r
+// Tizen Web Device API\r
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an AS IS BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+#ifndef _ALARM_PLUGIN_CONFIG_H_\r
+#define _ALARM_PLUGIN_CONFIG_H_\r
+\r
+#include <string>\r
+#include <Commons/FunctionDeclaration.h>\r
+\r
+#define ALARM_FUNCTION_API_GET_ALL "getAll"\r
+#define ALARM_FUNCTION_API_GET "get"\r
+#define ALARM_FUNCTION_API_ADD "add"\r
+#define ALARM_FUNCTION_API_REMOVE "remove"\r
+#define ALARM_FUNCTION_API_REMOVE_ALL "removeAll"\r
+#define ALARM_FUNCTION_API_GET_NEXT_SCHEDULED_DATE "getNextScheduledDate"\r
+#define ALARM_FUNCTION_API_GET_REMAINING_SECONDS "getRemainingSeconds"\r
+\r
+namespace DeviceAPI {\r
+namespace Alarm {\r
+\r
+DECLARE_FUNCTION_GETTER(Alarm);\r
+\r
+#define ALARM_CHECK_ACCESS(functionName)                     \\r
+    aceCheckAccess<AceFunctionGetter, DefaultArgsVerifier<> >(                \\r
+        getAlarmFunctionData,           \\r
+        functionName)\r
+}\r
+}\r
+#endif\r
+\r
diff --git a/src/Alarm/plugin_config_impl.h b/src/Alarm/plugin_config_impl.h
deleted file mode 100755 (executable)
index 3849162..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-//
-// Tizen Web Device API
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#ifndef _ALARM_PLUGIN_CONFIG_IMPL_H_
-#define _ALARM_PLUGIN_CONFIG_IMPL_H_
-
-#define ALARM_FUNCTION_API_GET_ALL "getAll"
-#define ALARM_FUNCTION_API_GET "get"
-#define ALARM_FUNCTION_API_ADD "add"
-#define ALARM_FUNCTION_API_REMOVE "remove"
-#define ALARM_FUNCTION_API_REMOVE_ALL "removeAll"
-#define ALARM_FUNCTION_API_GET_NEXT_SCHEDULED_DATE "getNextScheduledDate"
-#define ALARM_FUNCTION_API_GET_REMAINING_SECONDS "getRemainingSeconds"
-
-#endif
index 91022f0..2951641 100644 (file)
@@ -23,8 +23,6 @@
 #include "JSAlarmAbsolute.h"
 #include "JSAlarmRelative.h"
 #include <Logger.h>
-#include <Security.h>
-#include "plugin_config.h"
 
 #define WRT_JS_EXTENSION_OBJECT_TIZEN "tizen"
 
@@ -35,28 +33,6 @@ using namespace WrtDeviceApis;
 using namespace WrtDeviceApis::Commons;
 using namespace WrtDeviceApis::CommonsJavaScript;
 
-AceSecurityStatus alarmAceCheckAccessFunction(const char* functionName)
-{
-    return ALARM_CHECK_ACCESS(functionName);
-}
-
-DEFINE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor);
-
-DEFINE_SECURITY_ACCESSOR_SETTER(AceCheckerAlarmSetter,
-                                DeviceAPI::Common::SecurityAccessor,
-                                gSecurityAccessor);
-
-class_definition_options_t ClassOptions =
-{
-    JS_CLASS,
-    NONE,
-    ALWAYS_NOTICE,
-    IGNORED,
-    AceCheckerAlarmSetter,
-    NULL,
-    NULL
-};
-
 class_definition_options_t ConstructorClassOptions =
 {
     JS_INTERFACE,
@@ -80,8 +56,6 @@ void on_widget_start_callback(int widgetId)
     {
         LoggerE("WrtAccess initialization failed");
     }
-
-    INITAILIZE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor, alarmAceCheckAccessFunction);
 }
 
 void on_widget_stop_callback(int widgetId)
@@ -97,8 +71,6 @@ void on_widget_stop_callback(int widgetId)
     {
         LoggerE("WrtAccess deinitialization failed");
     }
-
-    FINALIZE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor);
 }
 
 PLUGIN_ON_WIDGET_START(on_widget_start_callback)
@@ -109,7 +81,7 @@ PLUGIN_CLASS_MAP_ADD_CLASS(
         WRT_JS_EXTENSION_OBJECT_TIZEN,
         "alarm",
         (js_class_template_getter)DeviceAPI::Alarm::JSAlarmManager::getClassRef,
-        &ClassOptions)
+        NULL)
 PLUGIN_CLASS_MAP_ADD_INTERFACE(
        WRT_JS_EXTENSION_OBJECT_TIZEN,
        TIZEN_ALARM_ABSOLUTE_INTERFACE,
index 48146fa..27e8bcf 100644 (file)
@@ -152,7 +152,6 @@ void AppManagerWrapper::appListChangedCallback(app_manger_event_type_e event_typ
                ret = package_info_foreach_app_from_package(package_info, PACKAGE_INFO_ALLAPP, app_callback, user_data);
                if (ret != PACKAGE_MANAGER_ERROR_NONE) {
                        LoggerE("failed while getting appids");
-                       package_info_destroy(package_info);
                        return;
                }
 
index ad7d281..daef6f2 100644 (file)
@@ -45,7 +45,6 @@ ApplicationController::ApplicationController(JSContextRef context, IApplicationM
                EventApplicationGetAppsContextEventAnswerReceiver(ThreadEnum::NULL_THREAD),
                EventApplicationGetAppsInfoEventAnswerReceiver(ThreadEnum::NULL_THREAD),
                EventApplicationAppInfoEventListenerListener(ThreadEnum::NULL_THREAD),
-               SecurityAccessor(),
                ApplicationPrivObject(context, application)
 {
        if (!application) {
index 452e99a..32bccb6 100755 (executable)
@@ -24,7 +24,6 @@
 #include <CommonsJavaScript/PrivateObject.h>
 #include <CommonsJavaScript/JSPendingOperationPrivateObject.h>
 #include <CommonsJavaScript/JSPendingOperation.h>
-#include <Security.h>
 #include "IApplicationManager.h"
 
 namespace DeviceAPI {
@@ -59,7 +58,6 @@ class ApplicationController :
        public EventApplicationGetAppsContextEventAnswerReceiver,
        public EventApplicationGetAppsInfoEventAnswerReceiver,
        public EventApplicationAppInfoEventListenerListener,
-       public DeviceAPI::Common::SecurityAccessor,
        public ApplicationPrivObject
 {
 public:
index 9e69946..f13f930 100644 (file)
@@ -829,18 +829,9 @@ ApplicationCertArrayPtr ApplicationManager::getAppCerts(const std::string id)
        TIME_TRACER_ITEM_END("(getAppCerts)package_info_foreach_cert_info", 0);
        if ((result != PACKAGE_MANAGER_ERROR_NONE) && (result != PACKAGE_MANAGER_ERROR_IO_ERROR))
        {
-               package_info_destroy(pkg_info);
                ThrowMsg(UnknownException, "Can not get package cert info");
        }
 
-       TIME_TRACER_ITEM_BEGIN("(getAppCerts)package_info_destroy", 0);
-       result = package_info_destroy(pkg_info);
-       TIME_TRACER_ITEM_END("(getAppCerts)package_info_destroy", 0);
-       if (result != PACKAGE_MANAGER_ERROR_NONE)
-       {
-               LoggerE("Failed to destroy package_info");
-       }
-
        return certArray;
 }
 
index 3439b0b..78b69ff 100644 (file)
@@ -1,6 +1,7 @@
 SET(TARGET_NAME ${application_target})
 SET(DESTINATION_NAME ${application_dest})
 SET(TARGET_IMPL_NAME ${application_impl})
+SET(TARGET_CONFIG_NAME ${application_config})
 
 PKG_CHECK_MODULES(platform_pkgs_application REQUIRED
        capi-appfw-app-manager
@@ -63,8 +64,17 @@ TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
        ${platform_pkgs_application_LIBRARIES}
 )
 
-SET(SRCS
+SET(SRCS_CONFIG
        plugin_config.cpp
+)
+
+ADD_LIBRARY(${TARGET_CONFIG_NAME} SHARED ${SRCS_CONFIG})
+
+TARGET_LINK_LIBRARIES(${TARGET_CONFIG_NAME}
+       ${LIBS_COMMON}
+)
+
+SET(SRCS
        plugin_initializer.cpp
 )
 
@@ -72,9 +82,10 @@ ADD_LIBRARY(${TARGET_NAME} SHARED ${SRCS})
 
 TARGET_LINK_LIBRARIES(${TARGET_NAME}
        ${TARGET_IMPL_NAME}
+       ${TARGET_CONFIG_NAME}
 )
 
-INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
+INSTALL(TARGETS ${TARGET_NAME} ${TARGET_CONFIG_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(
        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/application
index c26b44a..943c343 100644 (file)
@@ -35,7 +35,7 @@
 #include <JSWebAPIErrorFactory.h>
 
 #include "ApplicationFactory.h"
-#include "plugin_config_impl.h"
+#include "plugin_config.h"
 #include "ApplicationController.h"
 #include "JSApplicationManager.h"
 #include "ApplicationConverter.h"
@@ -51,7 +51,6 @@
 #include <TimeTracer.h>
 #include <Export.h>
 #include <Logger.h>
-#include <Security.h>
 
 #include <plugins-ipc-message/ipc_message_support.h>
 
@@ -179,6 +178,11 @@ JSValueRef JSApplicationManager::launch(JSContextRef context,
        TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        TIME_TRACER_ITEM_BEGIN("launch(async)", 0);
 
+       TIME_TRACER_ITEM_BEGIN("launch(ACE)", 0);
+       AceSecurityStatus status = APPLICATION_CHECK_ACCESS(APPLICATION_FUNCTION_API_LAUNCH);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+       TIME_TRACER_ITEM_END("launch(ACE)", 0);
+
        try {
                IApplicationManagerPtr appmgr;
                JSContextRef gContext;
@@ -191,10 +195,6 @@ JSValueRef JSApplicationManager::launch(JSContextRef context,
                appmgr = controller->getObject();
                gContext = controller->getContext();
 
-               TIME_TRACER_ITEM_BEGIN("launch(ACE)", 0);
-               TIZEN_CHECK_ACCESS(context, exception, controller, APPLICATION_FUNCTION_API_LAUNCH);
-               TIME_TRACER_ITEM_END("launch(ACE)", 0);
-
                EventApplicationLaunchPtr event(new EventApplicationLaunch());
                JSCallbackManagerPtr callbackManager = JSCallbackManager::createObject(gContext);               
 
@@ -242,6 +242,11 @@ JSValueRef JSApplicationManager::kill(JSContextRef context,
        TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        TIME_TRACER_ITEM_BEGIN("kill(async)", 0);
 
+       TIME_TRACER_ITEM_BEGIN("kill(ACE)", 0);
+       AceSecurityStatus status = APPLICATION_CHECK_ACCESS(APPLICATION_FUNCTION_API_KILL);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+       TIME_TRACER_ITEM_END("kill(ACE)", 0);
+
        try {
                IApplicationManagerPtr appmgr;
                JSContextRef gContext;
@@ -254,10 +259,6 @@ JSValueRef JSApplicationManager::kill(JSContextRef context,
                appmgr = controller->getObject();
                gContext = controller->getContext();
 
-               TIME_TRACER_ITEM_BEGIN("kill(ACE)", 0);
-               TIZEN_CHECK_ACCESS(context, exception, controller, APPLICATION_FUNCTION_API_KILL);
-               TIME_TRACER_ITEM_END("kill(ACE)", 0);
-
                EventApplicationKillPtr event(new EventApplicationKill());
                JSCallbackManagerPtr callbackManager = JSCallbackManager::createObject(gContext);
         ArgumentValidator validator(context, argumentCount, arguments);
@@ -337,6 +338,11 @@ JSValueRef JSApplicationManager::launchAppControl(JSContextRef context,
        TIME_TRACER_ITEM_BEGIN("launchAppControl(async)", 0);
        TIME_TRACER_ITEM_BEGIN("launchAppControlReply(async)", 0);
 
+       TIME_TRACER_ITEM_BEGIN("launchAppControl(ACE)", 0);
+       AceSecurityStatus status = APPLICATION_CHECK_ACCESS(APPLICATION_FUNCTION_API_LAUNCH_APP_CONTROL);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+       TIME_TRACER_ITEM_END("launchAppControl(ACE)", 0);
+
        try {
                IApplicationManagerPtr appmgr;
                JSContextRef gContext;
@@ -349,9 +355,6 @@ JSValueRef JSApplicationManager::launchAppControl(JSContextRef context,
                appmgr = controller->getObject();
                gContext = controller->getContext();
 
-               TIME_TRACER_ITEM_BEGIN("launchAppControl(ACE)", 0);
-               TIZEN_CHECK_ACCESS(context, exception, controller, APPLICATION_FUNCTION_API_LAUNCH_APP_CONTROL);
-               TIME_TRACER_ITEM_END("launchAppControl(ACE)", 0);
 
                EventApplicationLaunchAppControlPtr event(new EventApplicationLaunchAppControl());
            JSCallbackManagerPtr callbackManager = JSCallbackManager::createObject(gContext);
@@ -816,17 +819,12 @@ JSValueRef JSApplicationManager::getAppCerts(JSContextRef context,
 {
        TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
 
-       try {
-               ApplicationController *controller;
-               controller = static_cast<ApplicationController*>(JSObjectGetPrivate(thisObject));
-               if (!controller) {
-                       throw TypeMismatchException("No private object.");
-               }
-
-               TIME_TRACER_ITEM_BEGIN("getAppCerts(ACE)", 0);
-               TIZEN_CHECK_ACCESS(context, exception, controller, APPLICATION_FUNCTION_API_GET_APP_CERTS);
-               TIME_TRACER_ITEM_END("getAppCerts(ACE)", 0);
+       TIME_TRACER_ITEM_BEGIN("(getAppCerts)ACE", 0);
+       AceSecurityStatus status = APPLICATION_CHECK_ACCESS(APPLICATION_FUNCTION_API_GET_APP_CERTS);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+       TIME_TRACER_ITEM_END("(getAppCerts)ACE", 0);
 
+       try {
                ArgumentValidator validator(context, argumentCount, arguments);
 
                ApplicationCertArrayPtr result = ApplicationManager::getAppCerts(validator.toString(0, true, ""));
@@ -883,17 +881,12 @@ JSValueRef JSApplicationManager::getAppMetaData(JSContextRef context,
 {
        TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
 
-       try {
-               ApplicationController *controller;
-               controller = static_cast<ApplicationController*>(JSObjectGetPrivate(thisObject));
-               if (!controller) {
-                       throw TypeMismatchException("No private object.");
-               }
-
-               TIME_TRACER_ITEM_BEGIN("getAppMetaData(ACE)", 0);
-               TIZEN_CHECK_ACCESS(context, exception, controller, APPLICATION_FUNCTION_API_GET_APP_META_DATA);
-               TIME_TRACER_ITEM_END("getAppMetaData(ACE)", 0);
+       TIME_TRACER_ITEM_BEGIN("(getAppMetaData)ACE", 0);
+       AceSecurityStatus status = APPLICATION_CHECK_ACCESS(APPLICATION_FUNCTION_API_GET_APP_META_DATA);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+       TIME_TRACER_ITEM_END("(getAppMetaData)ACE", 0);
 
+       try {
                ArgumentValidator validator(context, argumentCount, arguments);
 
                ApplicationMetaDataArrayPtr result = ApplicationManager::getAppMetaData(validator.toString(0, true, ""));
index bb298d5..873be7c 100644 (file)
@@ -27,6 +27,9 @@ namespace Application {
 
 #define TIZEN_INTERFACE_APPLICATION_MANAGER "ApplicationManager"
 
+typedef WrtDeviceApis::CommonsJavaScript::PrivateObject
+               <IApplicationManagerPtr, WrtDeviceApis::CommonsJavaScript::NoOwnership> JSApplicationManagerPriv;
+
 class JSApplicationManager {
 public:
        static const JSClassDefinition* getClassInfo();
index e4ffab8..636a017 100755 (executable)
@@ -54,8 +54,12 @@ static FunctionMapping createApplicationFunctions();
 static FunctionMapping ApplicationFunctions =
     createApplicationFunctions();
 
+#pragma GCC visibility push(default)
+
 DEFINE_FUNCTION_GETTER(Application, ApplicationFunctions);
 
+#pragma GCC visibility pop
+
 static FunctionMapping createApplicationFunctions()
 {
     /**
index fa36426..0cfd8fb 100755 (executable)
@@ -1,39 +1,66 @@
-//
-// Tizen Web Device API
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-
-#ifndef _APPLICATOIN_PLUGIN_CONFIG_H_
-#define _APPLICATOIN_PLUGIN_CONFIG_H_
-
-#include <string>
-#include <Commons/FunctionDeclaration.h>
-#include "plugin_config_impl.h"
-
-namespace DeviceAPI {
-namespace Application {
-
-DECLARE_FUNCTION_GETTER(Application);
-
-#define APPLICATION_CHECK_ACCESS(functionName)                     \
-    aceCheckAccess<AceFunctionGetter, DefaultArgsVerifier<> >(     \
-        getApplicationFunctionData,                                \
-        functionName)
-
-}
-}
-#endif
-
+//\r
+// Tizen Web Device API\r
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an AS IS BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+\r
+#ifndef _APPLICATOIN_PLUGIN_CONFIG_H_\r
+#define _APPLICATOIN_PLUGIN_CONFIG_H_\r
+\r
+#include <string>\r
+#include <Commons/FunctionDeclaration.h>\r
+\r
+// feature : launch\r
+#define APPLICATION_FUNCTION_API_LAUNCH                                                "launch"\r
+#define APPLICATION_FUNCTION_API_LAUNCH_APP_CONTROL                            "launchAppControl"\r
+\r
+// feature : kill - public candidate\r
+#define APPLICATION_FUNCTION_API_KILL                                                  "kill"\r
+\r
+// feature : certificate - public candidate\r
+#define APPLICATION_FUNCTION_API_GET_APP_CERTS                                 "getAppCerts"\r
+\r
+// no feature required\r
+#define APPLICATION_FUNCTION_API_GET_APPS_INFO                                 "getAppsInfo"\r
+#define APPLICATION_FUNCTION_API_GET_APP_INFO                                  "getAppInfo"\r
+#define APPLICATION_FUNCTION_API_GET_APPS_CONTEXT                              "getAppsContext"\r
+#define APPLICATION_FUNCTION_API_GET_APP_CONTEXT                               "getAppContext"\r
+#define APPLICATION_FUNCTION_API_FIND_APP_CONTROL                              "findAppControl"\r
+#define APPLICATION_FUNCTION_API_ADD_APP_INFO_EVENT_LISTENER   "addAppInfoEventListener"\r
+#define APPLICATION_FUNCTION_API_REMOVE_APP_INFO_EVENT_LISTENER        "removeAppInfoEventListener"\r
+#define APPLICATION_FUNCTION_API_GET_CURRENT_APP                               "getCurrentApplication"\r
+#define APPLICATION_FUNCTION_API_GET_REQUESTED_APP_CONTROL             "getRequestedAppControl"\r
+#define APPLICATION_FUNCTION_API_EXIT                                                  "exit"\r
+#define APPLICATION_FUNCTION_API_HIDE                                                  "hide"\r
+#define APPLICATION_FUNCTION_API_REPLY_RESULT                                  "replyResult"\r
+#define APPLICATION_FUNCTION_API_REPLY_FAILURE                                 "replyFailure"\r
+#define APPLICATION_FUNCTION_API_GET_APP_SHARED_URI                            "getAppSharedURI"\r
+#define APPLICATION_FUNCTION_API_GET_APP_META_DATA                             "getAppMetaData"\r
+#define APPLICATION_FUNCTION_API_SET_USER_AGENT                                        "setUserAgent"\r
+\r
+namespace DeviceAPI {\r
+namespace Application {\r
+\r
+DECLARE_FUNCTION_GETTER(Application);\r
+\r
+#define APPLICATION_CHECK_ACCESS(functionName)                     \\r
+    aceCheckAccess<AceFunctionGetter, DefaultArgsVerifier<> >(     \\r
+        getApplicationFunctionData,                                \\r
+        functionName)\r
+\r
+}\r
+}\r
+#endif\r
+\r
diff --git a/src/Application/plugin_config_impl.h b/src/Application/plugin_config_impl.h
deleted file mode 100755 (executable)
index c47b181..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-//
-// Tizen Web Device API
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-
-#ifndef _APPLICATOIN_PLUGIN_CONFIG_IMPL_H_
-#define _APPLICATOIN_PLUGIN_CONFIG_IMPL_H_
-
-// feature : launch
-#define APPLICATION_FUNCTION_API_LAUNCH                                                "launch"
-#define APPLICATION_FUNCTION_API_LAUNCH_APP_CONTROL                            "launchAppControl"
-
-// feature : kill - public candidate
-#define APPLICATION_FUNCTION_API_KILL                                                  "kill"
-
-// feature : certificate - public candidate
-#define APPLICATION_FUNCTION_API_GET_APP_CERTS                                 "getAppCerts"
-
-// no feature required
-#define APPLICATION_FUNCTION_API_GET_APPS_INFO                                 "getAppsInfo"
-#define APPLICATION_FUNCTION_API_GET_APP_INFO                                  "getAppInfo"
-#define APPLICATION_FUNCTION_API_GET_APPS_CONTEXT                              "getAppsContext"
-#define APPLICATION_FUNCTION_API_GET_APP_CONTEXT                               "getAppContext"
-#define APPLICATION_FUNCTION_API_FIND_APP_CONTROL                              "findAppControl"
-#define APPLICATION_FUNCTION_API_ADD_APP_INFO_EVENT_LISTENER   "addAppInfoEventListener"
-#define APPLICATION_FUNCTION_API_REMOVE_APP_INFO_EVENT_LISTENER        "removeAppInfoEventListener"
-#define APPLICATION_FUNCTION_API_GET_CURRENT_APP                               "getCurrentApplication"
-#define APPLICATION_FUNCTION_API_GET_REQUESTED_APP_CONTROL             "getRequestedAppControl"
-#define APPLICATION_FUNCTION_API_EXIT                                                  "exit"
-#define APPLICATION_FUNCTION_API_HIDE                                                  "hide"
-#define APPLICATION_FUNCTION_API_REPLY_RESULT                                  "replyResult"
-#define APPLICATION_FUNCTION_API_REPLY_FAILURE                                 "replyFailure"
-#define APPLICATION_FUNCTION_API_GET_APP_SHARED_URI                            "getAppSharedURI"
-#define APPLICATION_FUNCTION_API_GET_APP_META_DATA                             "getAppMetaData"
-#define APPLICATION_FUNCTION_API_SET_USER_AGENT                                        "setUserAgent"
-
-#endif
-
index ec3177c..49c7a2f 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;
@@ -39,28 +37,8 @@ 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,
@@ -82,8 +60,6 @@ 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) {
@@ -97,8 +73,6 @@ 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)
@@ -124,21 +98,21 @@ PLUGIN_CLASS_MAP_BEGIN
                WRT_JS_EXTENSION_OBJECT_TIZEN,
                "application",
                (js_class_template_getter)DeviceAPI::Application::JSApplicationManager::getClassRef,
-               &ApplicationOptions)
+               NULL)
 
        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),
-               &ApplicationConstructorOptions)
+               &ApplicationOptions)
 
        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),
-               &ApplicationConstructorOptions)
+               &ApplicationOptions)
 
 PLUGIN_CLASS_MAP_END
 
index bd5436f..ba9a1a5 100644 (file)
@@ -21,7 +21,7 @@
 #include <JSWebAPIErrorFactory.h>
 #include <JSUtil.h>
 #include <TimeTracer.h>
-#include "plugin_config_impl.h"
+
 #include "BluetoothAdapter.h"
 #include "BluetoothCallbackUtil.h"
 #include "JSBluetoothDevice.h"
@@ -310,7 +310,6 @@ void BluetoothAdapter::onDiscoveryStateChangedCB(int result, bt_adapter_device_d
                 if(result == BT_ERROR_NONE) {
                     // create BluetoothDevice
                     BluetoothDeviceSharedPtr device(new BluetoothDevice(discoveryInfo));
-                                       device->copyAceCheckAccessFunction(getInstance());
                     JSContextRef context = callback->getContext();
                     JSObjectRef deviceObj = JSBluetoothDevice::createJSObject(context, device);
                     object->mFoundDevices.push_back(device);
@@ -368,7 +367,6 @@ bool BluetoothAdapter::foreachBondedDevicesCB(bt_device_info_s *deviceInfo, void
 
     if(iter == adapter->knownDevices.end()) {
         BluetoothDeviceSharedPtr device(new BluetoothDevice(deviceInfo));
-               device->copyAceCheckAccessFunction(getInstance());
         adapter->knownDevices.push_back(device);        
     }
 
@@ -399,7 +397,6 @@ void BluetoothAdapter::onBondCreatedCB(int result, bt_device_info_s *deviceInfo,
         if(result == BT_ERROR_NONE && deviceInfo != NULL) {
             if(callback) {
                 BluetoothDeviceSharedPtr device(new BluetoothDevice(deviceInfo));
-                               device->copyAceCheckAccessFunction(getInstance());
                 JSContextRef context = callback->getContext();
                 JSObjectRef deviceObj = JSBluetoothDevice::createJSObject(context, device);
                 callback->invokeCallback("success", deviceObj);
@@ -498,7 +495,7 @@ void BluetoothAdapter::onSocketConnected(int result, bt_socket_connection_state_
                 service->setConnectionState(true);
 
                 // Call BluetoothServiceHandler.onconnect
-                BluetoothSocketPtr socket = new BluetoothSocket(connection, getInstance());
+                BluetoothSocketPtr socket = new BluetoothSocket(connection);
                 MultiCallbackUserDataPtr callback = service->getOnConnect();
                 JSContextRef context = callback->getContext();
                 JSObjectRef socketObj = JSBluetoothSocket::createJSObject(context, socket);
@@ -562,8 +559,7 @@ void BluetoothAdapter::onSocketConnected(int result, bt_socket_connection_state_
 
             if(result == BT_ERROR_NONE) {
                 // Update mConnectedSocket
-                BluetoothSocketPtr socket = new BluetoothSocket(connection, getInstance());
-
+                BluetoothSocketPtr socket = new BluetoothSocket(connection);
                 object->mConnectedSocket.insert(std::pair<int, BluetoothSocketPtr>(connection->socket_fd, socket));
                 bt_socket_set_data_received_cb(onSocketReceivedCB, userData);
 
@@ -659,8 +655,6 @@ void BluetoothAdapter::onSocketReceivedCB(bt_socket_received_data_s *data, void
 BluetoothAdapter::BluetoothAdapter(): 
         mEnabled(false), mVisible(false)
 {
-       Common::SecurityAccessor();
-       
     bt_adapter_state_e state;
     if (bt_adapter_get_state(&state) == BT_ERROR_NONE) {
         if (state == BT_ADAPTER_ENABLED) {
@@ -712,8 +706,6 @@ BluetoothAdapter::~BluetoothAdapter()
     mConnReqMap.clear();
     mFoundDevices.clear();
     mConnectedSocket.clear();
-       
-       
 }
 
 void BluetoothAdapter::unloadFrame(JSContextRef context)
@@ -1422,12 +1414,11 @@ void BluetoothAdapter::returnKnownDevices(Common::MultiCallbackUserDataPtr userD
         knownDevices = mFoundDevices;
         if(bt_adapter_foreach_bonded_device(foreachBondedDevicesCB, this) == BT_ERROR_NONE) {
             if(knownDevices.size() > 0) { // There are found devices
-
+                LoggerD("There are found devices");                        
                 int num = knownDevices.size();
-                LoggerD("There are found devices " << num);                        
                 JSObjectRef devices[num];
                 for(int i = 0; i < num; i++) {
-                    JSObjectRef deviceObj = JSBluetoothDevice::createJSObject(userData->getContext(), knownDevices[i]);          
+                    JSObjectRef deviceObj = JSBluetoothDevice::createJSObject(userData->getContext(), knownDevices[i]);                        
                     devices[i] = deviceObj;
                 }
 
@@ -1471,7 +1462,6 @@ void BluetoothAdapter::returnDevice(std::string &address, Common::MultiCallbackU
                 deviceInfo != NULL) {  
             TIME_TRACER_ITEM_END("returnDevice::bt_adapter_get_bonded_device_info", 1);
             BluetoothDeviceSharedPtr device(new BluetoothDevice(deviceInfo));
-                       device->copyAceCheckAccessFunction(getInstance());
             bt_adapter_free_device_info(deviceInfo);
 
             LoggerD("invoke successCallback");
@@ -1551,7 +1541,6 @@ void BluetoothAdapter::returnRegisteredService(std::string &uuid, std::string &n
                         bt_socket_set_connection_state_changed_cb(onSocketConnected, this);
 
                         BluetoothServiceHandlerPtr serviceHandler = new BluetoothServiceHandler(uuid, name, socket);
-                                               serviceHandler->copyAceCheckAccessFunction(getInstance());
                         mRegisteredUUID.insert(std::pair<std::string, BluetoothServiceHandlerPtr>(uuid, serviceHandler));
                         
                         JSObjectRef serviceObj = JSBluetoothServiceHandler::createJSObject(userData->getContext(), serviceHandler);
@@ -1617,8 +1606,5 @@ void BluetoothAdapter::unsetChangeListener()
 }
 
 
-
-
-
 } // Bluetooth
 } // DeviceAPI
index 731b81e..8b573e0 100644 (file)
 #include <map>
 
 #include <bluetooth.h>
-#include <Security.h>
+
 #include <MultiCallbackUserData.h>
 #include <PlatformException.h>
+
 #include "BluetoothDevice.h"
 #include "BluetoothServiceHandler.h"
 #include "BluetoothSocket.h"
@@ -47,7 +48,7 @@ public:
 };
 typedef BluetoothConnReq* BluetoothConnReqPtr;
 
-class BluetoothAdapter : public Common::SecurityAccessor
+class BluetoothAdapter
 {
 public:
     enum adapterAsyncE
@@ -92,6 +93,7 @@ public:
     static bool isValidAddress(std::string &address);
     static bool isValidUUID(std::string &uuid);
     void unloadFrame(JSContextRef context);
+    
 private:  
     BluetoothAdapter();
     virtual ~BluetoothAdapter();
@@ -126,7 +128,6 @@ private:
     std::vector<BluetoothDeviceSharedPtr> mFoundDevices;
     std::vector<BluetoothDeviceSharedPtr> knownDevices;
     Common::MultiCallbackUserDataPtr mChangeListener;
-       
 };
 
 typedef BluetoothAdapter* BluetoothAdapterPtr;
index 6486574..8998d66 100644 (file)
@@ -34,7 +34,6 @@ namespace Bluetooth {
 
 BluetoothClass::BluetoothClass(bt_class_s bluetoothClass)    
 {
-       Common::SecurityAccessor();
     mMajor = BluetoothClassDeviceMajor::getInstance()->getMajorValue(bluetoothClass.major_device_class);
     mMinor = BluetoothClassDeviceMinor::getInstance()->getMinorValue(bluetoothClass.minor_device_class);
     mServices= BluetoothClassDeviceService::getInstance()->getServiceValues(bluetoothClass.major_service_class_mask);
index d1d18dd..f685247 100644 (file)
 
 #include <JavaScriptCore/JavaScript.h>
 #include <bluetooth.h>
-#include <Security.h>
+
 #include <boost/shared_ptr.hpp>
 #include <PropertyBag.h>
 
 namespace DeviceAPI {
 namespace Bluetooth {
 
-class BluetoothClass : public Common::SecurityAccessor
+class BluetoothClass
 {
 public:
     BluetoothClass(bt_class_s bluetoothClass);
index c87d099..1331a84 100644 (file)
@@ -32,7 +32,6 @@ namespace Bluetooth {
 
 BluetoothDevice::BluetoothDevice(bt_adapter_device_discovery_info_s *discoveryInfo)
 {
-       Common::SecurityAccessor();
     mName = std::string(discoveryInfo->remote_name);
     mAddress = std::string(discoveryInfo->remote_address);
     mDeviceClass = BluetoothClassSharedPtr(new BluetoothClass(discoveryInfo->bt_class));
@@ -44,11 +43,9 @@ BluetoothDevice::BluetoothDevice(bt_adapter_device_discovery_info_s *discoveryIn
 
 BluetoothDevice::BluetoothDevice(bt_device_info_s *deviceInfo)
 {
-       Common::SecurityAccessor();
     mName = std::string(deviceInfo->remote_name);
     mAddress = std::string(deviceInfo->remote_address);
     mDeviceClass = BluetoothClassSharedPtr(new BluetoothClass(deviceInfo->bt_class));
-       
     for(int i = 0; i < deviceInfo->service_count; i++) {
         mUUIDs.push_back(std::string(deviceInfo->service_uuid[i]));
     }
@@ -80,12 +77,6 @@ std::string BluetoothDevice::getAddress() const
     return mAddress;
 }
 
-void BluetoothDevice::copyAceCheckAccessFunction(const Common::SecurityAccessor *securityAccessor)
-{
-       Common::SecurityAccessor::copyAceCheckAccessFunction(securityAccessor);
-       mDeviceClass->copyAceCheckAccessFunction(securityAccessor);
-}
-
 JSValueRef BluetoothDevice::getDeviceClass(JSContextRef context)
 {
     /*
index e434bbc..1c83925 100644 (file)
 #include <bluetooth.h>
 #include <boost/shared_ptr.hpp>
 #include <PropertyBag.h>
-#include <Security.h>
+
 #include "BluetoothClass.h"
 
 namespace DeviceAPI {
 namespace Bluetooth {
 
-class BluetoothDevice : public Common::SecurityAccessor
+class BluetoothDevice
 {
 public:
     BluetoothDevice(bt_adapter_device_discovery_info_s *discoveryInfo);
@@ -46,7 +46,7 @@ public:
     bool isTrusted() const;
     bool isConnected() const;
     JSValueRef getUUIDs(JSContextRef context);    
-       void copyAceCheckAccessFunction(const Common::SecurityAccessor *securityAccessor);      
+
 private:
     std::string mName;
     std::string mAddress;
index 8fb9d5d..b54176d 100644 (file)
@@ -29,7 +29,6 @@ namespace Bluetooth {
 
 BluetoothHealthApplication::BluetoothHealthApplication(std::string appID, std::string name, unsigned short dataType)
 {
-       Common::SecurityAccessor();
     mAppID = appID;
     mName = name;
     mDataType = dataType;
index f823bea..c15c0d9 100644 (file)
 
 #include <MultiCallbackUserData.h>
 #include <PropertyBag.h>
-#include <Security.h>
 
 namespace DeviceAPI {
 namespace Bluetooth {
 
-class BluetoothHealthApplication : public Common::SecurityAccessor
+class BluetoothHealthApplication
 {
 public:
     BluetoothHealthApplication(std::string appID, std::string name, unsigned short dataType);
index f038d33..9303206 100644 (file)
@@ -32,7 +32,6 @@ namespace Bluetooth {
 BluetoothHealthChannel::BluetoothHealthChannel(unsigned int channel, BluetoothDeviceSharedPtr remoteDevice, 
         bt_hdp_channel_type_e type, BluetoothHealthApplicationSharedPtr application)
 {
-       Common::SecurityAccessor();
     mChannel = channel;
     mRemoteDevice = remoteDevice;
     if(type == BT_HDP_CHANNEL_TYPE_RELIABLE) {
index 87ea7b4..b348b04 100644 (file)
@@ -21,7 +21,7 @@
 #include <string>
 #include <bluetooth.h>
 #include <JavaScriptCore/JavaScript.h>
-#include <Security.h>
+
 #include <MultiCallbackUserData.h>
 #include "BluetoothDevice.h"
 #include "BluetoothHealthApplication.h"
@@ -29,7 +29,7 @@
 namespace DeviceAPI {
 namespace Bluetooth {
 
-class BluetoothHealthChannel : public Common::SecurityAccessor
+class BluetoothHealthChannel
 {
 public:
     BluetoothHealthChannel(unsigned int channel, BluetoothDeviceSharedPtr remoteDevice, bt_hdp_channel_type_e type, BluetoothHealthApplicationSharedPtr application);
index 8299baa..834e8fa 100644 (file)
@@ -71,13 +71,10 @@ void BluetoothHealthProfileHandler::onConnected(int result, const char *remote_a
             if(bt_adapter_get_bonded_device_info(remote_address, &deviceInfo) == BT_ERROR_NONE &&
                     deviceInfo != NULL) {            
                 BluetoothDeviceSharedPtr device(new BluetoothDevice(deviceInfo));
-                               // need to check
-                               device->copyAceCheckAccessFunction(getInstance());
                 bt_adapter_free_device_info(deviceInfo);
             
                 LoggerD("invoke BluetoothHealthApplication.onconnect");
                 healthChannel = new BluetoothHealthChannel(channel, device, type, application);
-                               healthChannel->copyAceCheckAccessFunction(getInstance());
                 object->mConnectedSocketMap.insert(std::pair<unsigned int, BluetoothHealthChannelPtr>(channel, healthChannel));
                 isChannelInserted = true;
                 callback->invokeCallback("onconnect", JSBluetoothHealthChannel::createJSObject(callback->getContext(), healthChannel));        
@@ -100,7 +97,6 @@ void BluetoothHealthProfileHandler::onConnected(int result, const char *remote_a
             if(result == BT_ERROR_NONE) {
                 if(isChannelInserted == false) {
                     healthChannel = new BluetoothHealthChannel(channel, i->second->mRemoteDevice, type, application);
-                                       healthChannel->copyAceCheckAccessFunction(getInstance());
                     object->mConnectedSocketMap.insert(std::pair<unsigned int, BluetoothHealthChannelPtr>(channel, healthChannel));
                 }
                 callback->invokeCallback("success", JSBluetoothHealthChannel::createJSObject(callback->getContext(), healthChannel));               
@@ -198,8 +194,6 @@ BluetoothHealthProfileHandler* BluetoothHealthProfileHandler::getInstance()
 
 BluetoothHealthProfileHandler::BluetoothHealthProfileHandler()
 {
-       Common::SecurityAccessor();             
-
     if(bt_hdp_set_connection_state_changed_cb(onConnected, onDisconnected, this) != BT_ERROR_NONE) {
         LoggerE("bt_hdp_set_connection_state_changed_cb() failed");
     }
@@ -209,7 +203,6 @@ BluetoothHealthProfileHandler::BluetoothHealthProfileHandler()
     }    
 }
 
-
 BluetoothHealthProfileHandler::~BluetoothHealthProfileHandler()
 {
     // unset platform callback
@@ -242,8 +235,6 @@ void BluetoothHealthProfileHandler::returnRegisteringSinkAppResult(unsigned shor
             std::string appID(app_id);
             //free(app_id);
             BluetoothHealthApplicationSharedPtr application(new BluetoothHealthApplication(appID, name, dataType));
-                       application->copyAceCheckAccessFunction(getInstance());
-
             mRegisteredHealthAppMap.insert(std::pair<std::string, BluetoothHealthApplicationSharedPtr>(appID, application));
             if(callback)
                 callback->invokeCallback("success", JSBluetoothHealthApplication::createJSObject(callback->getContext(), application));
index 9573473..3e9bb8d 100644 (file)
@@ -15,7 +15,7 @@
 // limitations under the License.
 //
 
-#ifndef __TIZEN_HEALTH_PROFILE_HANDLER_H__
+#ifndef __TIZEN_BLUETOOTH_ADAPTER_H__
 #define __TIZEN_HEALTH_PROFILE_HANDLER_H__
 
 #include <string>
@@ -50,7 +50,7 @@ public:
 };
 typedef HealthConnReq* HealthConnReqPtr;
 
-class BluetoothHealthProfileHandler : public Common::SecurityAccessor
+class BluetoothHealthProfileHandler
 {
 public:    
     static BluetoothHealthProfileHandler* getInstance();    
@@ -61,7 +61,7 @@ public:
     void unregisterApp(std::string appID, Common::MultiCallbackUserDataPtr callback);
     void returnUnregisteringAppResult(std::string appID, Common::MultiCallbackUserDataPtr callback);
     void connectToSource(JSObjectRef remoteDeviceObj, JSObjectRef appObj, Common::MultiCallbackUserDataPtr callback);
-       
+    
 private:  
     BluetoothHealthProfileHandler();
     virtual ~BluetoothHealthProfileHandler();
@@ -74,8 +74,7 @@ private:
     typedef std::map<BluetoothHealthApplicationSharedPtr, HealthConnReqPtr> HealthConnReqMapT;
     typedef std::map<unsigned int, BluetoothHealthChannelPtr> HealthConnectedSocketMapT;    // <channel, BluetoothHealthChannelPtr>
     typedef std::map<std::string, BluetoothHealthApplicationSharedPtr> RegisteredHealthAppMapT; // <app_id, BluetoothHealthApplicationSharedPtr>
-
-       
+    
     HealthConnReqMapT mHealthConnReqMap;
     HealthConnectedSocketMapT mConnectedSocketMap;
     RegisteredHealthAppMapT mRegisteredHealthAppMap;
index d325b37..7995611 100644 (file)
@@ -33,8 +33,6 @@ namespace Bluetooth {
 
 BluetoothServiceHandler::BluetoothServiceHandler(std::string uuid, std::string name, int registeredSocket)
 {
-       Common::SecurityAccessor();
-
     mUUID = uuid;
     mName = name;
     mRegisteredSocket = registeredSocket;
index fd30b1a..189f5a2 100644 (file)
 //#include <boost/shared_ptr.hpp>
 #include <MultiCallbackUserData.h>
 #include <PropertyBag.h>
-#include <Security.h>
 
 namespace DeviceAPI {
 namespace Bluetooth {
 
-class BluetoothServiceHandler : public Common::SecurityAccessor
+class BluetoothServiceHandler
 {
 public:
     BluetoothServiceHandler(std::string uuid, std::string name, int registeredSocket);
index 78b8596..6e64919 100644 (file)
@@ -31,19 +31,15 @@ using namespace DeviceAPI::Common;
 namespace DeviceAPI {
 namespace Bluetooth {
 
-BluetoothSocket::BluetoothSocket(bt_socket_connection_s *connection, Common::SecurityAccessor* accessor)
+BluetoothSocket::BluetoothSocket(bt_socket_connection_s *connection)
 {
-       Common::SecurityAccessor();
-       Common::SecurityAccessor::copyAceCheckAccessFunction(accessor);
-       
     mConnectedSocket = connection->socket_fd;
     mUUID = std::string(connection->service_uuid);
     mIsConnected = true;
-       
+
     bt_device_info_s *deviceInfo = NULL;
     if(bt_adapter_get_bonded_device_info(connection->remote_address, &deviceInfo) == BT_ERROR_NONE && deviceInfo != NULL) {
         BluetoothDeviceSharedPtr device(new BluetoothDevice(deviceInfo));
-               device->copyAceCheckAccessFunction(accessor);
         mPeer = device;
         bt_adapter_free_device_info(deviceInfo);
     }    
index 4ff9c38..d7d9d25 100644 (file)
 //#include <boost/shared_ptr.hpp>
 #include <MultiCallbackUserData.h>
 #include <PropertyBag.h>
-#include <Security.h>
+
 #include "BluetoothDevice.h"
 
 namespace DeviceAPI {
 namespace Bluetooth {
 
-class BluetoothSocket : public Common::SecurityAccessor
+class BluetoothSocket
 {
 public:
-    BluetoothSocket(bt_socket_connection_s *connection, Common::SecurityAccessor* accessor);
+    BluetoothSocket(bt_socket_connection_s *connection);
     virtual ~BluetoothSocket();
 
     std::string getUUID() const;
index 2e492a2..e5168dd 100644 (file)
 #include "plugin_config.h"
 #include "JSBluetoothAdapter.h"
 #include "BluetoothAdapter.h"
-#include "BluetoothHealthProfileHandler.h"
 #include "JSBluetoothHealthProfileHandler.h"
 
 #include <system_info.h>
 #include <TimeTracer.h>
 #include <Logger.h>
-#include "plugin_config_impl.h"
+
 using namespace WrtDeviceApis::Commons;
 using namespace DeviceAPI::Common;
 
@@ -151,9 +150,9 @@ JSValueRef JSBluetoothAdapter::setName(JSContextRef context,
     
     // Access Check
     TIME_TRACER_ITEM_BEGIN("setName::ACE", 1);
-       TIZEN_CHECK_ACCESS(context, exception, BluetoothAdapter::getInstance(), BLUETOOTH_ADAPTER_API_SET_NAME);
+    AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_ADAPTER_API_SET_NAME);
     TIME_TRACER_ITEM_END("setName::ACE", 1);
-
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     try {
         ArgumentValidator validator(context, argumentCount, arguments);        
@@ -197,8 +196,9 @@ JSValueRef JSBluetoothAdapter::setPowered(JSContextRef context,
     
     // Access Check
     TIME_TRACER_ITEM_BEGIN("setPowered::ACE", 1);
-       TIZEN_CHECK_ACCESS(context, exception, BluetoothAdapter::getInstance(), BLUETOOTH_ADAPTER_API_SET_POWERED);     
+    AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_ADAPTER_API_SET_POWERED);
     TIME_TRACER_ITEM_END("setPowered::ACE", 1);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     try {
         // Check whether BT is supported or not
@@ -255,9 +255,9 @@ JSValueRef JSBluetoothAdapter::setVisible(JSContextRef context,
 
     // Access Check
     TIME_TRACER_ITEM_BEGIN("setVisible::ACE", 1);    
-       TIZEN_CHECK_ACCESS(context, exception, BluetoothAdapter::getInstance(), BLUETOOTH_ADAPTER_API_SET_VISIBLE);
+    AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_ADAPTER_API_SET_VISIBLE);
     TIME_TRACER_ITEM_END("setVisible::ACE", 1);    
-
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     try {    
         // Validate arguments
@@ -303,9 +303,9 @@ JSValueRef JSBluetoothAdapter::discoverDevices(JSContextRef context,
 
     // Access Check
     TIME_TRACER_ITEM_BEGIN("discoverDevices::ACE", 1);
-       TIZEN_CHECK_ACCESS(context, exception, BluetoothAdapter::getInstance(), BLUETOOTH_ADAPTER_API_DISCOVER_DEVICES);
+    AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_ADAPTER_API_DISCOVER_DEVICES);
     TIME_TRACER_ITEM_END("discoverDevices::ACE", 1);
-
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     try {    
         TIME_TRACER_ITEM_BEGIN("discoverDevices::parameter", 1);
@@ -381,9 +381,9 @@ JSValueRef JSBluetoothAdapter::stopDiscovery(JSContextRef context,
 
     // Access Check
     TIME_TRACER_ITEM_BEGIN("stopDiscovery::ACE", 1);
-       TIZEN_CHECK_ACCESS(context, exception, BluetoothAdapter::getInstance(), BLUETOOTH_ADAPTER_API_STOP_DISCOVERY);
+    AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_ADAPTER_API_STOP_DISCOVERY);
     TIME_TRACER_ITEM_END("stopDiscovery::ACE", 1);
-
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     try {
         // Validate arguments
@@ -425,9 +425,9 @@ JSValueRef JSBluetoothAdapter::getKnownDevices(JSContextRef context,
 
     // Access Check
     TIME_TRACER_ITEM_BEGIN("getKnownDevices::ACE", 1);
-       TIZEN_CHECK_ACCESS(context, exception, BluetoothAdapter::getInstance(), BLUETOOTH_ADAPTER_API_GET_KNOWN_DEVICES);       
+    AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_ADAPTER_API_GET_KNOWN_DEVICES);
     TIME_TRACER_ITEM_END("getKnownDevices::ACE", 1);
-
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     try {
         // Validate arguments
@@ -469,9 +469,9 @@ JSValueRef JSBluetoothAdapter::getDevice(JSContextRef context,
 
     // Access Check
     TIME_TRACER_ITEM_BEGIN("getDevice::ACE", 1);
-       TIZEN_CHECK_ACCESS(context, exception, BluetoothAdapter::getInstance(), BLUETOOTH_ADAPTER_API_GET_DEVICE);      
+    AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_ADAPTER_API_GET_DEVICE);
     TIME_TRACER_ITEM_END("getDevice::ACE", 1);
-
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     try {
         // Validate arguments
@@ -514,9 +514,9 @@ JSValueRef JSBluetoothAdapter::createBonding(JSContextRef context,
 
     // Access Check
     TIME_TRACER_ITEM_BEGIN("createBonding::ACE", 1);
-       TIZEN_CHECK_ACCESS(context, exception, BluetoothAdapter::getInstance(), BLUETOOTH_ADAPTER_API_CREATE_BONDING);          
+    AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_ADAPTER_API_CREATE_BONDING);
     TIME_TRACER_ITEM_END("createBonding::ACE", 1);
-
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     try {
         // Validate arguments
@@ -559,9 +559,9 @@ JSValueRef JSBluetoothAdapter::destroyBonding(JSContextRef context,
 
     // Access Check
     TIME_TRACER_ITEM_BEGIN("destroyBonding::ACE", 1);
-       TIZEN_CHECK_ACCESS(context, exception, BluetoothAdapter::getInstance(), BLUETOOTH_ADAPTER_API_DESTROY_BONDING);         
+    AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_ADAPTER_API_DESTROY_BONDING);
     TIME_TRACER_ITEM_END("destroyBonding::ACE", 1);
-
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     try {
         // Validate arguments
@@ -604,9 +604,9 @@ JSValueRef JSBluetoothAdapter::registerRFCOMMServiceByUUID(JSContextRef context,
 
     // Access Check
     TIME_TRACER_ITEM_BEGIN("registerRFCOMMServiceByUUID::ACE", 1);
-       TIZEN_CHECK_ACCESS(context, exception, BluetoothAdapter::getInstance(), BLUETOOTH_ADAPTER_API_REGISTER_RFCOMMSERVICE_BY_UUID);          
+    AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_ADAPTER_API_REGISTER_RFCOMMSERVICE_BY_UUID);
     TIME_TRACER_ITEM_END("registerRFCOMMServiceByUUID::ACE", 1);
-
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     try {
         // Validate arguments
@@ -659,8 +659,6 @@ JSValueRef JSBluetoothAdapter::getBluetoothProfileHandler(JSContextRef context,
         bool isCorrectParameter = false;
         if(type.compare("HEALTH") == 0) {
             isCorrectParameter = true;
-                       BluetoothHealthProfileHandler::getInstance()->copyAceCheckAccessFunction(BluetoothAdapter::getInstance());
-                       
             profileHandler = JSBluetoothHealthProfileHandler::createJSObject(context);
         }
         TIME_TRACER_ITEM_END(__FUNCTION__, 1);
index 5306888..72c56e9 100644 (file)
@@ -19,7 +19,6 @@
 #define __TIZEN_JS_BLUETOOTH_ADAPTER_H__
 
 #include <JavaScriptCore/JavaScript.h>
-#include <Security.h>
 
 namespace DeviceAPI {
 namespace Bluetooth {
index 22c04ba..ecc8168 100644 (file)
@@ -139,19 +139,18 @@ JSValueRef JSBluetoothClass::hasService(JSContextRef context,
 {
     TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 1);
     
+    // Access Check
+    TIME_TRACER_ITEM_BEGIN("hasService::ACE", 1);
+    AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_CLASS_API_HAS_SERVICE);
+    TIME_TRACER_ITEM_END("hasService::ACE", 1);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
     try {
         // Private Object
         BluetoothClassHolderPtr priv = static_cast<BluetoothClassHolderPtr>(JSObjectGetPrivate(thisObject));
         if (!priv) {
             throw TypeMismatchException("Private object is NULL.");
         }
-
-                   // Access Check
-           BluetoothClass* btclass = priv->mClass.get();
-           TIME_TRACER_ITEM_BEGIN("hasService::ACE", 1);
-               TIZEN_CHECK_ACCESS(context, exception, btclass, BLUETOOTH_CLASS_API_HAS_SERVICE);
-           TIME_TRACER_ITEM_END("hasService::ACE", 1);
-       
     
         ArgumentValidator validator(context, argumentCount, arguments);
         unsigned long service = validator.toULong(0);  // uuid
index ff5a646..c188e54 100644 (file)
 namespace DeviceAPI {
 namespace Bluetooth {
 
-class BluetoothClassHolder 
+class BluetoothClassHolder
 {
 public:
-    BluetoothClassHolder(BluetoothClassSharedPtr bluetoothClass) { mClass = bluetoothClass;}
+    BluetoothClassHolder(BluetoothClassSharedPtr bluetoothClass) {mClass = bluetoothClass;}
     BluetoothClassSharedPtr mClass; 
 };
 typedef BluetoothClassHolder* BluetoothClassHolderPtr;
index 61e43fb..8b5a4aa 100644 (file)
@@ -161,6 +161,12 @@ JSValueRef JSBluetoothDevice::connectToServiceByUUID(JSContextRef context,
         JSValueRef* exception)
 {
     TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 1);
+    
+    // Access Check
+    TIME_TRACER_ITEM_BEGIN("connectToServiceByUUID::ACE", 1);
+    AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_DEVICE_API_CONNECT_TO_SERVICE_BY_UUID);
+    TIME_TRACER_ITEM_END("connectToServiceByUUID::ACE", 1);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     try {
         // Private Object
@@ -168,10 +174,6 @@ JSValueRef JSBluetoothDevice::connectToServiceByUUID(JSContextRef context,
         if (!priv) {
             throw TypeMismatchException("Private object is NULL.");
         }
-                 // Access Check
-           TIME_TRACER_ITEM_BEGIN("connectToServiceByUUID::ACE", 1);
-               TIZEN_CHECK_ACCESS(context, exception, priv->mDevice.get(), BLUETOOTH_DEVICE_API_CONNECT_TO_SERVICE_BY_UUID);           
-           TIME_TRACER_ITEM_END("connectToServiceByUUID::ACE", 1);
     
         ArgumentValidator validator(context, argumentCount, arguments);        
         std::string uuid = validator.toString(0);  // uuid
index cede559..d14630c 100644 (file)
 #define __TIZEN_JS_BLUETOOTH_DEVICE_H__
 
 #include <JavaScriptCore/JavaScript.h>
+
 #include "BluetoothDevice.h"
 
 namespace DeviceAPI {
 namespace Bluetooth {
 
-class BluetoothDeviceHolder 
+class BluetoothDeviceHolder
 {
 public:
-    BluetoothDeviceHolder(BluetoothDeviceSharedPtr device)  : mDevice(device) {}
+    BluetoothDeviceHolder(BluetoothDeviceSharedPtr device) {mDevice = device;}
     BluetoothDeviceSharedPtr mDevice; 
 };
 typedef BluetoothDeviceHolder* BluetoothDeviceHolderPtr;
index f31ad8f..a12226a 100644 (file)
@@ -198,16 +198,16 @@ JSValueRef JSBluetoothHealthApplication::unregister(JSContextRef context,
     TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 1);
     
     // Access Check
-
+    TIME_TRACER_ITEM_BEGIN("unregister::ACE", 1);
+    AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_HEALTH_APPLICATION_API_UNREGISTER);
+    TIME_TRACER_ITEM_END("unregister::ACE", 1);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     try {
         BluetoothHealthApplicationHolderPtr priv = static_cast<BluetoothHealthApplicationHolderPtr>(JSObjectGetPrivate(thisObject));
         if (!priv) {
             throw TypeMismatchException("Private object is NULL");
         }
-               TIME_TRACER_ITEM_BEGIN("unregister::ACE", 1);
-               TIZEN_CHECK_ACCESS(context, exception, priv->mApp.get(), BLUETOOTH_HEALTH_APPLICATION_API_UNREGISTER);          
-               TIME_TRACER_ITEM_END("unregister::ACE", 1);
 
         ArgumentValidator validator(context, argumentCount, arguments);
         JSObjectRef successCallback = validator.toFunction(0, true);  // successCallback  
index 375e738..27bdf21 100644 (file)
 #define __TIZEN_JS_BLUETOOTH_HEALTH_APPLICATION_H__
 
 #include <JavaScriptCore/JavaScript.h>
+
 #include "BluetoothHealthApplication.h"
 
 namespace DeviceAPI {
 namespace Bluetooth {
 
-class BluetoothHealthApplicationHolder 
+class BluetoothHealthApplicationHolder
 {
 public:
-    BluetoothHealthApplicationHolder(BluetoothHealthApplicationSharedPtr app){mApp = app;}
+    BluetoothHealthApplicationHolder(BluetoothHealthApplicationSharedPtr app) {mApp = app;}
     BluetoothHealthApplicationSharedPtr mApp; 
 };
 typedef BluetoothHealthApplicationHolder* BluetoothHealthApplicationHolderPtr;
index 3ee4bf3..e1a683c 100644 (file)
@@ -148,17 +148,19 @@ JSValueRef JSBluetoothHealthChannel::sendData(JSContextRef context,
 
     TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 1);;
 
+    // Access Check
+    TIME_TRACER_ITEM_BEGIN("sendData::ACE", 1);;
+    AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_HEALTH_CHANNEL_API_SEND_DATA);
+    TIME_TRACER_ITEM_END("sendData::ACE", 1);;
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
     try {
         // Private Object
         BluetoothHealthChannelPtr priv = static_cast<BluetoothHealthChannelPtr>(JSObjectGetPrivate(thisObject));
         if (!priv) {
             throw DeviceAPI::Common::UnknownException("Private object is NULL.");
         }
-           // Access Check
-           TIME_TRACER_ITEM_BEGIN("sendData::ACE", 1);;
-               TIZEN_CHECK_ACCESS(context, exception, priv, BLUETOOTH_HEALTH_CHANNEL_API_SEND_DATA);           
-           TIME_TRACER_ITEM_END("sendData::ACE", 1);;
-       
+    
         ArgumentValidator validator(context, argumentCount, arguments);
 
         JSObjectRef dataArrayObj  = validator.toArrayObject(0);  // data
@@ -191,9 +193,13 @@ JSValueRef JSBluetoothHealthChannel::close(JSContextRef context,
 {
     LoggerD("Enter");
 
-    TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 1);
+    TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 1);;
     
-
+    // Access Check
+    TIME_TRACER_ITEM_BEGIN("close::ACE", 1);;
+    AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_HEALTH_CHANNEL_API_CLOSE);
+    TIME_TRACER_ITEM_END("close::ACE", 1);;
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     try {
         // Private Object
@@ -201,10 +207,6 @@ JSValueRef JSBluetoothHealthChannel::close(JSContextRef context,
         if (!priv) {
             throw DeviceAPI::Common::UnknownException("Private object is NULL.");
         }
-           // Access Check
-           TIME_TRACER_ITEM_BEGIN("close::ACE", 1);;
-               TIZEN_CHECK_ACCESS(context, exception, priv, BLUETOOTH_HEALTH_CHANNEL_API_CLOSE);
-           TIME_TRACER_ITEM_END("close::ACE", 1);;
 
         priv->close();
         TIME_TRACER_ITEM_END(__FUNCTION__, 1);;
@@ -229,7 +231,11 @@ JSValueRef JSBluetoothHealthChannel::setListener(JSContextRef context,
 
     TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 1);;
     
-
+    // Access Check
+    TIME_TRACER_ITEM_BEGIN("setListener::ACE", 1);;
+    AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_HEALTH_CHANNEL_API_SET_LISTENER);
+    TIME_TRACER_ITEM_END("setListener::ACE", 1);;
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     try {
         // Private Object
@@ -238,12 +244,6 @@ JSValueRef JSBluetoothHealthChannel::setListener(JSContextRef context,
             throw DeviceAPI::Common::UnknownException("Private object is NULL.");
         }
 
-               // Access Check
-               TIME_TRACER_ITEM_BEGIN("setListener::ACE", 1);;
-               TIZEN_CHECK_ACCESS(context, exception, priv, BLUETOOTH_HEALTH_CHANNEL_API_SET_LISTENER);
-               TIME_TRACER_ITEM_END("setListener::ACE", 1);;
-               
-
         // Validate arguments
         ArgumentValidator validator(context, argumentCount, arguments);
 
@@ -294,6 +294,11 @@ JSValueRef JSBluetoothHealthChannel::unsetListener(JSContextRef context,
 
     TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 1);;
     
+    // Access Check
+    TIME_TRACER_ITEM_BEGIN("unsetListener::ACE", 1);;
+    AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_HEALTH_CHANNEL_API_UNSET_LISTENER);
+    TIME_TRACER_ITEM_END("unsetListener::ACE", 1);;
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     try {
         // Private Object
@@ -301,11 +306,6 @@ JSValueRef JSBluetoothHealthChannel::unsetListener(JSContextRef context,
         if (!priv) {
             throw DeviceAPI::Common::UnknownException("Private object is NULL.");
         }
-               // Access Check
-               TIME_TRACER_ITEM_BEGIN("unsetListener::ACE", 1);
-               TIZEN_CHECK_ACCESS(context, exception, priv, BLUETOOTH_HEALTH_CHANNEL_API_UNSET_LISTENER);
-               TIME_TRACER_ITEM_END("unsetListener::ACE", 1);
-
 
         priv->unsetListener();
         TIME_TRACER_ITEM_END(__FUNCTION__, 1);;
index 343ee45..a185fe0 100644 (file)
@@ -104,11 +104,12 @@ JSValueRef JSBluetoothHealthProfileHandler::registerSinkApplication(JSContextRef
     LoggerD("Enter");
     
     TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 1);
-               // Access Check
-       TIME_TRACER_ITEM_BEGIN("registerSinkApplication::ACE", 1);
-       TIZEN_CHECK_ACCESS(context, exception, BluetoothHealthProfileHandler::getInstance(), BLUETOOTH_HEALTH_PROFILE_HANDLER_API_REGISTER_SINK_APPLICATION);   
-       TIME_TRACER_ITEM_END("registerSinkApplication::ACE", 1);
-
+    
+    // Access Check
+    TIME_TRACER_ITEM_BEGIN("registerSinkApplication::ACE", 1);
+    AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_HEALTH_PROFILE_HANDLER_API_REGISTER_SINK_APPLICATION);
+    TIME_TRACER_ITEM_END("registerSinkApplication::ACE", 1);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     try {
         ArgumentValidator validator(context, argumentCount, arguments);        
@@ -153,10 +154,10 @@ JSValueRef JSBluetoothHealthProfileHandler::connectToSource(JSContextRef context
     TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 1);
     
     // Access Check
-    TIME_TRACER_ITEM_BEGIN("connectToSource::ACE", 1);
-       TIZEN_CHECK_ACCESS(context, exception, BluetoothHealthProfileHandler::getInstance(), BLUETOOTH_HEALTH_PROFILE_HANDLER_API_CONNECT_TO_SOURCE);   
-    TIME_TRACER_ITEM_END("connectToSource::ACE", 1);
-
+    TIME_TRACER_ITEM_BEGIN("setName::ACE", 1);
+    AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_HEALTH_PROFILE_HANDLER_API_CONNECT_TO_SOURCE);
+    TIME_TRACER_ITEM_END("setName::ACE", 1);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     try {
         ArgumentValidator validator(context, argumentCount, arguments);
index b0a1422..fcc0d60 100644 (file)
@@ -24,7 +24,7 @@
 #include <PropertyBag.h>
 #include <bluetooth.h>
 
-#include "plugin_config_impl.h"
+#include "plugin_config.h"
 #include "JSBluetoothManager.h"
 #include "JSBluetoothClassDeviceMajor.h"
 #include "JSBluetoothClassDeviceMinor.h"
@@ -90,42 +90,38 @@ const JSClassDefinition* JSBluetoothManager::getClassInfo()
 
 void JSBluetoothManager::initialize(JSContextRef context, JSObjectRef object)
 {
-       LoggerD("initialize");
-       
     if (!JSObjectGetPrivate(object)) {
-               JSBluetoothManagerPriv* priv = new JSBluetoothManagerPriv();
-
-               if(priv) {
-           // deviceMajor
-                       priv->setProperty(context, BLUETOOTH_MANAGER_DEVICE_MAJOR,
-                       JSBluetoothClassDeviceMajor::createJSObject(context));
-
-                       // deviceMinor
-                       priv->setProperty(context, BLUETOOTH_MANAGER_DEVICE_MINOR,
-                       JSBluetoothClassDeviceMinor::createJSObject(context));
-
-                       // deviceService
-                       priv->setProperty(context, BLUETOOTH_MANAGER_DEVICE_SERVICE,
-                       JSBluetoothClassDeviceService::createJSObject(context));
-       
-                       if (!JSObjectSetPrivate(object, static_cast<void*>(priv))) {
-                               LoggerW("Failed to set private data");
-                               delete priv;
-                       }            
-                       LoggerD("Private creation ok");
-               }
-               else {
-                       LoggerW("Failed to create private data");
-               }
-       }
-       else {
-               LoggerW("already has private data");
-       }
+        PropertyBag *priv = new PropertyBag();    
+        if(priv) {
+            // deviceMajor
+            priv->setProperty(context, BLUETOOTH_MANAGER_DEVICE_MAJOR,
+                    JSBluetoothClassDeviceMajor::createJSObject(context));
+
+            // deviceMinor
+            priv->setProperty(context, BLUETOOTH_MANAGER_DEVICE_MINOR,
+                    JSBluetoothClassDeviceMinor::createJSObject(context));
+
+            // deviceService
+            priv->setProperty(context, BLUETOOTH_MANAGER_DEVICE_SERVICE,
+                    JSBluetoothClassDeviceService::createJSObject(context));
+
+            if (!JSObjectSetPrivate(object, static_cast<void*>(priv))) {
+                LoggerW("Failed to set private data");
+                delete priv;
+            }            
+        }
+        else {
+            LoggerW("Failed to create private data");
+        }
+    }
+    else {
+        LoggerW("Private data already exists");
+    }
 }
 
 void JSBluetoothManager::finalize(JSObjectRef object)
 {
-    JSBluetoothManagerPriv *priv = static_cast<JSBluetoothManagerPriv*>(JSObjectGetPrivate(object));
+    PropertyBag *priv = static_cast<PropertyBag*>(JSObjectGetPrivate(object));
     if (priv) {
         JSObjectSetPrivate(object, NULL);
         delete priv;
@@ -133,7 +129,7 @@ void JSBluetoothManager::finalize(JSObjectRef object)
 }
 
 JSValueRef JSBluetoothManager::getReadOnlyProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) {
-    JSBluetoothManagerPriv *priv = static_cast<JSBluetoothManagerPriv*>(JSObjectGetPrivate(object));
+    PropertyBag *priv = static_cast<PropertyBag*>(JSObjectGetPrivate(object));
     if(!priv) {
         LoggerW("There is no private data");
         return NULL;
@@ -150,27 +146,20 @@ JSValueRef JSBluetoothManager::getDefaultAdapter(JSContextRef context,
         const JSValueRef arguments[],
         JSValueRef* exception)
 {
-       JSBluetoothManagerPriv *priv = static_cast<JSBluetoothManagerPriv*>(JSObjectGetPrivate(thisObject));
-       
-       if (!priv)
-       {
-               DeviceAPI::Common::TypeMismatchException err("Private Object is null");
-               return JSWebAPIErrorFactory::postException(context, exception, err);
-       }
-       
     TIME_TRACER_ITEM_BEGIN("getDefaultAdapter", 1);
-       TIZEN_CHECK_ACCESS(context, exception, priv, BLUETOOTH_MANAGER_API_GET_DEFAULT_ADAPTER);
+
+    // Access Check
+    TIME_TRACER_ITEM_BEGIN("getDefaultAdapter::ACE", 1);
+    AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_MANAGER_API_GET_DEFAULT_ADAPTER);
     TIME_TRACER_ITEM_END("getDefaultAdapter::ACE", 1);
-    
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     try {
-               
+        JSObjectRef adapter = JSBluetoothAdapter::createJSObject(context);
+
         if(bt_initialize() != BT_ERROR_NONE) {
             LoggerE("bt_initialize() failed");
         }
-
-               BluetoothAdapter::getInstance()->copyAceCheckAccessFunction(priv);
-        JSObjectRef adapter = JSBluetoothAdapter::createJSObject(context);
         
         TIME_TRACER_ITEM_END("getDefaultAdapter", 1);
         return adapter;
index 87c8b75..99e579e 100644 (file)
 #define __TIZEN_JS_BLUETOOTH_MANAGER_H__
 
 #include <JavaScriptCore/JavaScript.h>
-#include <PropertyBag.h>
-#include <memory>
-#include <Security.h>
 
 namespace DeviceAPI {
 namespace Bluetooth {
-       
-
-class JSBluetoothManagerPriv :
-       public DeviceAPI::Common::SecurityAccessor,     
-       public DeviceAPI::Common::PropertyBag
-{      
-public:        
-       JSBluetoothManagerPriv() :
-                       DeviceAPI::Common::SecurityAccessor(),
-                       DeviceAPI::Common::PropertyBag()
-       {
-       }
-       virtual ~JSBluetoothManagerPriv() {}
-};
 
 class JSBluetoothManager
 {
index 68d70d0..828d35b 100644 (file)
@@ -180,7 +180,11 @@ JSValueRef JSBluetoothServiceHandler::unregister(JSContextRef context,
 {
     TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 1);
     
-
+    // Access Check
+    TIME_TRACER_ITEM_BEGIN("unregister::ACE", 1);
+    AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_SERVICE_HANDLER_API_UNREGISTER);
+    TIME_TRACER_ITEM_END("unregister::ACE", 1);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     try {
         // Private Object
@@ -189,12 +193,6 @@ JSValueRef JSBluetoothServiceHandler::unregister(JSContextRef context,
             throw TypeMismatchException("Private object is NULL.");
         }
 
-               // Access Check
-               TIME_TRACER_ITEM_BEGIN("unregister::ACE", 1);
-               TIZEN_CHECK_ACCESS(context, exception, priv, BLUETOOTH_SERVICE_HANDLER_API_UNREGISTER);         
-               TIME_TRACER_ITEM_END("unregister::ACE", 1);
-
-
         ArgumentValidator validator(context, argumentCount, arguments);        
         JSObjectRef successCallback = validator.toFunction(0, true);  // successCallback  
         JSObjectRef errorCallback = validator.toFunction(1, true);  // errorCallback
index f8b3a0a..6bfb9ef 100644 (file)
@@ -239,7 +239,13 @@ JSValueRef JSBluetoothSocket::writeData(JSContextRef context,
         const JSValueRef arguments[],
         JSValueRef* exception)
 {
-       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 1);
+    TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 1);;
+
+    // Access Check
+    TIME_TRACER_ITEM_BEGIN("writeData::ACE", 1);;
+    AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_SOCKET_API_WRITE_DATA);
+    TIME_TRACER_ITEM_END("writeData::ACE", 1);;
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     try {
         // Private Object
@@ -247,12 +253,7 @@ JSValueRef JSBluetoothSocket::writeData(JSContextRef context,
         if (!priv) {
             throw DeviceAPI::Common::UnknownException("Private object is NULL.");
         }
-
-               // Access Check    
-           TIME_TRACER_ITEM_BEGIN("writeData::ACE", 1);        
-               TIZEN_CHECK_ACCESS(context, exception, priv, BLUETOOTH_SOCKET_API_WRITE_DATA);          
-           TIME_TRACER_ITEM_END("writeData::ACE", 1);
-
+    
         ArgumentValidator validator(context, argumentCount, arguments);
 
         JSObjectRef dataArrayObj  = validator.toArrayObject(0);  // data
@@ -283,8 +284,13 @@ JSValueRef JSBluetoothSocket::readData(JSContextRef context,
         const JSValueRef arguments[],
         JSValueRef* exception)
 {
-       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 1);
-
+    TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 1);;
+    
+    // Access Check
+    TIME_TRACER_ITEM_BEGIN("readData::ACE", 1);;
+    AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_SOCKET_API_READ_DATA);
+    TIME_TRACER_ITEM_END("readData::ACE", 1);;
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     try {
         // Private Object
@@ -292,15 +298,9 @@ JSValueRef JSBluetoothSocket::readData(JSContextRef context,
         if (!priv) {
             throw DeviceAPI::Common::UnknownException("Private object is NULL.");
         }
-               
-               // Access Check
-               TIME_TRACER_ITEM_BEGIN("readData::ACE", 1);
-               TIZEN_CHECK_ACCESS(context, exception, priv, BLUETOOTH_SOCKET_API_READ_DATA);           
-               TIME_TRACER_ITEM_END("readData::ACE", 1);
-               
 
         std::vector<signed char> data = priv->readData();
-        TIME_TRACER_ITEM_END(__FUNCTION__, 1);
+        TIME_TRACER_ITEM_END(__FUNCTION__, 1);;
         
         return JSUtil::toJSValueRef_(context, data);
     } catch (const BasePlatformException &err) {
@@ -319,6 +319,12 @@ JSValueRef JSBluetoothSocket::close(JSContextRef context,
         JSValueRef* exception)
 {
     TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 1);;
+    
+    // Access Check
+    TIME_TRACER_ITEM_BEGIN("close::ACE", 1);;
+    AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_SOCKET_API_CLOSE);
+    TIME_TRACER_ITEM_END("close::ACE", 1);;
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     try {
         // Private Object
@@ -327,12 +333,6 @@ JSValueRef JSBluetoothSocket::close(JSContextRef context,
             throw DeviceAPI::Common::UnknownException("Private object is NULL.");
         }
 
-               // Access Check
-               TIME_TRACER_ITEM_BEGIN("close::ACE", 1);
-               TIZEN_CHECK_ACCESS(context, exception, priv, BLUETOOTH_SOCKET_API_CLOSE);               
-               TIME_TRACER_ITEM_END("close::ACE", 1);
-               
-
         priv->close();
         TIME_TRACER_ITEM_END(__FUNCTION__, 1);;
         
index a44485a..5f346a8 100644 (file)
 #define _BLUETOOTH_PLUGIN_CONFIG_H_
 
 #include <Commons/FunctionDeclaration.h>
-#include "plugin_config_impl.h"
 
 namespace DeviceAPI {
 namespace Bluetooth {
 
+// attributes
+#define BLUETOOTH_MANAGER_DEVICE_MAJOR "deviceMajor"
+#define BLUETOOTH_MANAGER_DEVICE_MINOR "deviceMinor"
+#define BLUETOOTH_MANAGER_DEVICE_SERVICE "deviceService"
+#define BLUETOOTH_ADAPTER_NAME "name"
+#define BLUETOOTH_ADAPTER_ADDRESS "address"
+#define BLUETOOTH_ADAPTER_POWERED "powered"
+#define BLUETOOTH_ADAPTER_VISIBLE "visible"
+#define BLUETOOTH_DEVICE_NAME "name"
+#define BLUETOOTH_DEVICE_ADDRESS "address"
+#define BLUETOOTH_DEVICE_DEVICE_CLASS "deviceClass"
+#define BLUETOOTH_DEVICE_IS_BONDED "isBonded"
+#define BLUETOOTH_DEVICE_IS_TRUSTED "isTrusted"
+#define BLUETOOTH_DEVICE_IS_CONNECTED "isConnected"
+#define BLUETOOTH_DEVICE_UUIDS "uuids"
+#define BLUETOOTH_SOCKET_UUID "uuid"
+#define BLUETOOTH_SOCKET_STATE "state"
+#define BLUETOOTH_SOCKET_PEER "peer"
+#define BLUETOOTH_SOCKET_ONMESSAGE "onmessage"
+#define BLUETOOTH_SOCKET_ONCLOSE "onclose"
+#define BLUETOOTH_SOCKET_ONERROR "onerror"
+#define BLUETOOTH_CLASS_MAJOR "major"
+#define BLUETOOTH_CLASS_MINOR "minor"
+#define BLUETOOTH_CLASS_SERVICES "services"
+#define BLUETOOTH_SERVICE_HANDLER_UUID "uuid"
+#define BLUETOOTH_SERVICE_HANDLER_NAME "name"
+#define BLUETOOTH_SERVICE_HANDLER_IS_CONNECTED "isConnected"
+#define BLUETOOTH_SERVICE_HANDLER_ONCONNECT "onconnect"
+#define BLUETOOTH_PROFILE_TYPE "profileType"
+#define BLUETOOTH_HEALTH_APPLICATION_DATA_TYPE "dataType"
+#define BLUETOOTH_HEALTH_APPLICATION_NAME "name"
+#define BLUETOOTH_HEALTH_APPLICATION_ONCONNECT "onconnect"
+#define BLUETOOTH_HEALTH_CHANNEL_PEER "peer"
+#define BLUETOOTH_HEALTH_CHANNEL_TYPE "channelType"
+#define BLUETOOTH_HEALTH_CHANNEL_APP "application"
+#define BLUETOOTH_HEALTH_CHANNEL_IS_CONNECTED "isConnected"
+
+
+// functions
+#define BLUETOOTH_MANAGER_API_GET_DEFAULT_ADAPTER "getDefaultAdapter"
+#define BLUETOOTH_ADAPTER_API_SET_NAME "setName"
+#define BLUETOOTH_ADAPTER_API_SET_POWERED "setPowered"
+#define BLUETOOTH_ADAPTER_API_SET_VISIBLE "setVisible"
+#define BLUETOOTH_ADAPTER_API_DISCOVER_DEVICES "discoverDevices"
+#define BLUETOOTH_ADAPTER_API_STOP_DISCOVERY "stopDiscovery"
+#define BLUETOOTH_ADAPTER_API_GET_KNOWN_DEVICES "getKnownDevices"
+#define BLUETOOTH_ADAPTER_API_GET_DEVICE "getDevice"
+#define BLUETOOTH_ADAPTER_API_CREATE_BONDING "createBonding"
+#define BLUETOOTH_ADAPTER_API_DESTROY_BONDING "destroyBonding"
+#define BLUETOOTH_ADAPTER_API_REGISTER_RFCOMMSERVICE_BY_UUID "registerRFCOMMServiceByUUID"
+#define BLUETOOTH_ADAPTER_API_GET_BLUETOOTH_PROFILE_HANDLER "getBluetoothProfileHandler"
+#define BLUETOOTH_ADAPTER_API_SET_CHANGE_LISTENER "setChangeListener"
+#define BLUETOOTH_ADAPTER_API_UNSET_CHANGE_LISTENER "unsetChangeListener"
+#define BLUETOOTH_DEVICE_API_CONNECT_TO_SERVICE_BY_UUID "connectToServiceByUUID"
+#define BLUETOOTH_SOCKET_API_WRITE_DATA "writeData"
+#define BLUETOOTH_SOCKET_API_READ_DATA "readData"
+#define BLUETOOTH_SOCKET_API_CLOSE "close"
+#define BLUETOOTH_CLASS_API_HAS_SERVICE "hasService"
+#define BLUETOOTH_SERVICE_HANDLER_API_UNREGISTER "unregister"
+#define BLUETOOTH_HEALTH_PROFILE_HANDLER_API_REGISTER_SINK_APPLICATION "registerSinkApplication"
+#define BLUETOOTH_HEALTH_APPLICATION_API_UNREGISTER "healthUnregister"
+#define BLUETOOTH_HEALTH_PROFILE_HANDLER_API_CONNECT_TO_SOURCE "connectToSource"
+#define BLUETOOTH_HEALTH_CHANNEL_API_SEND_DATA "sendData"
+#define BLUETOOTH_HEALTH_CHANNEL_API_SET_LISTENER "setListener"
+#define BLUETOOTH_HEALTH_CHANNEL_API_UNSET_LISTENER "unsetListener"
+#define BLUETOOTH_HEALTH_CHANNEL_API_CLOSE "healthClose"
+
+
 DECLARE_FUNCTION_GETTER(Bluetooth);
 
 #define BLUETOOTH_CHECK_ACCESS(functionName) \
diff --git a/src/Bluetooth/plugin_config_impl.h b/src/Bluetooth/plugin_config_impl.h
deleted file mode 100644 (file)
index 4d7668a..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-#ifndef _BLUETOOTH_PLUGIN_CONFIG_IMPL_H_\r
-#define _BLUETOOTH_PLUGIN_CONFIG_IMPL_H_\r
-\r
-namespace DeviceAPI {\r
-namespace Bluetooth {\r
-\r
-// attributes\r
-#define BLUETOOTH_MANAGER_DEVICE_MAJOR "deviceMajor"\r
-#define BLUETOOTH_MANAGER_DEVICE_MINOR "deviceMinor"\r
-#define BLUETOOTH_MANAGER_DEVICE_SERVICE "deviceService"\r
-#define BLUETOOTH_ADAPTER_NAME "name"\r
-#define BLUETOOTH_ADAPTER_ADDRESS "address"\r
-#define BLUETOOTH_ADAPTER_POWERED "powered"\r
-#define BLUETOOTH_ADAPTER_VISIBLE "visible"\r
-#define BLUETOOTH_DEVICE_NAME "name"\r
-#define BLUETOOTH_DEVICE_ADDRESS "address"\r
-#define BLUETOOTH_DEVICE_DEVICE_CLASS "deviceClass"\r
-#define BLUETOOTH_DEVICE_IS_BONDED "isBonded"\r
-#define BLUETOOTH_DEVICE_IS_TRUSTED "isTrusted"\r
-#define BLUETOOTH_DEVICE_IS_CONNECTED "isConnected"\r
-#define BLUETOOTH_DEVICE_UUIDS "uuids"\r
-#define BLUETOOTH_SOCKET_UUID "uuid"\r
-#define BLUETOOTH_SOCKET_STATE "state"\r
-#define BLUETOOTH_SOCKET_PEER "peer"\r
-#define BLUETOOTH_SOCKET_ONMESSAGE "onmessage"\r
-#define BLUETOOTH_SOCKET_ONCLOSE "onclose"\r
-#define BLUETOOTH_SOCKET_ONERROR "onerror"\r
-#define BLUETOOTH_CLASS_MAJOR "major"\r
-#define BLUETOOTH_CLASS_MINOR "minor"\r
-#define BLUETOOTH_CLASS_SERVICES "services"\r
-#define BLUETOOTH_SERVICE_HANDLER_UUID "uuid"\r
-#define BLUETOOTH_SERVICE_HANDLER_NAME "name"\r
-#define BLUETOOTH_SERVICE_HANDLER_IS_CONNECTED "isConnected"\r
-#define BLUETOOTH_SERVICE_HANDLER_ONCONNECT "onconnect"\r
-#define BLUETOOTH_PROFILE_TYPE "profileType"\r
-#define BLUETOOTH_HEALTH_APPLICATION_DATA_TYPE "dataType"\r
-#define BLUETOOTH_HEALTH_APPLICATION_NAME "name"\r
-#define BLUETOOTH_HEALTH_APPLICATION_ONCONNECT "onconnect"\r
-#define BLUETOOTH_HEALTH_CHANNEL_PEER "peer"\r
-#define BLUETOOTH_HEALTH_CHANNEL_TYPE "channelType"\r
-#define BLUETOOTH_HEALTH_CHANNEL_APP "application"\r
-#define BLUETOOTH_HEALTH_CHANNEL_IS_CONNECTED "isConnected"\r
-\r
-\r
-// functions\r
-#define BLUETOOTH_MANAGER_API_GET_DEFAULT_ADAPTER "getDefaultAdapter"\r
-#define BLUETOOTH_ADAPTER_API_SET_NAME "setName"\r
-#define BLUETOOTH_ADAPTER_API_SET_POWERED "setPowered"\r
-#define BLUETOOTH_ADAPTER_API_SET_VISIBLE "setVisible"\r
-#define BLUETOOTH_ADAPTER_API_DISCOVER_DEVICES "discoverDevices"\r
-#define BLUETOOTH_ADAPTER_API_STOP_DISCOVERY "stopDiscovery"\r
-#define BLUETOOTH_ADAPTER_API_GET_KNOWN_DEVICES "getKnownDevices"\r
-#define BLUETOOTH_ADAPTER_API_GET_DEVICE "getDevice"\r
-#define BLUETOOTH_ADAPTER_API_CREATE_BONDING "createBonding"\r
-#define BLUETOOTH_ADAPTER_API_DESTROY_BONDING "destroyBonding"\r
-#define BLUETOOTH_ADAPTER_API_REGISTER_RFCOMMSERVICE_BY_UUID "registerRFCOMMServiceByUUID"\r
-#define BLUETOOTH_ADAPTER_API_GET_BLUETOOTH_PROFILE_HANDLER "getBluetoothProfileHandler"\r
-#define BLUETOOTH_ADAPTER_API_SET_CHANGE_LISTENER "setChangeListener"\r
-#define BLUETOOTH_ADAPTER_API_UNSET_CHANGE_LISTENER "unsetChangeListener"\r
-#define BLUETOOTH_DEVICE_API_CONNECT_TO_SERVICE_BY_UUID "connectToServiceByUUID"\r
-#define BLUETOOTH_SOCKET_API_WRITE_DATA "writeData"\r
-#define BLUETOOTH_SOCKET_API_READ_DATA "readData"\r
-#define BLUETOOTH_SOCKET_API_CLOSE "close"\r
-#define BLUETOOTH_CLASS_API_HAS_SERVICE "hasService"\r
-#define BLUETOOTH_SERVICE_HANDLER_API_UNREGISTER "unregister"\r
-#define BLUETOOTH_HEALTH_PROFILE_HANDLER_API_REGISTER_SINK_APPLICATION "registerSinkApplication"\r
-#define BLUETOOTH_HEALTH_APPLICATION_API_UNREGISTER "healthUnregister"\r
-#define BLUETOOTH_HEALTH_PROFILE_HANDLER_API_CONNECT_TO_SOURCE "connectToSource"\r
-#define BLUETOOTH_HEALTH_CHANNEL_API_SEND_DATA "sendData"\r
-#define BLUETOOTH_HEALTH_CHANNEL_API_SET_LISTENER "setListener"\r
-#define BLUETOOTH_HEALTH_CHANNEL_API_UNSET_LISTENER "unsetListener"\r
-#define BLUETOOTH_HEALTH_CHANNEL_API_CLOSE "healthClose"\r
-}\r
-}\r
-#endif\r
index d0270f5..e98bb1f 100644 (file)
@@ -18,9 +18,9 @@
 
 #include <Commons/plugin_initializer_def.h>
 #include <Commons/WrtAccess/WrtAccess.h>
-#include <Security.h>
+
 #include <GlobalContextManager.h>
-#include "plugin_config.h"
+
 #include "JSBluetoothManager.h"
 #include "BluetoothAdapter.h"
 
@@ -33,25 +33,6 @@ using namespace DeviceAPI::Common;
 
 namespace DeviceAPI {
 namespace Bluetooth {
-       
-AceSecurityStatus bluetoothAceCheckAccessFunction(const char* functionName)    
-{
-       return BLUETOOTH_CHECK_ACCESS(functionName);
-}
-
-DEFINE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor);
-DEFINE_SECURITY_ACCESSOR_SETTER(AceCheckerBluetoothSetter, JSBluetoothManagerPriv, gSecurityAccessor);
-
-class_definition_options_t BluetoothOptions =  
-{
-       JS_CLASS,
-       CREATE_INSTANCE,
-       ALWAYS_NOTICE,
-       USE_OVERLAYED,
-       AceCheckerBluetoothSetter,
-       NULL
-};
-                       
 
 
 void on_widget_start_callback(int widgetId)
@@ -63,7 +44,6 @@ void on_widget_start_callback(int widgetId)
     } catch (...) {
         LoggerE("WrtAccess initialization failed");
     }
-       INITAILIZE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor, bluetoothAceCheckAccessFunction);
 }
 
 void on_widget_stop_callback(int widgetId)
@@ -76,7 +56,6 @@ void on_widget_stop_callback(int widgetId)
     } catch (...) {
         LoggerE("WrtAccess deinitialization failed");
     }
-        FINALIZE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor);
 }
 
 void on_frame_load_callback(const void *context)
@@ -101,7 +80,7 @@ PLUGIN_CLASS_MAP_BEGIN
 PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
         "bluetooth",
         (js_class_template_getter)JSBluetoothManager::getClassRef,
-        &BluetoothOptions)
+        NULL)
 PLUGIN_CLASS_MAP_END
 
 } // Bluetooth
index 56bb9b6..b242e51 100755 (executable)
@@ -71,6 +71,7 @@ ADD_LIBRARY(${TARGET_NAME} SHARED ${SRCS})
 
 TARGET_LINK_LIBRARIES(${TARGET_NAME}
        ${TARGET_IMPL_NAME}
+       "-Wl,--no-as-needed" ${contact_config}
 )
 
 INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
index 90909eb..d2e015e 100755 (executable)
@@ -45,18 +45,9 @@ const int DEFAULT_EVENT_INTERVAL = 1;
 namespace DeviceAPI {
 namespace Calendar {
 
-CalendarConverter::CalendarConverter(JSContextRef context, CalendarEvent::CalendarType calendarType,
-        DeviceAPI::Common::SecurityAccessor *securityAccessor) : Converter(context)
+CalendarConverter::CalendarConverter(JSContextRef context, CalendarEvent::CalendarType calendarType) : Converter(context)
 {
     m_calendarType = calendarType;
-    m_securityAccessor = securityAccessor;
-}
-
-CalendarConverter::CalendarConverter(JSContextRef context, DeviceAPI::Common::SecurityAccessor *securityAccessor,
-        CalendarEvent::CalendarType calendarType) : Converter(context)
-{
-    m_securityAccessor = securityAccessor;
-    m_calendarType = calendarType;
 }
 
 CalendarConverter::~CalendarConverter()
@@ -65,18 +56,12 @@ CalendarConverter::~CalendarConverter()
 
 JSValueRef CalendarConverter::toJSValueRefEvent(const CalendarEventPtr& arg)
 {
-    CalendarEventPrivObject *priv = new CalendarEventPrivObject(m_context, arg);
-    if(m_securityAccessor != NULL)
-        priv->copyAceCheckAccessFunction(m_securityAccessor);
-    return JSObjectMake(m_context, JSCalendarEvent::getClassRef(), priv);
+    return JSUtils::makeObject(m_context, JSCalendarEvent::getClassRef(), arg);
 }
 
 JSValueRef CalendarConverter::toJSValueRefTask(const CalendarEventPtr& arg)
 {
-    CalendarTaskPrivObject *priv = new CalendarTaskPrivObject(m_context, arg);
-    if(m_securityAccessor != NULL)
-        priv->copyAceCheckAccessFunction(m_securityAccessor);
-    return JSObjectMake(m_context, JSCalendarTask::getClassRef(), priv);
+    return JSUtils::makeObject(m_context, JSCalendarTask::getClassRef(), arg);
 }
 
 JSValueRef CalendarConverter::toJSValueRefEventArray(const CalendarEventListPtr &arg)
@@ -92,8 +77,6 @@ JSValueRef CalendarConverter::toJSValueRefTaskArray(const CalendarEventListPtr &
 JSValueRef CalendarConverter::toJSValueRefCalendar(const ICalendarPtr& arg)
 {
     CalendarPrivObject *priv = new CalendarPrivObject(m_context, arg);
-    if(m_securityAccessor != NULL)
-        priv->copyAceCheckAccessFunction(m_securityAccessor);
     return JSObjectMake(m_context, JSCalendar::getClassRef(), priv);
 }
 
index 283d343..2092edb 100755 (executable)
@@ -26,7 +26,6 @@
 #include "EventAlarm.h"
 #include <CommonsJavaScript/Converter.h>
 #include <CommonsJavaScript/ScopedJSStringRef.h>
-#include <Security.h>
 
 namespace DeviceAPI {
 namespace Calendar {
@@ -36,10 +35,7 @@ class CalendarConverter : public WrtDeviceApis::CommonsJavaScript::Converter
   public:
     using Converter::toJSValueRef;
   public:
-    explicit CalendarConverter(JSContextRef context, CalendarEvent::CalendarType calendarType=CalendarEvent::EVENT_TYPE,
-            DeviceAPI::Common::SecurityAccessor *securityAccessor=NULL);
-    explicit CalendarConverter(JSContextRef context, DeviceAPI::Common::SecurityAccessor *securityAccessor,
-            CalendarEvent::CalendarType calendarType=CalendarEvent::EVENT_TYPE);
+    explicit CalendarConverter(JSContextRef context, CalendarEvent::CalendarType calendarType=CalendarEvent::EVENT_TYPE);
     virtual ~CalendarConverter();
 
     CalendarEventPtr toItem(const JSValueRef value, bool updateMode);
@@ -107,7 +103,6 @@ class CalendarConverter : public WrtDeviceApis::CommonsJavaScript::Converter
 
   private:
     CalendarEvent::CalendarType m_calendarType;
-    DeviceAPI::Common::SecurityAccessor* m_securityAccessor;
 };
 
 }
index 38d1588..6a0710f 100755 (executable)
@@ -23,7 +23,6 @@
 #include <Commons/IEvent.h>
 #include <CommonsJavaScript/JSCallbackManager.h>
 #include <JavaScriptCore/JavaScript.h>
-#include <Security.h>
 #include "CalendarEvent.h"
 
 
@@ -82,9 +81,7 @@ struct CalendarChangeCallback {
     { }
 };
 
-class CalendarChangeCallbackPrivateData :
-    public WrtDeviceApis::Commons::IEventPrivateData,
-    public DeviceAPI::Common::SecurityAccessor
+class CalendarChangeCallbackPrivateData : public WrtDeviceApis::Commons::IEventPrivateData
 {
 public:
     CalendarChangeCallbackPrivateData(const JSCallbackManagerPtr& onAdded,
index 23264d2..d5522f7 100755 (executable)
@@ -70,7 +70,7 @@ void CalendarResponseDispatcher::OnAnswerReceived(const IEventGetCalendarsPtr &e
     Try
     {  
         if (event->getResult()) {
-            CalendarConverter converter(cbm->getContext(), event.Get());
+            CalendarConverter converter(cbm->getContext());
             const std::vector<ICalendarPtr> &results = event->getCalendars();
             LoggerD("found calendars: " << results.size());
             JSValueRef result = converter.toJSValueRef(results);
@@ -104,7 +104,7 @@ void CalendarResponseDispatcher::OnAnswerReceived(const IEventAddEventsPtr &even
 
         if (event->getResult()) {
             LoggerD("result success");
-            CalendarConverter converter(cbm->getContext(), event.Get());
+            CalendarConverter converter(cbm->getContext());
 
             JSValueRef result;
             if (CalendarEvent::TASK_TYPE==event->getCalendarType()) {
@@ -194,7 +194,7 @@ void CalendarResponseDispatcher::OnAnswerReceived(const IEventFindEventsPtr &eve
     Try
     {
         if (event->getResult()) {
-            CalendarConverter converter(cbm->getContext(), event.Get());
+            CalendarConverter converter(cbm->getContext());
 
             JSValueRef result;
             if (CalendarEvent::TASK_TYPE==event->getCalendarType()) {
@@ -245,7 +245,7 @@ void CalendarResponseDispatcher::OnAnswerReceived(const IEventExpandEventRecurre
            }
 
         if (event->getResult()) {
-            CalendarConverter converter(cbm->getContext(), event.Get());
+            CalendarConverter converter(cbm->getContext());
             cbm->callOnSuccess(converter.toJSValueRefEventArray(event->getExpandedEventList()));
             return;
         } else {
@@ -279,7 +279,7 @@ void CalendarResponseDispatcher::onAnswerReceived(const OnEventsChangedPtr& even
         DPL::StaticPointerCast<CalendarChangeCallbackPrivateData>(event->getPrivateData());
     JSContextRef context = multiCallbacks->getOnAdded()->getContext();
 
-    CalendarConverter converter(context, multiCallbacks.Get());
+    CalendarConverter converter(context);
     JSValueRef result;
 
     Try
index 33462c7..f235214 100755 (executable)
 #include <Commons/IEvent.h>
 #include "CalendarEvent.h"
 #include <dpl/shared_ptr.h>
-#include <Security.h>
 
 namespace DeviceAPI {
 namespace Calendar {
 
-class IEventAddEvents : public WrtDeviceApis::Commons::IEvent<IEventAddEvents>, public DeviceAPI::Common::SecurityAccessor
+class IEventAddEvents : public WrtDeviceApis::Commons::IEvent<IEventAddEvents>
 {
     CalendarEventListPtr m_events;
     bool m_result;
index deed454..84c6543 100755 (executable)
 #include <Commons/IEvent.h>
 #include "CalendarEvent.h"
 #include <dpl/shared_ptr.h>
-#include <Security.h>
 
 namespace DeviceAPI {
 namespace Calendar {
 
-class IEventExpandEventRecurrence : public WrtDeviceApis::Commons::IEvent<IEventExpandEventRecurrence>, public DeviceAPI::Common::SecurityAccessor
+class IEventExpandEventRecurrence : public WrtDeviceApis::Commons::IEvent<IEventExpandEventRecurrence>
 {
     CalendarEventListPtr m_expandedEventList; //output
     bool m_result; // ouput
index c0c9461..b340b43 100755 (executable)
 #include <IFilter.h>
 #include <SortMode.h>
 #include <dpl/shared_ptr.h>
-#include <Security.h>
 
 namespace DeviceAPI {
 namespace Calendar {
 
-class IEventFindEvents : public WrtDeviceApis::Commons::IEvent<IEventFindEvents>, public DeviceAPI::Common::SecurityAccessor
+class IEventFindEvents : public WrtDeviceApis::Commons::IEvent<IEventFindEvents>
 {
     /* user is responsible to free objects inside list */
     CalendarEventListPtr m_events;
index 79601a9..47308a8 100755 (executable)
 #include <Commons/IEvent.h>
 #include "ICalendar.h"
 #include <dpl/shared_ptr.h>
-#include <Security.h>
 
 namespace DeviceAPI {
 namespace Calendar {
 
-class IEventGetCalendars : public WrtDeviceApis::Commons::IEvent<IEventGetCalendars>, public DeviceAPI::Common::SecurityAccessor
+class IEventGetCalendars : public WrtDeviceApis::Commons::IEvent<IEventGetCalendars>
 {
     std::vector<ICalendarPtr> m_calendars;
     bool m_result;
index ee8328c..55e6efc 100755 (executable)
@@ -151,8 +151,9 @@ JSValueRef JSCalendar::add(JSContextRef context,
     CalendarPrivObject *privateObject =
         static_cast<CalendarPrivObject*>(JSObjectGetPrivate(thisObject));
 
+    AceSecurityStatus status = CALENDAR_CHECK_ACCESS(CALENDAR_FUNCTION_API_ADD);
 
-    TIZEN_CHECK_ACCESS(context, exception, privateObject, CALENDAR_FUNCTION_API_ADD);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     Try
     {
@@ -231,7 +232,9 @@ JSValueRef JSCalendar::addBatch(JSContextRef context,
     CalendarPrivObject *privateObject =
         static_cast<CalendarPrivObject*>(JSObjectGetPrivate(thisObject));
 
-    TIZEN_CHECK_ACCESS(context, exception, privateObject, CALENDAR_FUNCTION_API_ADD_BATCH);
+    AceSecurityStatus status = CALENDAR_CHECK_ACCESS(CALENDAR_FUNCTION_API_ADD_BATCH);
+
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     Try
     {
@@ -274,7 +277,6 @@ JSValueRef JSCalendar::addBatch(JSContextRef context,
         dplEvent->setEvents(events);
         dplEvent->setPrivateData(DPL::StaticPointerCast<IEventPrivateData>(cbm));
         dplEvent->setForAsynchronousCall(&CalendarResponseDispatcher::getInstance());
-        dplEvent->copyAceCheckAccessFunction(privateObject);
         calendar->addEvents(dplEvent);
 
                TIME_TRACER_ITEM_END(__FUNCTION__, 0);
@@ -313,7 +315,9 @@ JSValueRef JSCalendar::update(JSContextRef context,
     CalendarPrivObject *privateObject =
         static_cast<CalendarPrivObject*>(JSObjectGetPrivate(thisObject));
 
-    TIZEN_CHECK_ACCESS(context, exception, privateObject, CALENDAR_FUNCTION_API_UPDATE);
+    AceSecurityStatus status = CALENDAR_CHECK_ACCESS(CALENDAR_FUNCTION_API_UPDATE);
+
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     Try
     {
@@ -399,7 +403,9 @@ JSValueRef JSCalendar::updateBatch(JSContextRef context,
     CalendarPrivObject *privateObject =
         static_cast<CalendarPrivObject*>(JSObjectGetPrivate(thisObject));
 
-    TIZEN_CHECK_ACCESS(context, exception, privateObject, CALENDAR_FUNCTION_API_UPDATE_BATCH);
+    AceSecurityStatus status = CALENDAR_CHECK_ACCESS(CALENDAR_FUNCTION_API_UPDATE_BATCH);
+
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     Try
     {
@@ -493,7 +499,9 @@ JSValueRef JSCalendar::remove(JSContextRef context,
     CalendarPrivObject *privateObject =
         static_cast<CalendarPrivObject*>(JSObjectGetPrivate(thisObject));
 
-    TIZEN_CHECK_ACCESS(context, exception, privateObject, CALENDAR_FUNCTION_API_REMOVE);
+    AceSecurityStatus status = CALENDAR_CHECK_ACCESS(CALENDAR_FUNCTION_API_REMOVE);
+
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     Try
     {
@@ -585,7 +593,9 @@ JSValueRef JSCalendar::removeBatch(JSContextRef context,
     CalendarPrivObject *privateObject =
         static_cast<CalendarPrivObject*>(JSObjectGetPrivate(thisObject));
 
-    TIZEN_CHECK_ACCESS(context, exception, privateObject, CALENDAR_FUNCTION_API_REMOVE_BATCH);
+    AceSecurityStatus status = CALENDAR_CHECK_ACCESS(CALENDAR_FUNCTION_API_REMOVE_BATCH);
+
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     Try
     {
@@ -698,7 +708,9 @@ JSValueRef JSCalendar::find(JSContextRef context,
     CalendarPrivObject *privateObject =
         static_cast<CalendarPrivObject*>(JSObjectGetPrivate(thisObject));
 
-    TIZEN_CHECK_ACCESS(context, exception, privateObject, CALENDAR_FUNCTION_API_FIND);
+    AceSecurityStatus status = CALENDAR_CHECK_ACCESS(CALENDAR_FUNCTION_API_FIND);
+
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     Try
     {
@@ -737,7 +749,6 @@ JSValueRef JSCalendar::find(JSContextRef context,
         dplEvent->setCalendarType(calendar->getType());
         dplEvent->setPrivateData(DPL::StaticPointerCast<IEventPrivateData>(cbm));
         dplEvent->setForAsynchronousCall(&CalendarResponseDispatcher::getInstance());
-        dplEvent->copyAceCheckAccessFunction(privateObject);
 
         if (argumentCount>=3) {
             if (JSValueIsObject(context, arguments[2])) {
@@ -804,7 +815,9 @@ JSValueRef JSCalendar::get(JSContextRef context,
     CalendarPrivObject *privateObject =
         static_cast<CalendarPrivObject*>(JSObjectGetPrivate(thisObject));
 
-    TIZEN_CHECK_ACCESS(context, exception, privateObject, CALENDAR_FUNCTION_API_GET);
+    AceSecurityStatus status = CALENDAR_CHECK_ACCESS(CALENDAR_FUNCTION_API_GET);
+
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     Try
     {
@@ -853,9 +866,9 @@ JSValueRef JSCalendar::get(JSContextRef context,
                        if (CalendarEvent::EVENT_TYPE==calendar->getType()) {
                                TIME_TRACER_ITEM_END(__FUNCTION__, 0);
                 // Use global context for the expandRecurrence api in event.
-                   return JSCalendarEvent::createJSCalendarEvent(globalContext, dplEvent->getItem(), privateObject);
+                   return JSCalendarEvent::createJSCalendarEvent(globalContext, dplEvent->getItem());
                        } else if (CalendarEvent::TASK_TYPE==calendar->getType()) {
-                   return JSCalendarTask::createJSCalendarTask(context, dplEvent->getItem(), privateObject);
+                   return JSCalendarTask::createJSCalendarTask(context, dplEvent->getItem());
                        } else {
                    ThrowMsg(UnknownException, "Wrong calendar type.");
                        }
@@ -905,7 +918,9 @@ JSValueRef JSCalendar::addChangeListener(JSContextRef context,
     CalendarPrivObject *privateObject =
         static_cast<CalendarPrivObject*>(JSObjectGetPrivate(thisObject));
 
-    TIZEN_CHECK_ACCESS(context, exception, privateObject, CALENDAR_FUNCTION_API_ADD_CHANGE_LISTENER);
+    AceSecurityStatus status = CALENDAR_CHECK_ACCESS(CALENDAR_FUNCTION_API_ADD_CHANGE_LISTENER);
+
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     Try
     {
@@ -963,7 +978,6 @@ JSValueRef JSCalendar::addChangeListener(JSContextRef context,
 
         CalendarChangeCallbackPrivateDataPtr privData(new CalendarChangeCallbackPrivateData(
             onAddedCbm, onUpdatedCbm, onDeletedCbm));
-        privData->copyAceCheckAccessFunction(privateObject);
         OnEventsChangedEmitterPtr emitter(new OnEventsChangedEmitter());
         emitter->setListener(&CalendarResponseDispatcher::getInstance());
         emitter->setEventPrivateData(DPL::StaticPointerCast<IEventPrivateData>(privData));
@@ -1021,7 +1035,9 @@ JSValueRef JSCalendar::removeChangeListener(JSContextRef context,
     CalendarPrivObject *privateObject =
         static_cast<CalendarPrivObject*>(JSObjectGetPrivate(thisObject));
 
-    TIZEN_CHECK_ACCESS(context, exception, privateObject, CALENDAR_FUNCTION_API_REMOVE_CHANGE_LISTENER);
+    AceSecurityStatus status = CALENDAR_CHECK_ACCESS(CALENDAR_FUNCTION_API_REMOVE_CHANGE_LISTENER);
+
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     Try
     {
index 03895f4..ee2486b 100755 (executable)
@@ -25,7 +25,6 @@
 #include <CommonsJavaScript/PrivateObject.h>
 #include "ICalendar.h"
 #include <CommonsJavaScript/JSCallbackManager.h>
-#include <Security.h>
 
 namespace DeviceAPI {
 namespace Calendar {
@@ -35,23 +34,7 @@ namespace Calendar {
 #define TIZEN_CALENDAR_PROPERTY_ID "id"
 
 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<ICalendarPtr,
-                               WrtDeviceApis::CommonsJavaScript::NoOwnership> CalendarPrivObjectBase;
-
-class CalendarPrivObject :
-    public CalendarPrivObjectBase,
-    public DeviceAPI::Common::SecurityAccessor
-{
-public:
-    CalendarPrivObject(JSContextRef context, ICalendarPtr calendar) :
-        CalendarPrivObjectBase(context, calendar),
-        DeviceAPI::Common::SecurityAccessor()
-    {
-    }
-
-    virtual ~CalendarPrivObject()
-    {
-    }
-};
+                               WrtDeviceApis::CommonsJavaScript::NoOwnership> CalendarPrivObject;
 
 class JSCalendar
 {
index 6ff19c7..0969560 100755 (executable)
@@ -33,7 +33,6 @@
 #include <TimeUtilConverter.h>
 #include <JSTZDate.h>
 #include <JSWebAPIErrorFactory.h>
-#include <Security.h>
 #include <SecurityExceptions.h>
 #include <GlobalContextManager.h>
 #include <TimeTracer.h>
@@ -129,18 +128,6 @@ JSObjectRef DLL_EXPORT JSCalendarEvent::constructor(JSContextRef context,
     CalendarEventPtr event(new CalendarEvent());
        JSContextRef globalContext = GlobalContextManager::getInstance()->getGlobalContext(context);
 
-    DeviceAPI::Common::SecurityAccessor *securityAccessor = NULL;
-
-    try
-    {
-        securityAccessor = DeviceAPI::Common::JSObjectGetSecurityAccessor(context, constructor);
-    }
-    catch(BasePlatformException &e)
-    {
-        event->setCalendarType(CalendarEvent::EVENT_TYPE);
-        return createJSCalendarEvent(globalContext, event, securityAccessor);
-    }
-
     Try
     {
         CalendarConverter converter(globalContext);
@@ -192,7 +179,7 @@ JSObjectRef DLL_EXPORT JSCalendarEvent::constructor(JSContextRef context,
         }
 
         event->setCalendarType(CalendarEvent::EVENT_TYPE);
-        return createJSCalendarEvent(globalContext, event, securityAccessor);
+        return createJSCalendarEvent(globalContext, event);
     }
     Catch(UnsupportedException)
     {
@@ -216,13 +203,12 @@ JSObjectRef DLL_EXPORT JSCalendarEvent::constructor(JSContextRef context,
     }
 
     event->setCalendarType(CalendarEvent::EVENT_TYPE);
-    return createJSCalendarEvent(globalContext, event, securityAccessor);
+    return createJSCalendarEvent(globalContext, event);
 }
 
-JSObjectRef JSCalendarEvent::createJSCalendarEvent(JSContextRef context, CalendarEventPtr event, const DeviceAPI::Common::SecurityAccessor *securityAccessor)
+JSObjectRef JSCalendarEvent::createJSCalendarEvent(JSContextRef context, CalendarEventPtr event)
 {
     CalendarEventPrivObject *priv = new CalendarEventPrivObject(context, event);
-    priv->copyAceCheckAccessFunction(securityAccessor);
     return JSObjectMake(context, getClassRef(), priv);
 }
 
@@ -284,7 +270,9 @@ JSValueRef JSCalendarEvent::expandRecurrence(JSContextRef context,
     CalendarEventPrivObject *privateObject =
         static_cast<CalendarEventPrivObject*>(JSObjectGetPrivate(thisObject));
 
-    TIZEN_CHECK_ACCESS(context, exception, privateObject, CALENDAR_FUNCTION_API_EXPAND_RECURRENCE);
+    AceSecurityStatus status = CALENDAR_CHECK_ACCESS(CALENDAR_FUNCTION_API_EXPAND_RECURRENCE);
+
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     Try
     {
@@ -341,7 +329,6 @@ JSValueRef JSCalendarEvent::expandRecurrence(JSContextRef context,
         dplEvent->setEvent(event);
         dplEvent->setStartDate(startDate);
         dplEvent->setEndDate(endDate);
-        dplEvent->copyAceCheckAccessFunction(privateObject);
         m_calendar->expandEventRecurrence(dplEvent);
 
                TIME_TRACER_ITEM_END(__FUNCTION__, 0);
index 1f224bf..9dd4bb4 100755 (executable)
@@ -23,9 +23,7 @@
 #include "CalendarEvent.h"
 #include "ICalendar.h"
 #include "CalendarFactory.h"
-#include "JSCalendarItemProperties.h"
 #include <CommonsJavaScript/PrivateObject.h>
-#include <Security.h>
 
 namespace DeviceAPI {
 namespace Calendar {
@@ -38,7 +36,8 @@ namespace Calendar {
 #define TIZEN_CALENDAR_EVENT_AVAILABILITY "availability"
 #define TIZEN_CALENDAR_EVENT_RECURRENCE_RULE "recurrenceRule"
 
-typedef CalendarItemPropertiesPrivObject CalendarEventPrivObject;
+typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<CalendarEventPtr,
+       WrtDeviceApis::CommonsJavaScript::NoOwnership> CalendarEventPrivObject;
 
 class JSCalendarEvent
 {
@@ -54,7 +53,7 @@ class JSCalendarEvent
             JSContextRef ctx,
             const JSObjectRef object);
 
-       static JSObjectRef createJSCalendarEvent(JSContextRef context, CalendarEventPtr event, const DeviceAPI::Common::SecurityAccessor *securityAccessor);
+       static JSObjectRef createJSCalendarEvent(JSContextRef context, CalendarEventPtr event);
 
        static JSObjectRef constructor(JSContextRef context,
     JSObjectRef constructor,
index 0391201..834bc95 100755 (executable)
@@ -196,7 +196,9 @@ JSValueRef JSCalendarItemProperties::convertToString(JSContextRef context,
     CalendarItemPropertiesPrivObject *privateObject =
         static_cast<CalendarItemPropertiesPrivObject*>(JSObjectGetPrivate(thisObject));
 
-    TIZEN_CHECK_ACCESS(context, exception, privateObject, CALENDAR_FUNCTION_API_CONVERT_TO_STRING);
+    AceSecurityStatus status = CALENDAR_CHECK_ACCESS(CALENDAR_FUNCTION_API_CONVERT_TO_STRING);
+
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     Try
     {
@@ -274,7 +276,9 @@ JSValueRef JSCalendarItemProperties::clone(JSContextRef context,
     CalendarItemPropertiesPrivObject *privateObject =
         static_cast<CalendarItemPropertiesPrivObject*>(JSObjectGetPrivate(thisObject));
 
-    TIZEN_CHECK_ACCESS(context, exception, privateObject, CALENDAR_FUNCTION_API_CLONE);
+    AceSecurityStatus status = CALENDAR_CHECK_ACCESS(CALENDAR_FUNCTION_API_CLONE);
+
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     Try
     {
@@ -297,11 +301,11 @@ JSValueRef JSCalendarItemProperties::clone(JSContextRef context,
 
                if (CalendarEvent::TASK_TYPE==clonedItem->getCalendarType()) {
                        TIME_TRACER_ITEM_END("clone(TASK)", 0);
-               return JSCalendarTask::createJSCalendarTask(context, clonedItem, privateObject);
+               return JSCalendarTask::createJSCalendarTask(context, clonedItem);
                } else if (CalendarEvent::EVENT_TYPE==clonedItem->getCalendarType()) {
                        TIME_TRACER_ITEM_END("clone(EVENT)", 0);
             // Use global context for potential async api invocation.
-            return JSCalendarEvent::createJSCalendarEvent(globalContext, clonedItem, privateObject);
+            return JSCalendarEvent::createJSCalendarEvent(globalContext, clonedItem);
                } else {
                        ThrowMsg(ConversionException, "Wrong object type.");
                }
index 3865088..6ac2c6f 100755 (executable)
@@ -22,7 +22,6 @@
 #include <JavaScriptCore/JavaScript.h>
 #include "CalendarEvent.h"
 #include <CommonsJavaScript/PrivateObject.h>
-#include <Security.h>
 
 namespace DeviceAPI {
 namespace Calendar {
@@ -46,23 +45,7 @@ namespace Calendar {
 #define TIZEN_CALENDAR_EVENT_LAST_MODIFICATION_DATE "lastModificationDate"
 
 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<CalendarEventPtr, 
-    WrtDeviceApis::CommonsJavaScript::NoOwnership> CalendarItemPropertiesPrivObjectBase;
-
-class CalendarItemPropertiesPrivObject :
-    public CalendarItemPropertiesPrivObjectBase,
-    public DeviceAPI::Common::SecurityAccessor
-{
-public:
-    CalendarItemPropertiesPrivObject(JSContextRef context, CalendarEventPtr calendarEvent) :
-        CalendarItemPropertiesPrivObjectBase(context, calendarEvent),
-        DeviceAPI::Common::SecurityAccessor()
-    {
-    }
-
-    virtual ~CalendarItemPropertiesPrivObject()
-    {
-    }
-};
+       WrtDeviceApis::CommonsJavaScript::NoOwnership> CalendarItemPropertiesPrivObject;
 
 class JSCalendarItemProperties
 {
index 86dbe9d..27cb03c 100755 (executable)
@@ -115,7 +115,9 @@ JSValueRef JSCalendarManager::getCalendars(JSContextRef context,
        TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
     CalendarManagerPrivObject *privateObject = static_cast<CalendarManagerPrivObject*>(JSObjectGetPrivate(thisObject));
 
-    TIZEN_CHECK_ACCESS(context, exception, privateObject, CALENDAR_FUNCTION_API_GET_CALENDARS);
+    AceSecurityStatus status = CALENDAR_CHECK_ACCESS(CALENDAR_FUNCTION_API_GET_CALENDARS);
+
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     Try {
         if (!privateObject) {
@@ -149,7 +151,6 @@ JSValueRef JSCalendarManager::getCalendars(JSContextRef context,
         dplEvent->setType(calendarType);
         dplEvent->setPrivateData(DPL::StaticPointerCast<IEventPrivateData>(cbm));
         dplEvent->setForAsynchronousCall(&CalendarResponseDispatcher::getInstance());
-        dplEvent->copyAceCheckAccessFunction(privateObject);
         privateObject->getObject()->getCalendars(dplEvent);
 
                TIME_TRACER_ITEM_END(__FUNCTION__, 0);
@@ -187,7 +188,9 @@ JSValueRef JSCalendarManager::getDefaultCalendar(JSContextRef context,
        TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
     CalendarManagerPrivObject *privateObject = static_cast<CalendarManagerPrivObject*>(JSObjectGetPrivate(thisObject));
 
-    TIZEN_CHECK_ACCESS(context, exception, privateObject, CALENDAR_FUNCTION_API_GET_DEFAULT_CALENDAR);
+    AceSecurityStatus status = CALENDAR_CHECK_ACCESS(CALENDAR_FUNCTION_API_GET_DEFAULT_CALENDAR);
+
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     Try {
         if (!privateObject) {
@@ -197,7 +200,7 @@ JSValueRef JSCalendarManager::getDefaultCalendar(JSContextRef context,
                // Global context should be passed to the calendar object.
         JSContextRef globalContext = GlobalContextManager::getInstance()->getGlobalContext(context);
 
-        CalendarConverter converter(globalContext, privateObject);
+        CalendarConverter converter(globalContext);
         CalendarEvent::CalendarType calendarType = CalendarEvent::UNDEFINED_TYPE;
         if (argumentCount>=1) {
             calendarType = converter.toCalendarType(converter.toString(arguments[0]));
@@ -261,7 +264,9 @@ JSValueRef JSCalendarManager::getUnifiedCalendar(JSContextRef context,
        TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
     CalendarManagerPrivObject *privateObject = static_cast<CalendarManagerPrivObject*>(JSObjectGetPrivate(thisObject));
 
-    TIZEN_CHECK_ACCESS(context, exception, privateObject, CALENDAR_FUNCTION_API_GET_UNIFIED_CALENDAR);
+    AceSecurityStatus status = CALENDAR_CHECK_ACCESS(CALENDAR_FUNCTION_API_GET_UNIFIED_CALENDAR);
+
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     Try {
         if (!privateObject) {
@@ -271,7 +276,7 @@ JSValueRef JSCalendarManager::getUnifiedCalendar(JSContextRef context,
                // Global context should be passed to the calendar object.
         JSContextRef globalContext = GlobalContextManager::getInstance()->getGlobalContext(context);
 
-        CalendarConverter converter(globalContext, privateObject);
+        CalendarConverter converter(globalContext);
         CalendarEvent::CalendarType calendarType = CalendarEvent::UNDEFINED_TYPE;
         if (argumentCount>=1) {
             calendarType = converter.toCalendarType(converter.toString(arguments[0]));
@@ -335,7 +340,9 @@ JSValueRef JSCalendarManager::getCalendar(JSContextRef context,
        TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
     CalendarManagerPrivObject *privateObject = static_cast<CalendarManagerPrivObject*>(JSObjectGetPrivate(thisObject));
 
-    TIZEN_CHECK_ACCESS(context, exception, privateObject, CALENDAR_FUNCTION_API_GET_CALENDAR);
+    AceSecurityStatus status = CALENDAR_CHECK_ACCESS(CALENDAR_FUNCTION_API_GET_CALENDAR);
+
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     Try {
         if (!privateObject) {
@@ -345,7 +352,7 @@ JSValueRef JSCalendarManager::getCalendar(JSContextRef context,
                // Global context should be passed to the calendar object.
         JSContextRef globalContext = GlobalContextManager::getInstance()->getGlobalContext(context);
 
-        CalendarConverter converter(globalContext, privateObject);
+        CalendarConverter converter(globalContext);
 
         CalendarEvent::CalendarType calendarType = CalendarEvent::UNDEFINED_TYPE;
         if (argumentCount>=1) {
index 207ed61..0fa49d9 100755 (executable)
@@ -21,7 +21,6 @@
 
 #include <JavaScriptCore/JavaScript.h>
 #include <CommonsJavaScript/PrivateObject.h>
-#include <Security.h>
 #include "ICalendarManager.h"
 #include "ICalendar.h"
 
@@ -29,21 +28,7 @@ namespace DeviceAPI {
 namespace Calendar {
 
 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<ICalendarManagerPtr,
-                               WrtDeviceApis::CommonsJavaScript::NoOwnership> CalendarManagerPrivObjectBase;
-
-class CalendarManagerPrivObject : public CalendarManagerPrivObjectBase, public DeviceAPI::Common::SecurityAccessor
-{
-public:
-    CalendarManagerPrivObject(JSContextRef context, ICalendarManagerPtr calendarManager) :
-        CalendarManagerPrivObjectBase(context, calendarManager),
-        DeviceAPI::Common::SecurityAccessor()
-    {
-    }
-
-    virtual ~CalendarManagerPrivObject()
-    {
-    }
-};
+                               WrtDeviceApis::CommonsJavaScript::NoOwnership> CalendarManagerPrivObject;
 
 #define TIZEN_CALENDAR_PROPERTY_VCALENDAR_20_FORMAT         "ICALENDAR_20"
 #define TIZEN_CALENDAR_PROPERTY_VCALENDAR_10_FORMAT         "VCALENDAR_10"
index b48ec11..27f6c87 100755 (executable)
 #include "ICalendar.h"
 #include "CalendarFactory.h"
 #include "JSCalendarTask.h"
+#include "JSCalendarItemProperties.h"
 #include "CalendarConverter.h"
 #include "JSCalendarEventId.h"
 #include <TimeUtilConverter.h>
 #include <JSTZDate.h>
 #include <JSWebAPIErrorFactory.h>
 #include <GlobalContextManager.h>
-#include <Security.h>
 #include <Logger.h>
 #include <Export.h>
 
@@ -113,17 +113,6 @@ JSObjectRef DLL_EXPORT JSCalendarTask::constructor(JSContextRef context,
     JSValueRef* exception)
 {
        CalendarEventPtr task(new CalendarEvent());
-       DeviceAPI::Common::SecurityAccessor *securityAccessor = NULL;
-
-    try
-    {
-        securityAccessor = DeviceAPI::Common::JSObjectGetSecurityAccessor(context, constructor);
-    }
-    catch(BasePlatformException &e)
-    {
-        task->setCalendarType(CalendarEvent::TASK_TYPE);
-        return createJSCalendarTask(context, task, securityAccessor);
-    }
 
     Try
     {
@@ -177,7 +166,7 @@ JSObjectRef DLL_EXPORT JSCalendarTask::constructor(JSContextRef context,
         }
 
         task->setCalendarType(CalendarEvent::TASK_TYPE);
-        return createJSCalendarTask(context, task, securityAccessor);
+        return createJSCalendarTask(context, task);
     }
     Catch(UnsupportedException)
     {
@@ -201,13 +190,12 @@ JSObjectRef DLL_EXPORT JSCalendarTask::constructor(JSContextRef context,
     }
 
     task->setCalendarType(CalendarEvent::TASK_TYPE);
-    return createJSCalendarTask(context, task, securityAccessor);
+    return createJSCalendarTask(context, task);
 }
 
-JSObjectRef JSCalendarTask::createJSCalendarTask(JSContextRef context, CalendarEventPtr task, const DeviceAPI::Common::SecurityAccessor *securityAccessor)
+JSObjectRef JSCalendarTask::createJSCalendarTask(JSContextRef context, CalendarEventPtr task)
 {
     CalendarTaskPrivObject *priv = new CalendarTaskPrivObject(context, task);
-    priv->copyAceCheckAccessFunction(securityAccessor);
     return JSObjectMake(context, getClassRef(), priv);
 }
 
index e33e57a..9abfbff 100755 (executable)
@@ -21,7 +21,6 @@
 
 #include <JavaScriptCore/JavaScript.h>
 #include "CalendarEvent.h"
-#include "JSCalendarItemProperties.h"
 #include <CommonsJavaScript/PrivateObject.h>
 
 namespace DeviceAPI {
@@ -34,7 +33,8 @@ namespace Calendar {
 #define TIZEN_CALENDAR_TASK_COMPLETED_DATE  "completedDate"
 #define TIZEN_CALENDAR_TASK_PROGRESS "progress"
 
-typedef CalendarItemPropertiesPrivObject CalendarTaskPrivObject;
+typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<CalendarEventPtr,
+       WrtDeviceApis::CommonsJavaScript::NoOwnership> CalendarTaskPrivObject;
 
 class JSCalendarTask
 {
@@ -50,7 +50,7 @@ class JSCalendarTask
             JSContextRef ctx,
             const JSObjectRef object);
 
-       static JSObjectRef createJSCalendarTask(JSContextRef context, CalendarEventPtr task, const DeviceAPI::Common::SecurityAccessor *securityAccessor);
+       static JSObjectRef createJSCalendarTask(JSContextRef context, CalendarEventPtr task);
 
        static JSObjectRef constructor(JSContextRef context,
     JSObjectRef constructor,
index 2a89106..f6518fe 100755 (executable)
@@ -40,8 +40,12 @@ static FunctionMapping createCalendarFunctions();
 
 static FunctionMapping CalendarFunctions = createCalendarFunctions();
 
+#pragma GCC visibility push(default)
+
 DEFINE_FUNCTION_GETTER(Calendar, CalendarFunctions);
 
+#pragma GCC visibility pop
+
 static FunctionMapping createCalendarFunctions()
 {
     /**
index c4dc578..f553673 100755 (executable)
 
 #include <string>
 #include <Commons/FunctionDeclaration.h>
-#include "plugin_config_impl.h"
 
 namespace DeviceAPI {
 namespace Calendar {
 
+// Functions from calendar manager
+#define CALENDAR_FUNCTION_API_GET_CALENDARS "getCalendars"
+#define CALENDAR_FUNCTION_API_GET_DEFAULT_CALENDAR "getDefaultCalendar"
+#define CALENDAR_FUNCTION_API_GET_UNIFIED_CALENDAR "getUnifiedCalendar"
+#define CALENDAR_FUNCTION_API_GET_CALENDAR "getCalendar"
+
+// Functions from calendar
+#define CALENDAR_FUNCTION_API_ADD "add"
+#define CALENDAR_FUNCTION_API_ADD_BATCH "addBatch"
+#define CALENDAR_FUNCTION_API_UPDATE "update"
+#define CALENDAR_FUNCTION_API_UPDATE_BATCH "updateBatch"
+#define CALENDAR_FUNCTION_API_REMOVE "remove"
+#define CALENDAR_FUNCTION_API_REMOVE_BATCH "removeBatch"
+#define CALENDAR_FUNCTION_API_FIND "find"
+#define CALENDAR_FUNCTION_API_CONVERT_TO_STRING "convertToString"
+#define CALENDAR_FUNCTION_API_ADD_CHANGE_LISTENER "addChangeListener"
+#define CALENDAR_FUNCTION_API_REMOVE_CHANGE_LISTENER "removeChangeListener"
+#define CALENDAR_FUNCTION_API_EXPAND_RECURRENCE "expandRecurrence"
+#define CALENDAR_FUNCTION_API_GET "get"
+#define CALENDAR_FUNCTION_API_CLONE "clone"
+
 DECLARE_FUNCTION_GETTER(Calendar);
 
 #define CALENDAR_CHECK_ACCESS(functionName) \
diff --git a/src/Calendar/plugin_config_impl.h b/src/Calendar/plugin_config_impl.h
deleted file mode 100755 (executable)
index 8b73606..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-//
-// Tizen Web Device API
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-
-#ifndef _CALENDAR_PLUGIN_CONFIG_IMPL_H_
-#define _CALENDAR_PLUGIN_CONFIG_IMPL_H_
-
-// Functions from calendar manager
-#define CALENDAR_FUNCTION_API_GET_CALENDARS "getCalendars"
-#define CALENDAR_FUNCTION_API_GET_DEFAULT_CALENDAR "getDefaultCalendar"
-#define CALENDAR_FUNCTION_API_GET_UNIFIED_CALENDAR "getUnifiedCalendar"
-#define CALENDAR_FUNCTION_API_GET_CALENDAR "getCalendar"
-
-// Functions from calendar
-#define CALENDAR_FUNCTION_API_ADD "add"
-#define CALENDAR_FUNCTION_API_ADD_BATCH "addBatch"
-#define CALENDAR_FUNCTION_API_UPDATE "update"
-#define CALENDAR_FUNCTION_API_UPDATE_BATCH "updateBatch"
-#define CALENDAR_FUNCTION_API_REMOVE "remove"
-#define CALENDAR_FUNCTION_API_REMOVE_BATCH "removeBatch"
-#define CALENDAR_FUNCTION_API_FIND "find"
-#define CALENDAR_FUNCTION_API_CONVERT_TO_STRING "convertToString"
-#define CALENDAR_FUNCTION_API_ADD_CHANGE_LISTENER "addChangeListener"
-#define CALENDAR_FUNCTION_API_REMOVE_CHANGE_LISTENER "removeChangeListener"
-#define CALENDAR_FUNCTION_API_EXPAND_RECURRENCE "expandRecurrence"
-#define CALENDAR_FUNCTION_API_GET "get"
-#define CALENDAR_FUNCTION_API_CLONE "clone"
-
-#endif //  _CALENDAR_PLUGIN_CONFIG_IMPL_H_
index da0e489..9d3f423 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,
-    ALWAYS_NOTICE,
+    NONE_NOTICE,
     USE_OVERLAYED, //ignored
-    AceCheckerCalendarSetter,
+    NULL,
     NULL
 };
 
 class_definition_options_t CalendarInterfaceOptions = {
     JS_INTERFACE,
     CREATE_INSTANCE,
-    ALWAYS_NOTICE,
+    NONE_NOTICE,
     USE_OVERLAYED, //ignored
-    AceCheckerCalendarConstructorSetter, // JSWidget::acquireGlobalContext,
+    NULL, // 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 << ")");
@@ -83,8 +69,6 @@ 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)
@@ -97,8 +81,6 @@ 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)
index 7172ede..aa894d4 100755 (executable)
@@ -5,8 +5,6 @@ SET(TARGET_IMPL_NAME ${callhistory_impl})
 IF(ENABLE_OPTIONAL_CALL_HISTORY)
 PKG_CHECK_MODULES(platform_pkgs_callhistory REQUIRED contacts-service2 glib-2.0 libpcrecpp)
 
-ADD_DEFINITIONS("-fvisibility=hidden")
-
 INCLUDE_DIRECTORIES(
        ${INCLUDE_COMMON}
        ${TOP}/Tizen
index fbd5eff..01cb59b 100755 (executable)
 //
 
 #include "CallHistoryAsyncCallbackManager.h"
+#include <dpl/singleton_impl.h>
+
+
+
+IMPLEMENT_SINGLETON(DeviceAPI::CallHistory::CallHistoryAsyncCallbackManager)
 
 namespace DeviceAPI {
 namespace CallHistory {
 
-SINGLETON_IMPLEMENTATION(CallHistoryAsyncCallbackManager)
-
 } // Tizen1_0
 } // TizenApis
index b950335..dca7c9c 100755 (executable)
@@ -18,6 +18,7 @@
 #ifndef _TIZEN_CALLHISTORY_ASYNC_CALLBACK_MANAGER_H_
 #define _TIZEN_CALLHISTORY_ASYNC_CALLBACK_MANAGER_H_
 
+#include <dpl/singleton.h>
 #include <AsyncCallbackManager.h>
 
 namespace DeviceAPI {
@@ -37,7 +38,7 @@ public:
        friend class DPL::Singleton<CallHistoryAsyncCallbackManager>;
 };
 
-SINGLETON_DEFINITION(CallHistoryAsyncCallbackManager)
+typedef DPL::Singleton<CallHistoryAsyncCallbackManager> CallHistoryAsyncCallbackManagerSingleton;
 
 } // Tizen1_0
 } // TizenApis
index 9283ac9..437fbde 100755 (executable)
 //
 
 #include "CallHistoryListenerManager.h"
+#include <dpl/singleton_impl.h>
+
+
+
+IMPLEMENT_SINGLETON(DeviceAPI::CallHistory::CallHistoryListenerManager)
 
 namespace DeviceAPI {
 namespace CallHistory {
 
-SINGLETON_IMPLEMENTATION(CallHistoryListenerManager)
-
 } // Tizen1_0
 } // TizenApis
index 357a335..bf756af 100644 (file)
@@ -21,6 +21,7 @@
 #include <map>
 #include <JavaScriptCore/JavaScript.h>
 #include <dpl/shared_ptr.h>
+#include <dpl/singleton.h>
 #include <IListenerManager.h>
 #include "JSCallHistory.h"
 #include <Logger.h>
@@ -39,7 +40,7 @@ public:
        {
        }
 };
-SINGLETON_DEFINITION(CallHistoryListenerManager)
+typedef DPL::Singleton<CallHistoryListenerManager> CallHistoryListenerManagerSingleton;
 
 class CallHistoryListenerCanceller : public DeviceAPI::Common::IListenerItem
 {
index 05274f5..ee4a63c 100755 (executable)
@@ -40,7 +40,7 @@
 #include "CallHistoryMultiCallback.h"
 #include "ResponseDispatcher.h"
 #include "Converter.h"
-#include "plugin_config_impl.h"
+#include "plugin_config.h"
 #include "CallHistoryAsyncCallbackManager.h"
 #include "CallHistoryListenerManager.h"
 #include "CallHistoryFilterConverter.h"
@@ -95,7 +95,7 @@ JSStaticFunction JSCallHistory::m_function[] =
        { 0, 0, 0 }
 };
 
-const JSClassRef DLL_EXPORT JSCallHistory::getClassRef() {
+const JSClassRef JSCallHistory::getClassRef() {
        if (!m_jsClassRef) {
                m_jsClassRef = JSClassCreate(&m_classInfo);
        }
@@ -142,17 +142,19 @@ bool JSCallHistory::hasInstance(JSContextRef context, JSObjectRef constructor,
 JSValueRef JSCallHistory::find(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
        const JSValueRef arguments[], JSValueRef* exception) {
        TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+       AceSecurityStatus status = CALLHISTORY_CHECK_ACCESS(
+                       CALL_HISTORY_FUNCTION_API_FIND);
 
-       JSCallHistoryPriv *priv = static_cast<JSCallHistoryPriv*> (JSObjectGetPrivate(thisObject));
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
-       if (!priv) {
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type missmatch error : Invalid private pointer");
+       if (argumentCount < 1) {
+               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type missmatch error");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, priv, CALL_HISTORY_FUNCTION_API_FIND);
+       JSCallHistoryPriv *priv = static_cast<JSCallHistoryPriv*> (JSObjectGetPrivate(thisObject));
 
-       if (argumentCount < 1) {
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type missmatch error");
+       if (!priv) {
+               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type missmatch error : Invalid private pointer");
        }
 
        JSContextRef gContext = priv->getContext();
@@ -254,24 +256,26 @@ JSValueRef JSCallHistory::remove(JSContextRef context, JSObjectRef object, JSObj
        const JSValueRef arguments[], JSValueRef* exception) {
 
        TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+       AceSecurityStatus status = CALLHISTORY_CHECK_ACCESS(
+                       CALL_HISTORY_FUNCTION_API_REMOVE);
+
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     try{
         ArgumentValidator validator(context, argumentCount, arguments);
 
-               JSCallHistoryPriv *priv = static_cast<JSCallHistoryPriv*> (JSObjectGetPrivate(thisObject));
-
-               if (!priv) {
-                       return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type missmatch error : Invalid private pointer");
-               }
-
-               TIZEN_CHECK_ACCESS(context, exception, priv, CALL_HISTORY_FUNCTION_API_REMOVE);
-
         JSObjectRef entryObj = validator.toObject(0);
 
                if (argumentCount < 1) {
                        return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type missmatch error");
                }
 
+               JSCallHistoryPriv *priv = static_cast<JSCallHistoryPriv*> (JSObjectGetPrivate(thisObject));
+
+               if (!priv) {
+                       return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type missmatch error : Invalid private pointer");
+               }
+
                Converter converter(context);
 
                if (!JSValueIsObjectOfClass(context, arguments[0], JSCallHistoryEntry::getClassRef())) {
@@ -303,17 +307,19 @@ JSValueRef JSCallHistory::removeBatch(JSContextRef context, JSObjectRef object,
        const JSValueRef arguments[], JSValueRef* exception) {
 
        TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+       AceSecurityStatus status = CALLHISTORY_CHECK_ACCESS(
+                       CALL_HISTORY_FUNCTION_API_REMOVE_BATCH);
 
-       JSCallHistoryPriv *priv = static_cast<JSCallHistoryPriv*> (JSObjectGetPrivate(thisObject));
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
-       if (!priv) {
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type missmatch error : Invalid private pointer");
+       if (argumentCount < 1) {
+               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type missmatch error");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, priv, CALL_HISTORY_FUNCTION_API_REMOVE_BATCH);
+       JSCallHistoryPriv *priv = static_cast<JSCallHistoryPriv*> (JSObjectGetPrivate(thisObject));
 
-       if (argumentCount < 1) {
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type missmatch error");
+       if (!priv) {
+               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type missmatch error : Invalid private pointer");
        }
 
        JSContextRef gContext = priv->getContext();
@@ -378,6 +384,10 @@ JSValueRef JSCallHistory::removeAll(JSContextRef context, JSObjectRef object, JS
        const JSValueRef arguments[], JSValueRef* exception) {
 
        TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+       AceSecurityStatus status = CALLHISTORY_CHECK_ACCESS(
+                       CALL_HISTORY_FUNCTION_API_REMOVE_ALL);
+
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        JSCallHistoryPriv *priv = static_cast<JSCallHistoryPriv*> (JSObjectGetPrivate(thisObject));
 
@@ -385,8 +395,6 @@ JSValueRef JSCallHistory::removeAll(JSContextRef context, JSObjectRef object, JS
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type missmatch error : Invalid private pointer");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, priv, CALL_HISTORY_FUNCTION_API_REMOVE_ALL);
-
        JSContextRef gContext = priv->getContext();
        Converter converter(context);
 
@@ -430,23 +438,26 @@ JSValueRef JSCallHistory::removeAll(JSContextRef context, JSObjectRef object, JS
 JSValueRef JSCallHistory::addChangeListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
        const JSValueRef arguments[], JSValueRef* exception) {
 
+       AceSecurityStatus status = CALLHISTORY_CHECK_ACCESS(
+                       CALL_HISTORY_FUNCTION_API_ADDLISTENER);
+
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
     try{
         ArgumentValidator validator(context, argumentCount, arguments);
 
         JSObjectRef observerObj = validator.toCallbackObject(0, false,"onadded","onchanged","onremoved",NULL);
 
+               if (argumentCount < 1) {
+                       return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type missmatch error");
+               }
+
                JSCallHistoryPriv *priv = static_cast<JSCallHistoryPriv*> (JSObjectGetPrivate(thisObject));
 
                if (!priv) {
                        return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type missmatch error : Invalid private pointer");
                }
 
-               TIZEN_CHECK_ACCESS(context, exception, priv, CALL_HISTORY_FUNCTION_API_ADDLISTENER);
-
-               if (argumentCount < 1) {
-                       return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type missmatch error");
-               }
-
                JSContextRef gContext = priv->getContext();
                Converter converter(context);
 
@@ -483,6 +494,10 @@ JSValueRef JSCallHistory::addChangeListener(JSContextRef context, JSObjectRef ob
 JSValueRef JSCallHistory::removeChangeListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
        const JSValueRef arguments[], JSValueRef* exception) {
 
+       AceSecurityStatus status = CALLHISTORY_CHECK_ACCESS(
+                       CALL_HISTORY_FUNCTION_API_REMOVELISTENER);
+
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
        long handle = 0;
 
     try{
@@ -496,8 +511,6 @@ JSValueRef JSCallHistory::removeChangeListener(JSContextRef context, JSObjectRef
                        return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type missmatch error : Invalid private pointer");
                }
 
-               TIZEN_CHECK_ACCESS(context, exception, priv, CALL_HISTORY_FUNCTION_API_REMOVELISTENER);
-
                JSContextRef gContext = priv->getContext();
 
                if (handle != 0) {
index 072fc3a..540a36b 100755 (executable)
 
 #include <JavaScriptCore/JavaScript.h>
 #include <CommonsJavaScript/PrivateObject.h>
-#include <Security.h>
 #include "ICallHistory.h"
 
-using namespace WrtDeviceApis::Commons;
-using namespace WrtDeviceApis::CommonsJavaScript;
-
 namespace DeviceAPI {
 namespace CallHistory {
 
-typedef PrivateObject<ICallHistoryPtr, NoOwnership> JSCallHistoryPrivObject;
-
-class JSCallHistoryPriv :
-       public JSCallHistoryPrivObject,
-       public DeviceAPI::Common::SecurityAccessor
-{
-public:
-       JSCallHistoryPriv(JSContextRef context, ICallHistoryPtr callHistory) :
-               JSCallHistoryPrivObject(context, callHistory),
-               DeviceAPI::Common::SecurityAccessor()
-       {
-       }
-
-       virtual ~JSCallHistoryPriv()
-       {
-       }
-};
+typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT<ICallHistoryPtr>::Type JSCallHistoryPriv;
 
 class JSCallHistory
 {
index 42a7a23..535f107 100755 (executable)
@@ -69,7 +69,7 @@ JSStaticValue JSCallHistoryEntry::m_property[] = {
        { 0, 0, 0, 0 }
 };
 
-const JSClassRef DLL_EXPORT JSCallHistoryEntry::getClassRef()
+const JSClassRef JSCallHistoryEntry::getClassRef()
 {
        if (!m_jsClassRef) {
                m_jsClassRef = JSClassCreate(&m_classInfo);
index 7bf70aa..c11a9c2 100755 (executable)
@@ -21,6 +21,7 @@
 #include <CommonsJavaScript/JSUtils.h>
 #include <CommonsJavaScript/JSCallbackManager.h>
 #include <JSWebAPIErrorFactory.h>
+#include "JSCallHistory.h"
 #include "Converter.h"
 #include "CallHistoryAsyncCallbackManager.h"
 #include <Logger.h>
index 53de37a..5f09245 100755 (executable)
@@ -22,7 +22,6 @@
 #include <Commons/FunctionDefinition.h>
 #include <Commons/FunctionDeclaration.h>
 #include <Commons/Exception.h>
-#include "plugin_config.h"
 
 #define CALL_HISTORY_FEATURE_API_READ "http://tizen.org/privilege/callhistory.read"
 #define CALL_HISTORY_FEATURE_API_WRITE "http://tizen.org/privilege/callhistory.write"
@@ -33,13 +32,24 @@ namespace CallHistory {
 const char* CALL_HISTORY_DEVICE_CAP_READ = "callhistory.read";
 const char* CALL_HISTORY_DEVICE_CAP_WRITE = "callhistory.write";
 
+const char* CALL_HISTORY_FUNCTION_API_FIND = "find";
+const char* CALL_HISTORY_FUNCTION_API_REMOVE = "remove";
+const char* CALL_HISTORY_FUNCTION_API_REMOVE_BATCH = "removeBatch";
+const char* CALL_HISTORY_FUNCTION_API_REMOVE_ALL = "removeAll";
+const char* CALL_HISTORY_FUNCTION_API_ADDLISTENER = "addListener";
+const char* CALL_HISTORY_FUNCTION_API_REMOVELISTENER = "removeListener";
+
 
 static WrtDeviceApis::Commons::FunctionMapping createCallHistoryFunctions();
 
 static WrtDeviceApis::Commons::FunctionMapping CallHistoryFunctions = createCallHistoryFunctions();
 
+#pragma GCC visibility push(default)
+
 DEFINE_FUNCTION_GETTER(CallHistory, CallHistoryFunctions);
 
+#pragma GCC visibility pop
+
 static WrtDeviceApis::Commons::FunctionMapping createCallHistoryFunctions()
 {
        using namespace WrtDeviceApis::Commons;
index cd206c0..327ce5d 100755 (executable)
 #define _CALLHISTORY_PLUGIN_CONFIG_H_
 
 #include <Commons/FunctionDeclaration.h>
-#include "plugin_config_impl.h"
 
 namespace DeviceAPI {
 namespace CallHistory {
 
+extern const char* CALL_HISTORY_FUNCTION_API_FIND;
+extern const char* CALL_HISTORY_FUNCTION_API_REMOVE;
+extern const char* CALL_HISTORY_FUNCTION_API_REMOVE_BATCH;
+extern const char* CALL_HISTORY_FUNCTION_API_REMOVE_ALL;
+extern const char* CALL_HISTORY_FUNCTION_API_ADDLISTENER;
+extern const char* CALL_HISTORY_FUNCTION_API_REMOVELISTENER;
+
 DECLARE_FUNCTION_GETTER(CallHistory);
 
+}
+}
+
+namespace WrtDeviceApis {
+namespace Commons {
+
 #define CALLHISTORY_CHECK_ACCESS(functionName) \
     WrtDeviceApis::Commons::aceCheckAccess<AceFunctionGetter, \
     WrtDeviceApis::Commons::DefaultArgsVerifier<> >(                \
diff --git a/src/Callhistory/plugin_config_impl.h b/src/Callhistory/plugin_config_impl.h
deleted file mode 100755 (executable)
index ac3a3de..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-//
-// Tizen Web Device API
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-
-#ifndef _CALLHISTORY_PLUGIN_CONFIG_IMPL_H_
-#define _CALLHISTORY_PLUGIN_CONFIG_IMPL_H_
-
-#define CALL_HISTORY_FUNCTION_API_FIND "find"
-#define CALL_HISTORY_FUNCTION_API_REMOVE "remove"
-#define CALL_HISTORY_FUNCTION_API_REMOVE_BATCH "removeBatch"
-#define CALL_HISTORY_FUNCTION_API_REMOVE_ALL "removeAll"
-#define CALL_HISTORY_FUNCTION_API_ADDLISTENER "addListener"
-#define CALL_HISTORY_FUNCTION_API_REMOVELISTENER "removeListener"
-
-#endif // _CALLHISTORY_PLUGIN_CONFIG_IMPL_H_
index 0f9a7fd..85d7500 100755 (executable)
@@ -19,8 +19,6 @@
 #include <Commons/WrtAccess/WrtAccess.h>
 #include <Commons/Exception.h>
 #include <TimeTracer.h>
-#include <Security.h>
-#include "plugin_config.h"
 #include "JSCallHistory.h"
 #include "CallHistoryAsyncCallbackManager.h"
 #include "CallHistoryListenerManager.h"
@@ -34,28 +32,6 @@ namespace CallHistory {
 using namespace WrtDeviceApis::Commons;
 using namespace WrtDeviceApis::CommonsJavaScript;
 
-AceSecurityStatus callhistoryAceCheckAccessFunction(const char* functionName)
-{
-    return CALLHISTORY_CHECK_ACCESS(functionName);
-}
-
-DEFINE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor);
-
-DEFINE_SECURITY_ACCESSOR_SETTER(AceCheckerCallhistorySetter,
-                                                                                               JSCallHistoryPriv,
-                                                                                               gSecurityAccessor);
-
-class_definition_options_t option =
-{
-        JS_CLASS,
-        NONE,
-        ALWAYS_NOTICE,
-        IGNORED,
-        AceCheckerCallhistorySetter,
-        NULL,
-        NULL
-};
-
 void on_widget_start_callback(int widgetId) {
        LoggerD("[Tizen\\callhistory] on_widget_start_callback");
        TIME_TRACER_INIT();
@@ -64,7 +40,6 @@ void on_widget_start_callback(int widgetId) {
        } catch(WrtDeviceApis::Commons::Exception) {
                LoggerE("WrtAccess initialization failed");
        }
-       INITAILIZE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor, callhistoryAceCheckAccessFunction);
 }
 
 void on_widget_stop_callback(int widgetId) {
@@ -76,7 +51,6 @@ 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)
@@ -102,7 +76,7 @@ PLUGIN_CLASS_MAP_BEGIN
         WRT_JS_EXTENSION_OBJECT_TIZEN,
         CALLHISTORY,
         (js_class_template_getter)DeviceAPI::CallHistory::JSCallHistory::getClassRef,
-        &option)
+        NULL)
 PLUGIN_CLASS_MAP_END
 
 } // CallHistory
index 30ae6c4..0bde2fc 100644 (file)
@@ -44,7 +44,6 @@ AddressBookController::AddressBookController(JSContextRef context, AddressBookPt
                EventAddressBookRemoveBatchEventAnswerReceiver(ThreadEnum::NULL_THREAD),
                EventAddressBookFindEventAnswerReceiver(ThreadEnum::NULL_THREAD),
                EventAddressBookChangeListenerListener(ThreadEnum::NULL_THREAD),
-               DeviceAPI::Common::SecurityAccessor(),
                AddressBookPrivObject(context, addressBook)
 {
        LoggerD("AddressBookController constructed : " << this);
index 75c5bc1..7cbc8b7 100755 (executable)
@@ -31,7 +31,6 @@
 #include <CommonsJavaScript/PrivateObject.h>
 #include <CommonsJavaScript/JSPendingOperationPrivateObject.h>
 #include <CommonsJavaScript/JSPendingOperation.h>
-#include <Security.h>
 #include "IAddressBook.h"
 
 namespace DeviceAPI {
@@ -52,7 +51,6 @@ class AddressBookController :
        public EventAddressBookRemoveBatchEventAnswerReceiver,
        public EventAddressBookFindEventAnswerReceiver,
        public EventAddressBookChangeListenerListener,
-       public DeviceAPI::Common::SecurityAccessor,
        public AddressBookPrivObject
 {
 public:
index b4b8634..5dc9cae 100755 (executable)
@@ -1,6 +1,7 @@
 SET(TARGET_NAME ${contact_target})
 SET(DESTINATION_NAME ${contact_dest})
 SET(TARGET_IMPL_NAME ${contact_impl})
+SET(TARGET_CONFIG_NAME ${contact_config})
 
 PKG_CHECK_MODULES(platform_pkgs_contact REQUIRED contacts-service2 libpcrecpp)
 
@@ -79,8 +80,17 @@ TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
        ${platform_pkgs_contact_LIBRARIES}
 )
 
-SET(SRCS
+SET(SRCS_CONFIG
        plugin_config.cpp
+)
+
+ADD_LIBRARY(${TARGET_CONFIG_NAME} SHARED ${SRCS_CONFIG})
+
+TARGET_LINK_LIBRARIES(${TARGET_CONFIG_NAME}
+       ${LIBS_COMMON}
+)
+
+SET(SRCS
        plugin_initializer.cpp
 )
 
@@ -88,9 +98,10 @@ ADD_LIBRARY(${TARGET_NAME} SHARED ${SRCS})
 
 TARGET_LINK_LIBRARIES(${TARGET_NAME}
        ${TARGET_IMPL_NAME}
+       ${TARGET_CONFIG_NAME}
 )
 
-INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
+INSTALL(TARGETS ${TARGET_NAME} ${TARGET_CONFIG_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(
        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/contact
index 795c371..be05585 100755 (executable)
@@ -160,11 +160,10 @@ ContactConverter::~ContactConverter()
 {
 }
 
-JSValueRef ContactConverter::toJSValueRef(const AddressBookPtr &arg, const DeviceAPI::Common::SecurityAccessor *securityAccessor)
+JSValueRef ContactConverter::toJSValueRef(const AddressBookPtr &arg)
 {
        // It may not used
        AddressBookController *priv = new AddressBookController(m_context, arg);
-       priv->copyAceCheckAccessFunction(securityAccessor);
        return JSObjectMake(m_context, JSAddressBook::getClassRef(), priv);
 }
 
@@ -176,7 +175,7 @@ AddressBookPtr ContactConverter::toAddressBook(const JSValueRef &jsValue)
        return JSAddressBook::getAddressBook(m_context, jsValue);
 }
 
-JSValueRef ContactConverter::toJSValueRef(const AddressBookArrayPtr &arg, const DeviceAPI::Common::SecurityAccessor *securityAccessor)
+JSValueRef ContactConverter::toJSValueRef(const AddressBookArrayPtr &arg)
 {
        int size = arg->size();
 
@@ -186,7 +185,7 @@ JSValueRef ContactConverter::toJSValueRef(const AddressBookArrayPtr &arg, const
 
        for(int i = 0; i < size; i++)
        {
-               JSValueRef jsvalue = toJSValueRef(arg->at(i), securityAccessor);
+               JSValueRef jsvalue = toJSValueRef(arg->at(i));
                if (!JSSetArrayElement(m_context, resultObject, i, jsvalue))
                        ThrowMsg(ConversionException, "Can not fill address book array.");
        }
@@ -484,11 +483,9 @@ ContactArrayPtr ContactConverter::toContactArray(const JSValueRef &jsValue)
     return result;
 }
 
-JSValueRef ContactConverter::toJSValueRef(const PersonPtr &arg, const DeviceAPI::Common::SecurityAccessor *securityAccessor)
+JSValueRef ContactConverter::toJSValueRef(const PersonPtr &arg)
 {
-       JSPersonPriv *priv = new JSPersonPriv(m_context, arg);
-       priv->copyAceCheckAccessFunction(securityAccessor);
-       return JSObjectMake(m_context, JSPerson::getClassRef(), priv);
+       return WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(m_context, JSPerson::getClassRef(), arg);
 }
 
 PersonPtr ContactConverter::toPerson(const JSValueRef &jsValue)
@@ -502,7 +499,7 @@ PersonPtr ContactConverter::toPerson(const JSValueRef &jsValue)
        return JSPerson::getPerson(m_context, jsValue);
 }
 
-JSValueRef ContactConverter::toJSValueRef(const PersonArrayPtr &arg, const DeviceAPI::Common::SecurityAccessor *securityAccessor)
+JSValueRef ContactConverter::toJSValueRef(const PersonArrayPtr &arg)
 {
        int size = arg->size();
 
@@ -512,7 +509,7 @@ JSValueRef ContactConverter::toJSValueRef(const PersonArrayPtr &arg, const Devic
 
        for(int i = 0; i < size; i++)
        {
-               JSValueRef jsvalue = toJSValueRef(arg->at(i), securityAccessor);
+               JSValueRef jsvalue = toJSValueRef(arg->at(i));
                if (!JSSetArrayElement(m_context, resultObject, i, jsvalue))
                        ThrowMsg(ConversionException, "Can not add object to array.");
        }
index 2c94377..2a9811e 100755 (executable)
@@ -42,7 +42,6 @@
 #include "ContactEmailAddress.h"
 #include <ArgumentValidator.h>
 #include <JSWebAPIErrorFactory.h>
-#include <Security.h>
 #include <JSUtil.h>
 #include <Export.h>
 
@@ -57,10 +56,10 @@ public:
        explicit ContactConverter(JSContextRef context);
        virtual ~ContactConverter();
 
-       JSValueRef toJSValueRef(const AddressBookPtr &arg, const DeviceAPI::Common::SecurityAccessor *securityAccessor);
+       JSValueRef toJSValueRef(const AddressBookPtr &arg);
        AddressBookPtr toAddressBook(const JSValueRef &jsValue);
 
-       JSValueRef toJSValueRef(const AddressBookArrayPtr &arg, const DeviceAPI::Common::SecurityAccessor *securityAccessor);
+       JSValueRef toJSValueRef(const AddressBookArrayPtr &arg);
        AddressBookArrayPtr toAddressBookArray(const JSValueRef &jsValue);
 
        JSValueRef toJSValueRef(const ContactPtr &arg);
@@ -76,10 +75,10 @@ public:
        JSValueRef toJSValueRef(const ContactGroupArrayPtr &arg);
        ContactGroupArrayPtr toContactGroupArray(const JSValueRef &jsValue);
 
-       JSValueRef toJSValueRef(const PersonPtr &arg, const DeviceAPI::Common::SecurityAccessor *securityAccessor);
+       JSValueRef toJSValueRef(const PersonPtr &arg);
        PersonPtr toPerson(const JSValueRef &jsValue);
 
-       JSValueRef toJSValueRef(const PersonArrayPtr &arg, const DeviceAPI::Common::SecurityAccessor *securityAccessor);
+       JSValueRef toJSValueRef(const PersonArrayPtr &arg);
        PersonArrayPtr toPersonArray(const JSValueRef &jsValue);
 
        JSValueRef toJSValueRef(const ContactRefPtr &arg);
index 18dd887..9589896 100644 (file)
@@ -44,7 +44,6 @@ ContactManagerController::ContactManagerController(JSContextRef context, Contact
                EventContactManagerRemoveBatchAnswerReceiver(ThreadEnum::NULL_THREAD),
                EventContactManagerFindAnswerReceiver(ThreadEnum::NULL_THREAD),
                EventContactManagerChangeListenerListener(ThreadEnum::NULL_THREAD),
-               SecurityAccessor(),
                ContactManagerPrivObject(context, contactManager)
 {
        LoggerD("ContactManagerController constructed : " << this);
@@ -55,7 +54,7 @@ ContactManagerController::~ContactManagerController()
        LoggerD("ContactManagerController destructed : " << this);
 }
 
-void ContactManagerAsyncAnswerHandler::getAddressBooks(const EventContactManagerGetAddressBooksPtr &event, SecurityAccessor *securityAccessor)
+void ContactManagerAsyncAnswerHandler::getAddressBooks(const EventContactManagerGetAddressBooksPtr &event)
 {
        LoggerD("entered");
        JSCallbackManagerPtr callbackManager =
@@ -104,7 +103,7 @@ void ContactManagerAsyncAnswerHandler::getAddressBooks(const EventContactManager
                ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
                AddressBookArrayPtr addressBooks = event->getAddressBooks();
 
-               JSValueRef result = converter->toJSValueRef(addressBooks, securityAccessor);
+               JSValueRef result = converter->toJSValueRef(addressBooks);
 
                callbackManager->callOnSuccess(result);
                return;
@@ -225,7 +224,7 @@ void ContactManagerAsyncAnswerHandler::removeBatch(const EventContactManagerRemo
        callbackManager->callOnSuccess();
 }
 
-void ContactManagerAsyncAnswerHandler::find(const EventContactManagerFindPtr &event, SecurityAccessor *securityAccessor)
+void ContactManagerAsyncAnswerHandler::find(const EventContactManagerFindPtr &event)
 {
        LoggerD("entered");
        JSCallbackManagerPtr callbackManager =
@@ -275,7 +274,7 @@ void ContactManagerAsyncAnswerHandler::find(const EventContactManagerFindPtr &ev
                ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
                PersonArrayPtr contacts = event->getPersons();
 
-               JSValueRef result = converter->toJSValueRef(contacts, securityAccessor);
+               JSValueRef result = converter->toJSValueRef(contacts);
 
                callbackManager->callOnSuccess(result);
                return;
@@ -310,7 +309,7 @@ void ContactManagerAsyncAnswerHandler::changeListenerError(const EventContactMan
        cbm->callOnError(errorObject);
 }
 
-void ContactManagerAsyncAnswerHandler::changeListenerPersonAdded(const EventContactManagerChangeListenerPtr &event, SecurityAccessor *securityAccessor)
+void ContactManagerAsyncAnswerHandler::changeListenerPersonAdded(const EventContactManagerChangeListenerPtr &event)
 {
        LoggerD("entered");
        JSContactManagerChangeCallbackManagerPtr cbm =
@@ -341,7 +340,7 @@ void ContactManagerAsyncAnswerHandler::changeListenerPersonAdded(const EventCont
 
        JSValueRef contacts;
        Try {
-               contacts = converter->toJSValueRef(eventInfo->getPersons(), securityAccessor);
+               contacts = converter->toJSValueRef(eventInfo->getPersons());
        } Catch (Exception) {
                LoggerE("Conversion error");
                return;
@@ -350,7 +349,7 @@ void ContactManagerAsyncAnswerHandler::changeListenerPersonAdded(const EventCont
        cbm->callOnPersonsAdded(contacts);
 }
 
-void ContactManagerAsyncAnswerHandler::changeListenerPersonUpdated(const EventContactManagerChangeListenerPtr &event, SecurityAccessor *securityAccessor)
+void ContactManagerAsyncAnswerHandler::changeListenerPersonUpdated(const EventContactManagerChangeListenerPtr &event)
 {
        LoggerD("entered");
        JSContactManagerChangeCallbackManagerPtr cbm =
@@ -381,7 +380,7 @@ void ContactManagerAsyncAnswerHandler::changeListenerPersonUpdated(const EventCo
 
        JSValueRef contacts;
        Try {
-               contacts = converter->toJSValueRef(eventInfo->getPersons(), securityAccessor);
+               contacts = converter->toJSValueRef(eventInfo->getPersons());
        } Catch (Exception) {
                LoggerE("Conversion error");
                return;
@@ -431,7 +430,7 @@ void ContactManagerAsyncAnswerHandler::changeListenerPersonRemoved(const EventCo
 
 void ContactManagerController::OnAnswerReceived(const EventContactManagerGetAddressBooksPtr &event)
 {
-       ContactManagerAsyncAnswerHandler::getAddressBooks(event, this);
+       ContactManagerAsyncAnswerHandler::getAddressBooks(event);
 }
 
 void ContactManagerController::OnAnswerReceived(const EventContactManagerUpdateBatchPtr &event)
@@ -446,7 +445,7 @@ void ContactManagerController::OnAnswerReceived(const EventContactManagerRemoveB
 
 void ContactManagerController::OnAnswerReceived(const EventContactManagerFindPtr &event)
 {
-       ContactManagerAsyncAnswerHandler::find(event, this);
+       ContactManagerAsyncAnswerHandler::find(event);
 }
 
 void ContactManagerController::onAnswerReceived(const EventContactManagerChangeListenerPtr &event)
@@ -460,9 +459,9 @@ void ContactManagerController::onAnswerReceived(const EventContactManagerChangeL
 
        EventInfoContactManagerChange::CallbackType type = eventInfo->getCallbackType();
        if(type == EventInfoContactManagerChange::OnPersonsAdded)
-               ContactManagerAsyncAnswerHandler::changeListenerPersonAdded(event, this);
+               ContactManagerAsyncAnswerHandler::changeListenerPersonAdded(event);
        else if(type == EventInfoContactManagerChange::OnPersonsUpdated)
-               ContactManagerAsyncAnswerHandler::changeListenerPersonUpdated(event, this);
+               ContactManagerAsyncAnswerHandler::changeListenerPersonUpdated(event);
        else if(type == EventInfoContactManagerChange::OnPersonsRemoved)
                ContactManagerAsyncAnswerHandler::changeListenerPersonRemoved(event);
        else if(type == EventInfoContactManagerChange::OnError)
index e9b7fbf..0b9e9d4 100755 (executable)
@@ -28,7 +28,6 @@
 #include <dpl/shared_ptr.h>
 #include <CommonsJavaScript/PrivateObject.h>
 #include <CommonsJavaScript/JSPendingOperationPrivateObject.h>
-#include <Security.h>
 #include "IContactManager.h"
 
 namespace DeviceAPI {
@@ -49,7 +48,6 @@ class ContactManagerController :
        public EventContactManagerRemoveBatchAnswerReceiver,
        public EventContactManagerFindAnswerReceiver,
        public EventContactManagerChangeListenerListener,
-       public DeviceAPI::Common::SecurityAccessor,
     public ContactManagerPrivObject
 {
 private:
@@ -74,13 +72,13 @@ typedef DPL::SharedPtr<ContactManagerController> ContactManagerControllerPtr;
 class ContactManagerAsyncAnswerHandler
 {
 public:
-       static void getAddressBooks(const EventContactManagerGetAddressBooksPtr &event, DeviceAPI::Common::SecurityAccessor *securityAccessor);
+       static void getAddressBooks(const EventContactManagerGetAddressBooksPtr &event);
        static void updateBatch(const EventContactManagerUpdateBatchPtr &event);
        static void removeBatch(const EventContactManagerRemoveBatchPtr &event);
-       static void find(const EventContactManagerFindPtr &event, DeviceAPI::Common::SecurityAccessor *securityAccessor);
+       static void find(const EventContactManagerFindPtr &event);
        static void changeListenerError(const EventContactManagerChangeListenerPtr &event);
-       static void changeListenerPersonAdded(const EventContactManagerChangeListenerPtr &event, DeviceAPI::Common::SecurityAccessor *securityAccessor);
-       static void changeListenerPersonUpdated(const EventContactManagerChangeListenerPtr &event, DeviceAPI::Common::SecurityAccessor *securityAccessor);
+       static void changeListenerPersonAdded(const EventContactManagerChangeListenerPtr &event);
+       static void changeListenerPersonUpdated(const EventContactManagerChangeListenerPtr &event);
        static void changeListenerPersonRemoved(const EventContactManagerChangeListenerPtr &event);
 };
 
index 3fac6f4..e6bd7ed 100755 (executable)
@@ -36,7 +36,7 @@
 #include "EventAddressBookFind.h"
 #include "EventAddressBookChangeListener.h"
 #include "EventAddressBookRemoveBatch.h"
-#include "plugin_config_impl.h"
+#include "plugin_config.h"
 #include "JSAddressBook.h"
 #include "JSContact.h"
 #include "JSContactGroup.h"
@@ -50,7 +50,6 @@
 #include <JSWebAPIErrorFactory.h>
 #include <JSUtil.h>
 #include <TimeTracer.h>
-#include <Security.h>
 #include <Logger.h>
 #include "ContactUtility.h"
 
@@ -292,7 +291,8 @@ JSValueRef JSAddressBook::get(JSContextRef context,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, controller, CONTACT_FUNCTION_API_ADDRESS_BOOK_GET);
+       AceSecurityStatus status = CONTACT_CHECK_ACCESS(CONTACT_FUNCTION_API_ADDRESS_BOOK_GET);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        string id;
 
@@ -384,7 +384,8 @@ JSValueRef JSAddressBook::add(JSContextRef context,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, controller, CONTACT_FUNCTION_API_ADDRESS_BOOK_ADD);
+       AceSecurityStatus status = CONTACT_CHECK_ACCESS(CONTACT_FUNCTION_API_ADDRESS_BOOK_ADD);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        try {
                ArgumentValidator validator(context, argumentCount, arguments);
@@ -471,7 +472,8 @@ JSValueRef JSAddressBook::addBatch(JSContextRef context,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, controller, CONTACT_FUNCTION_API_ADDRESS_BOOK_ADD_BATCH);
+       AceSecurityStatus status = CONTACT_CHECK_ACCESS(CONTACT_FUNCTION_API_ADDRESS_BOOK_ADD_BATCH);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        try {
                ArgumentValidator validator(context, argumentCount, arguments);
@@ -560,7 +562,8 @@ JSValueRef JSAddressBook::update(JSContextRef context,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, controller, CONTACT_FUNCTION_API_ADDRESS_BOOK_UPDATE);
+       AceSecurityStatus status = CONTACT_CHECK_ACCESS(CONTACT_FUNCTION_API_ADDRESS_BOOK_UPDATE);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        try {
                ArgumentValidator validator(context, argumentCount, arguments);
@@ -651,7 +654,8 @@ JSValueRef JSAddressBook::updateBatch(JSContextRef context,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, controller, CONTACT_FUNCTION_API_ADDRESS_BOOK_UPDATE_BATCH);
+       AceSecurityStatus status = CONTACT_CHECK_ACCESS(CONTACT_FUNCTION_API_ADDRESS_BOOK_UPDATE_BATCH);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        try {
                ArgumentValidator validator(context, argumentCount, arguments);
@@ -739,7 +743,8 @@ JSValueRef JSAddressBook::remove(JSContextRef context,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, controller, CONTACT_FUNCTION_API_ADDRESS_BOOK_REMOVE);
+       AceSecurityStatus status = CONTACT_CHECK_ACCESS(CONTACT_FUNCTION_API_ADDRESS_BOOK_REMOVE);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        ArgumentValidator validator(context, argumentCount, arguments);
        string contactId;
@@ -820,7 +825,8 @@ JSValueRef JSAddressBook::removeBatch(JSContextRef context,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, controller, CONTACT_FUNCTION_API_ADDRESS_BOOK_REMOVE_BATCH);
+       AceSecurityStatus status = CONTACT_CHECK_ACCESS(CONTACT_FUNCTION_API_ADDRESS_BOOK_REMOVE_BATCH);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        try {
                ArgumentValidator validator(context, argumentCount, arguments);
@@ -913,7 +919,8 @@ JSValueRef JSAddressBook::find(JSContextRef context,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, controller, CONTACT_FUNCTION_API_ADDRESS_BOOK_FIND);
+       AceSecurityStatus status = CONTACT_CHECK_ACCESS(CONTACT_FUNCTION_API_ADDRESS_BOOK_FIND);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        try {
                ArgumentValidator validator(context, argumentCount, arguments);
@@ -1024,7 +1031,8 @@ JSValueRef JSAddressBook::addChangeListener(JSContextRef context,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, controller, CONTACT_FUNCTION_API_ADDRESS_BOOK_ADD_CHANGE_LISTENER);
+       AceSecurityStatus status = CONTACT_CHECK_ACCESS(CONTACT_FUNCTION_API_ADDRESS_BOOK_ADD_CHANGE_LISTENER);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        BasicValidator validator = BasicValidatorFactory::getValidator(context, exception);
        try {
@@ -1162,7 +1170,8 @@ JSValueRef JSAddressBook::removeChangeListener(JSContextRef context,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, controller, CONTACT_FUNCTION_API_ADDRESS_BOOK_REMOVE_CHANGE_LISTENER);
+       AceSecurityStatus status = CONTACT_CHECK_ACCESS(CONTACT_FUNCTION_API_ADDRESS_BOOK_REMOVE_CHANGE_LISTENER);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        long watchId = 0;
        string id;
@@ -1242,7 +1251,8 @@ JSValueRef JSAddressBook::getGroup(JSContextRef context,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, controller, CONTACT_FUNCTION_API_ADDRESS_BOOK_GET_GROUP);
+       AceSecurityStatus status = CONTACT_CHECK_ACCESS(CONTACT_FUNCTION_API_ADDRESS_BOOK_GET_GROUP);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        string id;
 
@@ -1339,7 +1349,8 @@ JSValueRef JSAddressBook::addGroup(JSContextRef context,
                                JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, controller, CONTACT_FUNCTION_API_ADDRESS_BOOK_ADD_GROUP);
+       AceSecurityStatus status = CONTACT_CHECK_ACCESS(CONTACT_FUNCTION_API_ADDRESS_BOOK_ADD_GROUP);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        try {
                ArgumentValidator validator(context, argumentCount, arguments);
@@ -1425,7 +1436,8 @@ JSValueRef JSAddressBook::updateGroup(JSContextRef context,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, controller, CONTACT_FUNCTION_API_ADDRESS_BOOK_UPDATE_GROUP);
+       AceSecurityStatus status = CONTACT_CHECK_ACCESS(CONTACT_FUNCTION_API_ADDRESS_BOOK_UPDATE_GROUP);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        try {
                ArgumentValidator validator(context, argumentCount, arguments);
@@ -1515,7 +1527,8 @@ JSValueRef JSAddressBook::removeGroup(JSContextRef context,
                                JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, controller, CONTACT_FUNCTION_API_ADDRESS_BOOK_REMOVE_GROUP);
+       AceSecurityStatus status = CONTACT_CHECK_ACCESS(CONTACT_FUNCTION_API_ADDRESS_BOOK_REMOVE_GROUP);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        string groupId;
 
@@ -1599,7 +1612,8 @@ JSValueRef JSAddressBook::getGroups(JSContextRef context,
                                JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, controller, CONTACT_FUNCTION_API_ADDRESS_BOOK_GET_GROUPS);
+       AceSecurityStatus status = CONTACT_CHECK_ACCESS(CONTACT_FUNCTION_API_ADDRESS_BOOK_GET_GROUPS);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        string id;
 
index 07baef3..92616f5 100755 (executable)
@@ -26,6 +26,7 @@
 #include <CommonsJavaScript/Validator.h>
 #include <SecurityExceptions.h>
 #include "ContactFactory.h"
+#include "plugin_config.h"
 #include "ContactConverter.h"
 #include "JSContact.h"
 #include "Contact.h"
index 3961ae6..601d06d 100755 (executable)
@@ -34,7 +34,7 @@
 #include <FilterConverter.h>
 #include "ContactFactory.h"
 #include "ContactTypes.h"
-#include "plugin_config_impl.h"
+#include "plugin_config.h"
 #include "ContactManagerController.h"
 #include "ContactAsyncCallbackManager.h"
 #include "ContactListenerManager.h"
@@ -158,7 +158,8 @@ JSValueRef JSContactManager::getAddressBooks(JSContextRef context,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, controller, CONTACT_FUNCTION_API_CONTACT_MANAGER_GET_ADDRESS_BOOKS);
+       AceSecurityStatus status = CONTACT_CHECK_ACCESS(CONTACT_FUNCTION_API_CONTACT_MANAGER_GET_ADDRESS_BOOKS);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        BasicValidator validator = BasicValidatorFactory::getValidator(context, exception);
        try {
@@ -224,7 +225,8 @@ JSValueRef JSContactManager::getDefaultAddressBook(JSContextRef context,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, priv, CONTACT_FUNCTION_API_CONTACT_MANAGER_GET_DEFAULT_ADDRESS_BOOK);
+       AceSecurityStatus status = CONTACT_CHECK_ACCESS(CONTACT_FUNCTION_API_CONTACT_MANAGER_GET_DEFAULT_ADDRESS_BOOK);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        ContactManagerPtr contactManager;
        JSContextRef gContext;
@@ -273,7 +275,7 @@ JSValueRef JSContactManager::getDefaultAddressBook(JSContextRef context,
 
        JSValueRef resultValue;
        Try {
-               resultValue = converter->toJSValueRef(defaultAddressBook, priv);
+               resultValue = converter->toJSValueRef(defaultAddressBook);
        } Catch(Exception){
                LoggerE("Conversion error.");
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Internal error");
@@ -299,7 +301,8 @@ JSValueRef JSContactManager::getUnifiedAddressBook(JSContextRef context,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, priv, CONTACT_FUNCTION_API_CONTACT_MANAGER_GET_UNIFIED_ADDRESS_BOOK);
+       AceSecurityStatus status = CONTACT_CHECK_ACCESS(CONTACT_FUNCTION_API_CONTACT_MANAGER_GET_UNIFIED_ADDRESS_BOOK);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        ContactManagerPtr contactManager;
        JSContextRef gContext;
@@ -348,7 +351,7 @@ JSValueRef JSContactManager::getUnifiedAddressBook(JSContextRef context,
 
        JSValueRef resultValue;
        Try {
-               resultValue = converter->toJSValueRef(unifiedAddressBook, priv);
+               resultValue = converter->toJSValueRef(unifiedAddressBook);
        } Catch(Exception){
                LoggerE("Conversion error.");
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Internal error");
@@ -374,7 +377,8 @@ JSValueRef JSContactManager::getAddressBook(JSContextRef context,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, priv, CONTACT_FUNCTION_API_CONTACT_MANAGER_GET_ADDRESS_BOOK);
+       AceSecurityStatus status = CONTACT_CHECK_ACCESS(CONTACT_FUNCTION_API_CONTACT_MANAGER_GET_ADDRESS_BOOK);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        ContactManagerPtr contactManager;
        JSContextRef gContext;
@@ -438,7 +442,7 @@ JSValueRef JSContactManager::getAddressBook(JSContextRef context,
 
        JSValueRef resultValue;
        Try {
-               resultValue = converter->toJSValueRef(addressBook, priv);
+               resultValue = converter->toJSValueRef(addressBook);
        } Catch(Exception){
                LoggerE("Conversion error.");
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Internal error");
@@ -471,7 +475,8 @@ JSValueRef JSContactManager::get(JSContextRef context,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, controller, CONTACT_FUNCTION_API_CONTACT_MANAGER_GET);
+       AceSecurityStatus status = CONTACT_CHECK_ACCESS(CONTACT_FUNCTION_API_CONTACT_MANAGER_GET);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        std::string id;
 
@@ -528,7 +533,7 @@ JSValueRef JSContactManager::get(JSContextRef context,
 
        JSValueRef result;
        Try {
-               result = converter->toJSValueRef(person, controller);
+               result = converter->toJSValueRef(person);
        } Catch(Exception) {
                LoggerE("Error on conversion : " << _rethrown_exception.GetMessage());
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Internal error");
@@ -561,7 +566,8 @@ JSValueRef JSContactManager::update(JSContextRef context,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, controller, CONTACT_FUNCTION_API_CONTACT_MANAGER_UPDATE);
+       AceSecurityStatus status = CONTACT_CHECK_ACCESS(CONTACT_FUNCTION_API_CONTACT_MANAGER_UPDATE);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        try {
                ArgumentValidator validator(context, argumentCount, arguments);
@@ -652,7 +658,8 @@ JSValueRef JSContactManager::updateBatch(JSContextRef context,
                                JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, controller, CONTACT_FUNCTION_API_CONTACT_MANAGER_UPDATE_BATCH);
+       AceSecurityStatus status = CONTACT_CHECK_ACCESS(CONTACT_FUNCTION_API_CONTACT_MANAGER_UPDATE_BATCH);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        try {
                ArgumentValidator validator(context, argumentCount, arguments);
@@ -740,7 +747,8 @@ JSValueRef JSContactManager::remove(JSContextRef context,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, controller, CONTACT_FUNCTION_API_CONTACT_MANAGER_REMOVE);
+       AceSecurityStatus status = CONTACT_CHECK_ACCESS(CONTACT_FUNCTION_API_CONTACT_MANAGER_REMOVE);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        std::string personId;
 
@@ -828,7 +836,8 @@ JSValueRef JSContactManager::removeBatch(JSContextRef context,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, controller, CONTACT_FUNCTION_API_CONTACT_MANAGER_REMOVE_BATCH);
+       AceSecurityStatus status = CONTACT_CHECK_ACCESS(CONTACT_FUNCTION_API_CONTACT_MANAGER_REMOVE_BATCH);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        try {
                ArgumentValidator validator(context, argumentCount, arguments);
@@ -920,7 +929,8 @@ JSValueRef JSContactManager::find(JSContextRef context,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, controller, CONTACT_FUNCTION_API_CONTACT_MANAGER_FIND);
+       AceSecurityStatus status = CONTACT_CHECK_ACCESS(CONTACT_FUNCTION_API_CONTACT_MANAGER_FIND);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        try {
                ArgumentValidator validator(context, argumentCount, arguments);
@@ -1031,7 +1041,8 @@ JSValueRef JSContactManager::addChangeListener(JSContextRef context,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, controller, CONTACT_FUNCTION_API_CONTACT_MANAGER_ADD_CHANGE_LISTENER);
+       AceSecurityStatus status = CONTACT_CHECK_ACCESS(CONTACT_FUNCTION_API_CONTACT_MANAGER_ADD_CHANGE_LISTENER);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        BasicValidator validator = BasicValidatorFactory::getValidator(context, exception);
        try {
@@ -1170,7 +1181,8 @@ JSValueRef JSContactManager::removeChangeListener(JSContextRef context,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, controller, CONTACT_FUNCTION_API_CONTACT_MANAGER_REMOVE_CHANGE_LISTENER);
+       AceSecurityStatus status = CONTACT_CHECK_ACCESS(CONTACT_FUNCTION_API_CONTACT_MANAGER_REMOVE_CHANGE_LISTENER);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(context);
 
index 3b88f36..33ea99f 100755 (executable)
@@ -26,7 +26,7 @@
 #include <CommonsJavaScript/Validator.h>
 #include <SecurityExceptions.h>
 #include "ContactFactory.h"
-#include "plugin_config_impl.h"
+#include "plugin_config.h"
 #include "ContactConverter.h"
 #include "JSPerson.h"
 #include <ArgumentValidator.h>
@@ -485,16 +485,11 @@ JSValueRef JSPerson::link(JSContextRef context,
 {
        LoggerD("entered");
        TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
-       JSPersonPriv *priv = NULL;
        PersonPtr person(NULL);
 
        Try
        {
-               priv = static_cast<JSPersonPriv*>(JSObjectGetPrivate(thisObject));
-               if (!priv) {
-                       ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
-               }
-               person = priv->getObject();
+               person = getPrivData(thisObject);
                if (person == NULL)
                        ThrowMsg(InvalidArgumentException, "No private object.");
        }
@@ -505,7 +500,8 @@ JSValueRef JSPerson::link(JSContextRef context,
                                JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, priv, CONTACT_FUNCTION_API_PERSON_LINK);
+       AceSecurityStatus status = CONTACT_CHECK_ACCESS(CONTACT_FUNCTION_API_PERSON_LINK);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        ArgumentValidator validator(context, argumentCount, arguments);
        std::string personId;
@@ -581,16 +577,11 @@ JSValueRef JSPerson::unlink(JSContextRef context,
 {
        LoggerD("entered");
        TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
-       JSPersonPriv *priv = NULL;
        PersonPtr person(NULL);
 
        Try
        {
-               priv = static_cast<JSPersonPriv*>(JSObjectGetPrivate(thisObject));
-               if (!priv) {
-                       ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
-               }
-               person = priv->getObject();
+               person = getPrivData(thisObject);
                if (person == NULL)
                        ThrowMsg(InvalidArgumentException, "No private object.");
        }
@@ -601,7 +592,8 @@ JSValueRef JSPerson::unlink(JSContextRef context,
                                JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, priv, CONTACT_FUNCTION_API_PERSON_UNLINK);
+       AceSecurityStatus status = CONTACT_CHECK_ACCESS(CONTACT_FUNCTION_API_PERSON_UNLINK);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        ArgumentValidator validator(context, argumentCount, arguments);
        std::string contactId;
@@ -676,7 +668,7 @@ JSValueRef JSPerson::unlink(JSContextRef context,
        JSValueRef result;
        Try
        {
-               result = converter->toJSValueRef(unlinkedPerson, priv);
+               result = converter->toJSValueRef(unlinkedPerson);
        }
        Catch(Exception)
        {
index 109f1d6..68e7fd6 100755 (executable)
 #include <dpl/shared_ptr.h>
 #include <CommonsJavaScript/PrivateObject.h>
 #include <Commons/IEvent.h>
-#include <Security.h>
 #include "IPerson.h"
 
 namespace DeviceAPI {
 namespace Contact {
 
-typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<PersonPtr, WrtDeviceApis::CommonsJavaScript::NoOwnership> JSPersonPrivObject;
-
-class JSPersonPriv :
-       public DeviceAPI::Common::SecurityAccessor,
-       public JSPersonPrivObject
-{
-public:
-       JSPersonPriv(JSContextRef context, PersonPtr person) :
-               DeviceAPI::Common::SecurityAccessor(),
-               JSPersonPrivObject(context, person)
-       {
-       }
-
-       virtual ~JSPersonPriv()
-       {
-       }
-};
+typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<PersonPtr, WrtDeviceApis::CommonsJavaScript::NoOwnership> JSPersonPriv;
 
 class JSPerson {
 public:
index 83b46a6..c2aaeac 100755 (executable)
@@ -41,8 +41,12 @@ static FunctionMapping createContactFunctions();
 static FunctionMapping ContactFunctions =
     createContactFunctions();
 
+#pragma GCC visibility push(default)
+
 DEFINE_FUNCTION_GETTER(Contact, ContactFunctions);
 
+#pragma GCC visibility pop
+
 static FunctionMapping createContactFunctions()
 {
     /**
index 59717bb..f0c729e 100755 (executable)
 
 #include <string>
 #include <Commons/FunctionDeclaration.h>
-#include "plugin_config_impl.h"
 
 namespace DeviceAPI {
 namespace Contact {
 
+#define CONTACT_FUNCTION_API_CONTACT_MANAGER_GET_ADDRESS_BOOKS          "ContactManager.getAddressBooks"
+#define CONTACT_FUNCTION_API_CONTACT_MANAGER_GET_DEFAULT_ADDRESS_BOOK   "ContactManager.getDefaultAddressBook"
+#define CONTACT_FUNCTION_API_CONTACT_MANAGER_GET_UNIFIED_ADDRESS_BOOK   "ContactManager.getUnifiedAddressBook"
+#define CONTACT_FUNCTION_API_CONTACT_MANAGER_GET_ADDRESS_BOOK           "ContactManager.getAddressBook"
+#define CONTACT_FUNCTION_API_CONTACT_MANAGER_GET                        "ContactManager.get"
+#define CONTACT_FUNCTION_API_CONTACT_MANAGER_UPDATE                     "ContactManager.update"
+#define CONTACT_FUNCTION_API_CONTACT_MANAGER_UPDATE_BATCH               "ContactManager.updateBatch"
+#define CONTACT_FUNCTION_API_CONTACT_MANAGER_REMOVE                     "ContactManager.remove"
+#define CONTACT_FUNCTION_API_CONTACT_MANAGER_REMOVE_BATCH               "ContactManager.removeBatch"
+#define CONTACT_FUNCTION_API_CONTACT_MANAGER_FIND                       "ContactManager.find"
+#define CONTACT_FUNCTION_API_CONTACT_MANAGER_ADD_CHANGE_LISTENER        "ContactManager.addChangeListener"
+#define CONTACT_FUNCTION_API_CONTACT_MANAGER_REMOVE_CHANGE_LISTENER     "ContactManager.removeChangeListener"
+#define CONTACT_FUNCTION_API_ADDRESS_BOOK_GET                           "AddressBook.get"
+#define CONTACT_FUNCTION_API_ADDRESS_BOOK_ADD                           "AddressBook.add"
+#define CONTACT_FUNCTION_API_ADDRESS_BOOK_ADD_BATCH                     "AddressBook.addBatch"
+#define CONTACT_FUNCTION_API_ADDRESS_BOOK_UPDATE                        "AddressBook.update"
+#define CONTACT_FUNCTION_API_ADDRESS_BOOK_UPDATE_BATCH                  "AddressBook.updateBatch"
+#define CONTACT_FUNCTION_API_ADDRESS_BOOK_REMOVE                        "AddressBook.remove"
+#define CONTACT_FUNCTION_API_ADDRESS_BOOK_REMOVE_BATCH                  "AddressBook.removeBatch"
+#define CONTACT_FUNCTION_API_ADDRESS_BOOK_FIND                          "AddressBook.find"
+#define CONTACT_FUNCTION_API_ADDRESS_BOOK_ADD_CHANGE_LISTENER           "AddressBook.addChangeListener"
+#define CONTACT_FUNCTION_API_ADDRESS_BOOK_REMOVE_CHANGE_LISTENER        "AddressBook.removeChangeListener"
+#define CONTACT_FUNCTION_API_ADDRESS_BOOK_GET_GROUP                     "AddressBook.getGroup"
+#define CONTACT_FUNCTION_API_ADDRESS_BOOK_ADD_GROUP                     "AddressBook.addGroup"
+#define CONTACT_FUNCTION_API_ADDRESS_BOOK_UPDATE_GROUP                  "AddressBook.updateGroup"
+#define CONTACT_FUNCTION_API_ADDRESS_BOOK_REMOVE_GROUP                  "AddressBook.removeGroup"
+#define CONTACT_FUNCTION_API_ADDRESS_BOOK_GET_GROUPS                    "AddressBook.getGroups"
+#define CONTACT_FUNCTION_API_PERSON_LINK                                "AddressBook.link"
+#define CONTACT_FUNCTION_API_PERSON_UNLINK                              "AddressBook.unlink"
+
 DECLARE_FUNCTION_GETTER(Contact);
 
 #define CONTACT_CHECK_ACCESS(functionName)                     \
diff --git a/src/Contact/plugin_config_impl.h b/src/Contact/plugin_config_impl.h
deleted file mode 100755 (executable)
index e86c262..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-//
-// Tizen Web Device API
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-
-#ifndef _CONTACT_PLUGIN_CONFIG_IMPL_H_
-#define _CONTACT_PLUGIN_CONFIG_IMPL_H_
-
-#define CONTACT_FUNCTION_API_CONTACT_MANAGER_GET_ADDRESS_BOOKS          "ContactManager.getAddressBooks"
-#define CONTACT_FUNCTION_API_CONTACT_MANAGER_GET_DEFAULT_ADDRESS_BOOK   "ContactManager.getDefaultAddressBook"
-#define CONTACT_FUNCTION_API_CONTACT_MANAGER_GET_UNIFIED_ADDRESS_BOOK   "ContactManager.getUnifiedAddressBook"
-#define CONTACT_FUNCTION_API_CONTACT_MANAGER_GET_ADDRESS_BOOK           "ContactManager.getAddressBook"
-#define CONTACT_FUNCTION_API_CONTACT_MANAGER_GET                        "ContactManager.get"
-#define CONTACT_FUNCTION_API_CONTACT_MANAGER_UPDATE                     "ContactManager.update"
-#define CONTACT_FUNCTION_API_CONTACT_MANAGER_UPDATE_BATCH               "ContactManager.updateBatch"
-#define CONTACT_FUNCTION_API_CONTACT_MANAGER_REMOVE                     "ContactManager.remove"
-#define CONTACT_FUNCTION_API_CONTACT_MANAGER_REMOVE_BATCH               "ContactManager.removeBatch"
-#define CONTACT_FUNCTION_API_CONTACT_MANAGER_FIND                       "ContactManager.find"
-#define CONTACT_FUNCTION_API_CONTACT_MANAGER_ADD_CHANGE_LISTENER        "ContactManager.addChangeListener"
-#define CONTACT_FUNCTION_API_CONTACT_MANAGER_REMOVE_CHANGE_LISTENER     "ContactManager.removeChangeListener"
-#define CONTACT_FUNCTION_API_ADDRESS_BOOK_GET                           "AddressBook.get"
-#define CONTACT_FUNCTION_API_ADDRESS_BOOK_ADD                           "AddressBook.add"
-#define CONTACT_FUNCTION_API_ADDRESS_BOOK_ADD_BATCH                     "AddressBook.addBatch"
-#define CONTACT_FUNCTION_API_ADDRESS_BOOK_UPDATE                        "AddressBook.update"
-#define CONTACT_FUNCTION_API_ADDRESS_BOOK_UPDATE_BATCH                  "AddressBook.updateBatch"
-#define CONTACT_FUNCTION_API_ADDRESS_BOOK_REMOVE                        "AddressBook.remove"
-#define CONTACT_FUNCTION_API_ADDRESS_BOOK_REMOVE_BATCH                  "AddressBook.removeBatch"
-#define CONTACT_FUNCTION_API_ADDRESS_BOOK_FIND                          "AddressBook.find"
-#define CONTACT_FUNCTION_API_ADDRESS_BOOK_ADD_CHANGE_LISTENER           "AddressBook.addChangeListener"
-#define CONTACT_FUNCTION_API_ADDRESS_BOOK_REMOVE_CHANGE_LISTENER        "AddressBook.removeChangeListener"
-#define CONTACT_FUNCTION_API_ADDRESS_BOOK_GET_GROUP                     "AddressBook.getGroup"
-#define CONTACT_FUNCTION_API_ADDRESS_BOOK_ADD_GROUP                     "AddressBook.addGroup"
-#define CONTACT_FUNCTION_API_ADDRESS_BOOK_UPDATE_GROUP                  "AddressBook.updateGroup"
-#define CONTACT_FUNCTION_API_ADDRESS_BOOK_REMOVE_GROUP                  "AddressBook.removeGroup"
-#define CONTACT_FUNCTION_API_ADDRESS_BOOK_GET_GROUPS                    "AddressBook.getGroups"
-#define CONTACT_FUNCTION_API_PERSON_LINK                                "AddressBook.link"
-#define CONTACT_FUNCTION_API_PERSON_UNLINK                              "AddressBook.unlink"
-
-#endif // _CONTACT_PLUGIN_CONFIG_IMPL_H_
index 31c9b12..f1b519e 100644 (file)
@@ -25,7 +25,6 @@
 #include <Commons/plugin_initializer_def.h>
 #include <Commons/WrtAccess/WrtAccess.h>
 #include <TimeTracer.h>
-#include <Security.h>
 #include "JSContactManager.h"
 #include "JSContact.h"
 #include "JSContactGroup.h"
@@ -39,7 +38,6 @@
 #include "JSContactEmailAddress.h"
 #include "ContactAsyncCallbackManager.h"
 #include "ContactListenerManager.h"
-#include "plugin_config.h"
 #include <Logger.h>
 
 namespace DeviceAPI {
@@ -48,26 +46,6 @@ namespace Contact {
 using namespace WrtDeviceApis;
 using namespace WrtDeviceApis::Commons;
 
-AceSecurityStatus contactAceCheckAccessFunction(const char* functionName)
-{
-    return CONTACT_CHECK_ACCESS(functionName);
-}
-
-DEFINE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor);
-
-DEFINE_SECURITY_ACCESSOR_SETTER(AceCheckerContactSetter, ContactManagerController, gSecurityAccessor);
-
-class_definition_options_t option =
-{
-        JS_CLASS,
-        NONE,
-        ALWAYS_NOTICE,
-        IGNORED,
-        AceCheckerContactSetter,
-        NULL,
-        NULL
-};
-
 void on_widget_start_callback(int widgetId)
 {
     LoggerD("[Tizen\\contact] on_widget_start_callback (" << widgetId << ")");
@@ -80,8 +58,6 @@ void on_widget_start_callback(int widgetId)
     {
         LoggerE("WrtAccess initialization failed");
     }
-
-    INITAILIZE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor, contactAceCheckAccessFunction);
 }
 
 void on_widget_stop_callback(int widgetId)
@@ -97,8 +73,6 @@ void on_widget_stop_callback(int widgetId)
     {
         LoggerE("WrtAccess deinitialization failed");
     }
-
-    FINALIZE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor);
 }
 
 void on_frame_load_callback(const void * context)
@@ -123,7 +97,7 @@ PLUGIN_CLASS_MAP_BEGIN
     PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
                                "contact",
                                (js_class_template_getter)DeviceAPI::Contact::JSContactManager::getClassRef,
-                               &option)
+                               NULL)
     PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
                                "Contact",
                                (js_class_template_getter)DeviceAPI::Contact::JSContact::getClassRef,
index a52042e..a5d864b 100755 (executable)
@@ -33,7 +33,6 @@
 #include <JSWebAPIErrorFactory.h>
 #include <ArgumentValidator.h>
 #include <TimeTracer.h>
-#include <Security.h>
 
 #include "JSUtil.h"
 #include "ContentFactory.h"
@@ -44,7 +43,7 @@
 #include "JSVideo.h"
 #include "JSAudio.h"
 #include "ContentConverter.h"
-#include "plugin_config_impl.h"
+#include "plugin_config.h"
 #include "ContentAsyncCallbackManager.h"
 #include "ContentListener.h"
 #include "ContentVideo.h"
@@ -114,8 +113,8 @@ JSValueRef JSMediacontentManager::getFolders(
 {
     TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
 
-    MediacontentManagerPriv *privateObject;
-    privateObject = static_cast<MediacontentManagerPriv*>(JSObjectGetPrivate(thisObject));
+    MediacontentManagerPrivObject *privateObject;
+    privateObject = static_cast<MediacontentManagerPrivObject*>(JSObjectGetPrivate(thisObject));
     if (!privateObject) {
         DeviceAPI::Common::UnknownException err("Content's private object is NULL.");
         return JSWebAPIErrorFactory::postException(context, exception, err);
@@ -204,14 +203,16 @@ JSValueRef JSMediacontentManager::findItems(
 
     TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
 
-    MediacontentManagerPriv *privateObject;
-    privateObject = static_cast<MediacontentManagerPriv*>(JSObjectGetPrivate(thisObject));
+    MediacontentManagerPrivObject *privateObject;
+    privateObject = static_cast<MediacontentManagerPrivObject*>(JSObjectGetPrivate(thisObject));
     if(!privateObject) {
         DeviceAPI::Common::UnknownException err("Content's private object is NULL.");
         return JSWebAPIErrorFactory::postException(context, exception, err);
     }
 
-    TIZEN_CHECK_ACCESS(context, exception, privateObject, CONTENT_FUNCTION_API_FIND_ITEMS);
+    AceSecurityStatus status = CONTENT_CHECK_ACCESS(CONTENT_FUNCTION_API_FIND_ITEMS);
+
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     JSContextRef globalContext = GlobalContextManager::getInstance()->getGlobalContext(context);
 
@@ -343,15 +344,16 @@ JSValueRef JSMediacontentManager::updateItemsBatch(JSContextRef context,
         JSValueRef* exception)
 {
     TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
-    MediacontentManagerPriv *privateObject;
-    privateObject = static_cast<MediacontentManagerPriv*>(JSObjectGetPrivate(thisObject));
+    MediacontentManagerPrivObject *privateObject;
+    privateObject = static_cast<MediacontentManagerPrivObject*>(JSObjectGetPrivate(thisObject));
     if(!privateObject) {
         DeviceAPI::Common::UnknownException err("Content's private object is NULL.");
         return JSWebAPIErrorFactory::postException(context, exception, err);
     }
 
     JSContextRef globalContext = GlobalContextManager::getInstance()->getGlobalContext(context);
-    TIZEN_CHECK_ACCESS(context, exception, privateObject, CONTENT_FUNCTION_API_UPDATE_ITEMS_BATCH);
+    AceSecurityStatus status = CONTENT_CHECK_ACCESS(CONTENT_FUNCTION_API_UPDATE_ITEMS_BATCH);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     JSCallbackManagerPtr cbm(NULL);
     MediaConverterFactory::ConverterType converter = MediaConverterFactory::getConverter(context);
@@ -446,14 +448,15 @@ JSValueRef JSMediacontentManager::updateItem(
 
     TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
 
-    MediacontentManagerPriv *privateObject;
-    privateObject = static_cast<MediacontentManagerPriv*>(JSObjectGetPrivate(thisObject));
+    MediacontentManagerPrivObject *privateObject;
+    privateObject = static_cast<MediacontentManagerPrivObject*>(JSObjectGetPrivate(thisObject));
     if (!privateObject) {
         DeviceAPI::Common::UnknownException err("Content's private object is NULL.");
         return JSWebAPIErrorFactory::postException(context, exception, err);
     }
 
-    TIZEN_CHECK_ACCESS(context, exception, privateObject, CONTENT_FUNCTION_API_UPDATE_ITEM);
+    AceSecurityStatus status = CONTENT_CHECK_ACCESS(CONTENT_FUNCTION_API_UPDATE_ITEM);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     Try
     {
@@ -596,14 +599,15 @@ JSValueRef JSMediacontentManager::scanFile(
 {
     TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
 
-    MediacontentManagerPriv *privateObject;
-    privateObject = static_cast<MediacontentManagerPriv*>(JSObjectGetPrivate(thisObject));
+    MediacontentManagerPrivObject *privateObject;
+    privateObject = static_cast<MediacontentManagerPrivObject*>(JSObjectGetPrivate(thisObject));
     if(!privateObject) {
         DeviceAPI::Common::UnknownException err("Content's private object is NULL.");
         return JSWebAPIErrorFactory::postException(context, exception, err);
     }
 
-    TIZEN_CHECK_ACCESS(context, exception, privateObject, CONTENT_FUNCTION_API_SCAN_FILE);
+    AceSecurityStatus status = CONTENT_CHECK_ACCESS(CONTENT_FUNCTION_API_SCAN_FILE);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     string path;
     CallbackUserData *callback = NULL;
@@ -682,14 +686,15 @@ JSValueRef JSMediacontentManager::setChangeListener(
 {
     TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
 
-    MediacontentManagerPriv *privateObject;
-    privateObject = static_cast<MediacontentManagerPriv*>(JSObjectGetPrivate(thisObject));
+    MediacontentManagerPrivObject *privateObject;
+    privateObject = static_cast<MediacontentManagerPrivObject*>(JSObjectGetPrivate(thisObject));
     if(!privateObject) {
         DeviceAPI::Common::UnknownException err("Content's private object is NULL.");
         return JSWebAPIErrorFactory::postException(context, exception, err);
     }
 
-    TIZEN_CHECK_ACCESS(context, exception, privateObject, CONTENT_FUNCTION_API_SET_CHANGE_LISTENER);
+    AceSecurityStatus status = CONTENT_CHECK_ACCESS(CONTENT_FUNCTION_API_SET_CHANGE_LISTENER);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     try{
         ArgumentValidator argValidator(context, argumentCount, arguments);
@@ -722,14 +727,15 @@ JSValueRef JSMediacontentManager::unsetChangeListener(
                         JSValueRef* exception)
 {
     TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
-    MediacontentManagerPriv *privateObject;
-    privateObject = static_cast<MediacontentManagerPriv*>(JSObjectGetPrivate(thisObject));
+    MediacontentManagerPrivObject *privateObject;
+    privateObject = static_cast<MediacontentManagerPrivObject*>(JSObjectGetPrivate(thisObject));
     if(!privateObject) {
         DeviceAPI::Common::UnknownException err("Content's private object is NULL.");
         return JSWebAPIErrorFactory::postException(context, exception, err);
     }
 
-    TIZEN_CHECK_ACCESS(context, exception, privateObject, CONTENT_FUNCTION_API_SET_CHANGE_LISTENER);
+    AceSecurityStatus status = CONTENT_CHECK_ACCESS(CONTENT_FUNCTION_API_SET_CHANGE_LISTENER);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     try{
         // perform
@@ -765,11 +771,11 @@ const JSClassDefinition* JSMediacontentManager::getClassInfo()
 
 void JSMediacontentManager::initialize(JSContextRef context, JSObjectRef object)
 {
-    MediacontentManagerPriv *privateObject = static_cast<MediacontentManagerPriv*>(JSObjectGetPrivate(object));
+    MediacontentManagerPrivObject *privateObject = static_cast<MediacontentManagerPrivObject*>(JSObjectGetPrivate(object));
     if (NULL == privateObject)
     {
         IMediacontentManagerPtr contentManager = MediacontentFactory::getInstance().createMediacontentManagerObject();
-        privateObject = new MediacontentManagerPriv(context, contentManager);
+        privateObject = new MediacontentManagerPrivObject(context, contentManager);
         if (!JSObjectSetPrivate(object, static_cast<void*>(privateObject)))
         {
             delete privateObject;
@@ -780,7 +786,7 @@ void JSMediacontentManager::initialize(JSContextRef context, JSObjectRef object)
 
 void JSMediacontentManager::finalize(JSObjectRef object)
 {
-    MediacontentManagerPriv* priv = static_cast<MediacontentManagerPriv*> (JSObjectGetPrivate(object));
+    MediacontentManagerPrivObject* priv = static_cast<MediacontentManagerPrivObject*> (JSObjectGetPrivate(object));
     if(priv != NULL)
     {
         delete priv;
@@ -795,7 +801,7 @@ IMediacontentManagerPtr JSMediacontentManager::getContentManagerPrivObject(
                         const JSObjectRef object,
                         JSValueRef* exception)
 {
-    MediacontentManagerPriv *priv = static_cast<MediacontentManagerPriv*>(JSObjectGetPrivate(object));
+    MediacontentManagerPrivObject *priv = static_cast<MediacontentManagerPrivObject*>(JSObjectGetPrivate(object));
     if (priv)
     {
         return priv->getObject();
index c7f118f..73599a8 100755 (executable)
@@ -33,22 +33,6 @@ namespace Content {
 
 typedef PrivateObject<IMediacontentManagerPtr, NoOwnership> MediacontentManagerPrivObject;
 
-class MediacontentManagerPriv :
-       public MediacontentManagerPrivObject,
-       public DeviceAPI::Common::SecurityAccessor
-{
-public:
-       MediacontentManagerPriv(JSContextRef context, IMediacontentManagerPtr contentManager) :
-               MediacontentManagerPrivObject(context, contentManager),
-               DeviceAPI::Common::SecurityAccessor()
-       {
-       }
-
-       virtual ~MediacontentManagerPriv()
-       {
-       }
-};
-
 class JSMediacontentManager 
 {
 public:
index f08bd6e..6eb9188 100755 (executable)
 
 #include <string>
 #include <Commons/FunctionDeclaration.h>
-#include "plugin_config_impl.h"
 
 namespace DeviceAPI {
 namespace Content {
 
+// Functions from content manager
+#define CONTENT_FUNCTION_API_GET_LOCAL_MEDIASOURCE "getLocalMediaSource"
+
+// Functions from content
+#define CONTENT_FUNCTION_API_FIND_ITEMS "find"
+#define CONTENT_FUNCTION_API_GET_FOLDERS "getDirectories"
+#define CONTENT_FUNCTION_API_UPDATE_ITEM "update"
+#define CONTENT_FUNCTION_API_UPDATE_ITEMS_BATCH "updateBatch"
+#define CONTENT_FUNCTION_API_SCAN_FILE "scanFile"
+#define CONTENT_FUNCTION_API_SET_CHANGE_LISTENER "setChangeListener"
+#define CONTENT_FUNCTION_API_UNSET_CHANGE_LISTENER "unsetChangeListener"
+
+
 DECLARE_FUNCTION_GETTER(Content);
 
 #define CONTENT_CHECK_ACCESS(functionName) \
diff --git a/src/Content/plugin_config_impl.h b/src/Content/plugin_config_impl.h
deleted file mode 100755 (executable)
index 85b6eb2..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-//
-// Tizen Web Device API
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-
-#ifndef _CONTENT_PLUGIN_CONFIG_IMPL_H_
-#define _CONTENT_PLUGIN_CONFIG_IMPL_H_
-
-#define CONTENT_FUNCTION_API_GET_LOCAL_MEDIASOURCE "getLocalMediaSource"
-#define CONTENT_FUNCTION_API_FIND_ITEMS "find"
-#define CONTENT_FUNCTION_API_GET_FOLDERS "getDirectories"
-#define CONTENT_FUNCTION_API_UPDATE_ITEM "update"
-#define CONTENT_FUNCTION_API_UPDATE_ITEMS_BATCH "updateBatch"
-#define CONTENT_FUNCTION_API_SCAN_FILE "scanFile"
-#define CONTENT_FUNCTION_API_SET_CHANGE_LISTENER "setChangeListener"
-#define CONTENT_FUNCTION_API_UNSET_CHANGE_LISTENER "unsetChangeListener"
-
-
-#endif // _CONTENT_PLUGIN_CONFIG_IMPL_H_
index 2a0bf08..44ac0e9 100755 (executable)
@@ -20,8 +20,7 @@
 #include <Commons/Exception.h>
 #include <GlobalContextManager.h>
 #include <TimeTracer.h>
-#include <Security.h>
-#include "plugin_config.h"
+
 #include "JSContentManager.h"
 #include "ContentAsyncCallbackManager.h"
 #include <Logger.h>
@@ -34,28 +33,6 @@ using namespace WrtDeviceApis::CommonsJavaScript;
 namespace DeviceAPI {
 namespace Content {
 
-AceSecurityStatus contentAceCheckAccessFunction(const char* functionName)
-{
-    return CONTENT_CHECK_ACCESS(functionName);
-}
-
-DEFINE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor);
-
-DEFINE_SECURITY_ACCESSOR_SETTER(AceCheckerContentSetter,
-                                                                                               MediacontentManagerPriv,
-                                                                                               gSecurityAccessor);
-
-class_definition_options_t option =
-{
-        JS_CLASS,
-        NONE,
-        ALWAYS_NOTICE,
-        IGNORED,
-        AceCheckerContentSetter,
-        NULL,
-        NULL
-};
-
 void on_frame_load_callback(const void * context)
 {
     LoggerD("[Tizen\\content] on_frame_load_callback (" << context << ")");
@@ -83,7 +60,6 @@ void on_widget_start_callback(int widgetId)
         LoggerE("WrtAccess intialization failed");
     }
 
-    INITAILIZE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor, contentAceCheckAccessFunction);
 }
 
 void on_widget_stop_callback(int widgetId)
@@ -99,7 +75,6 @@ void on_widget_stop_callback(int widgetId)
     {
         LoggerE("WrtAccess deinitialization failed");
     }
-    FINALIZE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor);
 }
 
 PLUGIN_ON_WIDGET_START(on_widget_start_callback)
@@ -111,7 +86,7 @@ PLUGIN_CLASS_MAP_BEGIN
 PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
         "content",
         (js_class_template_getter)JSMediacontentManager::getClassRef,
-        &option)
+        NULL)
 PLUGIN_CLASS_MAP_END
 
 }
index ab14067..47f1a5b 100755 (executable)
@@ -43,6 +43,7 @@ ADD_LIBRARY(${TARGET_NAME} SHARED ${SRCS})
 
 TARGET_LINK_LIBRARIES(${TARGET_NAME}
        ${TARGET_IMPL_NAME}
+       "-Wl,--no-as-needed" ${filesystem_config}
 )
 
 INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
index 234660b..3b67e79 100755 (executable)
@@ -1,6 +1,7 @@
 SET(TARGET_NAME ${filesystem_target})
 SET(DESTINATION_NAME ${filesystem_dest})
 SET(TARGET_IMPL_NAME ${filesystem_impl})
+SET(TARGET_CONFIG_NAME ${filesystem_config})
 
 PKG_CHECK_MODULES(platform_pkgs_filesystem REQUIRED capi-appfw-application libpcrecpp ecore)
 
@@ -18,10 +19,6 @@ SET(CMAKE_INSTALL_RPATH
 )
 
 SET(SRCS_IMPL
-       JSFilesystemManager.cpp
-       JSFile.cpp
-       JSFilestream.cpp
-       JSStorage.cpp
        IManager.cpp
        IPath.cpp
        IStream.cpp
@@ -46,6 +43,10 @@ SET(SRCS_IMPL
        Stream.cpp
        NodeFilterMatcher.cpp
        Utils.cpp
+       JSFilesystemManager.cpp
+       JSFile.cpp
+       JSFilestream.cpp
+       JSStorage.cpp
        Converter.cpp
        EventGetNodeData.cpp
        Encodings.cpp
@@ -65,8 +66,17 @@ TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
        ${platform_pkgs_filesystem_LIBRARIES}
 )
 
-SET(SRCS
+SET(SRCS_CONFIG
        plugin_config.cpp
+)
+
+ADD_LIBRARY(${TARGET_CONFIG_NAME} SHARED ${SRCS_CONFIG})
+
+TARGET_LINK_LIBRARIES(${TARGET_CONFIG_NAME}
+       ${LIBS_COMMON}
+)
+
+SET(SRCS
        plugin_initializer.cpp
 )
 
@@ -77,7 +87,7 @@ TARGET_LINK_LIBRARIES(${TARGET_NAME}
        ${TARGET_CONFIG_NAME}
 )
 
-INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
+INSTALL(TARGETS ${TARGET_NAME} ${TARGET_CONFIG_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(
        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/filesystem
index 1c8e65a..2a9e833 100755 (executable)
@@ -67,7 +67,7 @@ Converter::Converter(JSContextRef context) : WrtDeviceApis::CommonsJavaScript::C
 JSValueRef Converter::toJSValueRef(
         const NodeList& arg,
         const JSFile::PrivateObjectDef::PermissionList &parentPermissions,
-        JSContextRef context, DeviceAPI::Common::SecurityAccessor *securityAccessor)
+        JSContextRef context)
 {
     JSObjectRef jsResult = JSCreateArrayObject(m_context, 0, NULL);
     if (!jsResult) {
@@ -84,10 +84,6 @@ JSValueRef Converter::toJSValueRef(
         JSFile::PrivateObject* privateObject = new JSFile::PrivateObject(
                 context,
                 privData);
-               
-               if (securityAccessor)
-                       privateObject->copyAceCheckAccessFunction(securityAccessor);
-               
         JSObjectRef jsObject = JSObjectMake(m_context,
                                             JSFile::getClassRef(),
                                             privateObject);
index 78726a9..70bd4cb 100755 (executable)
@@ -24,7 +24,6 @@
 #include <map>
 #include <JavaScriptCore/JavaScript.h>
 #include <CommonsJavaScript/Converter.h>
-#include <Security.h>
 #include "Enums.h"
 #include "IPath.h"
 #include "INodeTypes.h"
@@ -47,7 +46,7 @@ public:
     JSValueRef toJSValueRef(
             const NodeList& arg,
             const JSFile::PrivateObjectDef::PermissionList &parentPermissions,
-            JSContextRef context, DeviceAPI::Common::SecurityAccessor *securityAccessor);      
+            JSContextRef context);     
        JSValueRef toJSValueRef(unsigned char* data,
                std::size_t num);
        JSValueRef toJSValueRef(unsigned long long arg);
index 884cdd1..bd12cfb 100755 (executable)
 
 #include <dpl/shared_ptr.h>
 #include <Commons/IEvent.h>
-#include <Security.h>
 #include "IPath.h"
 #include "INode.h"
 
 namespace DeviceAPI {
 namespace Filesystem {
-class EventCopy : 
-       public WrtDeviceApis::Commons::IEvent<EventCopy>,
-       public DeviceAPI::Common::SecurityAccessor
+class EventCopy : public WrtDeviceApis::Commons::IEvent<EventCopy>
 {
   public:
     /**
index 7581dd5..abd8dac 100755 (executable)
 #include <Commons/IEvent.h>
 #include <dpl/shared_ptr.h>
 #include <string>
-#include <Security.h>
 #include "StorageProperties.h"
 
 namespace DeviceAPI {
 namespace Filesystem {
-class EventGetStorage : 
-       public WrtDeviceApis::Commons::IEvent<EventGetStorage>,
-       public DeviceAPI::Common::SecurityAccessor
+class EventGetStorage : public WrtDeviceApis::Commons::IEvent<
+        EventGetStorage>
 {
   private:
        std::string label;
@@ -46,4 +44,4 @@ typedef DPL::SharedPtr<EventGetStorage> EventGetStoragePtr;
 } // Filesystem
 } // TizenApis
 
-#endif //TIZENAPIS_API_FILESYSTEM_EVENT_GET_STORAGE_H_
+#endif //TIZENAPIS_API_FILESYSTEM_EVENT_GET_STORAGE_H_
\ No newline at end of file
index 49f8a51..383bc1e 100755 (executable)
 
 #include <dpl/shared_ptr.h>
 #include <Commons/IEvent.h>
-#include <Security.h>
 #include "INodeTypes.h"
 #include "NodeFilter.h"
 
 namespace DeviceAPI {
 namespace Filesystem {
-class EventListNodes : 
-       public WrtDeviceApis::Commons::IEvent<EventListNodes>, 
-       public DeviceAPI::Common::SecurityAccessor
+class EventListNodes : public WrtDeviceApis::Commons::IEvent<EventListNodes>
 {
   public:
     /**
@@ -79,4 +76,4 @@ typedef DPL::SharedPtr<EventListNodes> EventListNodesPtr;
 } // Filesystem
 } // TizenApis
 
-#endif // TIZENAPIS_FILESYSTEM_EVENTLISTNODES_H_
+#endif // TIZENAPIS_FILESYSTEM_EVENTLISTNODES_H_
\ No newline at end of file
index 286702f..8fd5bf9 100755 (executable)
 #include <Commons/IEvent.h>
 #include <dpl/shared_ptr.h>
 #include <vector>
-#include <Security.h>
 #include "StorageProperties.h"
 
 namespace DeviceAPI {
 namespace Filesystem {
-class EventListStorages : 
-       public WrtDeviceApis::Commons::IEvent<EventListStorages>,
-       public DeviceAPI::Common::SecurityAccessor
+class EventListStorages : public WrtDeviceApis::Commons::IEvent<
+        EventListStorages>
 {
   private:
        std::vector<StoragePropertiesPtr> storages;
@@ -43,4 +41,4 @@ typedef DPL::SharedPtr<EventListStorages> EventListStoragesPtr;
 }
 }
 
-#endif
+#endif
\ No newline at end of file
index 8afa2a9..742c7f6 100755 (executable)
 
 #include <dpl/shared_ptr.h>
 #include <Commons/IEvent.h>
-#include <Security.h>
 #include "IPath.h"
 #include "INode.h"
 
 namespace DeviceAPI {
 namespace Filesystem {
-class EventMove : 
-       public WrtDeviceApis::Commons::IEvent<EventMove>,
-       public DeviceAPI::Common::SecurityAccessor
+class EventMove : public WrtDeviceApis::Commons::IEvent<EventMove>
 {
   public:
     /**
@@ -88,4 +85,4 @@ typedef DPL::SharedPtr<EventMove> EventMovePtr;
 } // Filesystem
 } // TizenApis
 
-#endif // TIZENAPIS_FILESYSTEM_EVENTMOVE_H_
+#endif // TIZENAPIS_FILESYSTEM_EVENTMOVE_H_
\ No newline at end of file
index d67f65d..ad8cc58 100755 (executable)
 
 #include <dpl/shared_ptr.h>
 #include <Commons/IEvent.h>
-#include <Security.h>
 #include "IStream.h"
 
 namespace DeviceAPI {
 namespace Filesystem {
-class EventOpen : 
-       public WrtDeviceApis::Commons::IEvent<EventOpen>,
-       public DeviceAPI::Common::SecurityAccessor
+class EventOpen : public WrtDeviceApis::Commons::IEvent<EventOpen>
 {
   public:
     /**
@@ -68,4 +65,4 @@ typedef DPL::SharedPtr<EventOpen> EventOpenPtr;
 } // Filesystem
 } // TizenApis
 
-#endif // TIZENAPIS_FILESYSTEM_EVENTOPEN_H_
+#endif // TIZENAPIS_FILESYSTEM_EVENTOPEN_H_
\ No newline at end of file
index 17b6b86..fa70a96 100755 (executable)
 #include <string>
 #include <dpl/shared_ptr.h>
 #include <Commons/IEvent.h>
-#include <Security.h>
 #include "IPath.h"
 
 namespace DeviceAPI {
 namespace Filesystem {
-class EventReadText : 
-       public WrtDeviceApis::Commons::IEvent<EventReadText>,
-       public DeviceAPI::Common::SecurityAccessor
+class EventReadText : public WrtDeviceApis::Commons::IEvent<EventReadText>
 {
   public:
     /**
@@ -55,4 +52,4 @@ typedef DPL::SharedPtr<EventReadText> EventReadTextPtr;
 } // Filesystem
 } // TizenApis
 
-#endif // TIZENAPIS_FILESYSTEM_EVENTREADTEXT_H_
+#endif // TIZENAPIS_FILESYSTEM_EVENTREADTEXT_H_
\ No newline at end of file
index ccb310a..b8ccb79 100755 (executable)
 
 #include <dpl/shared_ptr.h>
 #include <Commons/IEvent.h>
-#include <Security.h>
 #include "INode.h"
 #include "Enums.h"
 
 namespace DeviceAPI {
 namespace Filesystem {
-class EventRemove : 
-       public WrtDeviceApis::Commons::IEvent<EventRemove>,
-       public DeviceAPI::Common::SecurityAccessor
+class EventRemove : public WrtDeviceApis::Commons::IEvent<EventRemove>
 {
   public:
     /**
@@ -66,4 +63,4 @@ typedef DPL::SharedPtr<EventRemove> EventRemovePtr;
 } // Filesystem
 } // TizenApis
 
-#endif // TIZENAPIS_FILESYSTEM_EVENTREMOVE_H_
+#endif // TIZENAPIS_FILESYSTEM_EVENTREMOVE_H_
\ No newline at end of file
index 70ed979..0f61331 100755 (executable)
 
 #include <dpl/shared_ptr.h>
 #include <Commons/IEvent.h>
-#include <Security.h>
-
 #include "IPath.h"
 #include "INode.h"
 
 namespace DeviceAPI {
 namespace Filesystem {
-class EventResolve :
-       public WrtDeviceApis::Commons::IEvent<EventResolve>,
-       public DeviceAPI::Common::SecurityAccessor
+class EventResolve : public WrtDeviceApis::Commons::IEvent<EventResolve>
 {
   public:
     /**
index 152b5fb..37da3aa 100755 (executable)
@@ -17,7 +17,6 @@
 
 
 #include "JSFile.h"
-#include "plugin_config_impl.h"
 
 #include <string>
 #include <ctime>
@@ -47,6 +46,7 @@
 #include "Converter.h"
 #include "plugin_config.h"
 #include "Encodings.h"
+#include "JSFilestream.h"
 #include "ResponseDispatcher.h"
 #include "FilesystemAsyncCallbackManager.h"
 #include <Logger.h>
@@ -198,13 +198,9 @@ JSValueRef JSFile::getProperty(JSContextRef context,
                        {
                                parent->setPermissions(perms.back());
                                perms.pop_back();
-                               PrivateObjectDefPtr privDefData(new PrivateObjectDef(parent, perms));
-                               JSFile::PrivateObject* privData = new JSFile::PrivateObject(globalContext, privDefData);
-                               privData->copyAceCheckAccessFunction(privateObject);
-                                       
-                               JSObjectRef object = JSObjectMake(globalContext, JSFile::getClassRef(), privData);
+                               PrivateObjectDefPtr privData(new PrivateObjectDef(parent, perms));
 
-                               return object;
+                               return JSUtils::makeObject(privateObject->getContext(), getClassRef(), privData);
                        }
                        return JSValueMakeNull(context);
                } 
@@ -360,10 +356,13 @@ JSValueRef JSFile::toUri(JSContextRef context,
                LoggerE("Private object is not set.");
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch error");
        }
-       TIZEN_CHECK_ACCESS(context, exception, privateObject, FILESYSTEM_FUNCTION_API_TO_URI);
 
        Converter converter(context);
 
+       AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_TO_URI);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+       
+
        try {
                int widgetId = WrtAccessSingleton::Instance().getWidgetId();
                TIME_TRACER_ITEM_END(__FUNCTION__, 0);
@@ -394,8 +393,6 @@ JSValueRef JSFile::listFiles(JSContextRef context,
 
        LoggerD("OK");
 
-       TIZEN_CHECK_ACCESS(context, exception, privateObject, FILESYSTEM_FUNCTION_API_LIST_FILES);
-
        // argument validation with new validator
        try {
                ArgumentValidator validator(context, argc, argv);
@@ -417,6 +414,8 @@ JSValueRef JSFile::listFiles(JSContextRef context,
 
        try {
 
+               AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_LIST_FILES);
+               TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
                for (index = 0; index < 3; index++)
                {
@@ -455,7 +454,6 @@ JSValueRef JSFile::listFiles(JSContextRef context,
 
                event->setPrivateData(DPL::StaticPointerCast<WrtDeviceApis::Commons::IEventPrivateData>(privData));
                event->setForAsynchronousCall(&ResponseDispatcher::getInstance());
-               event->copyAceCheckAccessFunction(privateObject);
 
                privateObject->getObject()->getNode()->getChildNodes(event);
                FilesystemAsyncCallbackManagerSingleton::Instance().registerCallbackManager(cbm, globalContext);
@@ -487,8 +485,6 @@ JSValueRef JSFile::openStream(JSContextRef context,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch error");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, privateObject, FILESYSTEM_FUNCTION_API_OPEN_STREAM);
-
        // argument validation with new validator
        try {
                ArgumentValidator validator(context, argumentCount, arguments);
@@ -508,6 +504,9 @@ JSValueRef JSFile::openStream(JSContextRef context,
        size_t index = 0;
        JSValueRef reserveArguments[4];
 
+       AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_OPEN_STREAM);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
 
        try {
 
@@ -548,12 +547,15 @@ JSValueRef JSFile::openStream(JSContextRef context,
                std::string path = privateObject->getObject()->getNode()->getPath()->getFullPath();
                std::string vpath = Utils::toVirtualPath(globalContext, path);
 
+               AccessModeInfo am = AccessModeInfo(mode, vpath);
+               status = FILESYSTEM_ACCESSMODE_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_OPEN_STREAM, am);
+
+               TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
                EventOpenPtr event(new EventOpen(mode));
                event->setPrivateData(DPL::StaticPointerCast<WrtDeviceApis::Commons::IEventPrivateData>(cbm));
                event->setCharSet(encoding);
                event->setForAsynchronousCall(&ResponseDispatcher::getInstance());
-               event->copyAceCheckAccessFunction(privateObject);
-               
                FilesystemAsyncCallbackManagerSingleton::Instance().registerCallbackManager(cbm, globalContext);
 
                privateObject->getObject()->getNode()->open(event);
@@ -585,7 +587,6 @@ JSValueRef JSFile::readAsText(JSContextRef context,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch error");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, privateObject, FILESYSTEM_FUNCTION_API_READ_AS_TEXT);
 
        // argument validation with new validator
        try {
@@ -602,7 +603,8 @@ JSValueRef JSFile::readAsText(JSContextRef context,
        
 
        JSContextRef globalContext = privateObject->getContext();
-       
+       AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_READ_AS_TEXT);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        size_t index = 0;
        JSValueRef reserveArguments[3];
@@ -677,13 +679,13 @@ JSValueRef JSFile::copyTo(JSContextRef context,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch error");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, privateObject,FILESYSTEM_FUNCTION_API_COPY_TO);
-
        JSContextRef globalContext = privateObject->getContext();
        size_t index = 0;
        JSValueRef reserveArguments[5];
        JSCallbackManagerPtr cbm = JSCallbackManager::createObject(globalContext);
 
+       AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_COPY_TO);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
        
        // argument validation with new validator
        try {
@@ -738,6 +740,12 @@ JSValueRef JSFile::copyTo(JSContextRef context,
                }
 
                std::string virtualDestPath = Utils::toVirtualPath(globalContext, dest->getFullPath());
+               AccessModeInfo amode = AccessModeInfo(AM_WRITE, virtualDestPath);
+               status = FILESYSTEM_ACCESSMODE_CHECK_ACCESS(
+                       FILESYSTEM_FUNCTION_API_COPY_TO,
+               amode);
+
+               TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
                EventCopyPtr event(new EventCopy(src, dest));
 
@@ -750,8 +758,6 @@ JSValueRef JSFile::copyTo(JSContextRef context,
                        JSCallbackManager>(
                        cbm));
                event->setForAsynchronousCall(&ResponseDispatcher::getInstance());
-               event->copyAceCheckAccessFunction(privateObject);
-                               
                FilesystemAsyncCallbackManagerSingleton::Instance().registerCallbackManager(cbm, globalContext);
                                        
                IManager::getInstance().copy(event);
@@ -784,8 +790,6 @@ JSValueRef JSFile::moveTo(JSContextRef context,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch error");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, privateObject, FILESYSTEM_FUNCTION_API_MOVE_TO);
-
        JSContextRef globalContext = privateObject->getContext();
 
        LoggerD("OK");
@@ -807,6 +811,8 @@ JSValueRef JSFile::moveTo(JSContextRef context,
        JSValueRef reserveArguments[5];
        JSCallbackManagerPtr cbm = JSCallbackManager::createObject(globalContext);
 
+       AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_MOVE_TO);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        try {
 
@@ -844,6 +850,11 @@ JSValueRef JSFile::moveTo(JSContextRef context,
 
                std::string virtualDestPath = Utils::toVirtualPath(globalContext, dest->getFullPath());
 
+               AccessModeInfo amode = AccessModeInfo(AM_WRITE, virtualDestPath);
+               AceSecurityStatus status = FILESYSTEM_ACCESSMODE_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_MOVE_TO, amode);
+
+               TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
                EventMovePtr event(new EventMove(src, dest));
                if (overwrite) {
                        event->setOptions(OPT_OVERWRITE);
@@ -851,8 +862,6 @@ JSValueRef JSFile::moveTo(JSContextRef context,
 
                event->setForAsynchronousCall(&ResponseDispatcher::getInstance()); 
                event->setPrivateData(DPL::StaticPointerCast<WrtDeviceApis::Commons::IEventPrivateData > (cbm));
-               event->copyAceCheckAccessFunction(privateObject);
-                               
                FilesystemAsyncCallbackManagerSingleton::Instance().registerCallbackManager(cbm, globalContext);
 
                IManager::getInstance().move(event);
@@ -886,7 +895,9 @@ JSValueRef JSFile::createDirectory(JSContextRef context,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch error");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, privateObject, FILESYSTEM_FUNCTION_API_CREATE_DIR);
+       AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_CREATE_DIR);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
 
        Converter converter(context);
        try {
@@ -902,16 +913,11 @@ JSValueRef JSFile::createDirectory(JSContextRef context,
                INodePtr node(privateObject->getObject()->getNode()->createChild(path, NT_DIRECTORY, OPT_RECURSIVE));
                node->setPermissions(privateObject->getObject()->getNode()->getPermissions());
 
-               PrivateObjectDefPtr privDefData(new PrivateObjectDef(node, privateObject->getObject()->getParentPermissions()));
-               privDefData->pushParentPermissions(privateObject->getObject()->getNode()->getPermissions());
-               JSFile::PrivateObject* privData = new JSFile::PrivateObject(privateObject->getContext(), privDefData);
-               privData->copyAceCheckAccessFunction(privateObject);
+               PrivateObjectDefPtr privData(new PrivateObjectDef(node, privateObject->getObject()->getParentPermissions()));
+               privData->pushParentPermissions(privateObject->getObject()->getNode()->getPermissions());
 
                TIME_TRACER_ITEM_END(__FUNCTION__, 0);
-       
-                                       
-               JSObjectRef object = JSObjectMake(privateObject->getContext(), JSFile::getClassRef(), privData);
-               return object;
+               return WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(privateObject->getContext(), getClassRef(), privData);
        } catch (const WrtDeviceApis::Commons::SecurityException& ex) {
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, ex.GetMessage());
        }
@@ -941,7 +947,9 @@ JSValueRef JSFile::createFile(JSContextRef context,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch error");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, privateObject, FILESYSTEM_FUNCTION_API_CREATE_FILE);
+       AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_CREATE_FILE);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
 
        Converter converter(context);
        try {
@@ -957,17 +965,10 @@ JSValueRef JSFile::createFile(JSContextRef context,
                IPathPtr path = converter.toPath(argv[0]);
                INodePtr node = privateObject->getObject()->getNode()->createChild(path, NT_FILE);
 
-               PrivateObjectDefPtr privDefData(new PrivateObjectDef(node, privateObject->getObject()->getParentPermissions()));
-               privDefData->pushParentPermissions(privateObject->getObject()->getNode()->getPermissions());
-
-               JSFile::PrivateObject* privData = new JSFile::PrivateObject(privateObject->getContext(), privDefData);
-               privData->copyAceCheckAccessFunction(privateObject);
-               
-        JSObjectRef object = JSObjectMake(privateObject->getContext(), JSFile::getClassRef(), privData);
-
+               PrivateObjectDefPtr privData(new PrivateObjectDef(node, privateObject->getObject()->getParentPermissions()));
+               privData->pushParentPermissions(privateObject->getObject()->getNode()->getPermissions());
                TIME_TRACER_ITEM_END(__FUNCTION__, 0);
-               return object;
-
+               return WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(privateObject->getContext(), getClassRef(), privData);
 
        } catch (const WrtDeviceApis::Commons::SecurityException& ex) {
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, ex.GetMessage());
@@ -998,7 +999,8 @@ JSValueRef JSFile::resolve(JSContextRef context,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch error");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, privateObject, FILESYSTEM_FUNCTION_API_RESOLVE);
+       AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_RESOLVE);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        if (privateObject->getObject()->getNode()->getType() != NT_DIRECTORY) {
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::IO_ERROR, "IO error");
@@ -1014,15 +1016,16 @@ JSValueRef JSFile::resolve(JSContextRef context,
                IPathPtr path = converter.toPath(argv[0]);
                INodePtr node = privateObject->getObject()->getNode()->getChild(path);
                node->setPermissions(privateObject->getObject()->getNode()->getPermissions());
-               PrivateObjectDefPtr privDefData(new PrivateObjectDef(node,      privateObject->getObject()->getParentPermissions()));
-               privDefData->pushParentPermissions(privateObject->getObject()->getNode()->getPermissions());
-
-               JSFile::PrivateObject* privData = new JSFile::PrivateObject(privateObject->getContext(), privDefData);
-               privData->copyAceCheckAccessFunction(privateObject);
+               PrivateObjectDefPtr privData(new PrivateObjectDef(node,         privateObject->getObject()->getParentPermissions()));
+               privData->pushParentPermissions(privateObject->getObject()->getNode()->getPermissions());
                TIME_TRACER_ITEM_END(__FUNCTION__, 0);
-               
-               JSObjectRef object = JSObjectMake(privateObject->getContext(), JSFile::getClassRef(), privData);
-               return object;
+               return WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(privateObject->getContext(), getClassRef(), privData);
+               /*
+               IPathPtr path = converter.toPath(argv[0]);
+               INodePtr node = privateObject->getObject()->getNode()->getChild(path);
+               node->setPermissions(privateObject->getObject()->getNode()->getPermissions());
+               return JSUtils::makeObject(privateObject->getContext(), getClassRef(), node);
+               */
        } catch (const WrtDeviceApis::Commons::PlatformException& ex) {
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::IO_ERROR, ex.GetMessage());
        } catch(const WrtDeviceApis::Commons::ConversionException& ex) {
@@ -1050,9 +1053,9 @@ JSValueRef JSFile::deleteDirectory(JSContextRef context,
        if (!privateObject) {
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch error");
        }
-
        
-       TIZEN_CHECK_ACCESS(context, exception, privateObject,FILESYSTEM_FUNCTION_API_DELETE_DIR);
+       AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_DELETE_DIR);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        if (argc < 2) {
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type missmatch error");
@@ -1146,8 +1149,6 @@ JSValueRef JSFile::deleteDirectory(JSContextRef context,
 
                        eventRemove->setForAsynchronousCall(&ResponseDispatcher::getInstance()); 
                        eventRemove->setPrivateData(DPL::StaticPointerCast<WrtDeviceApis::Commons::IEventPrivateData > (cbm));
-                       eventRemove->copyAceCheckAccessFunction(privateObject);
-
                        FilesystemAsyncCallbackManagerSingleton::Instance().registerCallbackManager(cbm, globalContext);
 
                        IManager::getInstance().remove(eventRemove);
@@ -1184,13 +1185,9 @@ JSValueRef JSFile::deleteFile(JSContextRef context,
 
        PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
 
-
        if (!privateObject) {
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch error");
        }
-
-       TIZEN_CHECK_ACCESS(context, exception, privateObject, FILESYSTEM_FUNCTION_API_DELETE_FILE);
-
        // argument validation with new validator
        try {
                ArgumentValidator validator(context, argc, argv);
@@ -1210,6 +1207,10 @@ JSValueRef JSFile::deleteFile(JSContextRef context,
        JSValueRef reserveArguments[3];
        JSCallbackManagerPtr cbm = JSCallbackManager::createObject(globalContext);      
 
+       AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_DELETE_FILE);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
+
        try {
                for (index = 0; index < 3; index++) {
                        if (index < argc)
@@ -1275,8 +1276,6 @@ JSValueRef JSFile::deleteFile(JSContextRef context,
                        EventRemovePtr eventRemove(new EventRemove(path));
                        eventRemove->setForAsynchronousCall(&ResponseDispatcher::getInstance()); 
                        eventRemove->setPrivateData(DPL::StaticPointerCast<WrtDeviceApis::Commons::IEventPrivateData > (cbm));
-                       eventRemove->copyAceCheckAccessFunction(privateObject);
-
                        FilesystemAsyncCallbackManagerSingleton::Instance().registerCallbackManager(cbm, globalContext);
 
                        IManager::getInstance().remove(eventRemove);
index d8d4288..162a7bb 100755 (executable)
@@ -23,7 +23,6 @@
 #include <Commons/IEvent.h>
 #include <CommonsJavaScript/PrivateObject.h>
 #include <CommonsJavaScript/JSCallbackManager.h>
-#include <Security.h>
 #include "INode.h"
 
 namespace DeviceAPI {
@@ -105,24 +104,8 @@ public:
     };
 
     typedef DPL::SharedPtr<ListFilesPrivateData> ListFilesPrivateDataPtr;
-    typedef DPL::SharedPtr<PrivateObjectDef> PrivateObjectDefPtr;      
-    typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT<PrivateObjectDefPtr>::Type PrivateObjectSecurity;
-
-       class PrivateObject :
-               public DeviceAPI::Common::SecurityAccessor,
-               public PrivateObjectSecurity
-       {
-       public :
-               PrivateObject (JSContextRef context, PrivateObjectDefPtr privDef) :
-                       DeviceAPI::Common::SecurityAccessor(), 
-                       PrivateObjectSecurity(context, privDef)
-               {
-               }
-                       
-               virtual ~PrivateObject()
-               {
-               }
-       };
+    typedef DPL::SharedPtr<PrivateObjectDef> PrivateObjectDefPtr;
+    typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT<PrivateObjectDefPtr>::Type PrivateObject;
 
 public:
        static const JSClassDefinition* getClassInfo();
index 641753d..95e2ad6 100644 (file)
@@ -197,7 +197,9 @@ JSValueRef JSFilestream::close(JSContextRef context,
                
        }
        
-       TIZEN_CHECK_ACCESS(context, exception, privateObject, FILESYSTEM_FUNCTION_API_CLOSE);
+       AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_CLOSE);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
 
        Try {
                privateObject->getObject()->close();
@@ -224,9 +226,9 @@ JSValueRef JSFilestream::read(JSContextRef context,
        }
 
        Converter converter(context);
-
        
-       TIZEN_CHECK_ACCESS(context, exception, privateObject, FILESYSTEM_FUNCTION_API_READ);
+       AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_READ);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        try {
                JSValueRef undefinedValue = JSValueMakeUndefined(context);
@@ -282,7 +284,9 @@ JSValueRef JSFilestream::readBytes(JSContextRef context,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch error");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, privateObject, FILESYSTEM_FUNCTION_API_READ_BYTES);
+       AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_READ_BYTES);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
 
        Converter converter(context);
        Try {
@@ -326,7 +330,8 @@ JSValueRef JSFilestream::readBase64(JSContextRef context,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch error");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, privateObject, FILESYSTEM_FUNCTION_API_READ_BASE64);
+       AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_READ_BASE64);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        Converter converter(context);
        try {
@@ -371,7 +376,9 @@ JSValueRef JSFilestream::write(JSContextRef context,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch error");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, privateObject, FILESYSTEM_FUNCTION_API_WRITE);
+       AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_WRITE);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
 
        Converter converter(context);
        try {
@@ -410,7 +417,9 @@ JSValueRef JSFilestream::writeBytes(JSContextRef context,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch error");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, privateObject, FILESYSTEM_FUNCTION_API_WRITE_BYTES);
+       AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_WRITE_BYTES);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
 
        Converter converter(context);
        Try {
@@ -450,7 +459,8 @@ JSValueRef JSFilestream::writeBase64(JSContextRef context,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type mismatch error");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, privateObject, FILESYSTEM_FUNCTION_API_WRITE_BASE64);
+       AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_WRITE_BASE64);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        Converter converter(context);
        try {
index 4ed2e54..6fc278e 100755 (executable)
 
 #include <JavaScriptCore/JavaScript.h>
 #include <CommonsJavaScript/PrivateObject.h>
-#include <Security.h>
 #include "IStream.h"
 
 namespace DeviceAPI {
 namespace Filesystem {
-
-       
 class JSFilestream
 {
 public:
-       typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT<IStreamPtr>::Type PrivateObjectSecurity;
-
-       class PrivateObject :
-               public DeviceAPI::Common::SecurityAccessor,
-               public PrivateObjectSecurity
-       {
-       public :
-               PrivateObject (JSContextRef context, IStreamPtr stream) :
-                       DeviceAPI::Common::SecurityAccessor(), 
-                       PrivateObjectSecurity(context, stream)
-               {
-               }
-                       
-               virtual ~PrivateObject()
-               {
-               }
-       };
-       
+       typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT<IStreamPtr>::Type PrivateObject;
+
 public:
        static const JSClassDefinition* getClassInfo();
 
@@ -188,4 +169,4 @@ private:
 }
 }
 
-#endif
+#endif
\ No newline at end of file
index f8e736a..c88b13a 100644 (file)
@@ -17,7 +17,6 @@
 
  
 #include "JSFilesystemManager.h"
-#include "plugin_config_impl.h"
 #include <Commons/Exception.h>
 #include "EventResolve.h"
 #include "IManager.h"
@@ -195,7 +194,8 @@ JSValueRef JSFilesystemManager::getStorage(JSContextRef context,
                return JSValueMakeUndefined(context);
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, privateObject, FILESYSTEM_FUNCTION_API_GET_STORAGE);
+       AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_GET_STORAGE);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        // argument validation with new validator
        try {
@@ -268,7 +268,8 @@ JSValueRef JSFilesystemManager::getStorageList(JSContextRef context,
                return JSValueMakeUndefined(context);
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, privateObject, FILESYSTEM_FUNCTION_API_LIST_STORAGE);
+       AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_LIST_STORAGE);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
        
        // argument validation with new validator
        try {
@@ -339,8 +340,9 @@ JSValueRef JSFilesystemManager::addStorageStateListener(JSContextRef context,
                return JSValueMakeUndefined(context);
        }
 
-       
-       TIZEN_CHECK_ACCESS(context, exception, privateObject, FILESYSTEM_FUNCTION_API_ADD_STORAGE_LISTENER);
+       AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_ADD_STORAGE_LISTENER);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
 
        // argument validation with new validator
        try {
@@ -349,6 +351,7 @@ JSValueRef JSFilesystemManager::addStorageStateListener(JSContextRef context,
                validator.toFunction(1, true);  
        }
        catch (const BasePlatformException &err) {
+               LogDebug("Exception");
                return JSWebAPIErrorFactory::postException(context, exception, err);
        } catch (...) {
                DeviceAPI::Common::UnknownException err("");
@@ -411,8 +414,10 @@ JSValueRef JSFilesystemManager::removeStorageStateListener(JSContextRef context,
                return JSValueMakeUndefined(context);
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, privateObject, FILESYSTEM_FUNCTION_API_REMOVE_STORAGE_LISTENER);
+       AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_REMOVE_STORAGE_LISTENER);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
+       LogDebug("a");
 
        // argument validation with new validator
        try {
@@ -481,8 +486,8 @@ JSValueRef JSFilesystemManager::resolve(JSContextRef context,
 
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, privateObject, FILESYSTEM_FUNCTION_API_MGR_RESOLVE_ID);
-       LoggerD("<<<" << std::hex << privateObject);
+       AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_MGR_RESOLVE_ID);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        // argument validation with new validator
        try {
@@ -503,6 +508,9 @@ JSValueRef JSFilesystemManager::resolve(JSContextRef context,
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type missmatch error");
        }
 
+       LogDebug("resolve");
+
+
        
 
        JSContextRef globalContext = privateObject->getContext();
@@ -588,12 +596,18 @@ JSValueRef JSFilesystemManager::resolve(JSContextRef context,
                        return JSValueMakeUndefined(context);
                }
 
+               PermissionsAccessInfo perms(permissions, virtualPath);
+               AceSecurityStatus status = FILESYSTEM_PERMISSION_CHECK_ACCESS(
+                               FILESYSTEM_FUNCTION_API_MGR_RESOLVE_ID,
+                               perms);
+
+               TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
                EventGetNodeDataPtr data(new EventGetNodeData(permissions, cbm));
                EventResolvePtr event(new EventResolve(path));
                event->setForAsynchronousCall(&ResponseDispatcher::getInstance()); 
                event->setMode(perm);
                event->setPrivateData(DPL::StaticPointerCast<WrtDeviceApis::Commons::IEventPrivateData > (data));
-               event->copyAceCheckAccessFunction(privateObject);
                FilesystemAsyncCallbackManagerSingleton::Instance().registerCallbackManager(cbm, globalContext);
 
                IManager::getInstance().getNode(event);
index d18466d..ba00d49 100755 (executable)
 
 #include <JavaScriptCore/JavaScript.h>
 #include <CommonsJavaScript/PrivateObject.h>
-#include <Security.h>
 
 namespace DeviceAPI {
 namespace Filesystem {
-
-
-
-       
 class JSFilesystemManager
 {
   public:
-       typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT<void>::Type PrivateObjectSecurity;
-                       
-       class PrivateObject :
-               public DeviceAPI::Common::SecurityAccessor,
-               public PrivateObjectSecurity 
-       {
-       public:
-               PrivateObject(JSContextRef context) :
-                       DeviceAPI::Common::SecurityAccessor(),
-                       PrivateObjectSecurity(context)  
-               {
-               }
-               
-               virtual ~PrivateObject()                
-               {
-               }
-       };        
+    typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT<void>::Type PrivateObject;
+
   public:
     static const JSClassDefinition* getClassInfo();
 
@@ -141,4 +121,4 @@ class JSFilesystemManager
 }
 }
 
-#endif
+#endif
\ No newline at end of file
index 59bd7e6..37c96e0 100755 (executable)
 
 #include <JavaScriptCore/JavaScript.h>
 #include <CommonsJavaScript/PrivateObject.h>
-#include <Security.h>
 #include "StorageProperties.h"
 
 namespace DeviceAPI {
 namespace Filesystem {
-
 typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT<StorageProperties*>::Type JSStoragePriv;
 
 class JSStorage
index 16f3fad..9f98ff2 100644 (file)
@@ -67,17 +67,13 @@ void ResponseDispatcher::OnAnswerReceived(const EventResolvePtr& event)
 
        if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::None) {
                event->getResult()->setPermissions(data->getPerms());
-               
-               JSFile::PrivateObjectDefPtr privDefData(new JSFile::PrivateObjectDef(event->getResult(), JSFile::PrivateObjectDef::PermissionList()));
-               JSFile::PrivateObject* privData = new JSFile::PrivateObject(data->getCallbackManager()->getContext(), privDefData);
-               privData->copyAceCheckAccessFunction(event.Get());
-
+               JSFile::PrivateObjectDefPtr privData(new JSFile::PrivateObjectDef(event->getResult(), JSFile::PrivateObjectDef::PermissionList()));
                try {
                        INodePtr parent = event->getResult()->getParent();
                        
                        if (parent)
                        {
-                               privDefData->pushParentPermissions(data->getPerms());
+                               privData->pushParentPermissions(data->getPerms());
                        }
                }
                catch (...)
@@ -85,7 +81,7 @@ void ResponseDispatcher::OnAnswerReceived(const EventResolvePtr& event)
                        LoggerD("no parent");
                }
 
-        JSObjectRef object = JSObjectMake(data->getCallbackManager()->getContext(), JSFile::getClassRef(), privData);
+               JSObjectRef object = JSUtils::makeObject(data->getCallbackManager()->getContext(), JSFile::getClassRef(), privData);
                data->getCallbackManager()->callOnSuccess(object);
        }  else {
                JSObjectRef jsException;
@@ -116,7 +112,7 @@ void ResponseDispatcher::OnAnswerReceived(const EventListNodesPtr& event)
        if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::None) {
                Converter converter(data->getContext());
                Try {
-                       JSValueRef result = converter.toJSValueRef(event->getResult(), privData->getParentPermissions(), data->getContext(), event.Get());
+                       JSValueRef result = converter.toJSValueRef(event->getResult(), privData->getParentPermissions(), data->getContext());
                        data->callOnSuccess(result);
                }
                Catch(WrtDeviceApis::Commons::ConversionException) {
@@ -138,10 +134,7 @@ void ResponseDispatcher::OnAnswerReceived(const EventOpenPtr& event)
        FilesystemAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(data);
 
        if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::None) {
-               JSFilestream::PrivateObject* privData = new JSFilestream::PrivateObject(data->getContext(), event->getResult());
-               privData->copyAceCheckAccessFunction(event.Get());
-               
-        JSObjectRef object = JSObjectMake(data->getContext(), JSFilestream::getClassRef(), privData);
+               JSObjectRef object = JSUtils::makeObject(data->getContext(), JSFilestream::getClassRef(), event->getResult());
                data->callOnSuccess(object);
        } else {
                JSObjectRef jsException;
@@ -168,11 +161,11 @@ void ResponseDispatcher::OnAnswerReceived(const EventCopyPtr& event)
        FilesystemAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(data);
 
        if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::None) {
-               JSFile::PrivateObjectDefPtr privDefData(new JSFile::PrivateObjectDef(event->getResult(),JSFile::PrivateObjectDef::PermissionList()));
-               JSFile::PrivateObject* privData = new JSFile::PrivateObject(data->getContext(), privDefData);
-               privData->copyAceCheckAccessFunction(event.Get());
+               JSFile::PrivateObjectDefPtr privData(new JSFile::PrivateObjectDef(
+               event->getResult(),
+               JSFile::PrivateObjectDef::PermissionList()));
 
-        JSObjectRef object = JSObjectMake(data->getContext(), JSFile::getClassRef(), privData);
+               JSObjectRef object = JSUtils::makeObject(data->getContext(), JSFile::getClassRef(), privData);
                data->callOnSuccess(object);
        } else {
                JSObjectRef jsException = NULL;
@@ -198,11 +191,12 @@ void ResponseDispatcher::OnAnswerReceived(const EventMovePtr& event)
        FilesystemAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(data);
 
        if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::None) {
-               JSFile::PrivateObjectDefPtr privDefData(new JSFile::PrivateObjectDef(event->getResult(), JSFile::PrivateObjectDef::PermissionList()));
-               JSFile::PrivateObject* privData = new JSFile::PrivateObject(data->getContext(), privDefData);
-               privData->copyAceCheckAccessFunction(event.Get());
-               
-        JSObjectRef object = JSObjectMake(data->getContext(), JSFile::getClassRef(), privData);
+               JSFile::PrivateObjectDefPtr privData(new JSFile::PrivateObjectDef(
+               event->getResult(),
+               JSFile::PrivateObjectDef::PermissionList()));
+               JSObjectRef object = JSUtils::makeObject(data->getContext(),
+                                JSFile::getClassRef(),
+                                privData);
                data->callOnSuccess(object);
        } else {
                JSObjectRef jsException = NULL;
index a1cf475..e0ca0b2 100755 (executable)
@@ -18,7 +18,7 @@
 
 #include <map>
 #include <utility>
-#include "plugin_config.h"
+
 #include <Commons/FunctionDefinition.h>
 #include <Commons/FunctionDeclaration.h>
 #include <Commons/Exception.h>
 namespace DeviceAPI {
 namespace Filesystem {
 
-
+#pragma GCC visibility push(default)
+
+const char* FILESYSTEM_PARAM_LOCATION = "param:location";
+const char* FILESYSTEM_DEVICE_CAP_READ = "filesystem.read";
+const char* FILESYSTEM_DEVICE_CAP_WRITE = "filesystem.write";
+
+const char* FILESYSTEM_FUNCTION_API_MGR_RESOLVE_ID = "manager_resolve";
+const char* FILESYSTEM_FUNCTION_API_MGR_RESOLVE = "resolve";
+
+const char* FILESYSTEM_FUNCTION_API_GET_STORAGE = "getStorage";
+const char* FILESYSTEM_FUNCTION_API_LIST_STORAGE = "listStorage";
+const char* FILESYSTEM_FUNCTION_API_ADD_STORAGE_LISTENER = "addStorageStateChangeListener";
+const char* FILESYSTEM_FUNCTION_API_REMOVE_STORAGE_LISTENER = "removeStorageStateChangeListener";
+
+const char* FILESYSTEM_FUNCTION_API_RESOLVE = "resolve";
+const char* FILESYSTEM_FUNCTION_API_TO_URI = "toURI";
+const char* FILESYSTEM_FUNCTION_API_LIST_FILES = "listFiles";
+const char* FILESYSTEM_FUNCTION_API_OPEN_STREAM = "openStream";
+const char* FILESYSTEM_FUNCTION_API_READ_AS_TEXT = "readAsText";
+const char* FILESYSTEM_FUNCTION_API_COPY_TO = "copyTo";
+const char* FILESYSTEM_FUNCTION_API_MOVE_TO = "moveTo";
+const char* FILESYSTEM_FUNCTION_API_CREATE_DIR = "createDirectory";
+const char* FILESYSTEM_FUNCTION_API_CREATE_FILE = "createFile";
+const char* FILESYSTEM_FUNCTION_API_DELETE_DIR = "deleteDirectory";
+const char* FILESYSTEM_FUNCTION_API_DELETE_FILE = "deleteFile";
+
+const char* FILESYSTEM_FUNCTION_API_CLOSE = "close";
+const char* FILESYSTEM_FUNCTION_API_READ = "read";
+const char* FILESYSTEM_FUNCTION_API_READ_BYTES = "readBytes";
+const char* FILESYSTEM_FUNCTION_API_READ_BASE64 = "readBase64";
+const char* FILESYSTEM_FUNCTION_API_WRITE = "write";
+const char* FILESYSTEM_FUNCTION_API_WRITE_BYTES = "writeBytes";
+const char* FILESYSTEM_FUNCTION_API_WRITE_BASE64 = "writeBase64";
 
 static WrtDeviceApis::Commons::FunctionMapping createFilesystemFunctions();
 
@@ -319,5 +351,86 @@ static WrtDeviceApis::Commons::FunctionMapping createFilesystemFunctions()
     return FilesystemMapping;
 }
 
+void setFilesystemPermDevCaps(int permissions,
+        const std::string& path,
+        WrtDeviceApis::Commons::AceFunction* outFunction)
+{
+    using namespace WrtDeviceApis::Commons;
+    AceDeviceCapParam paramLocation = AceDeviceCapParam(
+            FILESYSTEM_PARAM_LOCATION, path);
+
+    AceDeviceCaps devCaps;
+
+    if (permissions & Filesystem::PERM_READ) {
+        AceDeviceCapability devCapRead = AceDeviceCapability(
+                FILESYSTEM_DEVICE_CAP_READ,
+                AceDeviceCapParams());
+        devCaps.push_back(devCapRead);
+
+        ACE_ADD_DEV_CAP_PARAM(
+            devCaps,
+            FILESYSTEM_DEVICE_CAP_READ,
+            paramLocation);
+    }
+
+    if (permissions & Filesystem::PERM_WRITE) {
+        AceDeviceCapability devCapWrite = AceDeviceCapability(
+                FILESYSTEM_DEVICE_CAP_WRITE,
+                AceDeviceCapParams());
+
+        devCaps.push_back(devCapWrite);
+
+        ACE_ADD_DEV_CAP_PARAM(
+            devCaps,
+            FILESYSTEM_DEVICE_CAP_WRITE,
+            paramLocation);
+    }
+
+    outFunction->deviceCapabilities = devCaps;
+}
+
+void setFilesystemAccessModeDevCaps(int accessMode,
+        const std::string& path,
+        WrtDeviceApis::Commons::AceFunction
+        *outFunction)
+{
+    using namespace WrtDeviceApis::Commons;
+
+    AceDeviceCapParam paramLocation = AceDeviceCapParam(
+            FILESYSTEM_PARAM_LOCATION,
+            path);
+    AceDeviceCaps devCaps;
+
+    if (accessMode & Filesystem::AM_READ) {
+        AceDeviceCapability devCapRead = AceDeviceCapability(
+                FILESYSTEM_DEVICE_CAP_READ,
+                AceDeviceCapParams());
+
+        devCaps.push_back(devCapRead);
+
+        ACE_ADD_DEV_CAP_PARAM(
+            devCaps,
+            FILESYSTEM_DEVICE_CAP_READ,
+            paramLocation);
+    }
+
+    if ((accessMode & Filesystem::AM_WRITE) ||
+        (accessMode & Filesystem::AM_APPEND)) {
+        AceDeviceCapability devCapWrite = AceDeviceCapability(
+                FILESYSTEM_DEVICE_CAP_WRITE,
+                AceDeviceCapParams());
+
+        devCaps.push_back(devCapWrite);
+
+        ACE_ADD_DEV_CAP_PARAM(
+            devCaps,
+            FILESYSTEM_DEVICE_CAP_WRITE,
+            paramLocation);
+    }
+    outFunction->deviceCapabilities = devCaps;
+}
+
+#pragma GCC visibility pop
+
 }
 }
index 6d874ff..756ab0a 100755 (executable)
 #define _FILESYSTEM_PLUGIN_CONFIG_H_
 
 #include <Commons/FunctionDeclaration.h>
-#include "plugin_config_impl.h"
 
 namespace DeviceAPI {
 namespace Filesystem {
 
+extern const char* FILESYSTEM_FUNCTION_API_MGR_RESOLVE_ID;
+extern const char* FILESYSTEM_FUNCTION_API_GET_STORAGE;
+extern const char* FILESYSTEM_FUNCTION_API_LIST_STORAGE;
+extern const char* FILESYSTEM_FUNCTION_API_ADD_STORAGE_LISTENER;
+extern const char* FILESYSTEM_FUNCTION_API_REMOVE_STORAGE_LISTENER;
+
+extern const char* FILESYSTEM_FUNCTION_API_RESOLVE;
+extern const char* FILESYSTEM_FUNCTION_API_TO_URI;
+extern const char* FILESYSTEM_FUNCTION_API_LIST_FILES;
+extern const char* FILESYSTEM_FUNCTION_API_OPEN_STREAM;
+extern const char* FILESYSTEM_FUNCTION_API_READ_AS_TEXT;
+extern const char* FILESYSTEM_FUNCTION_API_COPY_TO;
+extern const char* FILESYSTEM_FUNCTION_API_MOVE_TO;
+extern const char* FILESYSTEM_FUNCTION_API_CREATE_DIR;
+extern const char* FILESYSTEM_FUNCTION_API_CREATE_FILE;
+extern const char* FILESYSTEM_FUNCTION_API_DELETE_DIR;
+extern const char* FILESYSTEM_FUNCTION_API_DELETE_FILE;
+
+extern const char* FILESYSTEM_FUNCTION_API_CLOSE;
+extern const char* FILESYSTEM_FUNCTION_API_READ;
+extern const char* FILESYSTEM_FUNCTION_API_READ_BYTES;
+extern const char* FILESYSTEM_FUNCTION_API_READ_BASE64;
+extern const char* FILESYSTEM_FUNCTION_API_WRITE;
+extern const char* FILESYSTEM_FUNCTION_API_WRITE_BYTES;
+extern const char* FILESYSTEM_FUNCTION_API_WRITE_BASE64;
 
 DECLARE_FUNCTION_GETTER(Filesystem);
 
+void setFilesystemPermDevCaps(int permissions,
+        const std::string& path,
+        WrtDeviceApis::Commons::AceFunction* outFunction);
+
+void setFilesystemAccessModeDevCaps(int accessMode,
+        const std::string& path,
+        WrtDeviceApis::Commons::AceFunction*
+        outFunction);
+
+struct PermissionsAccessInfo
+{
+    PermissionsAccessInfo(int perms,
+            const std::string& fpath) :
+        permissions(perms),
+        path(fpath)
+    {
+    }
+
+    int permissions;
+    const std::string path;
+};
+
+struct AccessModeInfo
+{
+    AccessModeInfo(int amode,
+            const std::string& fpath) :
+        accessMode(amode),
+        path(fpath)
+    {
+    }
+
+    int accessMode;
+    const std::string path;
+};
+
+}
+}
+
+namespace WrtDeviceApis {
+namespace Commons {
+
+/**
+ * template specialization for security access basing on permissions
+ */
+template <>
+class DefaultArgsVerifier <DeviceAPI::Filesystem::PermissionsAccessInfo>
+{
+  public:
+    void operator()(AceFunction& aceFunction,
+            const DeviceAPI::Filesystem::PermissionsAccessInfo& permInfo) const
+    {
+        DeviceAPI::Filesystem::setFilesystemPermDevCaps(permInfo.permissions,
+                                 permInfo.path,
+                                 &aceFunction);
+    }
+};
+
+/**
+ * template specialization for security access basing on access mode
+ */
+template <>
+class DefaultArgsVerifier <DeviceAPI::Filesystem::AccessModeInfo>
+{
+  public:
+    void operator()(AceFunction& aceFunction,
+            const DeviceAPI::Filesystem::AccessModeInfo& accessInfo) const
+    {
+        DeviceAPI::Filesystem::setFilesystemAccessModeDevCaps(accessInfo.accessMode,
+                                       accessInfo.path,
+                                       &aceFunction);
+    }
+};
+
 #define FILESYSTEM_CHECK_ACCESS(functionName) \
     WrtDeviceApis::Commons::aceCheckAccess<AceFunctionGetter, \
     WrtDeviceApis::Commons::DefaultArgsVerifier<> >(                \
         getFilesystemFunctionData,         \
         functionName)
 
+#define FILESYSTEM_PERMISSION_CHECK_ACCESS(functionName, perm)  \
+    WrtDeviceApis::Commons::aceCheckAccess<AceFunctionGetter,                  \
+    WrtDeviceApis::Commons::DefaultArgsVerifier <DeviceAPI::Filesystem::PermissionsAccessInfo> >(             \
+        getFilesystemFunctionData,         \
+        functionName,                      \
+        perm)
+
+#define FILESYSTEM_ACCESSMODE_CHECK_ACCESS(functionName, amode) \
+    WrtDeviceApis::Commons::aceCheckAccess<AceFunctionGetter,                  \
+    WrtDeviceApis::Commons::DefaultArgsVerifier <DeviceAPI::Filesystem::AccessModeInfo> >(                    \
+        getFilesystemFunctionData,         \
+        functionName,                      \
+        amode)
 }
 }
+
 #endif
diff --git a/src/Filesystem/plugin_config_impl.h b/src/Filesystem/plugin_config_impl.h
deleted file mode 100755 (executable)
index 17cb2af..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-//
-// Tizen Web Device API
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#ifndef _FILESYSTEM_PLUGIN_CONFIG_IMPL_H_
-#define _FILESYSTEM_PLUGIN_CONFIG_IMPL_H_
-
-#define FILESYSTEM_PARAM_LOCATION "param:location"
-#define FILESYSTEM_DEVICE_CAP_READ "filesystem.read"
-#define FILESYSTEM_DEVICE_CAP_WRITE "filesystem.write"
-
-#define FILESYSTEM_FUNCTION_API_MGR_RESOLVE_ID "manager_resolve"
-#define FILESYSTEM_FUNCTION_API_MGR_RESOLVE "resolve"
-
-#define FILESYSTEM_FUNCTION_API_GET_STORAGE "getStorage"
-#define FILESYSTEM_FUNCTION_API_LIST_STORAGE "listStorage"
-#define FILESYSTEM_FUNCTION_API_ADD_STORAGE_LISTENER "addStorageStateChangeListener"
-#define FILESYSTEM_FUNCTION_API_REMOVE_STORAGE_LISTENER "removeStorageStateChangeListener"
-
-#define FILESYSTEM_FUNCTION_API_RESOLVE "resolve"
-#define FILESYSTEM_FUNCTION_API_TO_URI "toURI"
-#define FILESYSTEM_FUNCTION_API_LIST_FILES "listFiles"
-#define FILESYSTEM_FUNCTION_API_OPEN_STREAM "openStream"
-#define FILESYSTEM_FUNCTION_API_READ_AS_TEXT "readAsText"
-#define FILESYSTEM_FUNCTION_API_COPY_TO "copyTo"
-#define FILESYSTEM_FUNCTION_API_MOVE_TO "moveTo"
-#define FILESYSTEM_FUNCTION_API_CREATE_DIR "createDirectory"
-#define FILESYSTEM_FUNCTION_API_CREATE_FILE "createFile"
-#define FILESYSTEM_FUNCTION_API_DELETE_DIR "deleteDirectory"
-#define FILESYSTEM_FUNCTION_API_DELETE_FILE "deleteFile"
-
-#define FILESYSTEM_FUNCTION_API_CLOSE "close"
-#define FILESYSTEM_FUNCTION_API_READ "read"
-#define FILESYSTEM_FUNCTION_API_READ_BYTES "readBytes"
-#define FILESYSTEM_FUNCTION_API_READ_BASE64 "readBase64"
-#define FILESYSTEM_FUNCTION_API_WRITE "write"
-#define FILESYSTEM_FUNCTION_API_WRITE_BYTES "writeBytes"
-#define FILESYSTEM_FUNCTION_API_WRITE_BASE64 "writeBase64"
-
-#endif
index fc64952..16b2b46 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;
@@ -34,26 +31,6 @@ 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();
@@ -62,7 +39,6 @@ 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)
@@ -74,7 +50,6 @@ 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)
@@ -100,7 +75,7 @@ PLUGIN_CLASS_MAP_BEGIN
 PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
         "filesystem",
         (js_class_template_getter)DeviceAPI::Filesystem::JSFilesystemManager::getClassRef,
-        &FilesystemOptions)
+        NULL)
 PLUGIN_CLASS_MAP_END
 
 #undef FILESYSTEM
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 1725dc0..db14749 100755 (executable)
@@ -149,6 +149,7 @@ ADD_LIBRARY(${TARGET_NAME} SHARED ${SRCS})
 
 TARGET_LINK_LIBRARIES(${TARGET_NAME}
        ${TARGET_IMPL_NAME}
+       "-Wl,--no-as-needed" ${filesystem_config}
 )
 
 INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 3d5a60f..b162748 100755 (executable)
 #include <Commons/IEvent.h>
 #include <dpl/shared_ptr.h>
 #include <Commons/Exception.h>
-#include <Security.h>
 
 #include "IMessagingService.h"
 #include "IMessagingTypes.h"
 
 namespace DeviceAPI {
 namespace Messaging {
-class EventGetMessagingService: public WrtDeviceApis::Commons::IEvent<EventGetMessagingService>, public DeviceAPI::Common::SecurityAccessor
+class EventGetMessagingService: public WrtDeviceApis::Commons::IEvent<EventGetMessagingService> 
 {
        
 public:
@@ -106,4 +105,4 @@ typedef DPL::SharedPtr<EventGetMessagingService> EventGetMessagingServicePtr;
 
 } // Messaging
 } // DeviceAPI
-#endif //WRTPLUGINS_API_GET_MESSAGING_SERVICE_EVENT_MESSAGING_H_
+#endif //WRTPLUGINS_API_GET_MESSAGING_SERVICE_EVENT_MESSAGING_H_
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index f9e32eb..5205242 100644 (file)
@@ -42,7 +42,7 @@
 #include "EventSendMessagePrivateData.h" //for send message
 #include "EventMessagingServicePrivateData.h"
 #include "MessageAsyncCallbackManager.h"
-#include "plugin_config_impl.h"
+#include "plugin_config.h"
 
 using namespace std;
 
@@ -123,10 +123,9 @@ bool JSMessagingService::hasInstance(JSContextRef context, JSObjectRef construct
     return JSValueIsObjectOfClass(context, possibleInstance, getClassRef());
 }
 
-JSObjectRef JSMessagingService::createJSObject(JSContextRef context, const IMessagingServicePtr &messagingService, const DeviceAPI::Common::SecurityAccessor *securityAccessor)
+JSObjectRef JSMessagingService::createJSObject(JSContextRef context, const IMessagingServicePtr &messagingService)
 {
     JSMessagingServicePriv* priv = new JSMessagingServicePriv( context, messagingService);    //make private class.
-    priv->copyAceCheckAccessFunction(securityAccessor);
     return JSObjectMake(context, getClassRef(), priv);
 }
 
@@ -177,7 +176,6 @@ JSValueRef JSMessagingService::getProperty(JSContextRef context,
             LoggerD("type" << ": " << storagePrivObj->m_type);
 
             MessagingStoragePriv *privStorage = new MessagingStoragePriv(l_globalContext, storagePrivObj);
-            privStorage->copyAceCheckAccessFunction(priv);
 
             return JSObjectMake(l_globalContext, JSMessagingStorage::getClassRef(), privStorage);
         }
@@ -253,8 +251,9 @@ JSValueRef JSMessagingService::createMessage(JSContextRef context, JSObjectRef o
     JSMessagingServicePriv* priv = static_cast<JSMessagingServicePriv*>(JSObjectGetPrivate(thisObject));
     if (priv)
     {
-        //check permission.
-        TIZEN_CHECK_ACCESS(context, exception, priv, MESSAGING_FUNCTION_API_CREATE_MESSAGE);
+        AceSecurityStatus status = MESSAGING_CHECK_ACCESS(
+            MessagingExportedNames[MESSAGING_FUNCTION_API_CREATE_MESSAGE]);
+        TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
         try {
             ConverterMessageFactory::ConverterType converter = ConverterMessageFactory::getConverter(context);
@@ -411,6 +410,11 @@ JSValueRef JSMessagingService::sendMessage(JSContextRef context,
 {
     LoggerD("Entered");
 
+    //check permission.
+    AceSecurityStatus status = MESSAGING_CHECK_ACCESS(
+        MessagingExportedNames[MESSAGING_FUNCTION_API_SEND_MESSAGE]);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
     JSMessagingServicePriv* priv = static_cast<JSMessagingServicePriv*>(JSObjectGetPrivate(thisObject));
     if (!priv) {
         LoggerE("Private object is NULL.");
@@ -418,9 +422,6 @@ JSValueRef JSMessagingService::sendMessage(JSContextRef context,
         return JSWebAPIErrorFactory::postException(context, exception, err);
     }
 
-    //check permission.
-    TIZEN_CHECK_ACCESS(context, exception, priv, MESSAGING_FUNCTION_API_SEND_MESSAGE);
-
     JSContextRef globalContext = priv->getContext();
 
     WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr callbackManager = JSCallbackManager::createObject(globalContext);
@@ -504,6 +505,11 @@ JSValueRef JSMessagingService::loadMessageBody(JSContextRef context,
 {
     LoggerD("Entered");
 
+    //check permission.
+    AceSecurityStatus status = MESSAGING_CHECK_ACCESS(
+        MessagingExportedNames[MESSAGING_FUNCTION_API_LOAD_MESSAGE_BODY]);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
     JSMessagingServicePriv* priv = static_cast<JSMessagingServicePriv*>(JSObjectGetPrivate(thisObject));
     if (!priv) {
         LoggerE("Private object is NULL.");
@@ -511,9 +517,6 @@ JSValueRef JSMessagingService::loadMessageBody(JSContextRef context,
         return JSWebAPIErrorFactory::postException(context, exception, err);
     }
 
-    //check permission.
-    TIZEN_CHECK_ACCESS(context, exception, priv, MESSAGING_FUNCTION_API_LOAD_MESSAGE_BODY);
-
     JSContextRef globalContext = priv->getContext(); //create global Context
 
     WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr callbackManager = JSCallbackManager::createObject(globalContext);
@@ -608,6 +611,11 @@ JSValueRef JSMessagingService::loadMessageAttachment(JSContextRef context,
 {
     LoggerD("Entered");
 
+    //check permission.
+    AceSecurityStatus status = MESSAGING_CHECK_ACCESS(
+        MessagingExportedNames[MESSAGING_FUNCTION_API_LOAD_MESSAGE_ATTACHMENT]);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
     JSMessagingServicePriv* priv = static_cast<JSMessagingServicePriv*>(JSObjectGetPrivate(thisObject));
     if (!priv) {
         LoggerE("Private object is NULL.");
@@ -615,9 +623,6 @@ JSValueRef JSMessagingService::loadMessageAttachment(JSContextRef context,
         return JSWebAPIErrorFactory::postException(context, exception, err);
     }
 
-    //check permission.
-    TIZEN_CHECK_ACCESS(context, exception, priv, MESSAGING_FUNCTION_API_LOAD_MESSAGE_ATTACHMENT);
-
     JSContextRef globalContext = priv->getContext(); //create global Context
 
     WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr callbackManager = JSCallbackManager::createObject(globalContext);
@@ -701,6 +706,11 @@ JSValueRef JSMessagingService::sync(JSContextRef context, JSObjectRef function,
 {
     LoggerD("Entered");
 
+    //check permission.
+    AceSecurityStatus status = MESSAGING_CHECK_ACCESS(
+        MessagingExportedNames[MESSAGING_FUNCTION_API_SYNC]);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
     JSMessagingServicePriv* priv = static_cast<JSMessagingServicePriv*>(JSObjectGetPrivate(thisObject));
     if (!priv) {
         LoggerE("Private object is NULL.");
@@ -708,9 +718,6 @@ JSValueRef JSMessagingService::sync(JSContextRef context, JSObjectRef function,
         return JSWebAPIErrorFactory::postException(context, exception, err);
     }
 
-    //check permission.
-    TIZEN_CHECK_ACCESS(context, exception, priv, MESSAGING_FUNCTION_API_SYNC);
-
     JSContextRef globalContext = priv->getContext(); //get global Context
 
     WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr callbackManager = JSCallbackManager::createObject(globalContext);
@@ -774,6 +781,11 @@ JSValueRef JSMessagingService::syncFolder(JSContextRef context, JSObjectRef func
 {
     LoggerD("Entered");
 
+    //check permission
+    AceSecurityStatus status = MESSAGING_CHECK_ACCESS(
+        MessagingExportedNames[MESSAGING_FUNCTION_API_SYNC_FOLDER]);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
     JSMessagingServicePriv* priv = static_cast<JSMessagingServicePriv*>(JSObjectGetPrivate(thisObject));
     if (!priv) {
         LoggerE("Private object is NULL.");
@@ -781,9 +793,6 @@ JSValueRef JSMessagingService::syncFolder(JSContextRef context, JSObjectRef func
         return JSWebAPIErrorFactory::postException(context, exception, err);
     }
 
-    //check permission.
-    TIZEN_CHECK_ACCESS(context, exception, priv, MESSAGING_FUNCTION_API_SYNC_FOLDER);
-
     JSContextRef globalContext = priv->getContext(); //get global Context
 
     WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr callbackManager = JSCallbackManager::createObject(globalContext);
index 7b52f16..831cd18 100755 (executable)
 
 #include <JavaScriptCore/JavaScript.h>
 #include <CommonsJavaScript/PrivateObject.h>
-#include <Security.h>
 #include "IMessagingService.h"
 
 namespace DeviceAPI {
 namespace Messaging {
 
-typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT<DeviceAPI::Messaging::IMessagingServicePtr>::Type JSMessagingServicePrivObject;
-
-class JSMessagingServicePriv :
-    public JSMessagingServicePrivObject,
-    public DeviceAPI::Common::SecurityAccessor
-{
-public:
-    JSMessagingServicePriv(JSContextRef context, IMessagingServicePtr messagingService) :
-        JSMessagingServicePrivObject(context, messagingService),
-        DeviceAPI::Common::SecurityAccessor()
-    {
-    }
-
-    virtual ~JSMessagingServicePriv()
-    {
-    }
-};
+typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT<IMessagingServicePtr>::Type JSMessagingServicePriv;
 
 class JSMessagingService {
 
@@ -50,7 +33,7 @@ public :
     static const JSClassDefinition* getClassInfo();
     static const JSClassRef getClassRef();
 
-    static JSObjectRef createJSObject(JSContextRef context, const IMessagingServicePtr &messagingService, const DeviceAPI::Common::SecurityAccessor *securityAccessor);
+    static JSObjectRef createJSObject(JSContextRef context, const IMessagingServicePtr &messagingService);
 
 private :
 
index 62ff869..a64a316 100644 (file)
@@ -182,7 +182,6 @@ JSValueRef JSMessagingServiceManager::getMessagingServices(JSContextRef context,
         event->setEventType(EventGetMessagingService::MESSAGING_SERVICE_MANAGER_EVENT_TYPE_ALL);
 
         event->setMessagingServiceType(messagingType);
-        event->copyAceCheckAccessFunction(priv);
 
         messagingServiceManager->getMessagingServiceManager(event); //call postEvent
         MessageAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, gContext);
index 9b8f65d..80e2ee8 100755 (executable)
 
 #include <JavaScriptCore/JavaScript.h>
 #include <CommonsJavaScript/PrivateObject.h>
-#include <Security.h>
 #include "IMessagingServiceManager.h"
 
 namespace DeviceAPI {
 namespace Messaging {
 
-typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT<DeviceAPI::Messaging::IMessagingServiceManagerPtr>::Type JSMessagingServiceManagerPrivObject;
-
-class JSMessagingServiceManagerPriv :
-    public JSMessagingServiceManagerPrivObject,
-    public DeviceAPI::Common::SecurityAccessor
-{
-public:
-    JSMessagingServiceManagerPriv(JSContextRef context, IMessagingServiceManagerPtr messagingServiceManager) :
-        JSMessagingServiceManagerPrivObject(context, messagingServiceManager),
-        DeviceAPI::Common::SecurityAccessor()
-    {
-    }
-
-    virtual ~JSMessagingServiceManagerPriv()
-    {
-    }
-};
+typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT<DeviceAPI::Messaging::IMessagingServiceManagerPtr>::Type JSMessagingServiceManagerPriv;
 
 class JSMessagingServiceManager {
 public:
index 35a82d4..6ea7dd9 100644 (file)
@@ -43,7 +43,7 @@
 #include "MessagingErrorMsg.h"
 #include "MessageAsyncCallbackManager.h"
 #include "MessageFilterConverter.h"
-#include "plugin_config_impl.h"
+#include "plugin_config.h"
 
 
 using namespace std;
@@ -181,6 +181,11 @@ JSValueRef JSMessagingStorage::addDraftMessage(JSContextRef context, JSObjectRef
 {
     LoggerD("Entered");
 
+    //check permission.
+    AceSecurityStatus status = MESSAGING_CHECK_ACCESS(
+        MessagingExportedNames[MESSAGING_FUNCTION_API_ADD_DRAFT_MESSAGE]);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
     MessagingStoragePriv* priv = static_cast<MessagingStoragePriv*>(JSObjectGetPrivate(thisObject));
     if (!priv) {
         LoggerE("Private object is NULL.");
@@ -188,9 +193,6 @@ JSValueRef JSMessagingStorage::addDraftMessage(JSContextRef context, JSObjectRef
         return JSWebAPIErrorFactory::postException(context, exception, err);
     }
 
-    //check permission.
-    TIZEN_CHECK_ACCESS(context, exception, priv, MESSAGING_FUNCTION_API_ADD_DRAFT_MESSAGE);
-
     MessagingStoragePrivObjPtr objectPriv = priv->getObject();
     if (!objectPriv) {
         LoggerE("objectPriv is NULL.");
@@ -277,6 +279,11 @@ JSValueRef JSMessagingStorage::findMessages(JSContextRef context, JSObjectRef ob
 
     LoggerD("Entered");
 
+    //check permission.
+    AceSecurityStatus status = MESSAGING_CHECK_ACCESS(
+        MessagingExportedNames[MESSAGING_FUNCTION_API_FIND_MESSAGES]);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
     MessagingStoragePriv* priv = static_cast<MessagingStoragePriv*>(JSObjectGetPrivate(thisObject));
     if (!priv) {
         LoggerE("Private object is NULL.");
@@ -284,9 +291,6 @@ JSValueRef JSMessagingStorage::findMessages(JSContextRef context, JSObjectRef ob
         return JSWebAPIErrorFactory::postException(context, exception, err);
     }
 
-    //check permission.
-    TIZEN_CHECK_ACCESS(context, exception, priv, MESSAGING_FUNCTION_API_FIND_MESSAGES);
-
     MessagingStoragePrivObjPtr objectPriv = priv->getObject();
     if (!objectPriv) {
         LoggerE("objectPriv is NULL.");
@@ -397,6 +401,11 @@ JSValueRef JSMessagingStorage::removeMessages(JSContextRef context, JSObjectRef
 {
     LoggerD("Entered");
 
+    //check permission.
+    AceSecurityStatus status = MESSAGING_CHECK_ACCESS(
+        MessagingExportedNames[MESSAGING_FUNCTION_API_REMOVE_MESSAGES]);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
     MessagingStoragePriv* priv = static_cast<MessagingStoragePriv*>(JSObjectGetPrivate(thisObject));
     if (!priv) {
         LoggerE("Private object is NULL.");
@@ -404,9 +413,6 @@ JSValueRef JSMessagingStorage::removeMessages(JSContextRef context, JSObjectRef
         return JSWebAPIErrorFactory::postException(context, exception, err);
     }
 
-    //check permission.
-    TIZEN_CHECK_ACCESS(context, exception, priv, MESSAGING_FUNCTION_API_REMOVE_MESSAGES);
-
     MessagingStoragePrivObjPtr objectPriv = priv->getObject();
     if (!objectPriv) {
         LoggerE("objectPriv is NULL.");
@@ -500,6 +506,11 @@ JSValueRef JSMessagingStorage::updateMessages(JSContextRef context, JSObjectRef
 
     LoggerD("Entered");
 
+    //check permission.
+    AceSecurityStatus status = MESSAGING_CHECK_ACCESS(
+        MessagingExportedNames[MESSAGING_FUNCTION_API_UPDATE_MESSAGES]);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
     MessagingStoragePriv* priv = static_cast<MessagingStoragePriv*>(JSObjectGetPrivate(thisObject));
     if (!priv) {
         LoggerE("Private object is NULL.");
@@ -507,9 +518,6 @@ JSValueRef JSMessagingStorage::updateMessages(JSContextRef context, JSObjectRef
         return JSWebAPIErrorFactory::postException(context, exception, err);
     }
 
-    //check permission.
-    TIZEN_CHECK_ACCESS(context, exception, priv, MESSAGING_FUNCTION_API_UPDATE_MESSAGES);
-
     MessagingStoragePrivObjPtr objectPriv = priv->getObject();
     if (!objectPriv) {
         LoggerE("objectPriv is NULL.");
@@ -603,6 +611,11 @@ JSValueRef JSMessagingStorage::findConversations(JSContextRef context, JSObjectR
 {
     LoggerD("Entered");
 
+    //check permission.
+    AceSecurityStatus status = MESSAGING_CHECK_ACCESS(
+        MessagingExportedNames[MESSAGING_FUNCTION_API_FIND_CONVERSATIONS]);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
     MessagingStoragePriv* priv = static_cast<MessagingStoragePriv*>(JSObjectGetPrivate(thisObject));
     if (!priv) {
         LoggerE("Private object is NULL.");
@@ -610,9 +623,6 @@ JSValueRef JSMessagingStorage::findConversations(JSContextRef context, JSObjectR
         return JSWebAPIErrorFactory::postException(context, exception, err);
     }
 
-    //check permission.
-    TIZEN_CHECK_ACCESS(context, exception, priv, MESSAGING_FUNCTION_API_FIND_CONVERSATIONS);
-
     MessagingStoragePrivObjPtr objectPriv = priv->getObject();
     if (!objectPriv) {
         LoggerE("objectPriv is NULL.");
@@ -723,6 +733,11 @@ JSValueRef JSMessagingStorage::removeConversations(JSContextRef context, JSObjec
 {
     LoggerD("Entered");
 
+    //check permission.
+    AceSecurityStatus status = MESSAGING_CHECK_ACCESS(
+            MessagingExportedNames[MESSAGING_FUNCTION_API_REMOVE_CONVERSATIONS]);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
     MessagingStoragePriv* priv = static_cast<MessagingStoragePriv*>(JSObjectGetPrivate(thisObject));
     if (!priv) {
         LoggerE("Private object is NULL.");
@@ -730,9 +745,6 @@ JSValueRef JSMessagingStorage::removeConversations(JSContextRef context, JSObjec
         return JSWebAPIErrorFactory::postException(context, exception, err);
     }
 
-    //check permission.
-    TIZEN_CHECK_ACCESS(context, exception, priv, MESSAGING_FUNCTION_API_REMOVE_CONVERSATIONS);
-
     MessagingStoragePrivObjPtr objectPriv = priv->getObject();
     if (!objectPriv) {
         LoggerE("objectPriv is NULL.");
@@ -826,6 +838,11 @@ JSValueRef JSMessagingStorage::findFolders(JSContextRef context, JSObjectRef obj
 {
     LoggerD("Entered");
 
+    //check permission.
+    AceSecurityStatus status = MESSAGING_CHECK_ACCESS(
+        MessagingExportedNames[MESSAGING_FUNCTION_API_FIND_FOLDERS]);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
     MessagingStoragePriv* priv = static_cast<MessagingStoragePriv*>(JSObjectGetPrivate(thisObject));
     if (!priv) {
         LoggerE("Private object is NULL.");
@@ -833,9 +850,6 @@ JSValueRef JSMessagingStorage::findFolders(JSContextRef context, JSObjectRef obj
         return JSWebAPIErrorFactory::postException(context, exception, err);
     }
 
-    //check permission.
-    TIZEN_CHECK_ACCESS(context, exception, priv, MESSAGING_FUNCTION_API_FIND_FOLDERS);
-
     MessagingStoragePrivObjPtr objectPriv = priv->getObject();
     if (!objectPriv) {
         LoggerE("objectPriv is NULL.");
@@ -926,6 +940,11 @@ JSValueRef JSMessagingStorage::addMessagesChangeListener(JSContextRef context, J
 
     LoggerD("Entered");
 
+    //check permission.
+    AceSecurityStatus status = MESSAGING_CHECK_ACCESS(
+        MessagingExportedNames[MESSAGING_FUNCTION_API_ADD_MESSAGES_CHANGE_LISTNER]);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
     MessagingStoragePriv* priv = static_cast<MessagingStoragePriv*>(JSObjectGetPrivate(thisObject));
     if (!priv) {
         LoggerE("Private object is NULL.");
@@ -933,9 +952,6 @@ JSValueRef JSMessagingStorage::addMessagesChangeListener(JSContextRef context, J
         return JSWebAPIErrorFactory::postException(context, exception, err);
     }
 
-    //check permission.
-    TIZEN_CHECK_ACCESS(context, exception, priv, MESSAGING_FUNCTION_API_ADD_MESSAGES_CHANGE_LISTNER);
-
     MessagingStoragePrivObjPtr objectPriv = priv->getObject();
     if (!objectPriv) {
         LoggerE("objectPriv is NULL.");
@@ -1057,6 +1073,11 @@ JSValueRef JSMessagingStorage::addConversationsChangeListener(JSContextRef conte
 {
     LoggerD("Entered");
 
+    //check permission.
+    AceSecurityStatus status = MESSAGING_CHECK_ACCESS(
+        MessagingExportedNames[MESSAGING_FUNCTION_API_ADD_CONVERSATIONS_CHANGE_LISTNER]);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
     MessagingStoragePriv* priv = static_cast<MessagingStoragePriv*>(JSObjectGetPrivate(thisObject));
     if (!priv) {
         LoggerE("Private object is NULL.");
@@ -1064,9 +1085,6 @@ JSValueRef JSMessagingStorage::addConversationsChangeListener(JSContextRef conte
         return JSWebAPIErrorFactory::postException(context, exception, err);
     }
 
-    //check permission.
-    TIZEN_CHECK_ACCESS(context, exception, priv, MESSAGING_FUNCTION_API_ADD_CONVERSATIONS_CHANGE_LISTNER);
-
     MessagingStoragePrivObjPtr objectPriv = priv->getObject();
     if (!objectPriv) {
         LoggerE("objectPriv is NULL.");
@@ -1191,6 +1209,11 @@ JSValueRef JSMessagingStorage::addFoldersChangeListener(JSContextRef context, JS
 {
     LoggerD("Entered");
 
+    //check permission.
+    AceSecurityStatus status = MESSAGING_CHECK_ACCESS(
+        MessagingExportedNames[MESSAGING_FUNCTION_API_ADD_FOLDERS_CHANGE_LISTNER]);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
     MessagingStoragePriv* priv = static_cast<MessagingStoragePriv*>(JSObjectGetPrivate(thisObject));
     if (!priv) {
         LoggerE("Private object is NULL.");
@@ -1198,9 +1221,6 @@ JSValueRef JSMessagingStorage::addFoldersChangeListener(JSContextRef context, JS
         return JSWebAPIErrorFactory::postException(context, exception, err);
     }
 
-    //check permission.
-    TIZEN_CHECK_ACCESS(context, exception, priv, MESSAGING_FUNCTION_API_ADD_FOLDERS_CHANGE_LISTNER);
-
     MessagingStoragePrivObjPtr objectPriv = priv->getObject();
     if (!objectPriv) {
         LoggerE("objectPriv is NULL.");
@@ -1322,6 +1342,11 @@ JSValueRef JSMessagingStorage::removeChangeListener(JSContextRef context, JSObje
 {
     LoggerD("Entered");
 
+    //check permission.
+    AceSecurityStatus status = MESSAGING_CHECK_ACCESS(
+        MessagingExportedNames[MESSAGING_FUNCTION_API_REMOVE_CHANGE_LISTENER]);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
     MessagingStoragePriv* priv = static_cast<MessagingStoragePriv*>(JSObjectGetPrivate(thisObject));
     if (!priv) {
         LoggerE("Private object is NULL.");
@@ -1329,9 +1354,6 @@ JSValueRef JSMessagingStorage::removeChangeListener(JSContextRef context, JSObje
         return JSWebAPIErrorFactory::postException(context, exception, err);
     }
 
-    //check permission.
-    TIZEN_CHECK_ACCESS(context, exception, priv, MESSAGING_FUNCTION_API_REMOVE_CHANGE_LISTENER);
-
     MessagingStoragePrivObjPtr objectPriv = priv->getObject();
     if (!objectPriv) {
         LoggerE("objectPriv is NULL.");
index 39f05a4..6ebaac6 100755 (executable)
@@ -20,7 +20,6 @@
 
 #include <JavaScriptCore/JavaScript.h>
 #include <CommonsJavaScript/PrivateObject.h>
-#include <Security.h>
 #include "MessagingListener.h"
 
 
@@ -48,23 +47,7 @@ int getType() const
 
 typedef DPL::SharedPtr<MessagingStoragePrivObj> MessagingStoragePrivObjPtr;
        
-typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT<MessagingStoragePrivObjPtr>::Type MessagingStoragePrivObject;
-
-class MessagingStoragePriv :
-    public MessagingStoragePrivObject,
-    public DeviceAPI::Common::SecurityAccessor
-{
-public:
-    MessagingStoragePriv(JSContextRef context, MessagingStoragePrivObjPtr messageStorage) :
-        MessagingStoragePrivObject(context, messageStorage),
-        DeviceAPI::Common::SecurityAccessor()
-    {
-    }
-
-    virtual ~MessagingStoragePriv()
-    {
-    }
-};
+typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<MessagingStoragePrivObjPtr, WrtDeviceApis::CommonsJavaScript::NoOwnership> MessagingStoragePriv;
 
 class JSMessagingStorage {
 public:
index a28ac1c..36f7a72 100644 (file)
@@ -84,7 +84,7 @@ void MessagingController::OnAnswerReceived(const EventGetMessagingServicePtr &ev
                
                for (index = 0; index < count; index++)
                {
-                       jsMessagingServiceObject[index] = JSMessagingService::createJSObject(callbackManager->getContext(), messagingServices[index], event.Get() );
+                       jsMessagingServiceObject[index] = JSMessagingService::createJSObject(callbackManager->getContext(), messagingServices[index] );
                }
                JSObjectRef result = JSObjectMakeArray(callbackManager->getContext(), count, jsMessagingServiceObject, NULL);
 
index 1ea152e..cccb790 100755 (executable)
@@ -3,9 +3,6 @@
 <plugin-properties>
     <library-name>libwrt-plugins-tizen-messaging.so</library-name>
     <feature-install-uri>messaging.install.uri</feature-install-uri>
-    <feature-key-cn>SAMSUNG plugin group</feature-key-cn>
-    <feature-root-cn>SAMSUNG certificate authority</feature-root-cn>
-    <feature-root-fingerprint>AAAABBBBCCCCDDDEEEE0000</feature-root-fingerprint>
 
         
     <api-feature>
old mode 100755 (executable)
new mode 100644 (file)
index 7ccef86..f7c0bd6 100755 (executable)
@@ -36,11 +36,39 @@ namespace Messaging {
 
 using namespace WrtDeviceApis::Commons;
 
+#pragma GCC visibility push(default)
+
+const char* MessagingExportedNames[] =
+{
+       "getMessageServices",
+       "createMessage",
+       "sendMessage",
+       "loadMessageBody",
+       "loadMessageAttachment",
+       "sync",
+       "syncFolder",
+       "cancelOperation",
+       "addDraftMessage",
+       "findMessages",
+       "removeMessages",
+       "updateMessages",
+       "findConversations",
+       "removeConversations",
+       "findFolders",
+       "addMessagesChangeListener",
+       "addConversationsChangeListener",
+       "addFoldersChangeListener",
+       "removeChangeListener"
+};
+
 static WrtDeviceApis::Commons::FunctionMapping createMessagingFunctions();
 static WrtDeviceApis::Commons::FunctionMapping MessagingFunctions = createMessagingFunctions();
 
+
 DEFINE_FUNCTION_GETTER(Messaging, MessagingFunctions);
 
+#pragma GCC visibility pop
+
 static WrtDeviceApis::Commons::FunctionMapping createMessagingFunctions()
 {
      /**
@@ -112,12 +140,12 @@ static WrtDeviceApis::Commons::FunctionMapping createMessagingFunctions()
        //get Message Service
        AceFunction getMessagingServiceFunc = ACE_CREATE_FUNCTION(
                        FUNCTION_GET_MGR_SERVICE,
-                       MESSAGING_FUNCTION_API_GET_MESSAGING_SERVICE,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_GET_MESSAGING_SERVICE],
                        MESSAGING_FEATURES_MESSAGING_READ_SEND_WRITE,
                        EMPTY_DEVICE_LIST);
        
        MessagingFunctions.insert(std::make_pair(
-                       MESSAGING_FUNCTION_API_GET_MESSAGING_SERVICE,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_GET_MESSAGING_SERVICE],
                        getMessagingServiceFunc));
 
       /**  Read  **/
@@ -125,82 +153,82 @@ static WrtDeviceApis::Commons::FunctionMapping createMessagingFunctions()
 
        AceFunction cancelOpFolderFunc = ACE_CREATE_FUNCTION(
                          FUNCTION_GET_MGR_SERVICE,
-                         MESSAGING_FUNCTION_API_CANCEL_OPERATION,
+                         MessagingExportedNames[MESSAGING_FUNCTION_API_CANCEL_OPERATION],
                          MESSAGING_FEATURES_MESSAGING_READ,
                          EMPTY_DEVICE_LIST);
          
        MessagingFunctions.insert( std::make_pair(
-                         MESSAGING_FUNCTION_API_CANCEL_OPERATION,
+                         MessagingExportedNames[MESSAGING_FUNCTION_API_CANCEL_OPERATION],
                          cancelOpFolderFunc));
          
       AceFunction findMessagesFunc = ACE_CREATE_FUNCTION(
                        FUNCTION_GET_MGR_SERVICE,
-                       MESSAGING_FUNCTION_API_FIND_MESSAGES,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_FIND_MESSAGES],
                        MESSAGING_FEATURES_MESSAGING_READ,
                        EMPTY_DEVICE_LIST);
        
        MessagingFunctions.insert( std::make_pair(
-                       MESSAGING_FUNCTION_API_FIND_MESSAGES,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_FIND_MESSAGES],
                        findMessagesFunc));
 
       AceFunction findConversationsFunc = ACE_CREATE_FUNCTION(
                        FUNCTION_GET_MGR_SERVICE,
-                       MESSAGING_FUNCTION_API_FIND_CONVERSATIONS,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_FIND_CONVERSATIONS],
                        MESSAGING_FEATURES_MESSAGING_READ,
                        EMPTY_DEVICE_LIST);
        
        MessagingFunctions.insert( std::make_pair(
-                       MESSAGING_FUNCTION_API_FIND_CONVERSATIONS,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_FIND_CONVERSATIONS],
                        findConversationsFunc));
 
       AceFunction findFoldersFunc = ACE_CREATE_FUNCTION(
                        FUNCTION_GET_MGR_SERVICE,
-                       MESSAGING_FUNCTION_API_FIND_FOLDERS,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_FIND_FOLDERS],
                        MESSAGING_FEATURES_MESSAGING_READ,
                        EMPTY_DEVICE_LIST);
        
        MessagingFunctions.insert( std::make_pair(
-                       MESSAGING_FUNCTION_API_FIND_FOLDERS,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_FIND_FOLDERS],
                        findFoldersFunc));
 
       AceFunction addMessagesChangeListenerFunc = ACE_CREATE_FUNCTION(
                        FUNCTION_GET_MGR_SERVICE,
-                       MESSAGING_FUNCTION_API_ADD_MESSAGES_CHANGE_LISTNER,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_ADD_MESSAGES_CHANGE_LISTNER],
                        MESSAGING_FEATURES_MESSAGING_READ,
                        EMPTY_DEVICE_LIST);
        
        MessagingFunctions.insert( std::make_pair(
-                       MESSAGING_FUNCTION_API_ADD_MESSAGES_CHANGE_LISTNER,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_ADD_MESSAGES_CHANGE_LISTNER],
                        addMessagesChangeListenerFunc));
 
       AceFunction addConversationsChangeListenerFunc = ACE_CREATE_FUNCTION(
                        FUNCTION_GET_MGR_SERVICE,
-                       MESSAGING_FUNCTION_API_ADD_CONVERSATIONS_CHANGE_LISTNER,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_ADD_CONVERSATIONS_CHANGE_LISTNER],
                        MESSAGING_FEATURES_MESSAGING_READ,
                        EMPTY_DEVICE_LIST);
        
        MessagingFunctions.insert( std::make_pair(
-                       MESSAGING_FUNCTION_API_ADD_CONVERSATIONS_CHANGE_LISTNER,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_ADD_CONVERSATIONS_CHANGE_LISTNER],
                        addConversationsChangeListenerFunc));
 
       AceFunction addFoldersChangeListenerFunc = ACE_CREATE_FUNCTION(
                        FUNCTION_GET_MGR_SERVICE,
-                       MESSAGING_FUNCTION_API_ADD_FOLDERS_CHANGE_LISTNER,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_ADD_FOLDERS_CHANGE_LISTNER],
                        MESSAGING_FEATURES_MESSAGING_READ,
                        EMPTY_DEVICE_LIST);
        
        MessagingFunctions.insert( std::make_pair(
-                       MESSAGING_FUNCTION_API_ADD_FOLDERS_CHANGE_LISTNER,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_ADD_FOLDERS_CHANGE_LISTNER],
                        addFoldersChangeListenerFunc));
 
       AceFunction removeChangeListenerFunc = ACE_CREATE_FUNCTION(
                        FUNCTION_GET_MGR_SERVICE,
-                       MESSAGING_FUNCTION_API_REMOVE_CHANGE_LISTENER,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_REMOVE_CHANGE_LISTENER],
                        MESSAGING_FEATURES_MESSAGING_READ,
                        EMPTY_DEVICE_LIST);
        
        MessagingFunctions.insert( std::make_pair(
-                       MESSAGING_FUNCTION_API_REMOVE_CHANGE_LISTENER,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_REMOVE_CHANGE_LISTENER],
                        removeChangeListenerFunc));
 
 
@@ -208,116 +236,116 @@ static WrtDeviceApis::Commons::FunctionMapping createMessagingFunctions()
      //create Message
      AceFunction createMessageFunc = ACE_CREATE_FUNCTION(
                        FUNCTION_GET_MGR_SERVICE,
-                       MESSAGING_FUNCTION_API_CREATE_MESSAGE,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_CREATE_MESSAGE],
                        MESSAGING_FEATURES_MESSAGING_SEND,
                        EMPTY_DEVICE_LIST);
        
        MessagingFunctions.insert( std::make_pair(
-                       MESSAGING_FUNCTION_API_CREATE_MESSAGE,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_CREATE_MESSAGE],
                        createMessageFunc));
 
  // before sendMessage move to write privilege start
      AceFunction sendMessageFunc = ACE_CREATE_FUNCTION(
                        FUNCTION_GET_MGR_SERVICE,
-                       MESSAGING_FUNCTION_API_SEND_MESSAGE,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_SEND_MESSAGE],
                        MESSAGING_FEATURES_MESSAGING_SEND_WRITE,
                        EMPTY_DEVICE_LIST);
        
        MessagingFunctions.insert( std::make_pair(
-                       MESSAGING_FUNCTION_API_SEND_MESSAGE,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_SEND_MESSAGE],
                        sendMessageFunc));
 // before sendMessage move to write privilege end      
       /**  Write  **/
           AceFunction loadMessageBodyFunc = ACE_CREATE_FUNCTION(
                        FUNCTION_GET_MGR_SERVICE,
-                       MESSAGING_FUNCTION_API_LOAD_MESSAGE_BODY,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_LOAD_MESSAGE_BODY],
                        MESSAGING_FEATURES_MESSAGING_WRITE,
                        EMPTY_DEVICE_LIST);
        
        MessagingFunctions.insert( std::make_pair(
-                       MESSAGING_FUNCTION_API_LOAD_MESSAGE_BODY,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_LOAD_MESSAGE_BODY],
                        loadMessageBodyFunc));      
 
       AceFunction loadMessageAttachmentFunc = ACE_CREATE_FUNCTION(
                        FUNCTION_GET_MGR_SERVICE,
-                       MESSAGING_FUNCTION_API_LOAD_MESSAGE_ATTACHMENT,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_LOAD_MESSAGE_ATTACHMENT],
                        MESSAGING_FEATURES_MESSAGING_WRITE,
                        EMPTY_DEVICE_LIST);
        
        MessagingFunctions.insert( std::make_pair(
-                       MESSAGING_FUNCTION_API_LOAD_MESSAGE_ATTACHMENT,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_LOAD_MESSAGE_ATTACHMENT],
                        loadMessageAttachmentFunc));
 
       AceFunction syncFunc = ACE_CREATE_FUNCTION(
                        FUNCTION_GET_MGR_SERVICE,
-                       MESSAGING_FUNCTION_API_SYNC,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_SYNC],
                        MESSAGING_FEATURES_MESSAGING_WRITE,
                        EMPTY_DEVICE_LIST);
        
        MessagingFunctions.insert( std::make_pair(
-                       MESSAGING_FUNCTION_API_SYNC,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_SYNC],
                        syncFunc));
 
       AceFunction syncFolderFunc = ACE_CREATE_FUNCTION(
                        FUNCTION_GET_MGR_SERVICE,
-                       MESSAGING_FUNCTION_API_SYNC_FOLDER,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_SYNC_FOLDER],
                        MESSAGING_FEATURES_MESSAGING_WRITE,
                        EMPTY_DEVICE_LIST);
        
        MessagingFunctions.insert( std::make_pair(
-                       MESSAGING_FUNCTION_API_SYNC_FOLDER,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_SYNC_FOLDER],
                        syncFolderFunc));
        
      AceFunction addDraftMessageFunc = ACE_CREATE_FUNCTION(
                        FUNCTION_GET_MGR_SERVICE,
-                       MESSAGING_FUNCTION_API_ADD_DRAFT_MESSAGE,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_ADD_DRAFT_MESSAGE],
                        MESSAGING_FEATURES_MESSAGING_WRITE,
                        EMPTY_DEVICE_LIST);
        
        MessagingFunctions.insert( std::make_pair(
-                       MESSAGING_FUNCTION_API_ADD_DRAFT_MESSAGE,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_ADD_DRAFT_MESSAGE],
                        addDraftMessageFunc));
        
      AceFunction removeMessagesFunc = ACE_CREATE_FUNCTION(
                        FUNCTION_GET_MGR_SERVICE,
-                       MESSAGING_FUNCTION_API_REMOVE_MESSAGES,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_REMOVE_MESSAGES],
                        MESSAGING_FEATURES_MESSAGING_WRITE,
                        EMPTY_DEVICE_LIST);
        
        MessagingFunctions.insert( std::make_pair(
-                       MESSAGING_FUNCTION_API_REMOVE_MESSAGES,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_REMOVE_MESSAGES],
                        removeMessagesFunc));
 
      AceFunction removeConversationsFunc = ACE_CREATE_FUNCTION(
                        FUNCTION_GET_MGR_SERVICE,
-                       MESSAGING_FUNCTION_API_REMOVE_CONVERSATIONS,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_REMOVE_CONVERSATIONS],
                        MESSAGING_FEATURES_MESSAGING_WRITE,
                        EMPTY_DEVICE_LIST);
        
        MessagingFunctions.insert( std::make_pair(
-                       MESSAGING_FUNCTION_API_REMOVE_CONVERSATIONS,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_REMOVE_CONVERSATIONS],
                        removeConversationsFunc));
 
      AceFunction updateMessagesFunc = ACE_CREATE_FUNCTION(
                        FUNCTION_GET_MGR_SERVICE,
-                       MESSAGING_FUNCTION_API_UPDATE_MESSAGES,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_UPDATE_MESSAGES],
                        MESSAGING_FEATURES_MESSAGING_WRITE,
                        EMPTY_DEVICE_LIST);
        
        MessagingFunctions.insert( std::make_pair(
-                       MESSAGING_FUNCTION_API_UPDATE_MESSAGES,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_UPDATE_MESSAGES],
                        updateMessagesFunc));   
 
 // before sendMessage move to write privilege start
 /*
      AceFunction sendMessageFunc = ACE_CREATE_FUNCTION(
                        FUNCTION_GET_MGR_SERVICE,
-                       MESSAGING_FUNCTION_API_SEND_MESSAGE,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_SEND_MESSAGE],
                        MESSAGING_FEATURES_MESSAGING_WRITE,
                        EMPTY_DEVICE_LIST);
        
        MessagingFunctions.insert( std::make_pair(
-                       MESSAGING_FUNCTION_API_SEND_MESSAGE,
+                       MessagingExportedNames[MESSAGING_FUNCTION_API_SEND_MESSAGE],
                        sendMessageFunc));      
 */
 // before sendMessage move to write privilege end
index 0163eea..546d379 100755 (executable)
 #define _MESSAGING_PLUGIN_CONFIG_H_
 
 #include <Commons/FunctionDeclaration.h>
-#include "plugin_config_impl.h"
 
 namespace DeviceAPI {
 namespace Messaging {
 
+typedef enum 
+{
+MESSAGING_FUNCTION_API_GET_MESSAGING_SERVICE = 0,
+MESSAGING_FUNCTION_API_CREATE_MESSAGE,
+MESSAGING_FUNCTION_API_SEND_MESSAGE,
+MESSAGING_FUNCTION_API_LOAD_MESSAGE_BODY,
+MESSAGING_FUNCTION_API_LOAD_MESSAGE_ATTACHMENT,
+MESSAGING_FUNCTION_API_SYNC,
+MESSAGING_FUNCTION_API_SYNC_FOLDER,
+MESSAGING_FUNCTION_API_CANCEL_OPERATION,
+MESSAGING_FUNCTION_API_ADD_DRAFT_MESSAGE,
+MESSAGING_FUNCTION_API_FIND_MESSAGES,
+MESSAGING_FUNCTION_API_REMOVE_MESSAGES,
+MESSAGING_FUNCTION_API_UPDATE_MESSAGES,
+MESSAGING_FUNCTION_API_FIND_CONVERSATIONS,
+MESSAGING_FUNCTION_API_REMOVE_CONVERSATIONS,
+MESSAGING_FUNCTION_API_FIND_FOLDERS,
+MESSAGING_FUNCTION_API_ADD_MESSAGES_CHANGE_LISTNER,
+MESSAGING_FUNCTION_API_ADD_CONVERSATIONS_CHANGE_LISTNER,
+MESSAGING_FUNCTION_API_ADD_FOLDERS_CHANGE_LISTNER,
+MESSAGING_FUNCTION_API_REMOVE_CHANGE_LISTENER
+} MessagingFuncNames;
+
+extern const char* MessagingExportedNames[];
+
 DECLARE_FUNCTION_GETTER(Messaging);
 
 #define MESSAGING_CHECK_ACCESS(functionName)   \
@@ -34,4 +58,5 @@ DECLARE_FUNCTION_GETTER(Messaging);
 }
 }
 
-#endif // _MESSAGING_PLUGIN_CONFIG_H_
+#endif //MESSAGING_PLUGIN_CONFIG_H_
+
diff --git a/src/Messaging/plugin_config_impl.h b/src/Messaging/plugin_config_impl.h
deleted file mode 100755 (executable)
index ff8657b..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-//
-// Tizen Web Device API
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#ifndef _MESSAGING_PLUGIN_CONFIG_IMPL_H_
-#define _MESSAGING_PLUGIN_CONFIG_IMPL_H_
-
-#define MESSAGING_FUNCTION_API_GET_MESSAGING_SERVICE            "getMessageServices"
-#define MESSAGING_FUNCTION_API_CREATE_MESSAGE                   "createMessage"
-#define MESSAGING_FUNCTION_API_SEND_MESSAGE                     "sendMessage"
-#define MESSAGING_FUNCTION_API_LOAD_MESSAGE_BODY                "loadMessageBody"
-#define MESSAGING_FUNCTION_API_LOAD_MESSAGE_ATTACHMENT          "loadMessageAttachment"
-#define MESSAGING_FUNCTION_API_SYNC                             "sync"
-#define MESSAGING_FUNCTION_API_SYNC_FOLDER                      "syncFolder"
-#define MESSAGING_FUNCTION_API_CANCEL_OPERATION                 "cancelOperation"
-#define MESSAGING_FUNCTION_API_ADD_DRAFT_MESSAGE                "addDraftMessage"
-#define MESSAGING_FUNCTION_API_FIND_MESSAGES                    "findMessages"
-#define MESSAGING_FUNCTION_API_REMOVE_MESSAGES                  "removeMessages"
-#define MESSAGING_FUNCTION_API_UPDATE_MESSAGES                  "updateMessages"
-#define MESSAGING_FUNCTION_API_FIND_CONVERSATIONS               "findConversations"
-#define MESSAGING_FUNCTION_API_REMOVE_CONVERSATIONS             "removeConversations"
-#define MESSAGING_FUNCTION_API_FIND_FOLDERS                     "findFolders"
-#define MESSAGING_FUNCTION_API_ADD_MESSAGES_CHANGE_LISTNER      "addMessagesChangeListener"
-#define MESSAGING_FUNCTION_API_ADD_CONVERSATIONS_CHANGE_LISTNER "addConversationsChangeListener"
-#define MESSAGING_FUNCTION_API_ADD_FOLDERS_CHANGE_LISTNER       "addFoldersChangeListener"
-#define MESSAGING_FUNCTION_API_REMOVE_CHANGE_LISTENER           "removeChangeListener"
-
-#endif // _MESSAGING_PLUGIN_CONFIG_IMPL_H_
old mode 100755 (executable)
new mode 100644 (file)
index ede803d..016421e
@@ -23,7 +23,6 @@
 #include "JSMessageAttachment.h"
 #include "MessageAsyncCallbackManager.h"
 #include "MessageListenerManager.h"
-#include "plugin_config.h"
 
 #include <GlobalContextManager.h>
 #include <Logger.h>
 namespace DeviceAPI {
 namespace Messaging {
 
-using namespace WrtDeviceApis;
-using namespace WrtDeviceApis::Commons;
-
-AceSecurityStatus messagingAceCheckAccessFunction(const char* functionName)
-{
-    return MESSAGING_CHECK_ACCESS(functionName);
-}
-
-DEFINE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor);
-
-DEFINE_SECURITY_ACCESSOR_SETTER(AceCheckerMessagingSetter, JSMessagingServiceManagerPriv, gSecurityAccessor);
-
 namespace Options{
 
 class_definition_options_t MessagingOptions =
 {
     JS_CLASS,
     CREATE_INSTANCE,
-    ALWAYS_NOTICE,
+    NONE_NOTICE,
     USE_OVERLAYED, //ignored
-    AceCheckerMessagingSetter,
     NULL,
     NULL
 };
@@ -70,6 +56,9 @@ class_definition_options_t MessagingInterfaceOptions = {
 
 }
 
+using namespace WrtDeviceApis;
+using namespace WrtDeviceApis::Commons;
+
 void on_widget_start_callback(int widgetId) {
        LoggerD("[Tizen\\MessagingServiceManager] on_widget_start_callback ("<<widgetId<<")");
     Try {
@@ -77,8 +66,6 @@ void on_widget_start_callback(int widgetId) {
     } Catch(Commons::Exception) {
         LoggerE("WrtAccess initialization failed");
     }
-
-    INITAILIZE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor, messagingAceCheckAccessFunction);
 }
 
 void on_widget_stop_callback(int widgetId) {
@@ -88,8 +75,6 @@ void on_widget_stop_callback(int widgetId) {
     } Catch(Commons::Exception) {
         LoggerE("WrtAccess deinitialization failed");
     }
-
-    FINALIZE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor);
 }
 
 void on_frame_load_callback(const void * context)
index ba01254..4503520 100755 (executable)
 #include <dpl/shared_ptr.h>
 #include <Commons/IEvent.h>
 #include <CommonsJavaScript/JSCallbackManager.h>
-#include <Security.h>
 
 namespace DeviceAPI {
 namespace NFC {
-class EventNFCChangedPrivateData : public WrtDeviceApis::Commons::IEventPrivateData,
-       public DeviceAPI::Common::SecurityAccessor
+class EventNFCChangedPrivateData : public WrtDeviceApis::Commons::IEventPrivateData
 {
   public:
     EventNFCChangedPrivateData(const WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr& callbackManager,
index 8f4cf70..5805a85 100755 (executable)
@@ -40,7 +40,7 @@
 #include "NFCListenerManager.h"
 #include "NFCFactory.h"
 #include "EventNFCChanged.h"
-#include "plugin_config_impl.h"
+#include "plugin_config.h"
 #include <Logger.h>
 
 using namespace std;
@@ -108,7 +108,7 @@ void JSNFCAdapter::finalize(JSObjectRef object)
        JSObjectSetPrivate(object, NULL);
 }
 
-JSObjectRef JSNFCAdapter::createJSObject(JSContextRef context, NFCManagerPrivObject *nfcManagerPriv) {
+JSObjectRef JSNFCAdapter::createJSObject(JSContextRef context) {
        LoggerD("entered");
 
        INFCAdapterPtr nfcAdapter(NFCFactory::getInstance().createNFCAdapterObject());
@@ -118,7 +118,6 @@ JSObjectRef JSNFCAdapter::createJSObject(JSContextRef context, NFCManagerPrivObj
                ThrowMsg(NullPointerException, "Can not new a NFCTag object");
        }
 
-       priv->copyAceCheckAccessFunction(nfcManagerPriv);
        return JSObjectMake(context, getClassRef(), priv);
 }
 
@@ -174,15 +173,9 @@ JSValueRef JSNFCAdapter::setTagListener (JSContextRef context, JSObjectRef objec
                JSValueRef* exception) {
        LoggerD("JSNFCAdapter::setTagListener Enter");
 
-       NFCAdapterPrivObject* privateObject = static_cast<NFCAdapterPrivObject*>(JSObjectGetPrivate(thisObject));
-       if (!privateObject) {
-               LoggerE("private object is null");
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
-       }
-
-       TIZEN_CHECK_ACCESS(context, exception, privateObject,
-        NFC_FUNCTION_API_TAG_FUNCS);
-
+       AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_TAG_FUNCS);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+       JSContextRef global_context = GlobalContextManager::getInstance()->getGlobalContext(context);
        Try {
                ArgumentValidator validator(context, argumentCount, arguments);
                NFCChangedCallback callbacks;
@@ -191,8 +184,7 @@ JSValueRef JSNFCAdapter::setTagListener (JSContextRef context, JSObjectRef objec
                        callbacks = nfcConverter.toNFCChangedCallback(arguments[0]);
 
                std::vector<std::string> filterValue = validator.toStringVector(1, true);
-
-               JSContextRef global_context = GlobalContextManager::getInstance()->getGlobalContext(context);
+       
                JSCallbackManagerPtr callbackManager = JSCallbackManager::createObject(global_context, callbacks.onattach, NULL, true, true);
                JSCallbackManagerPtr detachedCallbackManager = JSCallbackManager::createObject(global_context, callbacks.ondetach, NULL);
                TagFilterPtr tagFilter(new TagFilter());
@@ -203,14 +195,18 @@ JSValueRef JSNFCAdapter::setTagListener (JSContextRef context, JSObjectRef objec
                        LoggerD("tag_types.at(i): " << filterValue.at(i));
                }
 
+               NFCAdapterPrivObject* privateObject = static_cast<NFCAdapterPrivObject*>(JSObjectGetPrivate(thisObject));
+               if (!privateObject) {
+                       LoggerE("private object is null");
+                       return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
+               }
+
                INFCAdapterPtr nfcAdapter(privateObject->getObject());
 
                EventNFCChangedPrivateDataPtr privateData(
                    new EventNFCChangedPrivateData(callbackManager,
                                                    detachedCallbackManager)
                    );
-               privateData->copyAceCheckAccessFunction(privateObject);
-       
                EventNFCChangedEmitterPtr emitter(new EventNFCChangedEmitter);
                emitter->setListener(&NFCStaticController::getInstance());
                emitter->setEventPrivateData(DPL::StaticPointerCast<EventNFCChanged::PrivateDataType>(privateData));
@@ -245,14 +241,10 @@ JSValueRef JSNFCAdapter::setPeerListener (JSContextRef context, JSObjectRef obje
                JSValueRef* exception) {
        LoggerD("JSNFCAdapter::setPeerListener Enter");
 
-       NFCAdapterPrivObject* privateObject = static_cast<NFCAdapterPrivObject*>(JSObjectGetPrivate(thisObject));
-       if (!privateObject) {
-               LoggerE("private object is null");
-               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
-       }
+       AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_P2P_FUNCS);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
-       TIZEN_CHECK_ACCESS(context, exception, privateObject,
-        NFC_FUNCTION_API_P2P_FUNCS);
+       JSContextRef global_context = GlobalContextManager::getInstance()->getGlobalContext(context);
 
        Try {
                ArgumentValidator validator(context, argumentCount, arguments);
@@ -262,11 +254,16 @@ JSValueRef JSNFCAdapter::setPeerListener (JSContextRef context, JSObjectRef obje
 
                if (validator.toObject(0))
                        callbacks = nfcConverter.toNFCChangedCallback(arguments[0]);
-
-               JSContextRef global_context = GlobalContextManager::getInstance()->getGlobalContext(context);
+       
                JSCallbackManagerPtr callbackManager = JSCallbackManager::createObject(global_context, callbacks.onattach, NULL, true, true);
                JSCallbackManagerPtr detachedCallbackManager = JSCallbackManager::createObject(global_context, callbacks.ondetach, NULL);
 
+               NFCAdapterPrivObject* privateObject = static_cast<NFCAdapterPrivObject*>(JSObjectGetPrivate(thisObject));
+               if (!privateObject) {
+                       LoggerE("private object is null");
+                       return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
+               }
+
                INFCAdapterPtr nfcAdapter(privateObject->getObject());
 
                EventNFCChangedPrivateDataPtr privateData(
@@ -274,7 +271,6 @@ JSValueRef JSNFCAdapter::setPeerListener (JSContextRef context, JSObjectRef obje
                                                    detachedCallbackManager)
                    );
 
-               privateData->copyAceCheckAccessFunction(privateObject);
                EventNFCChangedEmitterPtr emitter(new EventNFCChangedEmitter);
                emitter->setListener(&NFCStaticController::getInstance());
                emitter->setEventPrivateData(DPL::StaticPointerCast<EventNFCChanged::PrivateDataType>(privateData));
@@ -307,15 +303,15 @@ JSValueRef JSNFCAdapter::unsetTagListener(JSContextRef context, JSObjectRef obje
                size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) {
        LoggerD("JSNFCAdapter::unsetNFCTagListener Enter");
 
+       AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_TAG_FUNCS);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
        NFCAdapterPrivObject* privateObject = static_cast<NFCAdapterPrivObject*>(JSObjectGetPrivate(thisObject));
        if (!privateObject) {
                LoggerE("private object is null");
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, privateObject,
-        NFC_FUNCTION_API_TAG_FUNCS);
-
        Try     {
                INFCAdapterPtr nfcAdapter(privateObject->getObject());
 
@@ -341,16 +337,17 @@ JSValueRef JSNFCAdapter::unsetPeerListener(JSContextRef context, JSObjectRef obj
                size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) {
        LoggerD("JSNFCAdapter::unsetPeerListener Enter");
 
+       AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_P2P_FUNCS);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
        NFCAdapterPrivObject* privateObject = static_cast<NFCAdapterPrivObject*>(JSObjectGetPrivate(thisObject));
        if (!privateObject) {
                LoggerE("private object is null");
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, privateObject,
-        NFC_FUNCTION_API_P2P_FUNCS);
        Try {
-               INFCAdapterPtr nfcAdapter( privateObject->getObject());
+               INFCAdapterPtr nfcAdapter( privateObject->getObject() );
 
                nfcAdapter->unsetPeerListener();
 
@@ -375,22 +372,21 @@ JSValueRef JSNFCAdapter::getCachedMessage (JSContextRef context, JSObjectRef obj
                JSValueRef* exception) {
        LoggerD("JSNFCAdapter::getCachedMessage Enter");
 
+       AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_COMMON_FUNCS);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
        NFCAdapterPrivObject* privateObject = static_cast<NFCAdapterPrivObject*>(JSObjectGetPrivate(thisObject));
        if (!privateObject) {
                LoggerE("private object is null");
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, privateObject,
-        NFC_FUNCTION_API_COMMON_FUNCS);
-
+       JSContextRef global_context = GlobalContextManager::getInstance()->getGlobalContext(context);
        Try {
                INFCAdapterPtr nfcAdapter(privateObject->getObject());
                void *cachedMessage = nfcAdapter->getCachedMessage();
-               if (cachedMessage != NULL) {
-                       JSContextRef global_context = GlobalContextManager::getInstance()->getGlobalContext(context);
+               if (cachedMessage != NULL)
                        return JSNdefMessage::createJSObject(global_context, cachedMessage);
-               }
                return JSValueMakeNull(context);
        } Catch (WrtDeviceApis::Commons::UnknownException) {
                LoggerE("Exception: " << _rethrown_exception.GetMessage());
@@ -411,16 +407,18 @@ JSValueRef JSNFCAdapter::setPowered (JSContextRef context, JSObjectRef object,
                JSValueRef* exception) {
        LoggerD("Enter");
 
+       AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_ADMIN_FUNCS);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
+       JSContextRef global_context = GlobalContextManager::getInstance()->getGlobalContext(context);
+
        NFCAdapterPrivObject* privateObject = static_cast<NFCAdapterPrivObject*>(JSObjectGetPrivate(thisObject));
        if (!privateObject) {
                LoggerE("private object is null");
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, privateObject,
-        NFC_FUNCTION_API_ADMIN_FUNCS);
-
-       JSContextRef global_context = GlobalContextManager::getInstance()->getGlobalContext(context);
+       INFCAdapterPtr nfcAdapter(privateObject->getObject());
        JSCallbackManagerPtr callbackManager = JSCallbackManager::createObject(global_context, NULL, NULL, true, true);
 
        Try {
@@ -435,11 +433,12 @@ JSValueRef JSNFCAdapter::setPowered (JSContextRef context, JSObjectRef object,
                if (validator.toFunction(2, true))
                        callbackManager->setOnError(arguments[2]);
 
+               NFCConverter nfcConverter(context);
+
                EventNFCChangedSetPoweredPtr event(new EventNFCChangedSetPowered(state));
-               event->setPrivateData(DPL::StaticPointerCast<IEventPrivateData>(callbackManager) );
+               event->setPrivateData( DPL::StaticPointerCast<IEventPrivateData>(callbackManager) );
                event->setForAsynchronousCall(&NFCStaticController::getInstance());
                callbackManager->setObject(thisObject);
-               INFCAdapterPtr nfcAdapter(privateObject->getObject());
                nfcAdapter->setPowered(event);
                NFCAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, global_context);
                return JSValueMakeUndefined(context);
index bf71a72..f910f18 100755 (executable)
 
 #include <JavaScriptCore/JavaScript.h>
 #include <CommonsJavaScript/PrivateObject.h>
-#include <Security.h>
 #include "INFCAdapter.h"
-#include "JSNFCManager.h"
 
 namespace DeviceAPI {
 namespace NFC {
 
-typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<INFCAdapterPtr, WrtDeviceApis::CommonsJavaScript::NoOwnership> NFCAdapterPrivObjectBase;
-class  NFCAdapterPrivObject :
-    public DeviceAPI::Common::SecurityAccessor,
-    public NFCAdapterPrivObjectBase
-{
-public:
-     NFCAdapterPrivObject(JSContextRef context, INFCAdapterPtr adapter) :
-        DeviceAPI::Common::SecurityAccessor(),
-        NFCAdapterPrivObjectBase(context, adapter)
-    {
-    }
-
-    virtual ~ NFCAdapterPrivObject()
-    {
-    }
-};
-
+typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<INFCAdapterPtr, WrtDeviceApis::CommonsJavaScript::NoOwnership> NFCAdapterPrivObject;
 class JSNFCAdapter
 {
 public:
@@ -54,7 +36,7 @@ public:
 
     static const JSClassRef getClassRef();
 
-    static JSObjectRef createJSObject(JSContextRef context, NFCManagerPrivObject *nfcManagerPriv);
+    static JSObjectRef createJSObject(JSContextRef context);
 private:
     /**
      * This member variable contains the values which has to be passed when
index 1264ed0..7869f67 100755 (executable)
@@ -27,7 +27,7 @@
 #include "JSNFCAdapter.h"
 #include "NFCConverter.h"
 #include "NFCFactory.h"
-#include "plugin_config_impl.h"
+#include "plugin_config.h"
 #include "NFCDefaultAdapter.h"
 #include <Logger.h>
 
@@ -184,16 +184,15 @@ JSValueRef JSNFCManager::getDefaultAdapter (JSContextRef context, JSObjectRef ob
        LoggerD("Enter");
 
        Try {
+               AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_COMMON_FUNCS);
+               TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
                NFCManagerPrivObject* privateObject = static_cast<NFCManagerPrivObject*>(JSObjectGetPrivate(thisObject));
                if (!privateObject) {
                        LoggerE("private object is null");
                        ThrowMsg(UnsupportedException, "private object is null");
                }
-
-               TIZEN_CHECK_ACCESS(context, exception, privateObject,
-               NFC_FUNCTION_API_COMMON_FUNCS);
-
-               return JSNFCAdapter::createJSObject(GlobalContextManager::getInstance()->getGlobalContext(context), privateObject);
+               return JSNFCAdapter::createJSObject(GlobalContextManager::getInstance()->getGlobalContext(context));
        } Catch (UnsupportedException) {
                LoggerE("UnsupportedException: " << _rethrown_exception.GetMessage());
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::NOT_SUPPORTED_ERROR, "Not Supported");
@@ -223,20 +222,18 @@ JSValueRef JSNFCManager::setExclusiveMode (JSContextRef context, JSObjectRef obj
        LoggerD("Enter");
 
        Try {
-               NFCManagerPrivObject* privateObject = static_cast<NFCManagerPrivObject*>(JSObjectGetPrivate(thisObject));
-               if (!privateObject) {
-                       LoggerE("private object is null");
-                       throw TypeMismatchException("private object is null");
-               }
-
-               TIZEN_CHECK_ACCESS(context, exception, privateObject,
-               NFC_FUNCTION_API_COMMON_FUNCS);
+               AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_COMMON_FUNCS);
+               TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
                ArgumentValidator validator(context, argumentCount, arguments);
                // mode
         bool mode = validator.toBool(0);
                LoggerD("mode : " << mode);
-
+               NFCManagerPrivObject* privateObject = static_cast<NFCManagerPrivObject*>(JSObjectGetPrivate(thisObject));
+               if (!privateObject) {
+                       LoggerE("private object is null");
+                       throw TypeMismatchException("private object is null");
+               }
                NFCDefaultAdapterSingleton::Instance().setExclusiveMode(mode);
                return JSValueMakeUndefined(context);
     } Catch (BasePlatformException) {
index c5082b3..f8eae26 100755 (executable)
 
 #include <JavaScriptCore/JavaScript.h>
 #include <CommonsJavaScript/PrivateObject.h>
-#include <Security.h>
 #include "INFCAdapter.h"
 
 namespace DeviceAPI {
 namespace NFC {
 
-typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<void, WrtDeviceApis::CommonsJavaScript::NoOwnership> NFCManagerPrivObjectBase;
-class NFCManagerPrivObject :
-    public DeviceAPI::Common::SecurityAccessor,
-    public NFCManagerPrivObjectBase
-{
-public:
-    NFCManagerPrivObject(JSContextRef context) :
-        DeviceAPI::Common::SecurityAccessor(),
-        NFCManagerPrivObjectBase(context)
-    {
-    }
-
-    virtual ~NFCManagerPrivObject()
-    {
-    }
-};
-
+typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<void, WrtDeviceApis::CommonsJavaScript::NoOwnership> NFCManagerPrivObject;
 class JSNFCManager
 {
 public:
index 128eae6..62dc324 100755 (executable)
@@ -34,7 +34,7 @@
 #include "NFCFactory.h"
 #include "EventTagAction.h"
 #include "NFCAsyncCallbackManager.h"
-#include "plugin_config_impl.h"
+#include "plugin_config.h"
 #include <Logger.h>
 
 using namespace DeviceAPI::Common;
@@ -99,7 +99,7 @@ JSStaticFunction JSNFCTag::m_function[] = {
 
 JSClassRef JSNFCTag::m_jsClassRef = JSClassCreate(JSNFCTag::getClassInfo());
 
-JSObjectRef JSNFCTag::createJSObject(JSContextRef context, void *tagHandle, EventNFCChangedPrivateDataPtr eventNFCChangedPriv) {
+JSObjectRef JSNFCTag::createJSObject(JSContextRef context, void *tagHandle) {
        LoggerD("entered");
 
        INFCTagPtr nfcTag = NFCFactory::getInstance().createNFCTagObject(tagHandle);
@@ -110,7 +110,6 @@ JSObjectRef JSNFCTag::createJSObject(JSContextRef context, void *tagHandle, Even
                ThrowMsg(NullPointerException, "Can not new a NFCTag object");
        }
 
-       priv->copyAceCheckAccessFunction(eventNFCChangedPriv.Get());
        return JSObjectMake(context, getClassRef(), priv);
 }
 
@@ -200,16 +199,18 @@ JSValueRef JSNFCTag::readNDEF(JSContextRef context,
 {
        LoggerD("Entered ");
 
+       AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_TAG_FUNCS);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
+       JSContextRef global_context = GlobalContextManager::getInstance()->getGlobalContext(context);
+
        NFCTagPrivObject* privateObject = static_cast<NFCTagPrivObject*>(JSObjectGetPrivate(thisObject));
        if (NULL == privateObject) {
                LoggerE("private object is null");
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, privateObject,
-        NFC_FUNCTION_API_TAG_FUNCS);
-
-       JSContextRef global_context = GlobalContextManager::getInstance()->getGlobalContext(context);
+       INFCTagPtr nfcTag(privateObject->getObject());
     JSCallbackManagerPtr callbackManager = JSCallbackManager::createObject(global_context, NULL, NULL, true, true);
 
        Try {
@@ -223,10 +224,9 @@ JSValueRef JSNFCTag::readNDEF(JSContextRef context,
                        callbackManager->setOnError(arguments[1]);
 
                EventTagActionReadPtr event(new EventTagActionRead());
-               event->setPrivateData(DPL::StaticPointerCast<IEventPrivateData>(callbackManager) );
+               event->setPrivateData( DPL::StaticPointerCast<IEventPrivateData>(callbackManager) );
                event->setForAsynchronousCall(&NFCResponseDispatcher::getInstance());
                callbackManager->setObject(thisObject);
-               INFCTagPtr nfcTag(privateObject->getObject());
                nfcTag->readNdef(event);
                NFCAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, global_context);
                return JSValueMakeUndefined(context);
@@ -266,16 +266,18 @@ JSValueRef JSNFCTag::writeNDEF(JSContextRef context,
 {
        LoggerD("Entered ");
 
+       AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_TAG_FUNCS);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
+       JSContextRef global_context = GlobalContextManager::getInstance()->getGlobalContext(context);
+
        NFCTagPrivObject* privateObject = static_cast<NFCTagPrivObject*>(JSObjectGetPrivate(thisObject));
        if (NULL == privateObject) {
                LoggerE("private object is null");
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, privateObject,
-        NFC_FUNCTION_API_TAG_FUNCS);
-
-       JSContextRef global_context = GlobalContextManager::getInstance()->getGlobalContext(context);
+       INFCTagPtr nfcTag(privateObject->getObject());
        JSCallbackManagerPtr callbackManager = JSCallbackManager::createObject(global_context, NULL, NULL, true, true);
        Try {
                ArgumentValidator validator(context, argumentCount, arguments);
@@ -290,6 +292,8 @@ JSValueRef JSNFCTag::writeNDEF(JSContextRef context,
                        callbackManager->setOnError(arguments[2]);
 
                EventTagActionWritePtr event(new EventTagActionWrite());
+               JSContextRef global_context = GlobalContextManager::getInstance()->getGlobalContext(context);
+               NFCConverter convert(global_context);
                void *messageHandle = NULL;
                try {
                        NdefMessagePrivObject* ndefMessagePrivateObj = static_cast<NdefMessagePrivObject*>(JSObjectGetPrivate(ndefMessageObj));
@@ -299,7 +303,6 @@ JSValueRef JSNFCTag::writeNDEF(JSContextRef context,
                        }
                        INdefMessagePtr ndefMessage(ndefMessagePrivateObj->getObject());
                        JSValueRef recordsValue = (ndefMessage->mLocalProperty).getProperty(global_context, TIZEN_NDEFMESSAGE_RECORDS);
-                       NFCConverter convert(global_context);
                        std::vector<void *> records = convert.toVectorOfRecordHandles(recordsValue);
                        messageHandle = ndefMessage->makeNdefMessageHandle(records);
                } catch (WrtDeviceApis::Commons::Exception& err) {
@@ -310,10 +313,9 @@ JSValueRef JSNFCTag::writeNDEF(JSContextRef context,
                        ThrowMsg(InvalidArgumentException, "Invalid NDEF Message");
        
                event->writeNdef(messageHandle);
-               event->setPrivateData(DPL::StaticPointerCast<IEventPrivateData>(callbackManager));
+               event->setPrivateData( DPL::StaticPointerCast<IEventPrivateData>(callbackManager));
                event->setForAsynchronousCall(&NFCResponseDispatcher::getInstance());
                callbackManager->setObject(thisObject);
-               INFCTagPtr nfcTag(privateObject->getObject());
                nfcTag->writeNdef(event);
                NFCAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, global_context);
                return JSValueMakeUndefined(context);
@@ -353,16 +355,18 @@ JSValueRef JSNFCTag::transceive(JSContextRef context,
 {
        LoggerD("Entered ");
 
+       AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_TAG_FUNCS);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
+       JSContextRef global_context = GlobalContextManager::getInstance()->getGlobalContext(context);
+
        NFCTagPrivObject* privateObject = static_cast<NFCTagPrivObject*>(JSObjectGetPrivate(thisObject));
        if (NULL == privateObject) {
                LoggerE("private object is null");
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, privateObject,
-        NFC_FUNCTION_API_TAG_FUNCS);
-
-       JSContextRef global_context = GlobalContextManager::getInstance()->getGlobalContext(context);
+       INFCTagPtr nfcTag(privateObject->getObject());
        JSCallbackManagerPtr callbackManager = JSCallbackManager::createObject(global_context, NULL, NULL, true, true);
        Try {
                ArgumentValidator validator(context, argumentCount, arguments);
@@ -378,16 +382,14 @@ JSValueRef JSNFCTag::transceive(JSContextRef context,
                        callbackManager->setOnError(arguments[2]);
 
                EventTagActionTransceivePtr event(new EventTagActionTransceive());
+               NFCConverter convert(context);
                std::vector<unsigned char> data;
-               if (dataObj) {
-                       NFCConverter convert(context);
+               if (dataObj)
                        data= convert.toVectorOfOctets(arguments[0]);
-               }
                event->transceive(data);
                event->setPrivateData( DPL::StaticPointerCast<IEventPrivateData>(callbackManager) );
                event->setForAsynchronousCall(&NFCResponseDispatcher::getInstance());
                callbackManager->setObject(thisObject);
-               INFCTagPtr nfcTag(privateObject->getObject());
                nfcTag->transceive(event);
                NFCAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, global_context);
                return JSValueMakeUndefined(context);
index 393693a..6f50bef 100755 (executable)
 
 #include <JavaScriptCore/JavaScript.h>
 #include <CommonsJavaScript/PrivateObject.h>
-#include <Security.h>
 #include "INFCTag.h"
-#include "EventNFCChangedPrivateData.h"
-
 
 namespace DeviceAPI {
 namespace NFC {
 
-typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<INFCTagPtr, WrtDeviceApis::CommonsJavaScript::NoOwnership> NFCTagPrivObjectBase;
-class  NFCTagPrivObject :
-    public DeviceAPI::Common::SecurityAccessor,
-    public NFCTagPrivObjectBase
-{
-public:
-     NFCTagPrivObject(JSContextRef context, INFCTagPtr nfcTag) :
-        DeviceAPI::Common::SecurityAccessor(),
-        NFCTagPrivObjectBase(context, nfcTag)
-    {
-    }
-
-    virtual ~NFCTagPrivObject()
-    {
-    }
-};
+typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<INFCTagPtr, WrtDeviceApis::CommonsJavaScript::NoOwnership> NFCTagPrivObject;
 
 class JSNFCTag
 {
@@ -55,7 +37,7 @@ public:
 
     static const JSClassRef getClassRef();
 
-    static JSObjectRef createJSObject(JSContextRef context, void *tagHandle, EventNFCChangedPrivateDataPtr eventNFCChangedPriv);
+    static JSObjectRef createJSObject(JSContextRef context, void *tagHandle);
 
 private:
     /**
index b00b6c4..c1eaa88 100755 (executable)
@@ -36,7 +36,7 @@
 #include "NFCListenerManager.h"
 #include "NFCFactory.h"
 #include "EventTargetAction.h"
-#include "plugin_config_impl.h"
+#include "plugin_config.h"
 #include <Logger.h>
 
 
@@ -90,7 +90,7 @@ JSStaticFunction JSNFCTarget::m_function[] = {
 
 JSClassRef JSNFCTarget::m_jsClassRef = JSClassCreate(JSNFCTarget::getClassInfo());
 
-JSObjectRef JSNFCTarget::createJSObject(JSContextRef context, void *tagHandle, EventNFCChangedPrivateDataPtr eventNFCChangedPriv) {
+JSObjectRef JSNFCTarget::createJSObject(JSContextRef context, void *tagHandle) {
        LoggerD("entered");
 
        INFCTargetPtr nfcTarget = NFCFactory::getInstance().createNFCTargetObject(tagHandle);
@@ -101,7 +101,6 @@ JSObjectRef JSNFCTarget::createJSObject(JSContextRef context, void *tagHandle, E
                ThrowMsg(NullPointerException, "Can not new a NFCTarget object");
        }
 
-       priv->copyAceCheckAccessFunction(eventNFCChangedPriv.Get());
        return JSObjectMake(context, getClassRef(), priv);
 }
 
@@ -180,14 +179,18 @@ JSValueRef JSNFCTarget::setReceiveNDEFListener(JSContextRef context,
 {
        LoggerD("Entered ");
 
+       AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_P2P_FUNCS);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
+       JSContextRef global_context = GlobalContextManager::getInstance()->getGlobalContext(context);
+
        NFCTargetPrivObject* privateObject = static_cast<NFCTargetPrivObject*>(JSObjectGetPrivate(thisObject));
        if (NULL == privateObject) {
                LoggerE("private object is null");
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        }
-
-       TIZEN_CHECK_ACCESS(context, exception, privateObject,
-        NFC_FUNCTION_API_P2P_FUNCS);
+       
+       INFCTargetPtr nfcTarget(privateObject->getObject());
 
        Try {
                ArgumentValidator validator(context, argumentCount, arguments);
@@ -196,13 +199,11 @@ JSValueRef JSNFCTarget::setReceiveNDEFListener(JSContextRef context,
                if (validator.toFunction(0))
                        onSuccessForCbm = arguments[0];
 
-               JSContextRef global_context = GlobalContextManager::getInstance()->getGlobalContext(context);
                JSCallbackManagerPtr callbackManager = JSCallbackManager::createObject(global_context, onSuccessForCbm, NULL, true, true);
 
                EventTargetActionReceiveEmitterPtr emitter(new EventTargetActionReceiveEmitter);
                emitter->setListener(&NFCResponseDispatcher::getInstance());
                emitter->setEventPrivateData(DPL::StaticPointerCast<EventTargetActionReceive::PrivateDataType>(callbackManager));
-               INFCTargetPtr nfcTarget(privateObject->getObject());
                nfcTarget->setReceiveNDEFListener(emitter);
 
                NFCListenerCancellerPtr canceller = NFCListenerCancellerPtr(new NFCListenerCanceller(global_context, thisObject, static_cast<long>(ID_NFCPEER_RECEIVENDEF_LISTENER)));
@@ -237,19 +238,20 @@ JSValueRef JSNFCTarget::unsetReceiveNDEFListener(JSContextRef context,
 {
        LoggerD("Entered ");
        Try {
+               AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_P2P_FUNCS);
+               TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
+               JSContextRef global_context = GlobalContextManager::getInstance()->getGlobalContext(context);
+
                NFCTargetPrivObject* privateObject = static_cast<NFCTargetPrivObject*>(JSObjectGetPrivate(thisObject));
                if (NULL == privateObject) {
                        LoggerE("private object is null");
                        return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
                }
 
-               TIZEN_CHECK_ACCESS(context, exception, privateObject,
-               NFC_FUNCTION_API_P2P_FUNCS);
-
                INFCTargetPtr nfcTarget(privateObject->getObject());
                nfcTarget->unsetReceiveNDEFListener();
 
-               JSContextRef global_context = GlobalContextManager::getInstance()->getGlobalContext(context);
                NFCListenerCancellerPtr canceller = NFCListenerCancellerPtr(new NFCListenerCanceller(global_context, thisObject,  static_cast<long>(ID_NFCPEER_RECEIVENDEF_LISTENER)));
                IListenerItemPtr listenerItem = DPL::StaticPointerCast<IListenerItem>(canceller);
                NFCListenerManagerSingleton::Instance().unregisterListener(listenerItem);
@@ -279,17 +281,20 @@ JSValueRef JSNFCTarget::sendNDEF(JSContextRef context,
 {
        LoggerD("Entered ");
 
+       AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_P2P_FUNCS);
+       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
+       JSContextRef global_context = GlobalContextManager::getInstance()->getGlobalContext(context);
+       
+       NFCConverter convert(context);
+
        NFCTargetPrivObject* privateObject = static_cast<NFCTargetPrivObject*>(JSObjectGetPrivate(thisObject));
        if (NULL == privateObject) {
                LoggerE("private object is null");
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type Mismatch");
        }
 
-       TIZEN_CHECK_ACCESS(context, exception, privateObject,
-        NFC_FUNCTION_API_P2P_FUNCS);
-
-       JSContextRef global_context = GlobalContextManager::getInstance()->getGlobalContext(context);
-
+       INFCTargetPtr nfcTarget(privateObject->getObject());
        JSCallbackManagerPtr callbackManager = JSCallbackManager::createObject(global_context, NULL, NULL, true, true);
        Try {
                ArgumentValidator validator(context, argumentCount, arguments);
@@ -303,6 +308,8 @@ JSValueRef JSNFCTarget::sendNDEF(JSContextRef context,
                if (validator.toFunction(2, true))
                        callbackManager->setOnError(arguments[2]);
 
+               JSContextRef global_context = GlobalContextManager::getInstance()->getGlobalContext(context);
+               NFCConverter convert(global_context);
                void *messageHandle = NULL;
                try {
                        NdefMessagePrivObject* ndefMessagePrivateObj = static_cast<NdefMessagePrivObject*>(JSObjectGetPrivate(ndefMessageObj));
@@ -312,7 +319,6 @@ JSValueRef JSNFCTarget::sendNDEF(JSContextRef context,
                        }
                        INdefMessagePtr ndefMessage(ndefMessagePrivateObj->getObject());
                        JSValueRef recordsValue = (ndefMessage->mLocalProperty).getProperty(global_context, TIZEN_NDEFMESSAGE_RECORDS);
-                       NFCConverter convert(global_context);
                        std::vector<void *> records = convert.toVectorOfRecordHandles(recordsValue);
                        messageHandle = ndefMessage->makeNdefMessageHandle(records);
                } catch (WrtDeviceApis::Commons::Exception& err) {
@@ -324,9 +330,8 @@ JSValueRef JSNFCTarget::sendNDEF(JSContextRef context,
        
                EventTargetActionSendPtr event(new EventTargetActionSend(messageHandle));
                callbackManager->setObject(thisObject);
-               event->setPrivateData(DPL::StaticPointerCast<IEventPrivateData>(callbackManager));
+               event->setPrivateData( DPL::StaticPointerCast<IEventPrivateData>(callbackManager));
                event->setForAsynchronousCall(&NFCResponseDispatcher::getInstance());
-               INFCTargetPtr nfcTarget(privateObject->getObject());
                nfcTarget->sendNDEF(event);
                NFCAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, global_context);
                return JSValueMakeUndefined(context);
index 7f3d17d..482b0eb 100755 (executable)
 
 #include <JavaScriptCore/JavaScript.h>
 #include <CommonsJavaScript/PrivateObject.h>
-#include <Security.h>
-#include "EventNFCChangedPrivateData.h"
 #include "INFCTarget.h"
 
 namespace DeviceAPI {
 namespace NFC {
 
-typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<INFCTargetPtr, WrtDeviceApis::CommonsJavaScript::NoOwnership> NFCTargetPrivObjectBase;
-class  NFCTargetPrivObject :
-    public DeviceAPI::Common::SecurityAccessor,
-    public NFCTargetPrivObjectBase
-{
-public:
-     NFCTargetPrivObject(JSContextRef context, INFCTargetPtr nfcTarget) :
-        DeviceAPI::Common::SecurityAccessor(),
-        NFCTargetPrivObjectBase(context, nfcTarget)
-    {
-    }
-
-    virtual ~NFCTargetPrivObject()
-    {
-    }
-};
+typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<INFCTargetPtr, WrtDeviceApis::CommonsJavaScript::NoOwnership> NFCTargetPrivObject;
 
 class JSNFCTarget
 {
@@ -54,7 +37,7 @@ public:
 
     static const JSClassRef getClassRef();
 
-    static JSObjectRef createJSObject(JSContextRef context, void *tagHandle, EventNFCChangedPrivateDataPtr eventNFCChangedPriv);
+    static JSObjectRef createJSObject(JSContextRef context, void *tagHandle);
 
 private:
     /**
index 9020dd0..da8e5a0 100755 (executable)
@@ -31,6 +31,7 @@
 #include <PlatformException.h>
 
 #include "NFCFactory.h"
+#include "plugin_config.h"
 #include <Logger.h>
 
 using namespace DeviceAPI::Common;
index 3a1abde..2608aea 100755 (executable)
@@ -28,6 +28,7 @@
 #include "NFCFactory.h"
 
 #include "JSNdefRecord.h"
+#include "plugin_config.h"
 #include "NFCConverter.h"
 #include <Logger.h>
 
index 38c6d98..dbdf43a 100755 (executable)
@@ -67,9 +67,9 @@ void NFCStaticController::onAnswerReceived(const EventNFCChangedPtr& event) {
                        JSContextRef context = callbackManager->getContext();
                        
                        if (event->getNFCType() == NFC_TAG_TYPE)
-                               nfcObj = JSNFCTag::createJSObject(context, nfcProp, privateData);
+                               nfcObj = JSNFCTag::createJSObject(context, nfcProp);
                        else
-                               nfcObj = JSNFCTarget::createJSObject(context, nfcProp, privateData);
+                               nfcObj = JSNFCTarget::createJSObject(context, nfcProp);
                        LoggerD("callOnSuccess");
                        callbackManager->callOnSuccess(static_cast<JSValueRef>(nfcObj));
                } else {
index fda5f11..31d1ca2 100755 (executable)
 namespace DeviceAPI {
 namespace NFC {
 
+const char* NFC_FUNCTION_API_COMMON_FUNCS = "NFCCommonFunctions";
+const char* NFC_FUNCTION_API_ADMIN_FUNCS = "NFCAdminFunctions";
+const char* NFC_FUNCTION_API_TAG_FUNCS = "NFCTagFunctions";
+const char* NFC_FUNCTION_API_P2P_FUNCS = "NFCP2PFunctions";
+const char* NFC_FUNCTION_API_CARDEMULATION_FUNCS = "NFCCardEmulationFunctions";
+
 static WrtDeviceApis::Commons::FunctionMapping createNFCFunctions();
 
 static WrtDeviceApis::Commons::FunctionMapping NFCFunctions =
     createNFCFunctions();
 
+#pragma GCC visibility push(default)
+
 DEFINE_FUNCTION_GETTER(NFC, NFCFunctions);
 
+#pragma GCC visibility pop
+
 static WrtDeviceApis::Commons::FunctionMapping createNFCFunctions()
 {
     using namespace WrtDeviceApis::Commons;
index 5388f9d..7f4190f 100755 (executable)
 #define _NFC_PLUGIN_CONFIG_H_
 
 #include <Commons/FunctionDeclaration.h>
-#include "plugin_config_impl.h"
 
 namespace DeviceAPI {
 namespace NFC {
 
+extern const char* NFC_FUNCTION_API_COMMON_FUNCS;
+extern const char* NFC_FUNCTION_API_ADMIN_FUNCS;
+extern const char* NFC_FUNCTION_API_TAG_FUNCS;
+extern const char* NFC_FUNCTION_API_P2P_FUNCS;
+extern const char* NFC_FUNCTION_API_CARDEMULATION_FUNCS;
 
 DECLARE_FUNCTION_GETTER(NFC);
 
diff --git a/src/NFC/plugin_config_impl.h b/src/NFC/plugin_config_impl.h
deleted file mode 100755 (executable)
index 1d8f572..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-//
-// Tizen Web Device API
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-
-#ifndef _NFC_PLUGIN_CONFIG_IMPL_H_
-#define _NFC_PLUGIN_CONFIG_IMPL_H_
-
-#define NFC_FUNCTION_API_COMMON_FUNCS "NFCCommonFunctions"
-#define NFC_FUNCTION_API_ADMIN_FUNCS "NFCAdminFunctions"
-#define NFC_FUNCTION_API_TAG_FUNCS "NFCTagFunctions"
-#define NFC_FUNCTION_API_P2P_FUNCS "NFCP2PFunctions"
-#define NFC_FUNCTION_API_CARDEMULATION_FUNCS "NFCCardEmulationFunctions"
-
-
-#endif //  _NFC_PLUGIN_CONFIG_IMPL_H_
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index e352c84..51521a6
@@ -27,9 +27,6 @@
 #include "NFCAsyncCallbackManager.h"
 #include "NFCListenerManager.h"
 #include "NFCDefaultAdapter.h"
-#include "plugin_config.h"
-#include <Security.h>
-#include <JSStringRefWrapper.h>
 #include <Logger.h>
 
 using namespace WrtDeviceApis;
@@ -39,33 +36,13 @@ using namespace DeviceAPI::Common;
 namespace DeviceAPI {
 namespace NFC {
 
-AceSecurityStatus nfcAceCheckAccessFunction(const char* functionName)
-{
-       return NFC_CHECK_ACCESS(functionName); 
-}
-
-DEFINE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor);
-DEFINE_SECURITY_ACCESSOR_SETTER(AceCheckerNfcSetter, NFCManagerPrivObject, gSecurityAccessor);
-DEFINE_JSOBJECT_SECURITY_ACCESSOR_SETTER(AceCheckerNfcConstructorSetter, gSecurityAccessor);  
-
-class_definition_options_t ClassOptions =    
-{    
-       JS_CLASS,    
-       CREATE_INSTANCE,    
-       ALWAYS_NOTICE,    
-       USE_OVERLAYED, //ignored    
-       AceCheckerNfcSetter,    
-       NULL    
-}; 
-
-
 class_definition_options_t ConstructorClassOptions =
 {
     JS_INTERFACE,
     CREATE_INSTANCE,
-    ALWAYS_NOTICE,
+    NONE_NOTICE,
     USE_OVERLAYED, //ignored
-    AceCheckerNfcConstructorSetter, // JSWidget::acquireGlobalContext,
+    NULL,
     NULL,
     NULL
 };
@@ -81,7 +58,6 @@ void on_widget_start_callback(int widgetId)
     {
         LoggerE("WrtAccess initialization failed");
     }
-       INITAILIZE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor, nfcAceCheckAccessFunction); 
 }
 
 void on_widget_stop_callback(int widgetId)
@@ -95,16 +71,15 @@ void on_widget_stop_callback(int widgetId)
     {
         LoggerE("WrtAccess deinitialization failed");
     }
-       FINALIZE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor); 
 }
 
-void on_frame_load_callback(const void *context)
+void on_frame_load_callback(const void * context)
 {
        LoggerD("[Tizen\\NFC] on_frame_load_callback (" << context << ")");
     GlobalContextManager::getInstance()->addGlobalContext(static_cast<JSContextRef>(context));
 }
 
-void on_frame_unload_callback(const void *context)
+void on_frame_unload_callback(const void * context)
 {
        LoggerD("[Tizen\\NFC] on_frame_unload_callback (" << context << ")");
        GlobalContextManager::getInstance()->removeGlobalContext(static_cast<JSContextRef>(context));
@@ -122,7 +97,7 @@ PLUGIN_CLASS_MAP_BEGIN
 PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
         "nfc",
         (js_class_template_getter)JSNFCManager::getClassRef,
-        &ClassOptions)
+        NULL)
 PLUGIN_CLASS_MAP_ADD_INTERFACE(WRT_JS_EXTENSION_OBJECT_TIZEN,
         "NDEFMessage",
         (js_class_template_getter)JSNdefMessage::getClassRef,
index b72610c..01c523e 100755 (executable)
@@ -51,6 +51,8 @@ TARGET_LINK_LIBRARIES(${TARGET_NAME}
        ${TARGET_IMPL_NAME}
                ${tizen_impl}
        ${timeutil_impl}
+       "-Wl,--no-as-needed" ${application_config}
+       "-Wl,--no-as-needed" ${filesystem_config}
 )
 
 INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
index a90141a..25a5ecc 100644 (file)
@@ -207,7 +207,6 @@ static int get_current_pkg_id(char** pkg_id)
        ret = app_info_get_package(handle, pkg_id);
        if ((ret != APP_MANAGER_ERROR_NONE) || (*pkg_id == NULL)) {
                LoggerE("Fail to get pkg_id");
-               app_info_destroy(handle);
                return ret;
        }
 
old mode 100755 (executable)
new mode 100644 (file)
index 8bd5a57..b5c292b
 //
 
 #include <SecurityExceptions.h>
+#include <CallbackUserData.h>
 #include <GlobalContextManager.h>
 #include <JSUtil.h>
 #include <ArgumentValidator.h>
 #include <TimeTracer.h>
 
 #include "JSPowerManager.h"
-#include "plugin_config_impl.h"
+#include "plugin_config.h"
 #include "PowerManager.h"
 #include <Logger.h>
 
@@ -72,19 +73,15 @@ JSClassRef JSPowerManager::m_jsClassRef = JSClassCreate(JSPowerManager::getClass
 
 void JSPowerManager::initialize(JSContextRef context, JSObjectRef object)
 {
-    LoggerD("entered");
-    PowerManagerPriv *priv = new PowerManagerPriv(GlobalContextManager::getInstance()->getGlobalContext(context));
-    JSObjectSetPrivate(object, static_cast<void*>(priv));
 }
 
 void JSPowerManager::finalize(JSObjectRef object)
 {
-    LoggerD("entered");
-    PowerManagerPriv *priv = static_cast<PowerManagerPriv*>(JSObjectGetPrivate(object));
-    if( priv != NULL ){
-        PowerManager::getInstance()->removeScreenStateChangedCallback(priv);
+    CallbackUserData *callback = static_cast<CallbackUserData*>(JSObjectGetPrivate(object));
+    if( callback != NULL ){
+        PowerManager::getInstance()->removeScreenStateChangedCallback(callback);
         JSObjectSetPrivate(object, NULL);
-        delete priv;
+        delete callback;
     }
 }
 
@@ -109,14 +106,10 @@ JSValueRef JSPowerManager::request(JSContextRef context,
         JSValueRef* exception)
 {
     LoggerD("entered");
-
-    PowerManagerPriv *thisPriv = static_cast<PowerManagerPriv*>(JSObjectGetPrivate(thisObject));
-    if (!thisPriv) {
-        LoggerE("private object is null");
-        return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
-    }
        TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
-    TIZEN_CHECK_ACCESS(context, exception, thisPriv, POWER_FUNCTION_API_REQUEST);
+
+    AceSecurityStatus status = POWER_CHECK_ACCESS(POWER_FUNCTION_API_REQUEST);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     try{
         ArgumentValidator validator(context, argumentCount, arguments);
@@ -170,9 +163,13 @@ JSValueRef JSPowerManager::setScreenStateChangeListener(JSContextRef context,
     try{
         ArgumentValidator validator(context, argumentCount, arguments);
         JSObjectRef func = validator.toFunction(0);
-        PowerManagerPriv *thisPriv = static_cast<PowerManagerPriv*>(JSObjectGetPrivate(thisObject));
-        thisPriv->setSuccessCallback(func);
-        PowerManager::getInstance()->addScreenStateChangedCallback(thisPriv);
+        CallbackUserData *callback = static_cast<CallbackUserData*>(JSObjectGetPrivate(thisObject));
+        if( callback == NULL ){
+            callback = new CallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context));
+            JSObjectSetPrivate(thisObject, callback);
+        }
+        callback->setSuccessCallback(func);
+        PowerManager::getInstance()->addScreenStateChangedCallback(callback);
 
     }catch(const BasePlatformException& err){
         return JSWebAPIErrorFactory::postException(context, exception, err);
@@ -194,8 +191,12 @@ JSValueRef JSPowerManager::unsetScreenStateChangeListener(JSContextRef context,
     LoggerD("entered");
        TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
 
-    PowerManagerPriv *thisPriv = static_cast<PowerManagerPriv*>(JSObjectGetPrivate(thisObject));
-
+    CallbackUserData *callback = static_cast<CallbackUserData*>(JSObjectGetPrivate(thisObject));
+    if( callback != NULL ){
+        PowerManager::getInstance()->removeScreenStateChangedCallback(callback);
+        JSObjectSetPrivate(thisObject, NULL);
+        delete callback;
+    }
        TIME_TRACER_ITEM_END(__FUNCTION__, 0);
     return JSValueMakeUndefined(context);
 }
@@ -227,15 +228,9 @@ JSValueRef JSPowerManager::setScreenBrightness(JSContextRef context,
         JSValueRef* exception)
 {
     LoggerD("entered");
-
-    PowerManagerPriv *thisPriv = static_cast<PowerManagerPriv*>(JSObjectGetPrivate(thisObject));
-    if (!thisPriv) {
-        LoggerE("private object is null");
-        return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
-    }
        TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
-    TIZEN_CHECK_ACCESS(context, exception, thisPriv, POWER_FUNCTION_API_SET_SCREEN_BRIGHTNESS);
-
+    AceSecurityStatus status = POWER_CHECK_ACCESS(POWER_FUNCTION_API_RELEASE);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
     try{
         ArgumentValidator validator(context, argumentCount, arguments);
 
@@ -295,14 +290,9 @@ JSValueRef JSPowerManager::turnScreenOn(JSContextRef context,
         JSValueRef* exception)
 {
     LoggerD("entered");
-
-    PowerManagerPriv *thisPriv = static_cast<PowerManagerPriv*>(JSObjectGetPrivate(thisObject));
-    if (!thisPriv) {
-        LoggerE("private object is null");
-        return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
-    }
        TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
-    TIZEN_CHECK_ACCESS(context, exception, thisPriv, POWER_FUNCTION_API_TURN_SCREEN_ON);
+    AceSecurityStatus status = POWER_CHECK_ACCESS(POWER_FUNCTION_API_RELEASE);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     try{
         PowerManager::getInstance()->setScreenState(true);
@@ -321,13 +311,9 @@ JSValueRef JSPowerManager::turnScreenOff(JSContextRef context,
         JSValueRef* exception)
 {
     LoggerD("entered");
-    PowerManagerPriv *thisPriv = static_cast<PowerManagerPriv*>(JSObjectGetPrivate(thisObject));
-    if (!thisPriv) {
-        LoggerE("private object is null");
-        return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
-    }
        TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
-    TIZEN_CHECK_ACCESS(context, exception, thisPriv, POWER_FUNCTION_API_TURN_SCREEN_OFF);    
+    AceSecurityStatus status = POWER_CHECK_ACCESS(POWER_FUNCTION_API_RELEASE);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
     try{
         PowerManager::getInstance()->setScreenState(false);
index 64d1292..04c2834 100755 (executable)
 
 #include <string>
 #include <JavaScriptCore/JavaScript.h>
-#include <Security.h>
-#include <CallbackUserData.h>
 
 namespace DeviceAPI {
 namespace Power {
 
-class PowerManagerPriv : public DeviceAPI::Common::CallbackUserData, public DeviceAPI::Common::SecurityAccessor
-{
-public:
-    PowerManagerPriv(JSContextRef ctx) : DeviceAPI::Common::CallbackUserData(ctx), DeviceAPI::Common::SecurityAccessor() {}
-    virtual ~PowerManagerPriv() {}
-};
-
 class JSPowerManager
 {
   public:
index 4fd7c1e..fb97251 100755 (executable)
@@ -19,7 +19,6 @@
 #include <Commons/FunctionDeclaration.h>
 #include <map>
 
-#include "plugin_config_impl.h"
 #include "plugin_config.h"
 
 #define POWER_FEATURE_API "http://tizen.org/privilege/power"
@@ -36,8 +35,12 @@ static FunctionMapping createPowerFunctions();
 static FunctionMapping PowerFunctions =
     createPowerFunctions();
 
+#pragma GCC visibility push(default)
+
 DEFINE_FUNCTION_GETTER(Power, PowerFunctions);
 
+#pragma GCC visibility pop
+
 static FunctionMapping createPowerFunctions()
 {
     /**
index 9efd699..b528cce 100755 (executable)
 namespace DeviceAPI {
 namespace Power {
 
+// Functions from power manager
+#define POWER_FUNCTION_API_REQUEST "request"
+#define POWER_FUNCTION_API_RELEASE "release"
+#define POWER_FUNCTION_API_SET_SCREEN_STATE_CHANGE_LISTENER "setScreenStateChangeListener"
+#define POWER_FUNCTION_API_UNSET_SCREEN_STATE_CHANGE_LISTENER "unsetScreenStateChangeListener"
+#define POWER_FUNCTION_API_GET_SCREEN_BRIGHTNESS "getScreenBrightness"
+#define POWER_FUNCTION_API_SET_SCREEN_BRIGHTNESS "setScreenBrightness"
+#define POWER_FUNCTION_API_IS_SCREEN_ON "isScreenOn"
+#define POWER_FUNCTION_API_RESTORE_SCREEN_BRIGHTNESS "restoreScreenBrightness"
+#define POWER_FUNCTION_API_TURN_SCREEN_ON "turnScreenOn"
+#define POWER_FUNCTION_API_TURN_SCREEN_OFF "turnScreenOff"
+
 DECLARE_FUNCTION_GETTER(Power);
 
 #define POWER_CHECK_ACCESS(functionName) \
diff --git a/src/Power/plugin_config_impl.h b/src/Power/plugin_config_impl.h
deleted file mode 100755 (executable)
index 7e8ab4f..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-//
-// Tizen Web Device API
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#ifndef _POWER_PLUGIN_CONFIG_IMPL_H_
-#define _POWER_PLUGIN_CONFIG_IMPL_H_
-
-#define POWER_FUNCTION_API_REQUEST "request"
-#define POWER_FUNCTION_API_RELEASE "release"
-#define POWER_FUNCTION_API_SET_SCREEN_STATE_CHANGE_LISTENER "setScreenStateChangeListener"
-#define POWER_FUNCTION_API_UNSET_SCREEN_STATE_CHANGE_LISTENER "unsetScreenStateChangeListener"
-#define POWER_FUNCTION_API_GET_SCREEN_BRIGHTNESS "getScreenBrightness"
-#define POWER_FUNCTION_API_SET_SCREEN_BRIGHTNESS "setScreenBrightness"
-#define POWER_FUNCTION_API_IS_SCREEN_ON "isScreenOn"
-#define POWER_FUNCTION_API_RESTORE_SCREEN_BRIGHTNESS "restoreScreenBrightness"
-#define POWER_FUNCTION_API_TURN_SCREEN_ON "turnScreenOn"
-#define POWER_FUNCTION_API_TURN_SCREEN_OFF "turnScreenOff"
-
-#endif
old mode 100755 (executable)
new mode 100644 (file)
index be0e6a3..2e9cdb3
@@ -23,8 +23,6 @@
 #include "JSPowerManager.h"
 #include <GlobalContextManager.h>
 #include <TimeTracer.h>
-#include <Security.h>
-#include "plugin_config.h"
 
 namespace DeviceAPI {
 namespace Power {
@@ -33,28 +31,6 @@ 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 << ")");
@@ -65,8 +41,6 @@ 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)
@@ -80,8 +54,6 @@ 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)
@@ -106,7 +78,7 @@ PLUGIN_CLASS_MAP_BEGIN
 PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
         "power",
         (js_class_template_getter)JSPowerManager::getClassRef,
-        &ClassOptions)
+        NULL)
 PLUGIN_CLASS_MAP_END
 
 }
diff --git a/src/Power/test/CMakeLists.txt b/src/Power/test/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..740aedc
--- /dev/null
@@ -0,0 +1,28 @@
+SET(TARGET_NAME ${power_target}_test)
+
+include_directories(
+  ${TOP}/Common
+  ${TOP}/Power  
+  ${TOP}/Common/StandaloneConsole
+)
+
+set(CMAKE_INSTALL_RPATH
+  ${CMAKE_INSTALL_RPATH}
+  ${CMAKE_INSTALL_PREFIX}/${DESTINATION_LIB_PREFIX}/${tizen_dest}
+  ${CMAKE_INSTALL_PREFIX}/${DESTINATION_LIB_PREFIX}/${power_dest}
+)
+
+set(SRCS
+    main.cpp
+)
+
+
+ADD_EXECUTABLE(${TARGET_NAME} ${SRCS})
+
+target_link_libraries(${TARGET_NAME}
+  ${power_impl}
+  ${LIBS_COMMON}
+  ${LIBS_TEST}
+)
+
+
diff --git a/src/Power/test/TestEngine.js b/src/Power/test/TestEngine.js
new file mode 100755 (executable)
index 0000000..0942267
--- /dev/null
@@ -0,0 +1,1020 @@
+/*
+*  wrt-plugins
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: Seung Mo Cho <seungm.cho@samsung.com>
+*
+* This library is free software; you can redistribute it and/or modify it under
+* the terms of the GNU Lesser General Public License as published by the
+* Free Software Foundation; either version 2.1 of the License, or (at your
+* option) any later version.
+*
+* This library is distributed in the hope that it will be useful, but WITHOUT
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+* License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this library; if not, write to the Free Software Foundation, Inc.,
+* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*
+*/
+/**
+ * This file contains the implementation of test engine class.
+ *
+ * @author      Wojciech Bielawski(w.bielawski@samsung.com)
+ * @author      Pawel Misiak (p.misiak@samsung.com)
+ * @version     0.1
+ */
+var jsPrint = console.log;
+var logFail = console.log;
+var logError = console.log;
+
+var TestEngine = {
+       logText : "",
+       testCaseTimeout : 10 * 1000, //in miliseconds
+       currentCaseTimeout : 10 * 1000,
+       timer : null,
+       countOK : 0,
+       countErr : 0,
+       countException : 0,
+       callbackMutex : 0,
+       callbackMethodName : "",
+       currentTestCase : 0,
+       countAllPassed : 0,
+       countAllFailed : 0,
+       testCasesFailedCount : 0,
+       testCasesPassedCount : 0,
+       testCasesFailed : [],
+       testList : [],
+       finalLog : "\n",
+       testSuccessCallback : null,
+       testErrorCallback : null,
+       testSuiteName : null,
+       testSuiteStats : [],
+       resultLogger : new HTMLTestResultLogger('log'),
+       summaryRenderer : new HTMLTestSummaryRenderer('summary'),
+
+       stepsArray : null,
+       stepTimeout : null,
+       currentStep : null,
+       errorType : null,
+       errorField : null,
+
+       /*
+        * Values used only as types representations.
+        */
+       STRING : '',
+       NUMBER : 0,
+       OBJECT : {},
+       ARRAY : [],
+       DATE : new Date(),
+       BOOL : false,
+       FUNCTION : function() {
+       },
+       /*
+        * Error test possible results.
+        */
+       ERROR_TEST_RESULT : {
+               NOT_RUN : -4,
+               NOT_THROWN : -3,
+               BAD_TYPE : -2,
+               BAD_VALUE : -1,
+               OK : 0
+       },
+
+       /**
+        * Prints specified object in a TreeView like structure.
+        * @param obj Object to print.
+        * @param indent Must be undefined (don't pass anything).
+        */
+       dumpObject : function(obj, indent) {
+               if(indent === undefined)
+                       indent = '';
+               else
+                       indent += '   ';
+               var prefix = (indent.length == 0 ? indent : indent + '|--');
+               for(var i in obj) {
+                       if( typeof (obj[i]) == "object") {
+                               TestEngine.log(prefix + i + ":");
+                               TestEngine.dumpObject(obj[i], indent);
+                       } else
+                               TestEngine.log(prefix + i + ": " + obj[i]);
+               }
+       },
+       addTest : function(enabled, testFunc, testName, testPrereq) {
+               if(null == testName) {
+                       testName = "unnamed test"
+               }
+               jsPrint("Add test: " + testName)
+               var data = new Object();
+               data.enabled = enabled;
+               data.testFunc = testFunc;
+               data.testName = testName;
+               data.testPrereq = testPrereq;
+               data.testSuite = TestEngine.testSuiteName;
+               data.failMessage = "";
+               // this.testList.push(testFunc)
+               this.testList.push(data);
+       },
+       setTestSuiteName : function(name, timeout) {
+               this.testSuiteName = name;
+               this.testSuiteStats[name] = new Object();
+               this.testSuiteStats[name].passed = 0;
+               this.testSuiteStats[name].failed = 0;
+               this.testSuiteStats[name].assertsOK = 0;
+               this.testSuiteStats[name].assertsErr = 0;
+               TestEngine.currentCaseTimeout = (timeout === undefined) ? TestEngine.testCaseTimeout : timeout;
+       },
+       log : function(text) {
+               try {
+                       jsPrint(text);
+                       this.logText += text + "<br/>";
+                       this.finalLog += text + "\n";
+                       // document.getElementById(TestEngine.currentTestSuite).innerHTML += text + "<br/>";
+                       //document.getElementById('log').innerHTML += text + "<br/>";
+               } catch(err) {
+                       this.countException++;
+                       logError("   TestEngine.log failure: " + err.message);
+               }
+       },
+       logException : function(text) {
+               try {
+                       logFail(text);
+                       TestEngine.countException++;
+                       TestEngine.log("[EXCEPTION] " + text);
+               } catch(err) {
+                       TestEngine.countException++;
+                       logError("   TestEngine.logErr failure: " + err.message);
+               }
+       },
+       logErr : function(text) {
+               try {
+                       TestEngine.countErr++;
+                       TestEngine.log("[FAILED] " + text);
+                       logFail("[FAILED] " + text);
+                       
+                       TestEngine.testList[TestEngine.currentTestCase-1].failMessage = text;
+                       
+               } catch(err) {
+                       TestEngine.countException++;
+                       logError("   TestEngine.logErr failure: " + err.message);
+               }
+       },
+       logOK : function(text) {
+               try {
+                       TestEngine.countOK++;
+                       TestEngine.log("[OK] " + text);
+               } catch(err) {
+                       TestEngine.countException++;
+                       logError("   TestEngine.logOK failure: " + err.message);
+               }
+       },
+       test : function(text, value) {
+               try {
+                       if( typeof (value) == "undefined") {
+                               TestEngine.logErr("value not defined for test: '" + text + "'");
+                       } else if(!value) {
+                               TestEngine.logErr(text);
+                       } else {
+                               TestEngine.logOK(text);
+                               return true;
+                       }
+               } catch(err) {
+                       TestEngine.countException++;
+                       logError("   TestEngine.test failure: " + err.message);
+               }
+               return false;
+       },
+       assertEqual : function(text, value1, value2){
+               try {
+                       if( typeof (value1) == "undefined") {
+                               TestEngine.logErr("value1 not defined for test: '" + text + "'");
+                       } else if( typeof (value2) == "undefined") {
+                               TestEngine.logErr("value2 not defined for test: '" + text + "'");
+                       }else if(value1 == value2) {
+                               TestEngine.logOK(text +" (value1:[" + value1 + "] value2:[" + value2 + "])");
+                       } else {
+                               TestEngine.logErr(text + " (expected value1:[" + value1 + "] but value2:[" + value2 + "])");
+                               return true;
+                       }
+               } catch(err) {
+                       TestEngine.countException++;
+                       logError("   TestEngine.test failure: " + err.message);
+               }
+               return false;
+       },
+       
+       /**
+        * Sets error type used in every typePresetError check.
+        * @param type Type of an error/exception.
+        */
+       setErrorType : function(type) {
+               TestEngine.errorType = type;
+       },
+       /**
+        * Sets error field used in every typePresetError check.
+        * @param field Name of the field in error structure to check its value.
+        */
+       setErrorField : function(field) {
+               TestEngine.errorField = field;
+       },
+       /**
+        * Checks if specified expression throws a specified error.
+        * Expression must be enclosed in a function. Use setErrorType and
+        * setErrorField to set what error to look for.
+        * Error type must be set but if error field is left unset (i.e. null)
+        * then whole exception object is compared to specified value.
+        * @param msg Text to display for this test.
+        * @param fn Function eclosing the expression one wants to verify.
+        * @param value Value of an error/exception one looks for.
+        */
+       testPresetError : function(msg, fn, value) {
+               if(TestEngine.errorType === null) {
+                       TestEngine.logException("testPresetError skipped. Set error type first.");
+                       return;
+               }
+
+               return TestEngine.testError(msg, fn, TestEngine.errorType, TestEngine.errorField, value);
+       },
+       /**
+        * Checks if specified expression throws a specified error.
+        * This is a more general version of testPresetError function.
+        * Expression must be enclosed in a function.
+        * Error type must be set but if error field is left unset (i.e. null)
+        * then whole exception object is compared to specified value.
+        * @param msg Text to display for this test.
+        * @param fn Function eclosing the expression one wants to verify.
+        * @param errType Type of desired error/exception.
+        * @param errField Property from exception structure to look for exception
+        * value.
+        * @param errValue Value of an error/exception one looks for.
+        */
+       testError : function(msg, fn, errType, errField, errValue) {
+               if(errType === null) {
+                       TestEngine.logException("testError skipped. Error type can't be null.");
+                       return TestEngine.ERROR_TEST_RESULT.NOT_RUN;
+               }
+
+               try {
+                       fn();
+                       TestEngine.logErr(msg + ' Exception has not been thrown.');
+                       return TestEngine.ERROR_TEST_RESULT.NOT_THROWN;
+               } catch (ex) {
+                       if( ex instanceof errType) {
+                               var exValue = (errField !== null ? ex[errField] : ex);
+                               if(exValue === errValue) {
+                                       TestEngine.logOK(msg + ' [' + errValue + ']');
+                                       return TestEngine.ERROR_TEST_RESULT.OK;
+                               } else {
+                                       TestEngine.logErr(msg + ' Exception is not of value ' + errValue);
+                                       return TestEngine.ERROR_TEST_RESULT.BAD_VALUE;
+                               }
+                       } else {
+                               TestEngine.logErr(msg + ' Exception is of wrong type.');
+                               return TestEngine.ERROR_TEST_RESULT.BAD_TYPE;
+                       }
+               }
+       },
+       testPresence : function(text, object) {
+               try {
+                       if(object === undefined) {
+                               TestEngine.logErr("value not defined. Name: " + text);
+                       } else {
+                               TestEngine.logOK("object " + text + " present");
+                       }
+               } catch(err) {
+                       TestEngine.countException++;
+                       logError("   TestEngine.testPresence failure: " + err.message);
+               }
+       },
+       /**
+        * Checks whether object implements given property.
+        * In addition it also checks whether any exception (e.g. "Not Supported")
+        * is thrown.
+        * @param object Object to check property for.
+        * @param property Property to look for.
+        * @return True if object implements such property, false otherwise.
+        */
+       testPresence2 : function(object, property) {
+               var result = property in object;
+               if(result) {
+                       TestEngine.logOK("property " + property + " present");
+               } else {
+                       TestEngine.logErr("property " + property + " absent");
+               }
+               return result;
+       },
+       /**
+        * Checks whether mainObj object equals templateObj object, property by
+        * property.
+        * Runs recursively through all the properties of templateObj object and
+        * checks if they exist and are equal to those in mainObj object.
+        * mainObj has to implement no less properties than templateObj.
+        * @param mainObj Object to check for properties implementation.
+        * @param templateObj Object to verify properties against.
+        * @return True if mainObj has at least the same properties as templateObj,
+        *         false otherwise.
+        */
+       checkObjectsEqual : function(mainObj, templateObj) {
+               try {
+                       if((!mainObj && templateObj) || ( typeof (mainObj) != typeof (templateObj))) {
+                               return false;
+                       } else if(isNumber(templateObj) || isString(templateObj) || isBoolean(templateObj)) {
+                               return (mainObj === templateObj);
+                       } else if(isDate(templateObj)) {
+                               return (mainObj.valueOf() === templateObj.valueOf());
+                       } else {
+                               for(var i in templateObj) {
+                                       if(!TestEngine.checkObjectsEqual(mainObj[i], templateObj[i])) {
+                                               return false;
+                                       }
+                               }
+                       }
+               } catch(err) {
+                       TestEngine.logException("TestEngine.checkObjectsEqual failure: " + err.message);
+                       return false;
+               }
+               return true;
+       },
+       // test properties of given object. Steps:
+       // - check name presence
+       // - check default value (if not null value passed)
+       // - check if name is writable
+       //
+       // description of properties array:
+       // [0] - property name
+       // [1] - default value - check if property equals given value
+       //          undefined or null - disable check
+       // [2] - value to do writability test - try to write given value
+       //          undefined or null - don't check writability
+       // [3] - indicates if property should be read-only
+       // [4] - assumed type, undefined value skips this check
+       testProperties : function(object, props) {
+               var result = new Object();
+               try {
+                       for(var i in props) {
+                               var name = props[i][0];
+                               var defaultVal = props[i][1];
+                               var setVal = props[i][2];
+                               var isReadonly = props[i][3];
+                               var type = props[i][4];
+                               var errors = TestEngine.countErr + TestEngine.countException;
+
+                               if(( typeof (name) != "string") || (name == "")) {
+                                       TestEngine.logException("Property name not defined, skipping it.");
+                                       continue;
+                               }
+
+                               result[name] = false;
+                               if(TestEngine.testPresence2(object, name)) {
+                                       if((defaultVal != null) && (defaultVal !== undefined)) {
+                                               var isObjectEqual = TestEngine.checkObjectsEqual(object[name], defaultVal);
+                                               TestEngine.test(name + " default value", isObjectEqual);
+                                       }
+
+                                       if((setVal != null) && (setVal !== undefined)) {
+                                               // try-catch is needed when SetProperty returns 'false'
+                                               if(setVal === defaultVal) {
+                                                       TestEngine.logException("Default value and set value are equal");
+                                                       continue;
+                                               }
+                                               try {
+                                                       object[name] = setVal;
+                                               } catch (e) {
+                                               }
+                                               if( typeof (isReadonly) == "undefined") {
+                                                       TestEngine.test(name + " writability, reason: isReadonly not specified", false);
+                                               }
+                                               if(isReadonly) {
+                                                       TestEngine.test(name + " writability", object[name] != setVal);
+                                               } else {
+                                                       var isObjectEqual = TestEngine.checkObjectsEqual(object[name], setVal);
+                                                       TestEngine.test(name + " writability", isObjectEqual);
+                                               }
+                                       }
+
+                                       if(type !== undefined) {
+                                               var isType = ( typeof (object[name]) == typeof (type));
+                                               if( typeof (type) == 'object') {
+                                                       if(isArray(type)) {
+                                                               isType = isArray(object[name]);
+                                                       } else if(isDate(type)) {
+                                                               isType = isDate(object[name]);
+                                                       }
+                                               }
+                                               TestEngine.test(name + " type check.", isType);
+                                       }
+                               }
+                               if(errors == TestEngine.countErr + TestEngine.countException) {
+                                       result[name] = true;
+                               }
+                       }
+               } catch(err) {
+                       TestEngine.countException++;
+                       logError("   TestEngine.testProperties failure: " + err.message);
+               }
+               return result;
+       },
+       startTestCase : function() {
+               try {
+                       TestEngine.countOK = 0;
+                       TestEngine.countErr = 0;
+                       TestEngine.countException = 0;
+                       TestEngine.timer = setTimeout(TestEngine.timeout, TestEngine.currentCaseTimeout);
+               } catch(err) {
+                       TestEngine.countException++;
+                       logError("   TestEngine.startTestCase failure: " + err.message);
+               }
+
+       },
+       endTestCase : function(testCase) {
+               try {
+                       if(this.timer === null) {
+                               return;
+                       }
+
+                       clearTimeout(this.timer);
+                       this.log("");
+                       var failed = this.countErr || ((this.countOK + this.countErr) < 1) || this.countException;
+                       this.log("Test case " + ( failed ? "FAILED" : "PASSED"));
+                       this.log("Passed: " + this.countOK);
+                       this.log("Failed: " + this.countErr);
+                       if(this.countException) {
+                               this.log("Exception occured!");
+                       }
+
+                       this.countAllPassed += this.countOK;
+                       this.countAllFailed += this.countErr;
+                       this.testSuiteStats[testCase.testSuite].assertsOK += this.countOK;
+                       this.testSuiteStats[testCase.testSuite].assertsErr += this.countErr;
+
+                       if(failed) {
+                               TestEngine.testCasesFailedCount++;
+                               this.testSuiteStats[testCase.testSuite].failed++;
+                               if(isVerbose()) {
+                                       TestEngine.testCasesFailed.push(testCase.testName + ":" + testCase.failMessage);
+                               }
+                               TestEngine.resultLogger.logFail(testCase.testName + ":" + testCase.failMessage);
+                       } else {
+                               TestEngine.testCasesPassedCount++;
+                               this.testSuiteStats[testCase.testSuite].passed++;
+                               TestEngine.resultLogger.logPass(testCase.testName);
+                       }
+                       TestEngine.summaryRenderer.render(TestEngine);
+               } catch(err) {
+                       this.countException++;
+                       logError("   TestEngine.endTestCase failure:" + err.message);
+               }
+       },
+       timeout : function() {
+               try {
+                       TestEngine.callbackMutex = 0;
+                       TestEngine.logErr("Widget run timeout.", false);
+               } catch(err) {
+                       TestEngine.countException++;
+                       logError("   TestEngine.timeout failure:" + err.message);
+               }
+       },
+       /**
+        * Registers callbacks for asynchronous function.
+        *
+        * To avoid finish test case before callbacks will execute it's necessary
+        * to register callbacks in the engine.
+        *
+        * @param methodName Testcase name, suggested asynchronous function name.
+        * @param testSuccessCallback Callback that will be executed on success.
+        * @param testErrorCallback Callback that will be executed on failure.
+        * @param callbacksCount number of callbacks to register.
+        * @return An object with defined functions "successCallback" and "errorCallback" you
+        *          need to pass as arguments to asynchronous function  e.g.
+        *
+        * function success() {  }
+        * function failure() {  }
+        *
+        * {
+        *      var obj = TestEngine.registerCallback("myAsyncFunc", success, failure);
+        *      myAsyncFunc(obj.successCallback, obj.errorCallback);
+        * }
+        */
+       registerCallback : function(methodName, testSuccessCallback, testErrorCallback, callbacksCount) {
+               try {
+                       if(callbacksCount !== undefined && callbacksCount > 0) {
+                               TestEngine.callbackMutex += callbacksCount;
+                       } else {
+                               TestEngine.callbackMutex++;
+                       }
+                       TestEngine.callbackMethodName = methodName;
+                       TestEngine.testSuccessCallback = testSuccessCallback;
+                       TestEngine.testErrorCallback = testErrorCallback;
+
+                       var retObj = new Object();
+                       retObj.callbackMethodName = methodName;
+                       retObj.testSuccessCallback = testSuccessCallback;
+                       retObj.successCallback = function(param) {
+                               try {
+                                       if(( typeof retObj.testSuccessCallback != "undefined") && (retObj.testSuccessCallback !== null)) {
+                                               retObj.testSuccessCallback(param);
+                                       } else {
+                                               TestEngine.logOK(retObj.callbackMethodName + " succeed");
+                                       }
+                               } catch(err) {
+                                       TestEngine.countException++;
+                                       logError("   TestEngine.this.successCallback failure:" + err.message);
+                               }
+                               TestEngine.callbackMutex--;
+                       };
+
+                       retObj.testErrorCallback = testErrorCallback;
+                       retObj.errorCallback = function(param) {
+                               try {
+                                       if(( typeof retObj.testErrorCallback != "undefined") && (retObj.testErrorCallback !== null)) {
+                                               retObj.testErrorCallback(param);
+                                       } else {
+                                               TestEngine.logErr(retObj.callbackMethodName + " failed");
+                                       }
+                               } catch(err) {
+                                       TestEngine.countException++;
+                                       logError("   TestEngine.retObj.errorCallback failure:" + err.message);
+                               }
+                               TestEngine.callbackMutex--;
+                       };
+                       return retObj;
+               } catch(err) {
+                       TestEngine.countException++;
+                       logError("   TestEngine.registerCallback failure:" + err.message);
+               }
+       },
+       successCallback : function(params) {
+               TestEngine.log("[Warning] Function TestEngine.successCallback deprecated");
+               try {
+                       TestEngine.callbackMutex--;
+                       if( typeof TestEngine.testSuccessCallback != "undefined") {
+                               TestEngine.testSuccessCallback(params);
+                       } else {
+                               TestEngine.logOK(TestEngine.callbackMethodName + " succeed");
+                       }
+               } catch(err) {
+                       TestEngine.countException++;
+                       logError("   TestEngine.successCallback failure:" + err.message);
+               }
+       },
+       errorCallback : function(params) {
+               TestEngine.log("[Warning] Function TestEngine.errorCallback deprecated");
+               try {
+                       TestEngine.callbackMutex--;
+                       if( typeof TestEngine.testErrorCallback != "undefined") {
+                               TestEngine.testErrorCallback(params);
+                       } else {
+                               TestEngine.logErr(TestEngine.callbackMethodName + " failed");
+                       }
+               } catch(err) {
+                       TestEngine.countException++;
+                       logError("   TestEngine.errorCallback failure:" + err.message);
+               }
+       },
+       waitForCallback : function() {
+               try {
+                       //    while( TestEngine.callbackMutex )
+                       {
+                       }
+               } catch(err) {
+                       TestEngine.countException++;
+                       logError("   TestEngine.waitForCallback failure:" + err.message);
+               }
+       },
+       /*
+        * code - error code which is expected
+        * object - object which will be used to call method
+        * functionName - method name to call
+        * restArguments - rest arguments which will be passed to callback (max arguments = 10)
+        *
+        * example:
+        * TestEngine.catchError(10001, bondi.messaging, findSMSs, succCallback, null, filter)
+        */
+       catchError : function(code, object, functionName, restArguments /* , ... */ ) {
+               try {
+                       TestEngine.log("TestEngine.catchError is DEPRECATED. Please use TestEngine.catchErrorType.");
+                       var error;
+                       try {
+                               var newArgs = []
+                               for(var i = 3; i < arguments.length; i++) {
+                                       newArgs.push(arguments[i])
+                               }
+                               var retVal = null;
+                               //no args
+                               if(arguments.length == 3) {
+                                       retVal = object[functionName]();
+                               }
+                               //1 arg
+                               if(arguments.length == 4) {
+                                       retVal = object[functionName](newArgs[0]);
+                               }
+                               //2 args
+                               if(arguments.length == 5) {
+                                       retVal = object[functionName](newArgs[0], newArgs[1]);
+                               }
+                               //3 args
+                               if(arguments.length == 6) {
+                                       retVal = object[functionName](newArgs[0], newArgs[1], newArgs[2]);
+                               }
+                               // 4 args
+                               if(arguments.length == 7) {
+                                       retVal = object[functionName](newArgs[0], newArgs[1], newArgs[2], newArgs[3]);
+                               }
+                               // 5 args
+                               if(arguments.length == 8) {
+                                       retVal = object[functionName](newArgs[0], newArgs[1], newArgs[2], newArgs[3], newArgs[4]);
+                               }
+                               // 6 args
+                               if(arguments.length == 9) {
+                                       retVal = object[functionName](newArgs[0], newArgs[1], newArgs[2], newArgs[3], newArgs[4], newArgs[5]);
+                               }
+                               // 7 args
+                               if(arguments.length == 10) {
+                                       retVal = object[functionName](newArgs[0], newArgs[1], newArgs[2], newArgs[3], newArgs[4], newArgs[5], newArgs[6]);
+                               }
+                               // 8 args
+                               if(arguments.length == 11) {
+                                       retVal = object[functionName](newArgs[0], newArgs[1], newArgs[2], newArgs[3], newArgs[4], newArgs[5], newArgs[6], newArgs[7]);
+                               }
+                               // 9 args
+                               if(arguments.length == 12) {
+                                       retVal = object[functionName](newArgs[0], newArgs[1], newArgs[2], newArgs[3], newArgs[4], newArgs[5], newArgs[6], newArgs[7], newArgs[8]);
+                               }
+                               // 10 args
+                               if(arguments.length == 13) {
+                                       retVal = object[functionName](newArgs[0], newArgs[1], newArgs[2], newArgs[3], newArgs[4], newArgs[5], newArgs[6], newArgs[7], newArgs[8], newArgs[9]);
+                               }
+
+                               TestEngine.logErr(functionName + " no error thrown");
+                               return retVal;
+                       } catch(error) {
+                               TestEngine.testPresence("<error code from: " + functionName + ">", error.code);
+                               TestEngine.test("Error number", error.code == code);
+                               return;
+                       }
+                       TestEngine.logErr("Function " + functionName + " desn't throw");
+               } catch(err) {
+                       TestEngine.countException++;
+                       logError("   TestEngine.testError failure:" + err.message);
+               }
+       },
+       /*
+        * errorTypeName - attribute name of catched exception to compare with code
+        * code - error code which is expected
+        * object - object which will be used to call method
+        * functionName - method name to call
+        * restArguments - rest arguments which will be passed to callback (max arguments = 10)
+        *
+        * example:
+        * TestEngine.catchErrorType("code", 10001, bondi.messaging, findSMSs, succCallback, null, filter)
+        */
+       catchErrorType : function(errorTypeName, code, object, functionName, restArguments /* , ... */ ) {
+               try {
+                       var error;
+                       try {
+                               var newArgs = []
+                               for(var i = 4; i < arguments.length; i++) {
+                                       newArgs.push(arguments[i])
+                               }
+                               var retVal = null;
+                               if(arguments.length < 4) {
+                                       TestEngine.logErr("Wrong catchErrorType usage.");
+                                       return retVal;
+                               }
+                               //no args
+                               if(arguments.length == 4) {
+                                       retVal = object[functionName]();
+                               }
+                               //1 arg
+                               if(arguments.length == 5) {
+                                       retVal = object[functionName](newArgs[0]);
+                               }
+                               //2 args
+                               if(arguments.length == 6) {
+                                       retVal = object[functionName](newArgs[0], newArgs[1]);
+                               }
+                               //3 args
+                               if(arguments.length == 7) {
+                                       retVal = object[functionName](newArgs[0], newArgs[1], newArgs[2]);
+                               }
+                               // 4 args
+                               if(arguments.length == 8) {
+                                       retVal = object[functionName](newArgs[0], newArgs[1], newArgs[2], newArgs[3]);
+                               }
+                               // 5 args
+                               if(arguments.length == 9) {
+                                       retVal = object[functionName](newArgs[0], newArgs[1], newArgs[2], newArgs[3], newArgs[4]);
+                               }
+                               // 6 args
+                               if(arguments.length == 10) {
+                                       retVal = object[functionName](newArgs[0], newArgs[1], newArgs[2], newArgs[3], newArgs[4], newArgs[5]);
+                               }
+                               // 7 args
+                               if(arguments.length == 11) {
+                                       retVal = object[functionName](newArgs[0], newArgs[1], newArgs[2], newArgs[3], newArgs[4], newArgs[5], newArgs[6]);
+                               }
+                               // 8 args
+                               if(arguments.length == 12) {
+                                       retVal = object[functionName](newArgs[0], newArgs[1], newArgs[2], newArgs[3], newArgs[4], newArgs[5], newArgs[6], newArgs[7]);
+                               }
+                               // 9 args
+                               if(arguments.length == 13) {
+                                       retVal = object[functionName](newArgs[0], newArgs[1], newArgs[2], newArgs[3], newArgs[4], newArgs[5], newArgs[6], newArgs[7], newArgs[8]);
+                               }
+                               // 10 args
+                               if(arguments.length == 14) {
+                                       retVal = object[functionName](newArgs[0], newArgs[1], newArgs[2], newArgs[3], newArgs[4], newArgs[5], newArgs[6], newArgs[7], newArgs[8], newArgs[9]);
+                               }
+
+                               TestEngine.logErr(functionName + " no error thrown");
+                               return retVal;
+                       } catch(error) {
+                               TestEngine.testPresence("<error code from: " + functionName + ">", error[errorTypeName]);
+                               TestEngine.test("Error number", error[errorTypeName] == code);
+                               return;
+                       }
+                       TestEngine.logErr("Function " + functionName + " desn't throw");
+               } catch(err) {
+                       TestEngine.countException++;
+                       logError("   TestEngine.testError failure:" + err.message);
+               }
+       },
+       /*
+        * code - error type which is expected
+        * object - object which will be used to call method
+        * functionName - method name to call
+        * restArguments - rest arguments which will be passed to callback (max arguments = 10)
+        *
+        * example:
+        * TestEngine.catchErrorJil("INVALID_ARGUMENT", Widget.Telephony, "getCallRecord", null, null)
+        */
+       catchErrorJil : function(code, object, functionName, restArguments /* , ... */ ) {
+               try {
+                       TestEngine.logErr("TestEngine.catchErrorJil is DEPRECATED. Please use TestEngine.catchErrorType.");
+               } catch(err) {
+                       TestEngine.countException++;
+                       logError("   TestEngine.testError failure:" + err.message);
+               }
+       },
+       // Executes step by step functions passed in steps array
+       // and waits after every execution time defined in timeInterval
+       executeSteps : function(steps, timeInterval) {
+               try {
+                       if( typeof (timeInterval) == "undefined") {
+                               timeInterval = 100;
+                               //default value
+                       }
+
+                       TestEngine.stepsArray = steps;
+                       TestEngine.stepTimeout = timeInterval;
+                       TestEngine.currentStep = 0;
+                       TestEngine.executeNextStep();
+               } catch(err) {
+                       TestEngine.countException++;
+                       logError("   TestEngine.executeSteps failure:" + err.message);
+               }
+       },
+       executeNextStep : function() {
+               try {
+                       if(TestEngine.stepsArray && (TestEngine.currentStep < TestEngine.stepsArray.length)) {
+                               if(isArray(TestEngine.stepsArray[TestEngine.currentStep])) {
+                                       TestEngine.stepsArray[ TestEngine.currentStep ][0]();
+                                       setTimeout(TestEngine.executeNextStep, TestEngine.stepsArray[ TestEngine.currentStep ][1]);
+
+                               } else {
+                                       TestEngine.stepsArray[ TestEngine.currentStep ]();
+                                       setTimeout(TestEngine.executeNextStep, TestEngine.stepTimeout);
+                               }
+                               TestEngine.currentStep++;
+                       } else {
+                               TestEngine.currentStep = null;
+                               TestEngine.stepTimeout = null;
+                               TestEngine.stepsArray = null;
+                       }
+               } catch(err) {
+                       TestEngine.countException++;
+                       logError("   TestEngine.executeNextStep failure:" + err.message);
+                       jsPrint("   Current step:" + TestEngine.currentStep);
+
+                       TestEngine.currentStep = null;
+                       TestEngine.stepTimeout = null;
+                       TestEngine.stepsArray = null;
+               }
+       },
+       enumerate : function(obj, level) {
+               try {
+                       if( typeof level == "undefined") {
+                               TestEngine.log(obj + ":");
+                               level = "";
+                       }
+                       for(i in obj) {
+                               if(!( typeof obj[i] == "object" || typeof obj[i] == "array")) {
+                                       TestEngine.log(level + i + " =  " + obj[i]);
+                               } else {
+                                       TestEngine.log(level + i + " =  ");
+                                       TestEngine.enumerate(obj[i], level + "----");
+                               }
+                       }
+               } catch(err) {
+                       TestEngine.countException++;
+                       logError("   TestEngine.enumerate failure:" + err.message);
+               }
+       },
+       doTests : function() {
+               try {
+                       TestEngine.testCasesFailed = [];
+                       TestEngine.doNextTestCase();
+               } catch(err) {
+                       TestEngine.countException++;
+                       logError("   TestEngine.doTests failure:" + err.message);
+               }
+       },
+       showSuitesStats : function() {
+               try {
+                       jsPrint("============ Test suites:");
+                       for(var i in this.testSuiteStats) {
+                               jsPrint(i + " - " + this.testSuiteStats[i].passed + " passed, " + this.testSuiteStats[i].failed + " failed," + "   asserts: " + this.testSuiteStats[i].assertsOK + " passed, " + this.testSuiteStats[i].assertsErr + " failed");
+                       }
+               } catch(err) {
+                       logError("   TestEngine.showSuitesStats failure:" + err.message);
+               }
+       },
+       doNextTestCase : function() {
+               try {
+                       if(TestEngine.stepsArray !== null || (TestEngine.callbackMutex > 0)) {
+                               setTimeout(TestEngine.doNextTestCase, 100);
+                               return;
+                       }
+
+                       if(TestEngine.currentTestCase) {
+                               TestEngine.endTestCase(TestEngine.testList[TestEngine.currentTestCase - 1]);
+                       }
+
+                       if(TestEngine.testList.length == TestEngine.currentTestCase) {
+                               jsPrint("============");
+                               jsPrint(TestEngine.finalLog);
+                               TestEngine.showSuitesStats();
+                               jsPrint("============ Summary:");
+                               jsPrint("Test cases all: " + TestEngine.testList.length);
+                               jsPrint("Test cases passed: " + TestEngine.testCasesPassedCount);
+                               jsPrint("Test cases failed: " + TestEngine.testCasesFailedCount);
+                               jsPrint("Asserts passed: " + TestEngine.countAllPassed);
+                               jsPrint("Asserts failed: " + TestEngine.countAllFailed);
+                               if(isVerbose()) {
+                                       jsPrint("============ Failing test cases:");
+                                       for( i = 0; i < TestEngine.testCasesFailed.length; ++i) {
+                                               logError(TestEngine.testCasesFailed[i]);
+                                       }
+                               }
+                               TestEngine.summaryRenderer.render(TestEngine);
+                               return;
+                       }
+
+                       var i = TestEngine.currentTestCase++;
+                       try {
+                               TestEngine.log("");
+                               TestEngine.log("==== Test case: " + TestEngine.testList[i].testName);
+                               TestEngine.startTestCase();
+                               var testPrereq = true;
+                               if(TestEngine.testList[i].testPrereq !== undefined) {
+                                       testPrereq = TestEngine.testList[i].testPrereq();
+                               }
+                               if(testPrereq) {
+                                       if(TestEngine.testList[i].enabled) {
+                                               TestEngine.testList[i].testFunc();
+                                       } else {
+                                               TestEngine.logErr("Test disabled");
+                                       }
+
+                               } else {
+                                       TestEngine.logException("Test case prerequisites unfulfilled.  Skipping it.");
+                               }
+                       } catch(err) {
+                               TestEngine.countException++;
+                               TestEngine.log("   Test case '" + TestEngine.testList[i].testName + "' failed:" + err.message);
+                       }
+                       setTimeout(TestEngine.doNextTestCase, 100);
+               } catch(err) {
+                       logError("   TestEngine.doNextTestCase failure:" + err.message);
+               }
+       }
+};
+
+function isUndefined(val) {
+       if( typeof val == "undefined") {
+               return true;
+       }
+       return false;
+}
+
+function isNull(val) {
+       return val === null;
+}
+
+function isString(val) {
+       if( typeof val == typeof "") {
+               return true;
+       }
+       return false;
+}
+
+function isNumber(val) {
+       if( typeof val == typeof 0) {
+               return true
+       }
+       return false;
+}
+
+function isDate(val) {
+       return ( val instanceof Date);
+}
+
+function isFunction(val) {
+       return ( typeof (val) == 'function');
+}
+
+function isBoolean(val) {
+       if( typeof val == typeof true) {
+               return true
+       }
+       return false;
+}
+
+function isArray(val) {
+       return ( val instanceof Array);
+}
+
+function isObject(val) {
+       return ( val );
+}
+
+function isVerbose() {
+       return (( typeof (VERBOSE) != "undefined") && (VERBOSE === 1));
+}
+
+/**
+ * Tests results logger.
+ */
+function HTMLTestResultLogger(sinkId) {
+
+       /**
+        * Logs a message.
+        * @param message Message to log.
+        * @param status Status of the message (PASSED, FAILED, EXCEPTION).
+        *               By default status is set to PASSED.
+        */
+       this.log = function(message, status) {
+               if(arguments.length < 2)
+                       throw "Not enough number of arguments.";
+               console.log("["+status+"]:"+message);
+       }
+       /**
+        * Helper functions.
+        */
+       this.logPass = function(message) {
+               if(arguments.length < 1)
+                       throw "Not enough number of arguments.";
+               this.log(message, HTMLTestResultLogger.PASSED);
+       }
+
+       this.logFail = function(message) {
+               if(arguments.length < 1)
+                       throw "Not enough number of arguments.";
+               this.log(message, HTMLTestResultLogger.FAILED);
+       }
+
+       var createLogEntry = function(message, status) {
+               var entry = '<div class="entry ' + status + '">';
+               entry += message.toString();
+               entry += '</div>';
+               return entry;
+       }
+       var id = sinkId;
+       var sink = null;
+}
+
+HTMLTestResultLogger.PASSED = "passed";
+HTMLTestResultLogger.FAILED = "failed";
+HTMLTestResultLogger.EXCEPTION = "exception";
+
+/**
+ * Tests summary renderer.
+ */
+function HTMLTestSummaryRenderer(summaryId) {
+
+       this.render = function(engine) {
+       }
+
+       var isSuiteStarted = function(stats) {
+               return (stats.passed + stats.failed != 0);
+       }
+       var renderSuite = function(name, stats) {
+       }
+       var setupSummary = function(summary) {
+       }
+       var id = summaryId;
+       var summary = null;
+}
diff --git a/src/Power/test/TestPower.js b/src/Power/test/TestPower.js
new file mode 100755 (executable)
index 0000000..1e1c227
--- /dev/null
@@ -0,0 +1,310 @@
+//
+// Tizen Web Device API
+// Copyright (c) 2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+var TYPE_MISMATCH_ERR = 'TypeMismatchError';
+var INVALID_VALUES_ERR = 'InvalidValuesError';
+var NOT_SUPPORTED_ERR = 'NotSupportedError';
+var NOT_FOUND_ERR = 'NotFoundError';
+//var UNKNOWN_ERR = 'UnknownError';
+//var PERMISSION_DENIED_ERR = 'PermissionDeniedError';
+
+var ERROR_STR = "GG";
+
+function UTC_power_module_presence_P_001()
+{
+    TestEngine.log("UTC_power_module_presence_P_001");
+
+    TestEngine.test("Power manager presence", power);
+    TestEngine.testPresence("request presence", power.request);
+    TestEngine.testPresence("release presence", power.release);
+    TestEngine.testPresence("setScreenStateChangeListener presence", power.setScreenStateChangeListener);
+    TestEngine.testPresence("unsetScreenStateChangeListener presence", power.unsetScreenStateChangeListener);
+    TestEngine.testPresence("getScreenBrightness presence", power.getScreenBrightness);
+    TestEngine.testPresence("setScreenBrightness presence", power.setScreenBrightness);
+    TestEngine.testPresence("isScreenOn presence", power.isScreenOn);
+    TestEngine.testPresence("restoreScreenBrightness presence", power.restoreScreenBrightness);
+    TestEngine.testPresence("turnScreenOn presence", power.turnScreenOn);
+    TestEngine.testPresence("turnScreenOff presence", power.turnScreenOff);
+}
+
+function UTC_power_request_P_001()
+{
+    TestEngine.log("UTC_power_request_P_001");
+
+    testNoExceptionWithMessage("test request display",
+        function(){
+            power.request("SCREEN", "SCREEN_DIM");
+            power.request("SCREEN", "SCREEN_NORMAL");
+            power.request("SCREEN", "SCREEN_BRIGHT");
+        }
+    );
+
+    testNoExceptionWithMessage("test request cpu",
+        function(){
+            power.request("CPU", "CPU_AWAKE");
+        }
+    );
+
+    testNoExceptionWithMessage("test request additional",
+        function(){
+            power.request("SCREEN", "SCREEN_BRIGHT", ERROR_STR);
+        }
+    );
+}
+
+function UTC_power_request_N_001()
+{
+    TestEngine.log("UTC_power_request_N_001");
+
+    TestEngine.log("First parameter check.");
+    TestEngine.catchErrorType("name", TYPE_MISMATCH_ERR, power, "request", ERROR_STR);
+    TestEngine.catchErrorType("name", TYPE_MISMATCH_ERR, power, "request", null);
+    TestEngine.catchErrorType("name", TYPE_MISMATCH_ERR, power, "request", undefined);
+
+    TestEngine.log("Second parameter check.");
+    TestEngine.catchErrorType("name", TYPE_MISMATCH_ERR, power, "request", "SCREEN", ERROR_STR);
+    TestEngine.catchErrorType("name", TYPE_MISMATCH_ERR, power, "request", "SCREEN", null);
+    TestEngine.catchErrorType("name", TYPE_MISMATCH_ERR, power, "request", "SCREEN", undefined);
+
+    TestEngine.log("Invalid number of parameters check.");
+    TestEngine.catchErrorType("name", TYPE_MISMATCH_ERR, power, "request");
+    TestEngine.catchErrorType("name", TYPE_MISMATCH_ERR, power, "request", "SCREEN");
+}
+
+function UTC_power_release_P_001()
+{
+    TestEngine.log("UTC_power_release_P_001");
+
+    testNoExceptionWithMessage("test release display",
+            function(){
+                       power.release("SCREEN");
+            }
+    );
+
+    testNoExceptionWithMessage("test release display additional",
+            function(){
+                       power.release("SCREEN", 1);
+            }
+    );
+}
+
+function UTC_power_release_N_001()
+{
+    TestEngine.log("UTC_power_release_N_001");
+
+    TestEngine.log("First parameter check.");
+    TestEngine.catchErrorType("name", TYPE_MISMATCH_ERR, power, "release", ERROR_STR);
+    TestEngine.catchErrorType("name", TYPE_MISMATCH_ERR, power, "release", null);
+    TestEngine.catchErrorType("name", TYPE_MISMATCH_ERR, power, "release", undefined);
+
+    TestEngine.log("Invalid number of parameters check.");
+    TestEngine.catchErrorType("name", TYPE_MISMATCH_ERR, power, "release");
+}
+
+function onChanged(previousState, changedState) {
+       TestEngine.log("State changed." + ", previousState: " + previousState + ", changedState: " + changedState);
+}
+
+function UTC_power_setScreenStateChangeListener_P_001()
+{
+    TestEngine.log("UTC_power_setScreenStateChangeListener_P_001");
+
+    testNoExceptionWithMessage("test setScreenStateChangeListener",
+        function(){
+            power.setScreenStateChangeListener(onChanged);
+        }
+    );
+
+    testNoExceptionWithMessage("test setScreenStateChangeListener additional",
+        function(){
+            power.setScreenStateChangeListener(onChanged, ERROR_STR);
+        }
+    );
+}
+
+function UTC_power_setScreenStateChangeListener_N_001()
+{
+    TestEngine.log("UTC_power_setScreenStateChangeListener_N_001");
+
+    TestEngine.log("First parameter check.");
+    TestEngine.catchErrorType("name", TYPE_MISMATCH_ERR, power, "setScreenStateChangeListener", ERROR_STR);
+    TestEngine.catchErrorType("name", TYPE_MISMATCH_ERR, power, "setScreenStateChangeListener", null);
+    TestEngine.catchErrorType("name", TYPE_MISMATCH_ERR, power, "setScreenStateChangeListener", undefined);
+
+    TestEngine.log("Invalid number of parameters check.");
+    TestEngine.catchErrorType("name", TYPE_MISMATCH_ERR, power, "setScreenStateChangeListener");
+}
+
+function UTC_power_unsetScreenStateChangeListener_P_001()
+{
+    TestEngine.log("UTC_power_unsetScreenStateChangeListener_P_001");
+
+    testNoExceptionWithMessage("test unsetScreenStateChangeListener",
+        function(){
+            power.unsetScreenStateChangeListener();
+        }
+    );
+
+    testNoExceptionWithMessage("test request additional",
+        function(){
+            power.unsetScreenStateChangeListener(ERROR_STR);
+        }
+    );
+}
+
+function UTC_power_getScreenBrightness_P_001()
+{
+    TestEngine.log("UTC_power_getScreenBrightness_P_001");
+
+    testNoExceptionWithMessage("test getScreenBrightness",
+        function(){
+            power.getScreenBrightness();
+        }
+    );
+
+    testNoExceptionWithMessage("test getScreenBrightness additional",
+        function(){
+            power.getScreenBrightness(ERROR_STR);
+        }
+    );
+}
+
+function UTC_power_setScreenBrightness_P_001()
+{
+    TestEngine.log("UTC_power_setScreenBrightness_P_001");
+
+    testNoExceptionWithMessage("test setScreenBrightness",
+        function(){
+            power.setScreenBrightness(0.5);
+        }
+    );
+
+    testNoExceptionWithMessage("test setScreenBrightness additional",
+        function(){
+            power.setScreenBrightness(0.1, ERROR_STR);
+        }
+    );
+}
+
+function UTC_power_setScreenBrightness_N_001()
+{
+    TestEngine.log("UTC_power_setScreenBrightness_N_001");
+
+    TestEngine.log("First parameter check.");
+    TestEngine.catchErrorType("name", TYPE_MISMATCH_ERR, power, "setScreenBrightness", ERROR_STR);
+}
+
+function UTC_power_isScreenOn_P_001()
+{
+    TestEngine.log("UTC_power_isScreenOn_P_001");
+
+    testNoExceptionWithMessage("test isScreenOn",
+        function(){
+            power.isScreenOn();
+        }
+    );
+
+    testNoExceptionWithMessage("test isScreenOn additional",
+        function(){
+            power.isScreenOn(ERROR_STR);
+        }
+    );
+}
+
+function UTC_power_restoreScreenBrightness_P_001()
+{
+    TestEngine.log("UTC_power_restoreScreenBrightness_P_001");
+
+    testNoExceptionWithMessage("test restoreScreenBrightness",
+        function(){
+            power.restoreScreenBrightness();
+        }
+    );
+
+    testNoExceptionWithMessage("test restoreScreenBrightness additional",
+        function(){
+            power.restoreScreenBrightness(ERROR_STR);
+        }
+    );
+}
+
+function UTC_power_turnScreenOff_P_001()
+{
+    TestEngine.log("UTC_power_turnScreenOff_P_001");
+
+    testNoExceptionWithMessage("test turnScreenOff",
+        function(){
+            power.turnScreenOff();
+        }
+    );
+
+    testNoExceptionWithMessage("test turnScreenOff additional",
+        function(){
+            power.turnScreenOff(ERROR_STR);
+        }
+    );
+}
+
+function UTC_power_turnScreenOn_P_001()
+{
+    TestEngine.log("UTC_power_turnScreenOn_P_001");
+
+    testNoExceptionWithMessage("test turnScreenOn",
+        function(){
+            power.turnScreenOn();
+        }
+    );
+
+    testNoExceptionWithMessage("test turnScreenOn additional",
+        function(){
+            power.turnScreenOn(ERROR_STR);
+        }
+    );
+}
+
+//=============================================================================
+TestEngine.setTestSuiteName("[Tizen][Power]", 30 * 1000);
+TestEngine.addTest(true, UTC_power_module_presence_P_001, "[Tizen][Power] UTC_power_module_presence_P_001");
+TestEngine.addTest(true, UTC_power_request_P_001, "[Tizen][Power] UTC_power_request_P_001");
+TestEngine.addTest(true, UTC_power_request_N_001, "[Tizen][Power] UTC_power_request_N_001");
+TestEngine.addTest(true, UTC_power_release_N_001, "[Tizen][Power] UTC_power_release_N_001");
+TestEngine.addTest(true, UTC_power_release_P_001, "[Tizen][Power] UTC_power_release_P_001");
+TestEngine.addTest(true, UTC_power_setScreenStateChangeListener_P_001, "[Tizen][Power] UTC_power_setScreenStateChangeListener_P_001");
+TestEngine.addTest(true, UTC_power_setScreenStateChangeListener_N_001, "[Tizen][Power] UTC_power_setScreenStateChangeListener_N_001");
+TestEngine.addTest(true, UTC_power_unsetScreenStateChangeListener_P_001, "[Tizen][Power] UTC_power_unsetScreenStateChangeListener_P_001");
+TestEngine.addTest(true, UTC_power_getScreenBrightness_P_001, "[Tizen][Power] UTC_power_getScreenBrightness_P_001");
+TestEngine.addTest(true, UTC_power_setScreenBrightness_P_001, "[Tizen][Power] UTC_power_setScreenBrightness_P_001");
+TestEngine.addTest(true, UTC_power_setScreenBrightness_N_001, "[Tizen][Power] UTC_power_setScreenBrightness_N_001");
+TestEngine.addTest(true, UTC_power_isScreenOn_P_001, "[Tizen][Power] UTC_power_isScreenOn_P_001");
+TestEngine.addTest(true, UTC_power_restoreScreenBrightness_P_001, "[Tizen][Power] UTC_power_restoreScreenBrightness_P_001");
+TestEngine.addTest(true, UTC_power_turnScreenOff_P_001, "[Tizen][Power] UTC_power_turnScreenOff_P_001");
+TestEngine.addTest(true, UTC_power_turnScreenOn_P_001, "[Tizen][Power] UTC_power_turnScreenOn_P_001");
+//=============================================================================
+
+function testNoExceptionWithMessage(message, fun) {
+    var testResult = true;
+    try
+    {
+        fun();
+    }
+    catch (e)
+    {
+        testResult = false;
+    }
+    TestEngine.test(message, testResult);
+}
+
diff --git a/src/Power/test/main.cpp b/src/Power/test/main.cpp
new file mode 100755 (executable)
index 0000000..385b7b6
--- /dev/null
@@ -0,0 +1,90 @@
+//
+// Tizen Web Device API
+// Copyright (c) 2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+
+#include <stdio.h>
+#include <string.h>
+#include <JavaScriptCore/JavaScript.h>
+#include "StandaloneConsole.h"
+#include <Ecore.h>
+#include <GlobalContextManager.h>
+#include <JSPowerManager.h>
+
+#include <Commons/FunctionDefinition.h>
+#include <Commons/FunctionDeclaration.h>
+#include <pthread.h>
+
+using namespace std;
+using namespace DeviceAPI::Test;
+using namespace DeviceAPI::Common;
+using namespace DeviceAPI::Power;
+using namespace WrtDeviceApis::Commons;
+
+
+namespace DeviceAPI{
+namespace Power{
+AceFunction getPowerFunctionData(const std::string & functionId){
+       return AceFunction();
+}
+}
+}
+
+void loopQuit(void *data, Ecore_Thread *thread){
+    ecore_main_loop_quit();
+}
+
+void threadRun(void *data, Ecore_Thread *thread){
+    StandaloneConsole *console = (StandaloneConsole*)data;
+    StandaloneConsole::commandline(console);
+}
+
+int main(int argc, char** argv){
+
+    if (!ecore_init())
+    {
+        printf("ERROR: Cannot init Ecore!\n");
+        return -1;
+    }
+    ecore_main_loop_glib_integrate();
+
+    DPL::Log::LogSystemSingleton::Instance().SetTag("STANDALONE");
+    //DPL::Event::GetMainEventDispatcherInstance().ResetCrossEventCallHandler();
+    try{
+        WrtAccessSingleton::Instance().initialize(0);
+    }catch(...){
+        printf("ERROR: Cannot init WrtAccessSingleton\n");
+        return -1;
+    }
+
+
+    StandaloneConsole console;
+    console.initialize();
+    GlobalContextManager::getInstance()->addGlobalContext(console.getGlobalContext());
+    console.registModule("power", JSPowerManager::getClassRef(), NULL);
+
+    if( argc > 1 ){
+        for(unsigned int i = 1 ; i< (unsigned int)argc; i++){
+            console.RunScript(argv[i]);
+        }
+    }
+    
+    ecore_thread_run(threadRun, loopQuit, NULL, &console);
+
+    ecore_main_loop_begin();
+    ecore_shutdown();
+    return 0;
+}
index bd40cb2..b782951 100644 (file)
@@ -32,6 +32,7 @@ TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
        ${LIBS_COMMON}
     ${tizen_impl}
     ${application_impl}
+    "-Wl,--no-as-needed" ${application_config}
        ${platform_pkgs_push_LIBRARIES}
 )
 
index a96597c..fad59ee 100644 (file)
@@ -34,6 +34,7 @@ ADD_LIBRARY(${TARGET_NAME} SHARED ${SRCS})
 TARGET_LINK_LIBRARIES(${TARGET_NAME}
        ${LIBS_COMMON}
        ${filesystem_impl}
+       "-Wl,--no-as-needed" ${filesystem_config}
        ${platform_pkgs_systemsetting_LIBRARIES}
 )