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_VALUE "progressValue"
48 #define NOTIFICATION_LINES "detailInfo"
49 #define NOTIFICATION_BACKGROUND_IMAGE_PATH "backgroundImagePath"
50 #define NOTIFICATION_NUMBER "number"
51 #define NOTIFICATION_THUMBNAILS "thumbnails"
52 #define NOTIFICATION_SUB_ICON_PATH "subIconPath"
55 class JSStatusNotification {
57 static const JSClassDefinition* getClassInfo();
58 static const JSClassRef getClassRef();
59 static INotificationPtr getNotification(JSContextRef context, JSValueRef value);
60 static JSValueRef getProperty(JSContextRef context, JSObjectRef object,
61 JSStringRef propertyName, JSValueRef* exception);
62 static bool setProperty(JSContextRef context, JSObjectRef object,
63 JSStringRef propertyName, JSValueRef value, JSValueRef* exception);
64 static JSObjectRef createJSObject(JSContextRef context, INotificationPtr notification);
67 static void initialize(JSContextRef context, JSObjectRef object);
68 static void finalize(JSObjectRef object);
69 static bool hasInstance(JSContextRef context, JSObjectRef constructor,
70 JSValueRef possibleInstance, JSValueRef* exception);
72 static JSObjectRef constructor(JSContextRef context,
73 JSObjectRef constructor,
75 const JSValueRef arguments[],
76 JSValueRef* exception);
78 static JSClassDefinition m_classInfo;
79 static JSStaticValue m_properties[];
81 static JSClassRef m_jsClassRef;