Name: wrt-plugins-tizen
Summary: JavaScript plugins for WebRuntime
-Version: 0.4.78
+Version: 0.4.79
Release: 0
Group: Development/Libraries
License: Apache License, Version 2.0
}
}
-void AppManagerWrapper::setCurrentAppId(std::string appId)
-{
- m_curr_app_id = appId;
-}
-
-std::string AppManagerWrapper::getCurrentAppId() const
-{
- return m_curr_app_id;
-}
-
-
void AppManagerWrapper::registerAppListChangedCallbacks(IAppManagerAppListChangedCallbacks *callbacks)
{
if(callbacks == NULL)
bool initializeAppInfo(ApplicationInformationPtr &appInfo);
- // get the current application id from WRT
- void setCurrentAppId(std::string appId);
- std::string getCurrentAppId() const;
-
private:
static bool app_callback(package_info_app_component_type_e comp_type, const char *app_id, void *user_data);
static std::string get_current_app_id()
{
- std::string appId = AppManagerWrapperSingleton::Instance().getCurrentAppId();
+ char *app_id = NULL;
+ int pid = getpid();
+ int ret = app_manager_get_app_id(pid, &app_id);
+ if (ret != APP_MANAGER_ERROR_NONE) {
+ LoggerE("Fail to get appid");
+ return "";
+ }
+
+ std::string appId = app_id;
+
+ free(app_id);
+
return appId;
}
//
#include "JSApplicationEventCallbackManager.h"
+#include <WebKitProxy.h>
#include <Logger.h>
namespace DeviceAPI {
if (JSObjectIsFunction(context, callback))
{
+ JSValueRef exception = NULL;
+
if (argc == 0)
{
- JSObjectCallAsFunction(context, callback, object, 0, NULL, NULL);
+ JSObjectCallAsFunction(context, callback, object, 0, NULL, &exception);
}
else
{
- JSObjectCallAsFunction(context, callback, object, argc, argv, NULL);
+ JSObjectCallAsFunction(context, callback, object, argc, argv, &exception);
}
+
+ if (exception)
+ DeviceAPI::Common::WebKitProxy::reportException(context, exception);
+
return;
}
}
// limitations under the License.
//
-#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
#include <dpl/string.h>
#include <Commons/plugin_initializer_def.h>
void on_widget_start_callback(int widgetId) {
LoggerD("[Tizen1_0\\Application] on_widget_start_callback ("<<widgetId<<")");
Try {
- WrtDB::WidgetDAOReadOnly dao(widgetId);
- std::string tzAppId = DPL::ToUTF8String(dao.getTzAppId());
- AppManagerWrapperSingleton::Instance().setCurrentAppId(tzAppId);
-
TIME_TRACER_INIT();
WrtAccessSingleton::Instance().initialize(widgetId);
} Catch(WrtDeviceApis::Commons::Exception) {
void CalendarFilter::setType(CalendarEvent::CalendarType type)
{
+ int ret;
if(CalendarEvent::TASK_TYPE==type) {
m_type = CalendarEvent::TASK_TYPE;
- calendar_query_create(_calendar_todo._uri, &m_query);
+ ret = calendar_query_create(_calendar_todo._uri, &m_query);
+ if( CALENDAR_ERROR_NONE!=ret ) {
+ ThrowMsg(PlatformException, "Creating a query failed: "<<ret);
+ }
if(CALENDAR_ERROR_NONE!=calendar_filter_create(_calendar_todo._uri, &m_filter)) LoggerW("Filter creation failed.");
} else {
m_type = CalendarEvent::EVENT_TYPE;
- calendar_query_create(_calendar_event._uri, &m_query);
+ ret = calendar_query_create(_calendar_event._uri, &m_query);
+ if( CALENDAR_ERROR_NONE!=ret ) {
+ ThrowMsg(PlatformException, "Creating a query failed: "<<ret);
+ }
if(CALENDAR_ERROR_NONE!=calendar_filter_create(_calendar_event._uri, &m_filter)) LoggerW("Filter creation failed.");
-
- calendar_query_create(_calendar_instance_normal_calendar_book._uri, &m_normalInstanceQuery);
+ ret = calendar_query_create(_calendar_instance_normal_calendar_book._uri, &m_normalInstanceQuery);
+ if( CALENDAR_ERROR_NONE!=ret ) {
+ ThrowMsg(PlatformException, "Creating a query failed: "<<ret);
+ }
if(CALENDAR_ERROR_NONE!=calendar_filter_create(_calendar_instance_normal_calendar_book._uri, &m_normalInstanceFilter)) LoggerW("Filter creation failed.");
- calendar_query_create(_calendar_instance_allday_calendar_book._uri, &m_alldayInstanceQuery);
+ ret = calendar_query_create(_calendar_instance_allday_calendar_book._uri, &m_alldayInstanceQuery);
+ if( CALENDAR_ERROR_NONE!=ret ) {
+ ThrowMsg(PlatformException, "Creating a query failed: "<<ret);
+ }
if(CALENDAR_ERROR_NONE!=calendar_filter_create(_calendar_instance_allday_calendar_book._uri, &m_alldayInstanceFilter)) LoggerW("Filter creation failed.");
}
}
#include <Logger.h>
#include <Export.h>
#include <GlobalContextManager.h>
+#include <FilterConverter.h>
#include "JSCalendarManager.h"
#include "CalendarConverter.h"
onError = converter.toFunctionOrNull(arguments[1]);
}
JSCallbackManagerPtr cbm = JSCallbackManager::createObject(globalContext, onSuccess, onError);
-
- cbm->setObject(thisObject);
+ cbm->setObject(thisObject);
LoggerD("Proceed the find event to the platform.");
dplEvent->copyAceCheckAccessFunction(privateObject);
if (argumentCount>=3) {
- if (JSValueIsObject(context, arguments[2])) {
- dplEvent->setGenericFilter(filterConverter->toFilter(arguments[2]));
+ if (JSValueIsObject(context, arguments[2])) {
+ DeviceAPI::Tizen::FilterPtr filter = filterConverter->toFilter(arguments[2]);
+ if(filter)
+ {
+ dplEvent->setGenericFilter(filter);
+ }
+ else
+ {
+ ThrowMsg(ConversionException, "Wrong third parameter type.");
+ }
} else if (JSValueIsNull(context, arguments[2])) {
LoggerD("Use default filter.");
} else {
JSArray.cpp
SecurityAccessor.cpp
JSTizenSecurityObject.cpp
+ WebKitProxy.cpp
)
ADD_LIBRARY(${COMMON_TARGET_NAME} SHARED ${SRCS})
#include "JSUtil.h"
#include "PlatformException.h"
+#include <WKBundle.h>
#include <cmath>
#include <limits>
#include "MultiCallbackUserData.h"
#include "GlobalContextManager.h"
#include "PlatformException.h"
+#include "WebKitProxy.h"
#include "JSUtil.h"
#include "Logger.h"
JSValueRef exception = NULL;
JSObjectCallAsFunction(mContext, callbackObject, NULL, count, obj, &exception);
+ if(exception)
+ WebKitProxy::reportException(mContext, exception);
+
// check Exception in function call
if( exception != NULL ){
throw UnknownException(mContext, exception);
}
if( itr->second ){
- JSObjectCallAsFunction(mContext, itr->second , NULL, count, obj, NULL);
+ JSValueRef exception = NULL;
+ JSObjectCallAsFunction(mContext, itr->second , NULL, count, obj, &exception);
+ if(exception)
+ WebKitProxy::reportException(mContext, exception);
}else{
LOGE("The callback[%s] is NULL", key.c_str());
}
--- /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 "WebKitProxy.h"
+#include <WKBundle.h>
+#include "Logger.h"
+
+using namespace std;
+
+namespace DeviceAPI {
+namespace Common {
+
+void WebKitProxy::reportException(JSContextRef context, JSValueRef exception)
+{
+ LoggerW("Throwing exception to WebKit.");
+
+ if (exception)
+ {
+ WKBundleReportException(context, exception);
+ }
+}
+
+} // Common
+} // DeviceAPI
--- /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.
+//
+
+#ifndef _WEBKIT_PROXY_H_
+#define _WEBKIT_PROXY_H_
+
+#include <JavaScriptCore/JavaScript.h>
+
+namespace DeviceAPI {
+namespace Common {
+
+class WebKitProxy
+{
+public:
+ static void reportException(JSContextRef ctx, JSValueRef exception);
+};
+
+} // Common
+} // DeviceAPI
+
+#endif //_WEBKIT_PROXY_H_
*/
#include "JSAddressBookChangeCallbackManager.h"
+#include <WebKitProxy.h>
#include <Logger.h>
namespace DeviceAPI {
if (JSObjectIsFunction(context, callback))
{
+ JSValueRef exception = NULL;
+
if (argc == 0)
{
- //LoggerD("Calling object directly, no arguments");
- JSObjectCallAsFunction(context, callback, object, 0, NULL, NULL);
+ //LoggerD("Calling object directly, no arguments");
+ JSObjectCallAsFunction(context, callback, object, 0, NULL, &exception);
}
else
{
- //LoggerD("Calling object directly, one argument");
- JSObjectCallAsFunction(context, callback, object, argc, argv, NULL);
+ //LoggerD("Calling object directly, one argument");
+ JSObjectCallAsFunction(context, callback, object, argc, argv, &exception);
}
+
+ if (exception)
+ DeviceAPI::Common::WebKitProxy::reportException(context, exception);
+
return;
}
}
*/
#include "JSContactManagerChangeCallbackManager.h"
+#include <WebKitProxy.h>
#include <Logger.h>
namespace DeviceAPI {
if (JSObjectIsFunction(context, callback))
{
- if (argc == 0)
+ JSValueRef exception = NULL;
+
+ if (argc == 0)
{
- //LoggerD("Calling object directly, no arguments");
- JSObjectCallAsFunction(context, callback, object, 0, NULL, NULL);
+ //LoggerD("Calling object directly, no arguments");
+ JSObjectCallAsFunction(context, callback, object, 0, NULL, &exception);
}
else
{
- //LoggerD("Calling object directly, one argument");
- JSObjectCallAsFunction(context, callback, object, argc, argv, NULL);
+ //LoggerD("Calling object directly, one argument");
+ JSObjectCallAsFunction(context, callback, object, argc, argv, &exception);
}
+
+ if (exception)
+ DeviceAPI::Common::WebKitProxy::reportException(context, exception);
+
return;
}
}
//
#include "JSNetworkBearerSelectionCallbackManager.h"
+#include <WebKitProxy.h>
#include <Logger.h>
namespace DeviceAPI {
if (JSObjectIsFunction(context, callback))
{
+ JSValueRef exception = NULL;
+
if (argc == 0)
{
- //LoggerD("Calling object directly, no arguments");
- JSObjectCallAsFunction(context, callback, object, 0, NULL, NULL);
+ //LoggerD("Calling object directly, no arguments");
+ JSObjectCallAsFunction(context, callback, object, 0, NULL, &exception);
}
else
{
- //LoggerD("Calling object directly, one argument");
- JSObjectCallAsFunction(context, callback, object, argc, argv, NULL);
+ //LoggerD("Calling object directly, one argument");
+ JSObjectCallAsFunction(context, callback, object, argc, argv, &exception);
}
+
+ if (exception)
+ DeviceAPI::Common::WebKitProxy::reportException(context, exception);
+
return;
}
}
{
app_info_h handle;
- string appId = PackageManager::getInstance()->getCurrentAppId();
+ char *app_id = NULL;
+ int pid = getpid();
+ int ret = app_manager_get_app_id(pid, &app_id);
+ if (ret != APP_MANAGER_ERROR_NONE) {
+ LoggerE("Fail to get appid");
+ return ret;
+ }
- int ret = app_manager_get_app_info(appId.c_str(), &handle);
+ ret = app_manager_get_app_info(app_id, &handle);
+ free(app_id);
if (ret != APP_MANAGER_ERROR_NONE) {
LoggerE("Fail to get appinfo");
return ret;
return &instance;
}
-void PackageManager::setCurrentAppId(string appId)
-{
- m_curr_app_id = appId;
-}
-
-string PackageManager::getCurrentAppId() const
-{
- return m_curr_app_id;
-}
-
PackageManager::PackageManager()
{
}
void setPackageInfoEventListener(PackageInfoEventCallback * eventCB);
void unsetPackageInfoEventListener();
- // get the current application id from WRT
- void setCurrentAppId(string appId);
- string getCurrentAppId() const;
-
static PackageManager* getInstance();
private:
// limitations under the License.
//
-#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
#include <dpl/string.h>
#include <Commons/plugin_initializer_def.h>
LoggerD("[Tizen2_1\\Package] on_widget_start_callback ("<<widgetId<<")");
TIME_TRACER_INIT();
Try {
- WrtDB::WidgetDAOReadOnly dao(widgetId);
- std::string tzAppId = DPL::ToUTF8String(dao.getTzAppId());
- PackageManager::getInstance()->setCurrentAppId(tzAppId);
-
WrtAccessSingleton::Instance().initialize(widgetId);
} Catch(WrtDeviceApis::Commons::Exception) {
LoggerE("WrtAccess initialization failed");
LOGI("Current state is not normal state the value is saved in cache: %d", brightness);
mShouldBeReadFromCache = true;
return;
+ } else if( mCurrentState.mState == PowerState::SCREENBRIGHT ){
+ mCurrentBrightness = brightness;
+ LOGI("Current state is not normal state the value is saved in cache: %d", brightness);
+ mShouldBeReadFromCache = true;
+ return;
}else
mShouldBeReadFromCache = false;
{
LOGD("Connecting to the push service...");
+ setAppId();
+
int ret = push_connect(m_pkgId.c_str(), push_connection_state_cb, push_notify_cb, this, &m_connectionHandle);
if (PUSH_ERROR_NONE!=ret) {
LOGE("Error while connecting to the push service: %d", ret);
return &instance;
}
-void PushManager::setAppId(std::string appId) {
+void PushManager::setAppId() {
app_info_h handle;
char *_pkg_id = NULL;
+ char *app_id = NULL;
+ int pid = getpid();
+ int ret = app_manager_get_app_id(pid, &app_id);
+ if (ret != APP_MANAGER_ERROR_NONE) {
+ LOGE("Fail to get appid");
+ return;
+ }
+
+ m_appId = app_id;
+ free(app_id);
- int ret = app_manager_get_app_info(appId.c_str(), &handle);
+ ret = app_manager_get_app_info(m_appId.c_str(), &handle);
if (ret != APP_MANAGER_ERROR_NONE) {
LOGE("WrtAccess initialization failed");
return;
return;
}
- m_appId = appId;
if (_pkg_id) {
m_pkgId = _pkg_id;
free(_pkg_id);
std::string getRegistrationId();
static PushManager* getInstance();
- static void setAppId(std::string appId);
+ void setAppId();
private:
PushManager();
// limitations under the License.
//
-#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
#include <dpl/string.h>
#include <Commons/plugin_initializer_def.h>
LOGD("[Tizen\\Push] on_widget_start_callback (%d)", widgetId);
TIME_TRACER_INIT();
try {
- WrtDB::WidgetDAOReadOnly dao(widgetId);
- PushManager::setAppId(DPL::ToUTF8String(dao.getTzAppId()));
WrtAccessSingleton::Instance().initialize(widgetId);
} catch (...) {
LOGE("WrtAccess initialization failed");