Name: wrt-plugins-tizen
Summary: JavaScript plugins for WebRuntime
-Version: 0.4.50
+Version: 0.4.51
Release: 0
Group: Development/Libraries
License: Apache License, Version 2.0
}
-bool JSAlarmAbsolute::hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception)
-{
- return JSValueIsObjectOfClass(context, possibleInstance, getClassRef());
-}
JSObjectRef DLL_EXPORT JSAlarmAbsolute::constructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
- try {
- AlarmAbsolutePtr priv = AlarmAbsolutePtr(new AlarmAbsolute());
- if (!priv) {
- throw TypeMismatchException("Private object is null");
- }
+ ArgumentValidator validator(ctx, argumentCount, arguments);
- ArgumentValidator validator(ctx, argumentCount, arguments);
+ AlarmAbsolutePtr priv = AlarmAbsolutePtr(new AlarmAbsolute());
+
+ try {
time_t date = validator.toTimeT(0);
struct tm *startDate = localtime(&date);
mktime(startDate);
priv->setInterval(interval);
}
}
+ } catch (const BasePlatformException& err) {
+ LoggerE("Exception occured while creating constructor : " << err.getMessage());
+ }
- return JSValueToObject(ctx, createJSObject(ctx, priv), exception);
+ JSAlarmAbsolutePriv *jspriv = new JSAlarmAbsolutePriv(ctx, priv);
+ JSObjectRef obj = JSObjectMake(ctx, getClassRef(), jspriv);
- } catch (const BasePlatformException& err) {
- return JSWebAPIErrorFactory::postException(ctx, exception, err);
- }
+ JSStringRef ctorName = JSStringCreateWithUTF8CString("constructor");
+ JSObjectSetProperty(ctx, obj, ctorName, constructor,
+ kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete | kJSPropertyAttributeDontEnum, NULL);
+ JSStringRelease(ctorName);
+
+ return obj;
}
AlarmAbsolutePtr JSAlarmAbsolute::getPrivData(JSObjectRef object)
return result;
}
-JSValueRef JSAlarmAbsolute::createJSObject(JSContextRef context, const int id)
-{
- AlarmAbsolutePtr privateData = AlarmAbsolutePtr(new AlarmAbsolute());
- privateData->setId(id);
-
- JSAlarmAbsolutePriv *priv = new JSAlarmAbsolutePriv(context, privateData);
- if (!priv) {
- throw TypeMismatchException("Private object is null");
- }
- return JSObjectMake(context, getClassRef(), static_cast<void*>(priv));
-}
JSValueRef JSAlarmAbsolute::createJSObject(JSContextRef context, AlarmAbsolutePtr privateData)
{
return JSObjectMake(context, getClassRef(), static_cast<void*>(priv));
}
-JSValueRef JSAlarmAbsolute::createJSObject(JSContextRef context, struct tm date, int interval)
-{
- AlarmAbsolutePtr privateData = AlarmAbsolutePtr(new AlarmAbsolute());
- privateData->setDate(date);
-
- JSAlarmAbsolutePriv *priv = new JSAlarmAbsolutePriv(context, privateData);
- if (!priv) {
- throw TypeMismatchException("Private object is null");
- }
- return JSObjectMake(context, getClassRef(), static_cast<void*>(priv));
-}
-
-JSValueRef JSAlarmAbsolute::createJSObject(JSContextRef context, struct tm date)
-{
- AlarmAbsolutePtr privateData = AlarmAbsolutePtr(new AlarmAbsolute());
- privateData->setDate(date);
-
- JSAlarmAbsolutePriv *priv = new JSAlarmAbsolutePriv(context, privateData);
- if (!priv) {
- throw TypeMismatchException("Private object is null");
- }
- return JSObjectMake(context, getClassRef(), static_cast<void*>(priv));
-}
-
JSValueRef JSAlarmAbsolute::getNextScheduledDate( JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception)
{
TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
public:
static const JSClassDefinition* getClassInfo();
static const JSClassRef getClassRef();
- static JSValueRef createJSObject(JSContextRef context, const int id);
- static JSValueRef createJSObject(JSContextRef context, AlarmAbsolutePtr privateData);
- static JSValueRef createJSObject(JSContextRef context, struct tm date, int interval);
- static JSValueRef createJSObject(JSContextRef context, struct tm date);
static JSObjectRef constructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
-
+ static JSValueRef createJSObject(JSContextRef context, AlarmAbsolutePtr privateData);
protected:
static void initialize(JSContextRef context, JSObjectRef object);
static void finalize(JSObjectRef object);
- static bool hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception);
static JSValueRef getNextScheduledDate(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
private:
{
}
-bool JSAlarmManager::hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception) {
- return JSValueIsObjectOfClass(context, possibleInstance, getClassRef());
-}
-
JSValueRef JSAlarmManager::add(JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
protected:
static void initialize(JSContextRef context, JSObjectRef object);
static void finalize(JSObjectRef object);
- static bool hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception);
static JSValueRef add(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
static JSValueRef remove(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
static JSValueRef removeAll(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
delete priv;
}
-bool JSAlarmRelative::hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception)
-{
- return JSValueIsObjectOfClass(context, possibleInstance, getClassRef());
-}
-
+
JSObjectRef DLL_EXPORT JSAlarmRelative::constructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
- try {
- ArgumentValidator validator(ctx, argumentCount, arguments);
+ ArgumentValidator validator(ctx, argumentCount, arguments);
+ AlarmRelativePtr privateData = AlarmRelativePtr(new AlarmRelative());
+
+ try {
long delay = validator.toLong(0);
- if (delay < 0) {
- throw InvalidValuesException("delay cannot be negative value");
- }
- long period = validator.toLong(1, true, 0);
- if (period < 0) {
- throw InvalidValuesException("period cannot be negative value");
- }
+ privateData->setDelay(delay);
- if ((argumentCount > 1) && !JSValueIsNull(ctx, arguments[1])) {
- return JSValueToObject(ctx, createJSObject(ctx, delay, period), exception);
- } else {
- return JSValueToObject(ctx, createJSObject(ctx, delay, -1), exception);
- }
- } catch (const BasePlatformException& err) {
- return JSWebAPIErrorFactory::postException(ctx, exception, err);
- }
+ long period = validator.toLong(1, true, -1);
+ privateData->setPeriod(period);
+
+ } catch (const BasePlatformException& err) {
+ LoggerE("Exception occured while creating constructor : " << err.getMessage());
+ }
+
+ JSAlarmRelativePriv *priv = new JSAlarmRelativePriv(ctx, privateData);
+ JSObjectRef obj = JSObjectMake(ctx, getClassRef(), priv);
+
+ JSStringRef ctorName = JSStringCreateWithUTF8CString("constructor");
+ JSObjectSetProperty(ctx, obj, ctorName, constructor,
+ kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete | kJSPropertyAttributeDontEnum, NULL);
+ JSStringRelease(ctorName);
+ return obj;
}
AlarmRelativePtr JSAlarmRelative::getPrivData(JSObjectRef object)
protected:
static void initialize(JSContextRef context, JSObjectRef object);
static void finalize(JSObjectRef object);
- static bool hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception);
- //static JSValueRef getRemainingDuration(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
static JSValueRef getRemainingSeconds(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception);
private:
return priv->getObject();
}
-#if 0
-ApplicationControlPtr JSApplicationControl::getPrivateData(JSContextRef context, JSObjectRef object)
-{
- JSApplicationControlPriv* priv = static_cast<JSApplicationControlPriv*>(JSObjectGetPrivate(object));
- if (!priv) {
- throw TypeMismatchException("Private object is null");
- }
-
- return priv->getObject();
-}
-#endif
-
void JSApplicationControl::initialize(JSContextRef context,JSObjectRef object)
{
}
appsvc->setAppControlDataArray(appControlDataArray);
}
} catch (const BasePlatformException& err) {
- return JSWebAPIErrorFactory::postException(context, exception, err);
+ LoggerE("Exception occured while creating constructor : " << err.getMessage());
}
JSApplicationControlPriv *priv = new JSApplicationControlPriv(context, appsvc);
return false;
}
-
-bool JSApplicationControl::hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception)
-{
- return JSValueIsObjectOfClass(context, possibleInstance, getClassRef());
-}
-
-
}
}
JSValueRef* exception);
/**
- * The callback invoked when an object is used as the target of an 'instanceof' expression.
- */
- static bool hasInstance(JSContextRef context,
- JSObjectRef constructor,
- JSValueRef possibleInstance,
- JSValueRef* exception);
-
- /**
* This structure contains properties and callbacks that define a type of object.
*/
static JSClassDefinition m_classInfo;
JSObjectRef DLL_EXPORT JSApplicationControlData::constructor(JSContextRef context, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
- try {
- ArgumentValidator validator(context, argumentCount, arguments);
- ApplicationControlDataPtr appdata(new ApplicationControlData());
+ ArgumentValidator validator(context, argumentCount, arguments);
+
+ ApplicationControlDataPtr appdata(new ApplicationControlData());
+ try {
appdata->setKey(validator.toString(0));
appdata->setValue(JSUtil::JSArrayToStringVector(context, validator.toArrayObject(1)));
+ } catch (BasePlatformException &err) {
+ LoggerE("Exception occured while creating constructor : " << err.getMessage());
+ }
- JSApplicationControlDataPriv *priv = new JSApplicationControlDataPriv(context, appdata);
- JSObjectRef obj = JSObjectMake(context, getClassRef(),priv);
+ JSApplicationControlDataPriv *priv = new JSApplicationControlDataPriv(context, appdata);
+ JSObjectRef obj = JSObjectMake(context, getClassRef(),priv);
- JSStringRef ctorName = JSStringCreateWithUTF8CString("constructor");
- JSObjectSetProperty(context, obj, ctorName, constructor,
- kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete | kJSPropertyAttributeDontEnum, NULL);
- JSStringRelease(ctorName);
+ JSStringRef ctorName = JSStringCreateWithUTF8CString("constructor");
+ JSObjectSetProperty(context, obj, ctorName, constructor,
+ kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete | kJSPropertyAttributeDontEnum, NULL);
+ JSStringRelease(ctorName);
- return obj;
- } catch (BasePlatformException &err) {
- return JSWebAPIErrorFactory::postException(context, exception, err);
- }
+ return obj;
}
void JSApplicationControlData::initialize(JSContextRef context, JSObjectRef object)
delete priv;
}
-bool JSApplicationManager::hasInstance(JSContextRef context,
- JSObjectRef constructor,
- JSValueRef possibleInstance,
- JSValueRef* exception)
-{
- return JSValueIsObjectOfClass(context, possibleInstance, getClassRef());
-}
-
-
JSValueRef JSApplicationManager::getCurrentApplication(JSContextRef context,
JSObjectRef object,
JSObjectRef thisObject,
static void finalize(JSObjectRef object);
/**
- * The callback invoked when an object is used as the target of an 'instanceof' expression.
- */
- static bool hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception);
-
- /**
* Gets a current application
*/
static JSValueRef getCurrentApplication(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
}
-bool JSRequestedApplicationControl::hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception)
-{
- return JSValueIsObjectOfClass(context, possibleInstance, getClassRef());
-}
-
JSValueRef JSRequestedApplicationControl::replyResult(JSContextRef context,
JSObjectRef object,
JSObjectRef thisObject,
static JSObjectRef createJSObject(JSContextRef context,
const RequestedApplicationControlPtr &appsvc);
- /**
- * The Constructor of ApplicationControl
- */
- static JSObjectRef constructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
-
static bool isObjectOfClass(JSContextRef context, JSValueRef value);
JSValueRef value,
JSValueRef* exception);
- /**
- * The callback invoked when an object is used as the target of an 'instanceof' expression.
- */
- static bool hasInstance(JSContextRef context,
- JSObjectRef constructor,
- JSValueRef possibleInstance,
- JSValueRef* exception);
/**
* This structure contains properties and callbacks that define a type of object.
if(getCurrentFolder() == DRAFTBOX)
{
// updateBody();
-// updateSubject();
+ updateSubject();
// updateRecipients();
// updateFrom();
// updateAttachments();
error = email_update_mail( m_mail.Get(), attachment, attachmentCount, meeting_req, 0);
if (EMAIL_ERROR_NONE != error) {
LoggerW("Nothing to update or error. [" << error << "]");
+/*
+ if(error == EMAIL_ERROR_DB_FAILURE)
+ {
+ int retry = 0;
+ while (retry < 2) {
+ LoggerW("wait 300 ms");
+ usleep(300 * 1000);
+ email_update_mail( m_mail.Get(), attachment, attachmentCount, meeting_req, 0);
+ LoggerW("error. [" << error << "]");
+ if (EMAIL_ERROR_NONE == error) {
+ break;
+ }
+ retry++;
+
+ }
+ }
+*/
}
if(getCurrentFolder() == DRAFTBOX)
LoggerW("email_update_mail_attribute error. [" << error << "]");
}
}
- tm* time = localtime(&result->date_time);
- if (!time) {
- LoggerE("localtime failed");
- Throw(WrtDeviceApis::Commons::PlatformException);
- }
- setDateTime(*time);
+
+ tm* time = localtime(&result->date_time);
+ if (!time) {
+ LoggerE("localtime failed");
+ Throw(WrtDeviceApis::Commons::PlatformException);
+ }
+ setDateTime(*time);
+
}
if(result != NULL)
{
std::set<int> checkUnique;
for(int i=0; i<mailListCount; i++){
+ if(mailList[i].mail_id != mailList[i].thread_id)
+ {
+ LoggerD("skip mail");
+ LoggerD("mailList[i].mail_id: " << mailList[i].mail_id);
+ LoggerD("mailList[i].thread_id:" << mailList[i].thread_id);
+ continue;
+ }
if (checkUnique.find(mailList[i].thread_id) == checkUnique.end()){
checkUnique.insert(mailList[i].thread_id);
IConversationPtr convPtr(new Conversation(mailList[i].thread_id, EMAIL));
#include <email-types.h>
#include <email-api.h>
#include <Logger.h>
-
+#include <unistd.h>
using namespace std;
index = type;
}
- LoggerD("m_opRequests size : " << cnt );
+ LoggerD("m_opRequests cnt : " << cnt );
LoggerD("index " << index);
m_opRequests.insert(std::make_pair(index, MessagingServiceOpData(0,type)));
int MessagingService::getHandleFromOpId(int opIdx)
{
- LoggerD("operation index size : " << opIdx);
-
+ LoggerD("opIdx : " << opIdx);
+ LoggerD("m_opRequests.size() : " << m_opRequests.size() );
int handle = -1;
OpRequestsIterator it = m_opRequests.find(opIdx);
if ( m_opRequests.end() != it)
{
- handle = it->second.handle;
+ int retryCount = 0;
+ if(it->second.checkSetHandle == false)
+ {
+ while (retryCount < 2) {
+ LoggerW("Wait for handle");
+ usleep(200 * 1000);
+ if (it->second.checkSetHandle) {
+ break;
+ }
+ retryCount++;
+ }
+ handle = it->second.handle;
+ }
}
- LoggerD("index " << handle);
+ LoggerD("handle " << handle);
return handle;
}
{
LoggerD(" find Message ");
it->second.handle = handle;
+ it->second.checkSetHandle = true;
}
}
{
unsigned int handle;
unsigned short type;
+ bool checkSetHandle;
IMessagePtr message;
EventMessagingServicePtr event;
explicit MessagingServiceOpData(int handle, int type) :
handle(handle),
type(type),
+ checkSetHandle(false),
message(NULL),
event(NULL)
{
#include <JSUtil.h>
#include <vconf.h>
#include <Logger.h>
+#include <unistd.h>
using namespace DeviceAPI::Common;
using namespace std;
}
LoggerD("simState : " << simState);
event->setSimState(simState);
- if (simState)
- free(simState);
if(strcmp(simState, "READY") == 0) {
if (tel_get_sim_imsi(m_tapiHandle, &imsi) == TAPI_API_SUCCESS) {
LoggerD("mcc : " << imsi.szMcc << \r" mnc : " << imsi.szMnc << " msin : " << imsi.szMsin);
event->makeSimObject();
EventRequestReceiver<EventGetSysteminfo>::ManualAnswer(event);
}
+ if (simState)
+ free(simState);
} else {
LoggerE("get fail sim state");
event->makeSimObject();
storagePtr->units[1].type = "MMC";
storagePtr->units[1].capacity = (unsigned long long)fs.f_bsize * (unsigned long long)fs.f_blocks;
storagePtr->units[1].availableCapacity = (unsigned long long)fs.f_bsize * (unsigned long long)fs.f_bavail;
- storagePtr->units[1].isRemoveable = false;
- storagePtr->units[1].isRemovable = false;
+ storagePtr->units[1].isRemoveable = true;
+ storagePtr->units[1].isRemovable = true;
storagePtr->cnt = 2;
LoggerD("type : " << storagePtr->units[1].type);
}
using namespace WrtDeviceApis::Commons;
using namespace DeviceAPI::Common;
-namespace DeviceAPI {
-namespace WebSetting {
+namespace DeviceAPI
+{
+namespace WebSetting
+{
-JSClassDefinition JSWebSettingManager::m_classInfo = {
+JSClassDefinition JSWebSettingManager::m_classInfo =
+{
0,
kJSClassAttributeNone,
"WebSettingManager",
NULL //ConvertToType
};
-JSStaticFunction JSWebSettingManager::m_function[] = {
+JSStaticFunction JSWebSettingManager::m_function[] =
+{
{ WEB_SETTING_MANAGER_API_SET_USER_AGENT_STRING, setUserAgentString, kJSPropertyAttributeNone },
{ WEB_SETTING_MANAGER_API_REMOVE_ALL_COOKIES, removeAllCookies, kJSPropertyAttributeNone },
{ 0, 0, 0 }
const JSClassRef JSWebSettingManager::getClassRef()
{
- if (!m_jsClassRef) {
+ if (!m_jsClassRef)
+ {
m_jsClassRef = JSClassCreate(&m_classInfo);
}
return m_jsClassRef;
void JSWebSettingManager::initialize(JSContextRef context, JSObjectRef object)
{
- if (!JSObjectGetPrivate(object)) {
- SLoggerI("JSWebSettingManager::initialize called...");
+ if (!JSObjectGetPrivate(object))
+ {
+ SLoggerI("JSWebSettingManager::initialize called...");
WebSettingManager *priv = WebSettingManager::getInstance();
- JSObjectSetPrivate(object, static_cast<void*>(priv));
+ JSObjectSetPrivate(object, static_cast<void*>(priv));
}
}
void JSWebSettingManager::finalize(JSObjectRef object)
{
- SLoggerI("JSWebSettingManager::finalize called...");
+ SLoggerI("JSWebSettingManager::finalize called...");
WebSettingManager *priv = static_cast<WebSettingManager*>(JSObjectGetPrivate(object));
- if (priv) {
+ if (priv)
+ {
JSObjectSetPrivate(object, NULL);
}
}
const JSValueRef arguments[],
JSValueRef* exception)
{
- try {
+ try
+ {
// Private Object
WebSettingManager *priv = static_cast<WebSettingManager*>(JSObjectGetPrivate(thisObject));
- if (!priv) {
+ if (!priv)
+ {
throw TypeMismatchException("Private object is NULL.");
}
ArgumentValidator validator(context, argumentCount, arguments);
// errorCallback
JSObjectRef errorCallbackObj = validator.toFunction(2, true);
-
+
if (errorCallbackObj)
{
callbacks->setCallback("onerror", errorCallbackObj);
}
priv->setUserAgentString(userAgent, callbacks);
+
return JSValueMakeUndefined(context);
- } catch (const BasePlatformException &err) {
- SLoggerE(err.getName().c_str() << ":" << err.getMessage().c_str());
- return JSWebAPIErrorFactory::postException(context, exception, err);
- } catch (...) {
+ }
+ catch (const BasePlatformException &err)
+ {
+ SLoggerE(err.getName().c_str() << ":" << err.getMessage().c_str());
+ return JSWebAPIErrorFactory::postException(context, exception, err);
+ }
+ catch (...)
+ {
DeviceAPI::Common::UnknownException err("Unknown Error in WebSettingManager.setUserAgentString().");
- SLoggerE(err.getName().c_str() << ":" << err.getMessage().c_str());
- return JSWebAPIErrorFactory::postException(context, exception, err);
+ SLoggerE(err.getName().c_str() << ":" << err.getMessage().c_str());
+ return JSWebAPIErrorFactory::postException(context, exception, err);
}
}
const JSValueRef arguments[],
JSValueRef* exception)
{
- //AceSecurityStatus status = WEB_SETTING_CHECK_ACCESS(WEB_SETTING_MANAGER_API_REMOVE_ALL_COOKIES);
- //TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+ AceSecurityStatus status = WEB_SETTING_CHECK_ACCESS(WEB_SETTING_MANAGER_API_REMOVE_ALL_COOKIES);
+ TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+ SLoggerI("removeAllCookies::TIZEN_SYNC_ACCESS_HANDLER succeeded.");
- try {
+ try
+ {
// Private Object
WebSettingManager *priv = static_cast<WebSettingManager*>(JSObjectGetPrivate(thisObject));
- if (!priv) {
+ if (!priv)
+ {
throw TypeMismatchException("Private object is NULL.");
}
}
priv->removeAllCookies(callbacks);
return JSValueMakeUndefined(context);
- } catch (const BasePlatformException &err) {
- SLoggerE(err.getName().c_str() << ":" << err.getMessage().c_str());
- return JSWebAPIErrorFactory::postException(context, exception, err);
- } catch (...) {
+ }
+ catch (const BasePlatformException &err)
+ {
+ SLoggerE(err.getName().c_str() << ":" << err.getMessage().c_str());
+ return JSWebAPIErrorFactory::postException(context, exception, err);
+ }
+ catch (...)
+ {
DeviceAPI::Common::UnknownException err("Unknown Error in WebSettingManager.removeAllCookies().");
- SLoggerE(err.getName().c_str() << ":" << err.getMessage().c_str());
- return JSWebAPIErrorFactory::postException(context, exception, err);
+ SLoggerE(err.getName().c_str() << ":" << err.getMessage().c_str());
+ return JSWebAPIErrorFactory::postException(context, exception, err);
}
}
#include "WebSettingManager.h"
-namespace DeviceAPI {
-namespace WebSetting {
+namespace DeviceAPI
+{
+namespace WebSetting
+{
class JSWebSettingManager
{
* The callback invoked when an object is first created.
*/
static void initialize(JSContextRef context,
- JSObjectRef object);
+ JSObjectRef object);
/**
* The callback invoked when an object is finalized.
static void finalize(JSObjectRef object);
static JSValueRef setUserAgentString(JSContextRef context,
- JSObjectRef object,
- JSObjectRef thisObject,
- size_t argumentCount,
- const JSValueRef arguments[],
- JSValueRef* exception);
+ JSObjectRef object,
+ JSObjectRef thisObject,
+ size_t argumentCount,
+ const JSValueRef arguments[],
+ JSValueRef* exception);
static JSValueRef removeAllCookies(JSContextRef context,
- JSObjectRef object,
- JSObjectRef thisObject,
- size_t argumentCount,
- const JSValueRef arguments[],
- JSValueRef* exception);
+ JSObjectRef object,
+ JSObjectRef thisObject,
+ size_t argumentCount,
+ const JSValueRef arguments[],
+ JSValueRef* exception);
/**
* This member variable contains the values which has to be passed
#include <plugins-ipc-message/ipc_message_support.h>
-namespace DeviceAPI {
-namespace WebSetting {
+namespace DeviceAPI
+{
+namespace WebSetting
+{
std::list<Common::MultiCallbackUserData *> WebSettingManager::mUserAgentCallbacks;
std::list<Common::MultiCallbackUserData *> WebSettingManager::mDeleteAllCookiesCallbacks;
SLoggerI("Desstructor of WebSettingManager...");
}
-WebSettingManager* WebSettingManager::getInstance()
+WebSettingManager* WebSettingManager::getInstance()
{
SLoggerI("Getting instance of WebSettingManager...");
static WebSettingManager instance;
return &instance;
}
-void WebSettingManager::onAsyncUAStringReplyCallback(unsigned int num, void* user_data, const char* result)
-{
- MultiCallbackUserData* multiPointer = static_cast<MultiCallbackUserData *>(user_data);
- if (multiPointer != NULL) {
- int successStrLength = strlen("success");
- if ((strncmp(result,"success", successStrLength)== 0) && (strlen(result) == successStrLength)) {
+void WebSettingManager::onAsyncUAStringReplyCallback(unsigned int num, void* user_data, const char* result)
+{
+ MultiCallbackUserData* multiPointer = static_cast<MultiCallbackUserData *>(user_data);
+ if (multiPointer != NULL)
+ {
+ unsigned int successStrLength = strlen("success");
+ if ((strncmp(result,"success", successStrLength) == 0) && (strlen(result) == successStrLength))
+ {
multiPointer->invokeCallback("onsuccess", NULL);
}
- else {
+ else
+ {
UnknownException error("Unknown");
JSObjectRef errorObj = JSWebAPIErrorFactory::makeErrorObject(multiPointer->getContext(), error);
- multiPointer->invokeCallback("onerror", errorObj);
- }
- WebSettingManager::mUserAgentCallbacks.remove(multiPointer);
- delete multiPointer;;
- }
- else {
- SLoggerI("[WebSettingManager::onAsyncUAStringReplyCallback] Warning. MultiCallbackUserData is NULL." << __LINE__);;
- }
+ multiPointer->invokeCallback("onerror", errorObj);
+ }
+ WebSettingManager::mUserAgentCallbacks.remove(multiPointer);
+ delete multiPointer;;
+ }
+ else
+ {
+ SLoggerI("[WebSettingManager::onAsyncUAStringReplyCallback] Warning. MultiCallbackUserData is NULL." << __LINE__);;
+ }
}
-void WebSettingManager::onAsyncReplyRemoveAllCookiesCallback(unsigned int num, void* user_data, const char* result)
-{
- MultiCallbackUserData* multiPointer = static_cast<MultiCallbackUserData *>(user_data);
- if (multiPointer != NULL) {
- int successStrLength = strlen("success");
- if ((strncmp(result,"success", successStrLength)== 0) && (strlen(result) == successStrLength)) {
- multiPointer->invokeCallback("onsuccess", NULL);
- }
- else {
+void WebSettingManager::onAsyncReplyRemoveAllCookiesCallback(unsigned int num, void* user_data, const char* result)
+{
+ MultiCallbackUserData* multiPointer = static_cast<MultiCallbackUserData *>(user_data);
+ if (multiPointer != NULL)
+ {
+ unsigned int successStrLength = strlen("success");
+ if ((strncmp(result,"success", successStrLength)== 0) && (strlen(result) == successStrLength))
+ {
+ multiPointer->invokeCallback("onsuccess", NULL);
+ }
+ else
+ {
UnknownException error("Unknown");
JSObjectRef errorObj = JSWebAPIErrorFactory::makeErrorObject(multiPointer->getContext(), error);
- multiPointer->invokeCallback("onerror", errorObj);
- }
- WebSettingManager::mDeleteAllCookiesCallbacks.remove(multiPointer);
- delete multiPointer;;
- }
- else {
- SLoggerI("[WebSettingManager::onAsyncReplyRemoveAllCookiesCallback] Warning. MultiCallbackUserData is NULL." << __LINE__);;
- }
+ multiPointer->invokeCallback("onerror", errorObj);
+ }
+ WebSettingManager::mDeleteAllCookiesCallbacks.remove(multiPointer);
+ delete multiPointer;;
+ }
+ else
+ {
+ SLoggerI("[WebSettingManager::onAsyncReplyRemoveAllCookiesCallback] Warning. MultiCallbackUserData is NULL." << __LINE__);;
+ }
}
void WebSettingManager::setUserAgentString(std::string userAgent, MultiCallbackUserData* callbacks)
{
SLoggerI("WebSetting:setUserAgentString: " << userAgent);
- WebSettingManager::mUserAgentCallbacks.push_back(callbacks);
+ WebSettingManager::mUserAgentCallbacks.push_back(callbacks);
IPCMessageSupport::sendAsyncMessageToUiProcess(IPCMessageSupport::TIZEN_CHANGE_USERAGENT, userAgent.c_str(), WebSettingManager::onAsyncUAStringReplyCallback, callbacks);
}
void WebSettingManager::removeAllCookies(MultiCallbackUserData* callbacks)
{
SLoggerI("WebSetting:removeAllCookies: ");
- WebSettingManager::mDeleteAllCookiesCallbacks.push_back(callbacks);
+ WebSettingManager::mDeleteAllCookiesCallbacks.push_back(callbacks);
IPCMessageSupport::sendAsyncMessageToUiProcess(IPCMessageSupport::TIZEN_DELETE_ALL_COOKIES, NULL, WebSettingManager::onAsyncReplyRemoveAllCookiesCallback, callbacks);
-}
+}
}
}
using namespace DeviceAPI::Common;
-namespace DeviceAPI {
-namespace WebSetting {
+namespace DeviceAPI
+{
+namespace WebSetting
+{
class WebSettingManager
{
void setUserAgentString(std::string userAgent, MultiCallbackUserData* callbacks);
void removeAllCookies(MultiCallbackUserData* callbacks);
- static std::list<Common::MultiCallbackUserData *> mUserAgentCallbacks;
- static std::list<Common::MultiCallbackUserData *> mDeleteAllCookiesCallbacks;
+ static std::list<Common::MultiCallbackUserData *> mUserAgentCallbacks;
+ static std::list<Common::MultiCallbackUserData *> mDeleteAllCookiesCallbacks;
static void onAsyncUAStringReplyCallback(unsigned int num, void* user_data, const char* result);
static void onAsyncReplyRemoveAllCookiesCallback(unsigned int num, void* user_data, const char* result);
- static WebSettingManager* getInstance();
+ static WebSettingManager* getInstance();
private:
WebSettingManager();
virtual ~WebSettingManager();
#include <vector>
#include <map>
-namespace DeviceAPI {
-namespace WebSetting {
+namespace DeviceAPI
+{
+namespace WebSetting
+{
} // WebSetting
using namespace WrtDeviceApis::Commons;
-namespace DeviceAPI {
-namespace WebSetting {
+namespace DeviceAPI
+{
+namespace WebSetting
+{
static FunctionMapping createWebSettingFunctions();
static FunctionMapping WebSettingFunctions = createWebSettingFunctions();
static FunctionMapping createWebSettingFunctions()
{
- FunctionMapping webSettingMapping;
/**
* Device capabilities
- */
+ */
ACE_CREATE_DEVICE_CAP(DEVICE_CAP_WEBSETTING, WEBSETTING_DEVICE_CAP);
ACE_CREATE_DEVICE_CAPS_LIST(DEVICE_LIST_WEBSETTING);
ACE_ADD_DEVICE_CAP(DEVICE_LIST_WEBSETTING, DEVICE_CAP_WEBSETTING);
-
+
/**
* Api Features
*/
ACE_CREATE_FEATURE(FEATURE_WEBSETTING, WEBSETTING_FEATURE_API);
ACE_CREATE_FEATURE_LIST(WEBSETTING_FEATURES);
- ACE_ADD_API_FEATURE(WEBSETTING_FEATURES, FEATURE_WEBSETTING);
-
+ ACE_ADD_API_FEATURE(WEBSETTING_FEATURES, FEATURE_WEBSETTING);
+
/**
* Functions
*/
FunctionMapping websettingMapping;
-
- // remove cookies
- AceFunction removeAllCookiesFunc = ACE_CREATE_FUNCTION(
- FUNCTION_ADD,
- WEB_SETTING_MANAGER_API_REMOVE_ALL_COOKIES,
- WEBSETTING_FEATURES,
- DEVICE_LIST_WEBSETTING);
-
- websettingMapping.insert(std::make_pair(
- WEB_SETTING_MANAGER_API_REMOVE_ALL_COOKIES,
- removeAllCookiesFunc));
-
- return webSettingMapping;
+
+ // remove cookies
+ AceFunction removeAllCookiesFunc = ACE_CREATE_FUNCTION(
+ FUNCTION_REMOVE_ALL_COOKIES,
+ WEB_SETTING_MANAGER_API_REMOVE_ALL_COOKIES,
+ WEBSETTING_FEATURES,
+ DEVICE_LIST_WEBSETTING);
+
+ websettingMapping.insert(std::make_pair(
+ WEB_SETTING_MANAGER_API_REMOVE_ALL_COOKIES,
+ removeAllCookiesFunc));
+
+ return websettingMapping;
}
} // WebSetting
#include <Logger.h>
-namespace DeviceAPI {
-namespace WebSetting {
+namespace DeviceAPI
+{
+namespace WebSetting
+{
// attributes
using namespace WrtDeviceApis::Commons;
using namespace DeviceAPI::Common;
-namespace DeviceAPI {
-namespace WebSetting {
+namespace DeviceAPI
+{
+namespace WebSetting
+{
void on_widget_start_callback(int widgetId)
{
SLoggerD("[Tizen\\WebSetting] on_widget_start_callback (%d)", widgetId);
- try {
+ try
+ {
WrtAccessSingleton::Instance().initialize(widgetId);
- } catch (...) {
+ }
+ catch (...)
+ {
SLoggerE("WrtAccess initialization failed");
}
}
void on_widget_stop_callback(int widgetId)
{
SLoggerD("[Tizen\\WebSetting] on_widget_stop_callback (%d)", widgetId);
- try {
+ try
+ {
WrtAccessSingleton::Instance().deinitialize(widgetId);
- } catch (...) {
+ }
+ catch (...)
+ {
SLoggerE("WrtAccess deinitialization failed");
}
}
PLUGIN_CLASS_MAP_BEGIN
PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
- "websetting",
- (js_class_template_getter)JSWebSettingManager::getClassRef,
- NULL)
+ "websetting",
+ (js_class_template_getter)JSWebSettingManager::getClassRef,
+ NULL)
PLUGIN_CLASS_MAP_END
} // WebSetting