%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
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}
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}
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})
#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 {
#include <ArgumentValidator.h>
#include <JSUtil.h>
-#include <Security.h>
#include <SecurityExceptions.h>
#include <Commons/Exception.h>
#include <ail.h>
-#include "plugin_config_impl.h"
+#include "plugin_config.h"
#include "AlarmConverter.h"
#include "JSAlarmAbsolute.h"
#include "AlarmAbsolute.h"
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)
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 {
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 {
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);
#include <JSWebAPIErrorFactory.h>
#include <SecurityExceptions.h>
+#include "plugin_config.h"
+
#include "AlarmRelative.h"
#include "AlarmConverter.h"
#include "JSAlarmRelative.h"
#include <Export.h>
#include <Logger.h>
-#define ALARM_FUNCTION_API_GET_REMAINING_SECONDS "getRemainingSeconds"
-
namespace DeviceAPI {
namespace Alarm {
#include <dpl/exception.h>
#include <map>
-#include "plugin_config_impl.h"
#include "plugin_config.h"
#define ALARM_FEATURE_API "http://tizen.org/privilege/alarm"
static FunctionMapping AlarmFunctions =
createAlarmFunctions();
+#pragma GCC visibility push(default)
+
DEFINE_FUNCTION_GETTER(Alarm, AlarmFunctions);
+#pragma GCC visibility pop
+
static FunctionMapping createAlarmFunctions()
{
/**
-//
-// 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
+++ /dev/null
-//
-// 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
#include "JSAlarmAbsolute.h"
#include "JSAlarmRelative.h"
#include <Logger.h>
-#include <Security.h>
-#include "plugin_config.h"
#define WRT_JS_EXTENSION_OBJECT_TIZEN "tizen"
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,
{
LoggerE("WrtAccess initialization failed");
}
-
- INITAILIZE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor, alarmAceCheckAccessFunction);
}
void on_widget_stop_callback(int widgetId)
{
LoggerE("WrtAccess deinitialization failed");
}
-
- FINALIZE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor);
}
PLUGIN_ON_WIDGET_START(on_widget_start_callback)
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,
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;
}
EventApplicationGetAppsContextEventAnswerReceiver(ThreadEnum::NULL_THREAD),
EventApplicationGetAppsInfoEventAnswerReceiver(ThreadEnum::NULL_THREAD),
EventApplicationAppInfoEventListenerListener(ThreadEnum::NULL_THREAD),
- SecurityAccessor(),
ApplicationPrivObject(context, application)
{
if (!application) {
#include <CommonsJavaScript/PrivateObject.h>
#include <CommonsJavaScript/JSPendingOperationPrivateObject.h>
#include <CommonsJavaScript/JSPendingOperation.h>
-#include <Security.h>
#include "IApplicationManager.h"
namespace DeviceAPI {
public EventApplicationGetAppsContextEventAnswerReceiver,
public EventApplicationGetAppsInfoEventAnswerReceiver,
public EventApplicationAppInfoEventListenerListener,
- public DeviceAPI::Common::SecurityAccessor,
public ApplicationPrivObject
{
public:
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;
}
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
${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
)
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
#include <JSWebAPIErrorFactory.h>
#include "ApplicationFactory.h"
-#include "plugin_config_impl.h"
+#include "plugin_config.h"
#include "ApplicationController.h"
#include "JSApplicationManager.h"
#include "ApplicationConverter.h"
#include <TimeTracer.h>
#include <Export.h>
#include <Logger.h>
-#include <Security.h>
#include <plugins-ipc-message/ipc_message_support.h>
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;
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);
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;
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);
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;
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);
{
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, ""));
{
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, ""));
#define TIZEN_INTERFACE_APPLICATION_MANAGER "ApplicationManager"
+typedef WrtDeviceApis::CommonsJavaScript::PrivateObject
+ <IApplicationManagerPtr, WrtDeviceApis::CommonsJavaScript::NoOwnership> JSApplicationManagerPriv;
+
class JSApplicationManager {
public:
static const JSClassDefinition* getClassInfo();
static FunctionMapping ApplicationFunctions =
createApplicationFunctions();
+#pragma GCC visibility push(default)
+
DEFINE_FUNCTION_GETTER(Application, ApplicationFunctions);
+#pragma GCC visibility pop
+
static FunctionMapping createApplicationFunctions()
{
/**
-//
-// 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
+++ /dev/null
-//
-// 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
-
#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;
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,
} Catch(WrtDeviceApis::Commons::Exception) {
LoggerE("WrtAccess initialization failed");
}
-
- INITAILIZE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor, applicationAceCheckAccessFunction);
}
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)
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
#include <JSWebAPIErrorFactory.h>
#include <JSUtil.h>
#include <TimeTracer.h>
-#include "plugin_config_impl.h"
+
#include "BluetoothAdapter.h"
#include "BluetoothCallbackUtil.h"
#include "JSBluetoothDevice.h"
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);
if(iter == adapter->knownDevices.end()) {
BluetoothDeviceSharedPtr device(new BluetoothDevice(deviceInfo));
- device->copyAceCheckAccessFunction(getInstance());
adapter->knownDevices.push_back(device);
}
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);
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);
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);
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) {
mConnReqMap.clear();
mFoundDevices.clear();
mConnectedSocket.clear();
-
-
}
void BluetoothAdapter::unloadFrame(JSContextRef context)
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;
}
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");
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);
}
-
-
-
} // Bluetooth
} // DeviceAPI
#include <map>
#include <bluetooth.h>
-#include <Security.h>
+
#include <MultiCallbackUserData.h>
#include <PlatformException.h>
+
#include "BluetoothDevice.h"
#include "BluetoothServiceHandler.h"
#include "BluetoothSocket.h"
};
typedef BluetoothConnReq* BluetoothConnReqPtr;
-class BluetoothAdapter : public Common::SecurityAccessor
+class BluetoothAdapter
{
public:
enum adapterAsyncE
static bool isValidAddress(std::string &address);
static bool isValidUUID(std::string &uuid);
void unloadFrame(JSContextRef context);
+
private:
BluetoothAdapter();
virtual ~BluetoothAdapter();
std::vector<BluetoothDeviceSharedPtr> mFoundDevices;
std::vector<BluetoothDeviceSharedPtr> knownDevices;
Common::MultiCallbackUserDataPtr mChangeListener;
-
};
typedef BluetoothAdapter* BluetoothAdapterPtr;
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);
#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);
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));
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]));
}
return mAddress;
}
-void BluetoothDevice::copyAceCheckAccessFunction(const Common::SecurityAccessor *securityAccessor)
-{
- Common::SecurityAccessor::copyAceCheckAccessFunction(securityAccessor);
- mDeviceClass->copyAceCheckAccessFunction(securityAccessor);
-}
-
JSValueRef BluetoothDevice::getDeviceClass(JSContextRef context)
{
/*
#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);
bool isTrusted() const;
bool isConnected() const;
JSValueRef getUUIDs(JSContextRef context);
- void copyAceCheckAccessFunction(const Common::SecurityAccessor *securityAccessor);
+
private:
std::string mName;
std::string mAddress;
BluetoothHealthApplication::BluetoothHealthApplication(std::string appID, std::string name, unsigned short dataType)
{
- Common::SecurityAccessor();
mAppID = appID;
mName = name;
mDataType = dataType;
#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);
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) {
#include <string>
#include <bluetooth.h>
#include <JavaScriptCore/JavaScript.h>
-#include <Security.h>
+
#include <MultiCallbackUserData.h>
#include "BluetoothDevice.h"
#include "BluetoothHealthApplication.h"
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);
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));
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));
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");
}
}
}
-
BluetoothHealthProfileHandler::~BluetoothHealthProfileHandler()
{
// unset platform callback
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));
// limitations under the License.
//
-#ifndef __TIZEN_HEALTH_PROFILE_HANDLER_H__
+#ifndef __TIZEN_BLUETOOTH_ADAPTER_H__
#define __TIZEN_HEALTH_PROFILE_HANDLER_H__
#include <string>
};
typedef HealthConnReq* HealthConnReqPtr;
-class BluetoothHealthProfileHandler : public Common::SecurityAccessor
+class BluetoothHealthProfileHandler
{
public:
static BluetoothHealthProfileHandler* getInstance();
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();
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;
BluetoothServiceHandler::BluetoothServiceHandler(std::string uuid, std::string name, int registeredSocket)
{
- Common::SecurityAccessor();
-
mUUID = uuid;
mName = name;
mRegisteredSocket = registeredSocket;
//#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);
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);
}
//#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;
#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;
// 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);
// 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
// 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
// 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);
// 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
// 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
// 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
// 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
// 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
// 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
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);
#define __TIZEN_JS_BLUETOOTH_ADAPTER_H__
#include <JavaScriptCore/JavaScript.h>
-#include <Security.h>
namespace DeviceAPI {
namespace Bluetooth {
{
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
namespace DeviceAPI {
namespace Bluetooth {
-class BluetoothClassHolder
+class BluetoothClassHolder
{
public:
- BluetoothClassHolder(BluetoothClassSharedPtr bluetoothClass) { mClass = bluetoothClass;}
+ BluetoothClassHolder(BluetoothClassSharedPtr bluetoothClass) {mClass = bluetoothClass;}
BluetoothClassSharedPtr mClass;
};
typedef BluetoothClassHolder* BluetoothClassHolderPtr;
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
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
#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;
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
#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;
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
{
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
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);;
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
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);
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
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);;
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);
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);
#include <PropertyBag.h>
#include <bluetooth.h>
-#include "plugin_config_impl.h"
+#include "plugin_config.h"
#include "JSBluetoothManager.h"
#include "JSBluetoothClassDeviceMajor.h"
#include "JSBluetoothClassDeviceMinor.h"
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;
}
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;
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;
#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
{
{
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
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
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
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
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
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) {
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
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);;
#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) \
+++ /dev/null
-#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
#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"
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)
} catch (...) {
LoggerE("WrtAccess initialization failed");
}
- INITAILIZE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor, bluetoothAceCheckAccessFunction);
}
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)
PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
"bluetooth",
(js_class_template_getter)JSBluetoothManager::getClassRef,
- &BluetoothOptions)
+ NULL)
PLUGIN_CLASS_MAP_END
} // Bluetooth
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})
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()
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)
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);
}
#include "EventAlarm.h"
#include <CommonsJavaScript/Converter.h>
#include <CommonsJavaScript/ScopedJSStringRef.h>
-#include <Security.h>
namespace DeviceAPI {
namespace Calendar {
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);
private:
CalendarEvent::CalendarType m_calendarType;
- DeviceAPI::Common::SecurityAccessor* m_securityAccessor;
};
}
#include <Commons/IEvent.h>
#include <CommonsJavaScript/JSCallbackManager.h>
#include <JavaScriptCore/JavaScript.h>
-#include <Security.h>
#include "CalendarEvent.h"
{ }
};
-class CalendarChangeCallbackPrivateData :
- public WrtDeviceApis::Commons::IEventPrivateData,
- public DeviceAPI::Common::SecurityAccessor
+class CalendarChangeCallbackPrivateData : public WrtDeviceApis::Commons::IEventPrivateData
{
public:
CalendarChangeCallbackPrivateData(const JSCallbackManagerPtr& onAdded,
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);
if (event->getResult()) {
LoggerD("result success");
- CalendarConverter converter(cbm->getContext(), event.Get());
+ CalendarConverter converter(cbm->getContext());
JSValueRef result;
if (CalendarEvent::TASK_TYPE==event->getCalendarType()) {
Try
{
if (event->getResult()) {
- CalendarConverter converter(cbm->getContext(), event.Get());
+ CalendarConverter converter(cbm->getContext());
JSValueRef result;
if (CalendarEvent::TASK_TYPE==event->getCalendarType()) {
}
if (event->getResult()) {
- CalendarConverter converter(cbm->getContext(), event.Get());
+ CalendarConverter converter(cbm->getContext());
cbm->callOnSuccess(converter.toJSValueRefEventArray(event->getExpandedEventList()));
return;
} else {
DPL::StaticPointerCast<CalendarChangeCallbackPrivateData>(event->getPrivateData());
JSContextRef context = multiCallbacks->getOnAdded()->getContext();
- CalendarConverter converter(context, multiCallbacks.Get());
+ CalendarConverter converter(context);
JSValueRef result;
Try
#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;
#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
#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;
#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;
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
{
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
{
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);
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
{
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
{
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
{
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
{
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
{
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])) {
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
{
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.");
}
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
{
CalendarChangeCallbackPrivateDataPtr privData(new CalendarChangeCallbackPrivateData(
onAddedCbm, onUpdatedCbm, onDeletedCbm));
- privData->copyAceCheckAccessFunction(privateObject);
OnEventsChangedEmitterPtr emitter(new OnEventsChangedEmitter());
emitter->setListener(&CalendarResponseDispatcher::getInstance());
emitter->setEventPrivateData(DPL::StaticPointerCast<IEventPrivateData>(privData));
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
{
#include <CommonsJavaScript/PrivateObject.h>
#include "ICalendar.h"
#include <CommonsJavaScript/JSCallbackManager.h>
-#include <Security.h>
namespace DeviceAPI {
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
{
#include <TimeUtilConverter.h>
#include <JSTZDate.h>
#include <JSWebAPIErrorFactory.h>
-#include <Security.h>
#include <SecurityExceptions.h>
#include <GlobalContextManager.h>
#include <TimeTracer.h>
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);
}
event->setCalendarType(CalendarEvent::EVENT_TYPE);
- return createJSCalendarEvent(globalContext, event, securityAccessor);
+ return createJSCalendarEvent(globalContext, event);
}
Catch(UnsupportedException)
{
}
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);
}
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
{
dplEvent->setEvent(event);
dplEvent->setStartDate(startDate);
dplEvent->setEndDate(endDate);
- dplEvent->copyAceCheckAccessFunction(privateObject);
m_calendar->expandEventRecurrence(dplEvent);
TIME_TRACER_ITEM_END(__FUNCTION__, 0);
#include "CalendarEvent.h"
#include "ICalendar.h"
#include "CalendarFactory.h"
-#include "JSCalendarItemProperties.h"
#include <CommonsJavaScript/PrivateObject.h>
-#include <Security.h>
namespace DeviceAPI {
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
{
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,
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
{
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
{
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.");
}
#include <JavaScriptCore/JavaScript.h>
#include "CalendarEvent.h"
#include <CommonsJavaScript/PrivateObject.h>
-#include <Security.h>
namespace DeviceAPI {
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
{
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) {
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);
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) {
// 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]));
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) {
// 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]));
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) {
// 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) {
#include <JavaScriptCore/JavaScript.h>
#include <CommonsJavaScript/PrivateObject.h>
-#include <Security.h>
#include "ICalendarManager.h"
#include "ICalendar.h"
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"
#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>
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
{
}
task->setCalendarType(CalendarEvent::TASK_TYPE);
- return createJSCalendarTask(context, task, securityAccessor);
+ return createJSCalendarTask(context, task);
}
Catch(UnsupportedException)
{
}
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);
}
#include <JavaScriptCore/JavaScript.h>
#include "CalendarEvent.h"
-#include "JSCalendarItemProperties.h"
#include <CommonsJavaScript/PrivateObject.h>
namespace DeviceAPI {
#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
{
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,
static FunctionMapping CalendarFunctions = createCalendarFunctions();
+#pragma GCC visibility push(default)
+
DEFINE_FUNCTION_GETTER(Calendar, CalendarFunctions);
+#pragma GCC visibility pop
+
static FunctionMapping createCalendarFunctions()
{
/**
#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) \
+++ /dev/null
-//
-// 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_
#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 << ")");
} Catch (Exception) {
LoggerE("WrtAccess initialization failed");
}
-
- INITAILIZE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor, calendarAceCheckAccessFunction);
}
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)
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
//
#include "CallHistoryAsyncCallbackManager.h"
+#include <dpl/singleton_impl.h>
+
+
+
+IMPLEMENT_SINGLETON(DeviceAPI::CallHistory::CallHistoryAsyncCallbackManager)
namespace DeviceAPI {
namespace CallHistory {
-SINGLETON_IMPLEMENTATION(CallHistoryAsyncCallbackManager)
-
} // Tizen1_0
} // TizenApis
#ifndef _TIZEN_CALLHISTORY_ASYNC_CALLBACK_MANAGER_H_
#define _TIZEN_CALLHISTORY_ASYNC_CALLBACK_MANAGER_H_
+#include <dpl/singleton.h>
#include <AsyncCallbackManager.h>
namespace DeviceAPI {
friend class DPL::Singleton<CallHistoryAsyncCallbackManager>;
};
-SINGLETON_DEFINITION(CallHistoryAsyncCallbackManager)
+typedef DPL::Singleton<CallHistoryAsyncCallbackManager> CallHistoryAsyncCallbackManagerSingleton;
} // Tizen1_0
} // TizenApis
//
#include "CallHistoryListenerManager.h"
+#include <dpl/singleton_impl.h>
+
+
+
+IMPLEMENT_SINGLETON(DeviceAPI::CallHistory::CallHistoryListenerManager)
namespace DeviceAPI {
namespace CallHistory {
-SINGLETON_IMPLEMENTATION(CallHistoryListenerManager)
-
} // Tizen1_0
} // TizenApis
#include <map>
#include <JavaScriptCore/JavaScript.h>
#include <dpl/shared_ptr.h>
+#include <dpl/singleton.h>
#include <IListenerManager.h>
#include "JSCallHistory.h"
#include <Logger.h>
{
}
};
-SINGLETON_DEFINITION(CallHistoryListenerManager)
+typedef DPL::Singleton<CallHistoryListenerManager> CallHistoryListenerManagerSingleton;
class CallHistoryListenerCanceller : public DeviceAPI::Common::IListenerItem
{
#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"
{ 0, 0, 0 }
};
-const JSClassRef DLL_EXPORT JSCallHistory::getClassRef() {
+const JSClassRef JSCallHistory::getClassRef() {
if (!m_jsClassRef) {
m_jsClassRef = JSClassCreate(&m_classInfo);
}
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();
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())) {
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();
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));
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);
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);
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{
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) {
#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
{
{ 0, 0, 0, 0 }
};
-const JSClassRef DLL_EXPORT JSCallHistoryEntry::getClassRef()
+const JSClassRef JSCallHistoryEntry::getClassRef()
{
if (!m_jsClassRef) {
m_jsClassRef = JSClassCreate(&m_classInfo);
#include <CommonsJavaScript/JSUtils.h>
#include <CommonsJavaScript/JSCallbackManager.h>
#include <JSWebAPIErrorFactory.h>
+#include "JSCallHistory.h"
#include "Converter.h"
#include "CallHistoryAsyncCallbackManager.h"
#include <Logger.h>
#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"
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;
#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<> >( \
+++ /dev/null
-//
-// 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_
#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"
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();
} catch(WrtDeviceApis::Commons::Exception) {
LoggerE("WrtAccess initialization failed");
}
- INITAILIZE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor, callhistoryAceCheckAccessFunction);
}
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)
WRT_JS_EXTENSION_OBJECT_TIZEN,
CALLHISTORY,
(js_class_template_getter)DeviceAPI::CallHistory::JSCallHistory::getClassRef,
- &option)
+ NULL)
PLUGIN_CLASS_MAP_END
} // CallHistory
EventAddressBookRemoveBatchEventAnswerReceiver(ThreadEnum::NULL_THREAD),
EventAddressBookFindEventAnswerReceiver(ThreadEnum::NULL_THREAD),
EventAddressBookChangeListenerListener(ThreadEnum::NULL_THREAD),
- DeviceAPI::Common::SecurityAccessor(),
AddressBookPrivObject(context, addressBook)
{
LoggerD("AddressBookController constructed : " << this);
#include <CommonsJavaScript/PrivateObject.h>
#include <CommonsJavaScript/JSPendingOperationPrivateObject.h>
#include <CommonsJavaScript/JSPendingOperation.h>
-#include <Security.h>
#include "IAddressBook.h"
namespace DeviceAPI {
public EventAddressBookRemoveBatchEventAnswerReceiver,
public EventAddressBookFindEventAnswerReceiver,
public EventAddressBookChangeListenerListener,
- public DeviceAPI::Common::SecurityAccessor,
public AddressBookPrivObject
{
public:
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)
${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
)
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
{
}
-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);
}
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();
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.");
}
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)
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();
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.");
}
#include "ContactEmailAddress.h"
#include <ArgumentValidator.h>
#include <JSWebAPIErrorFactory.h>
-#include <Security.h>
#include <JSUtil.h>
#include <Export.h>
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);
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);
EventContactManagerRemoveBatchAnswerReceiver(ThreadEnum::NULL_THREAD),
EventContactManagerFindAnswerReceiver(ThreadEnum::NULL_THREAD),
EventContactManagerChangeListenerListener(ThreadEnum::NULL_THREAD),
- SecurityAccessor(),
ContactManagerPrivObject(context, contactManager)
{
LoggerD("ContactManagerController constructed : " << this);
LoggerD("ContactManagerController destructed : " << this);
}
-void ContactManagerAsyncAnswerHandler::getAddressBooks(const EventContactManagerGetAddressBooksPtr &event, SecurityAccessor *securityAccessor)
+void ContactManagerAsyncAnswerHandler::getAddressBooks(const EventContactManagerGetAddressBooksPtr &event)
{
LoggerD("entered");
JSCallbackManagerPtr callbackManager =
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;
callbackManager->callOnSuccess();
}
-void ContactManagerAsyncAnswerHandler::find(const EventContactManagerFindPtr &event, SecurityAccessor *securityAccessor)
+void ContactManagerAsyncAnswerHandler::find(const EventContactManagerFindPtr &event)
{
LoggerD("entered");
JSCallbackManagerPtr callbackManager =
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;
cbm->callOnError(errorObject);
}
-void ContactManagerAsyncAnswerHandler::changeListenerPersonAdded(const EventContactManagerChangeListenerPtr &event, SecurityAccessor *securityAccessor)
+void ContactManagerAsyncAnswerHandler::changeListenerPersonAdded(const EventContactManagerChangeListenerPtr &event)
{
LoggerD("entered");
JSContactManagerChangeCallbackManagerPtr cbm =
JSValueRef contacts;
Try {
- contacts = converter->toJSValueRef(eventInfo->getPersons(), securityAccessor);
+ contacts = converter->toJSValueRef(eventInfo->getPersons());
} Catch (Exception) {
LoggerE("Conversion error");
return;
cbm->callOnPersonsAdded(contacts);
}
-void ContactManagerAsyncAnswerHandler::changeListenerPersonUpdated(const EventContactManagerChangeListenerPtr &event, SecurityAccessor *securityAccessor)
+void ContactManagerAsyncAnswerHandler::changeListenerPersonUpdated(const EventContactManagerChangeListenerPtr &event)
{
LoggerD("entered");
JSContactManagerChangeCallbackManagerPtr cbm =
JSValueRef contacts;
Try {
- contacts = converter->toJSValueRef(eventInfo->getPersons(), securityAccessor);
+ contacts = converter->toJSValueRef(eventInfo->getPersons());
} Catch (Exception) {
LoggerE("Conversion error");
return;
void ContactManagerController::OnAnswerReceived(const EventContactManagerGetAddressBooksPtr &event)
{
- ContactManagerAsyncAnswerHandler::getAddressBooks(event, this);
+ ContactManagerAsyncAnswerHandler::getAddressBooks(event);
}
void ContactManagerController::OnAnswerReceived(const EventContactManagerUpdateBatchPtr &event)
void ContactManagerController::OnAnswerReceived(const EventContactManagerFindPtr &event)
{
- ContactManagerAsyncAnswerHandler::find(event, this);
+ ContactManagerAsyncAnswerHandler::find(event);
}
void ContactManagerController::onAnswerReceived(const EventContactManagerChangeListenerPtr &event)
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)
#include <dpl/shared_ptr.h>
#include <CommonsJavaScript/PrivateObject.h>
#include <CommonsJavaScript/JSPendingOperationPrivateObject.h>
-#include <Security.h>
#include "IContactManager.h"
namespace DeviceAPI {
public EventContactManagerRemoveBatchAnswerReceiver,
public EventContactManagerFindAnswerReceiver,
public EventContactManagerChangeListenerListener,
- public DeviceAPI::Common::SecurityAccessor,
public ContactManagerPrivObject
{
private:
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);
};
#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"
#include <JSWebAPIErrorFactory.h>
#include <JSUtil.h>
#include <TimeTracer.h>
-#include <Security.h>
#include <Logger.h>
#include "ContactUtility.h"
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;
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);
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);
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);
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);
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;
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);
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);
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 {
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;
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;
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);
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);
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;
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;
#include <CommonsJavaScript/Validator.h>
#include <SecurityExceptions.h>
#include "ContactFactory.h"
+#include "plugin_config.h"
#include "ContactConverter.h"
#include "JSContact.h"
#include "Contact.h"
#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"
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 {
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;
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");
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;
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");
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;
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");
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;
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");
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);
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);
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;
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);
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);
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 {
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);
#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>
{
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.");
}
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;
{
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.");
}
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;
JSValueRef result;
Try
{
- result = converter->toJSValueRef(unlinkedPerson, priv);
+ result = converter->toJSValueRef(unlinkedPerson);
}
Catch(Exception)
{
#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:
static FunctionMapping ContactFunctions =
createContactFunctions();
+#pragma GCC visibility push(default)
+
DEFINE_FUNCTION_GETTER(Contact, ContactFunctions);
+#pragma GCC visibility pop
+
static FunctionMapping createContactFunctions()
{
/**
#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) \
+++ /dev/null
-//
-// 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_
#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"
#include "JSContactEmailAddress.h"
#include "ContactAsyncCallbackManager.h"
#include "ContactListenerManager.h"
-#include "plugin_config.h"
#include <Logger.h>
namespace DeviceAPI {
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 << ")");
{
LoggerE("WrtAccess initialization failed");
}
-
- INITAILIZE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor, contactAceCheckAccessFunction);
}
void on_widget_stop_callback(int widgetId)
{
LoggerE("WrtAccess deinitialization failed");
}
-
- FINALIZE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor);
}
void on_frame_load_callback(const void * context)
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,
#include <JSWebAPIErrorFactory.h>
#include <ArgumentValidator.h>
#include <TimeTracer.h>
-#include <Security.h>
#include "JSUtil.h"
#include "ContentFactory.h"
#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"
{
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);
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);
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);
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
{
{
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;
{
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);
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
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;
void JSMediacontentManager::finalize(JSObjectRef object)
{
- MediacontentManagerPriv* priv = static_cast<MediacontentManagerPriv*> (JSObjectGetPrivate(object));
+ MediacontentManagerPrivObject* priv = static_cast<MediacontentManagerPrivObject*> (JSObjectGetPrivate(object));
if(priv != NULL)
{
delete priv;
const JSObjectRef object,
JSValueRef* exception)
{
- MediacontentManagerPriv *priv = static_cast<MediacontentManagerPriv*>(JSObjectGetPrivate(object));
+ MediacontentManagerPrivObject *priv = static_cast<MediacontentManagerPrivObject*>(JSObjectGetPrivate(object));
if (priv)
{
return priv->getObject();
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:
#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) \
+++ /dev/null
-//
-// 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_
#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>
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 << ")");
LoggerE("WrtAccess intialization failed");
}
- INITAILIZE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor, contentAceCheckAccessFunction);
}
void on_widget_stop_callback(int widgetId)
{
LoggerE("WrtAccess deinitialization failed");
}
- FINALIZE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor);
}
PLUGIN_ON_WIDGET_START(on_widget_start_callback)
PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
"content",
(js_class_template_getter)JSMediacontentManager::getClassRef,
- &option)
+ NULL)
PLUGIN_CLASS_MAP_END
}
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})
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)
)
SET(SRCS_IMPL
- JSFilesystemManager.cpp
- JSFile.cpp
- JSFilestream.cpp
- JSStorage.cpp
IManager.cpp
IPath.cpp
IStream.cpp
Stream.cpp
NodeFilterMatcher.cpp
Utils.cpp
+ JSFilesystemManager.cpp
+ JSFile.cpp
+ JSFilestream.cpp
+ JSStorage.cpp
Converter.cpp
EventGetNodeData.cpp
Encodings.cpp
${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
)
${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
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) {
JSFile::PrivateObject* privateObject = new JSFile::PrivateObject(
context,
privData);
-
- if (securityAccessor)
- privateObject->copyAceCheckAccessFunction(securityAccessor);
-
JSObjectRef jsObject = JSObjectMake(m_context,
JSFile::getClassRef(),
privateObject);
#include <map>
#include <JavaScriptCore/JavaScript.h>
#include <CommonsJavaScript/Converter.h>
-#include <Security.h>
#include "Enums.h"
#include "IPath.h"
#include "INodeTypes.h"
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);
#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:
/**
#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;
} // Filesystem
} // TizenApis
-#endif //TIZENAPIS_API_FILESYSTEM_EVENT_GET_STORAGE_H_
+#endif //TIZENAPIS_API_FILESYSTEM_EVENT_GET_STORAGE_H_
\ No newline at end of file
#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:
/**
} // Filesystem
} // TizenApis
-#endif // TIZENAPIS_FILESYSTEM_EVENTLISTNODES_H_
+#endif // TIZENAPIS_FILESYSTEM_EVENTLISTNODES_H_
\ No newline at end of file
#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;
}
}
-#endif
+#endif
\ No newline at end of file
#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:
/**
} // Filesystem
} // TizenApis
-#endif // TIZENAPIS_FILESYSTEM_EVENTMOVE_H_
+#endif // TIZENAPIS_FILESYSTEM_EVENTMOVE_H_
\ No newline at end of file
#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:
/**
} // Filesystem
} // TizenApis
-#endif // TIZENAPIS_FILESYSTEM_EVENTOPEN_H_
+#endif // TIZENAPIS_FILESYSTEM_EVENTOPEN_H_
\ No newline at end of file
#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:
/**
} // Filesystem
} // TizenApis
-#endif // TIZENAPIS_FILESYSTEM_EVENTREADTEXT_H_
+#endif // TIZENAPIS_FILESYSTEM_EVENTREADTEXT_H_
\ No newline at end of file
#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:
/**
} // Filesystem
} // TizenApis
-#endif // TIZENAPIS_FILESYSTEM_EVENTREMOVE_H_
+#endif // TIZENAPIS_FILESYSTEM_EVENTREMOVE_H_
\ No newline at end of file
#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:
/**
#include "JSFile.h"
-#include "plugin_config_impl.h"
#include <string>
#include <ctime>
#include "Converter.h"
#include "plugin_config.h"
#include "Encodings.h"
+#include "JSFilestream.h"
#include "ResponseDispatcher.h"
#include "FilesystemAsyncCallbackManager.h"
#include <Logger.h>
{
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);
}
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);
LoggerD("OK");
- TIZEN_CHECK_ACCESS(context, exception, privateObject, FILESYSTEM_FUNCTION_API_LIST_FILES);
-
// argument validation with new validator
try {
ArgumentValidator validator(context, argc, argv);
try {
+ AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_LIST_FILES);
+ TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
for (index = 0; index < 3; index++)
{
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);
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);
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 {
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);
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 {
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];
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 {
}
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));
JSCallbackManager>(
cbm));
event->setForAsynchronousCall(&ResponseDispatcher::getInstance());
- event->copyAceCheckAccessFunction(privateObject);
-
FilesystemAsyncCallbackManagerSingleton::Instance().registerCallbackManager(cbm, globalContext);
IManager::getInstance().copy(event);
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");
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 {
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);
event->setForAsynchronousCall(&ResponseDispatcher::getInstance());
event->setPrivateData(DPL::StaticPointerCast<WrtDeviceApis::Commons::IEventPrivateData > (cbm));
- event->copyAceCheckAccessFunction(privateObject);
-
FilesystemAsyncCallbackManagerSingleton::Instance().registerCallbackManager(cbm, globalContext);
IManager::getInstance().move(event);
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 {
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());
}
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 {
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());
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");
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) {
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");
eventRemove->setForAsynchronousCall(&ResponseDispatcher::getInstance());
eventRemove->setPrivateData(DPL::StaticPointerCast<WrtDeviceApis::Commons::IEventPrivateData > (cbm));
- eventRemove->copyAceCheckAccessFunction(privateObject);
-
FilesystemAsyncCallbackManagerSingleton::Instance().registerCallbackManager(cbm, globalContext);
IManager::getInstance().remove(eventRemove);
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);
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)
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);
#include <Commons/IEvent.h>
#include <CommonsJavaScript/PrivateObject.h>
#include <CommonsJavaScript/JSCallbackManager.h>
-#include <Security.h>
#include "INode.h"
namespace DeviceAPI {
};
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();
}
- 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();
}
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);
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 {
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 {
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 {
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 {
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 {
#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();
}
}
-#endif
+#endif
\ No newline at end of file
#include "JSFilesystemManager.h"
-#include "plugin_config_impl.h"
#include <Commons/Exception.h>
#include "EventResolve.h"
#include "IManager.h"
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 {
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 {
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 {
validator.toFunction(1, true);
}
catch (const BasePlatformException &err) {
+ LogDebug("Exception");
return JSWebAPIErrorFactory::postException(context, exception, err);
} catch (...) {
DeviceAPI::Common::UnknownException err("");
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 {
}
- 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 {
return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Type missmatch error");
}
+ LogDebug("resolve");
+
+
JSContextRef globalContext = privateObject->getContext();
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);
#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();
}
}
-#endif
+#endif
\ No newline at end of file
#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
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 (...)
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;
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) {
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;
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;
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;
#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();
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
+
}
}
#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
+++ /dev/null
-//
-// 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
#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;
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();
} Catch (Commons::Exception) {
LoggerE("WrtAccess initialization failed");
}
- INITAILIZE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor, filesystemAceCheckAccessFunction);
}
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)
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
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})
#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:
} // 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
#include "EventSendMessagePrivateData.h" //for send message
#include "EventMessagingServicePrivateData.h"
#include "MessageAsyncCallbackManager.h"
-#include "plugin_config_impl.h"
+#include "plugin_config.h"
using namespace std;
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);
}
LoggerD("type" << ": " << storagePrivObj->m_type);
MessagingStoragePriv *privStorage = new MessagingStoragePriv(l_globalContext, storagePrivObj);
- privStorage->copyAceCheckAccessFunction(priv);
return JSObjectMake(l_globalContext, JSMessagingStorage::getClassRef(), privStorage);
}
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);
{
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.");
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);
{
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.");
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);
{
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.");
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);
{
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.");
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);
{
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.");
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);
#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 {
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 :
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);
#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:
#include "MessagingErrorMsg.h"
#include "MessageAsyncCallbackManager.h"
#include "MessageFilterConverter.h"
-#include "plugin_config_impl.h"
+#include "plugin_config.h"
using namespace std;
{
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.");
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.");
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.");
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.");
{
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.");
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.");
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.");
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.");
{
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.");
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.");
{
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.");
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.");
{
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.");
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.");
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.");
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.");
{
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.");
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.");
{
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.");
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.");
{
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.");
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.");
#include <JavaScriptCore/JavaScript.h>
#include <CommonsJavaScript/PrivateObject.h>
-#include <Security.h>
#include "MessagingListener.h"
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:
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);
<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>
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()
{
/**
//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 **/
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));
//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
#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) \
}
}
-#endif // _MESSAGING_PLUGIN_CONFIG_H_
+#endif //MESSAGING_PLUGIN_CONFIG_H_
+
+++ /dev/null
-//
-// 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_
#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
};
}
+using namespace WrtDeviceApis;
+using namespace WrtDeviceApis::Commons;
+
void on_widget_start_callback(int widgetId) {
LoggerD("[Tizen\\MessagingServiceManager] on_widget_start_callback ("<<widgetId<<")");
Try {
} Catch(Commons::Exception) {
LoggerE("WrtAccess initialization failed");
}
-
- INITAILIZE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor, messagingAceCheckAccessFunction);
}
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)
#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,
#include "NFCListenerManager.h"
#include "NFCFactory.h"
#include "EventNFCChanged.h"
-#include "plugin_config_impl.h"
+#include "plugin_config.h"
#include <Logger.h>
using namespace std;
JSObjectSetPrivate(object, NULL);
}
-JSObjectRef JSNFCAdapter::createJSObject(JSContextRef context, NFCManagerPrivObject *nfcManagerPriv) {
+JSObjectRef JSNFCAdapter::createJSObject(JSContextRef context) {
LoggerD("entered");
INFCAdapterPtr nfcAdapter(NFCFactory::getInstance().createNFCAdapterObject());
ThrowMsg(NullPointerException, "Can not new a NFCTag object");
}
- priv->copyAceCheckAccessFunction(nfcManagerPriv);
return JSObjectMake(context, getClassRef(), priv);
}
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;
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());
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));
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);
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(
detachedCallbackManager)
);
- privateData->copyAceCheckAccessFunction(privateObject);
EventNFCChangedEmitterPtr emitter(new EventNFCChangedEmitter);
emitter->setListener(&NFCStaticController::getInstance());
emitter->setEventPrivateData(DPL::StaticPointerCast<EventNFCChanged::PrivateDataType>(privateData));
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());
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();
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());
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 {
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);
#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:
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
#include "JSNFCAdapter.h"
#include "NFCConverter.h"
#include "NFCFactory.h"
-#include "plugin_config_impl.h"
+#include "plugin_config.h"
#include "NFCDefaultAdapter.h"
#include <Logger.h>
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");
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) {
#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:
#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;
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);
ThrowMsg(NullPointerException, "Can not new a NFCTag object");
}
- priv->copyAceCheckAccessFunction(eventNFCChangedPriv.Get());
return JSObjectMake(context, getClassRef(), priv);
}
{
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 {
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);
{
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);
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));
}
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) {
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);
{
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);
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);
#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
{
static const JSClassRef getClassRef();
- static JSObjectRef createJSObject(JSContextRef context, void *tagHandle, EventNFCChangedPrivateDataPtr eventNFCChangedPriv);
+ static JSObjectRef createJSObject(JSContextRef context, void *tagHandle);
private:
/**
#include "NFCListenerManager.h"
#include "NFCFactory.h"
#include "EventTargetAction.h"
-#include "plugin_config_impl.h"
+#include "plugin_config.h"
#include <Logger.h>
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);
ThrowMsg(NullPointerException, "Can not new a NFCTarget object");
}
- priv->copyAceCheckAccessFunction(eventNFCChangedPriv.Get());
return JSObjectMake(context, getClassRef(), priv);
}
{
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);
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)));
{
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);
{
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);
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));
}
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) {
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);
#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
{
static const JSClassRef getClassRef();
- static JSObjectRef createJSObject(JSContextRef context, void *tagHandle, EventNFCChangedPrivateDataPtr eventNFCChangedPriv);
+ static JSObjectRef createJSObject(JSContextRef context, void *tagHandle);
private:
/**
#include <PlatformException.h>
#include "NFCFactory.h"
+#include "plugin_config.h"
#include <Logger.h>
using namespace DeviceAPI::Common;
#include "NFCFactory.h"
#include "JSNdefRecord.h"
+#include "plugin_config.h"
#include "NFCConverter.h"
#include <Logger.h>
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 {
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;
#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);
+++ /dev/null
-//
-// 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
#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;
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
};
{
LoggerE("WrtAccess initialization failed");
}
- INITAILIZE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor, nfcAceCheckAccessFunction);
}
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));
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,
${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})
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;
}
//
#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>
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;
}
}
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);
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);
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);
}
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);
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);
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);
#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:
#include <Commons/FunctionDeclaration.h>
#include <map>
-#include "plugin_config_impl.h"
#include "plugin_config.h"
#define POWER_FEATURE_API "http://tizen.org/privilege/power"
static FunctionMapping PowerFunctions =
createPowerFunctions();
+#pragma GCC visibility push(default)
+
DEFINE_FUNCTION_GETTER(Power, PowerFunctions);
+#pragma GCC visibility pop
+
static FunctionMapping createPowerFunctions()
{
/**
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) \
+++ /dev/null
-//
-// 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
#include "JSPowerManager.h"
#include <GlobalContextManager.h>
#include <TimeTracer.h>
-#include <Security.h>
-#include "plugin_config.h"
namespace DeviceAPI {
namespace Power {
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 << ")");
} Catch (Exception) {
LoggerE("WrtAccess initialization failed");
}
-
- INITAILIZE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor, powerAceCheckAccessFunction);
}
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)
PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
"power",
(js_class_template_getter)JSPowerManager::getClassRef,
- &ClassOptions)
+ NULL)
PLUGIN_CLASS_MAP_END
}
--- /dev/null
+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}
+)
+
+
--- /dev/null
+/*
+* 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;
+}
--- /dev/null
+//
+// 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);
+}
+
--- /dev/null
+//
+// 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;
+}
${LIBS_COMMON}
${tizen_impl}
${application_impl}
+ "-Wl,--no-as-needed" ${application_config}
${platform_pkgs_push_LIBRARIES}
)
TARGET_LINK_LIBRARIES(${TARGET_NAME}
${LIBS_COMMON}
${filesystem_impl}
+ "-Wl,--no-as-needed" ${filesystem_config}
${platform_pkgs_systemsetting_LIBRARIES}
)