2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 #ifndef TIZENAPIS_TIZEN_JS_STATUS_NOTIFICATION_H_
20 #define TIZENAPIS_TIZEN_JS_STATUS_NOTIFICATION_H_
22 #include <JavaScriptCore/JavaScript.h>
23 #include <CommonsJavaScript/PrivateObject.h>
24 #include "INotification.h"
27 namespace Notification {
30 typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT<INotificationPtr>::Type JSStatusNotificationPriv;
32 #define NOTIFICATION_ID "id"
33 #define NOTIFICATION_TYPE "type"
34 #define NOTIFICATION_POSTED_TIME "postedTime"
35 #define NOTIFICATION_TITLE "title"
36 #define NOTIFICATION_CONTENT "content"
38 #define NOTIFICATION_STATUS_TYPE "statusType"
39 #define NOTIFICATION_ICON_PATH "iconPath"
40 #define NOTIFICATION_SOUND_PATH "soundPath"
41 #define NOTIFICATION_VIBRATION "vibration"
42 #ifdef APPLICATION_API_BACKWARD_COMPATIBILITY
43 #define NOTIFICATION_SEVICE "service"
45 #define NOTIFICATION_APP_CONTROL "appControl"
46 #define NOTIFICATION_APP_ID "appId"
47 #define NOTIFICATION_PROGRESS_TYPE "progressType"
48 #define NOTIFICATION_PROGRESS_VALUE "progressValue"
49 #define NOTIFICATION_LINES "detailInfo"
50 #define NOTIFICATION_BACKGROUND_IMAGE_PATH "backgroundImagePath"
51 #define NOTIFICATION_NUMBER "number"
52 #define NOTIFICATION_THUMBNAILS "thumbnails"
53 #define NOTIFICATION_SUB_ICON_PATH "subIconPath"
56 class JSStatusNotification {
58 static const JSClassDefinition* getClassInfo();
59 static const JSClassRef getClassRef();
60 static INotificationPtr getNotification(JSContextRef context, JSValueRef value);
61 static JSValueRef getProperty(JSContextRef context, JSObjectRef object,
62 JSStringRef propertyName, JSValueRef* exception);
63 static bool setProperty(JSContextRef context, JSObjectRef object,
64 JSStringRef propertyName, JSValueRef value, JSValueRef* exception);
65 static JSObjectRef createJSObject(JSContextRef context, INotificationPtr notification);
68 static void initialize(JSContextRef context, JSObjectRef object);
69 static void finalize(JSObjectRef object);
70 static bool hasInstance(JSContextRef context, JSObjectRef constructor,
71 JSValueRef possibleInstance, JSValueRef* exception);
73 static JSObjectRef constructor(JSContextRef context,
74 JSObjectRef constructor,
76 const JSValueRef arguments[],
77 JSValueRef* exception);
79 static JSClassDefinition m_classInfo;
80 static JSStaticValue m_properties[];
82 static JSClassRef m_jsClassRef;