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.
18 #ifndef WRTPLUGINS_TIZEN_JS_MESSAGING_STORAGE_H_
19 #define WRTPLUGINS_TIZEN_JS_MESSAGING_STORAGE_H_
21 #include <JavaScriptCore/JavaScript.h>
22 #include <CommonsJavaScript/PrivateObject.h>
24 #include "MessagingListener.h"
30 class MessagingStoragePrivObj
35 // MessagingListener instance;
49 typedef DPL::SharedPtr<MessagingStoragePrivObj> MessagingStoragePrivObjPtr;
51 typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT<MessagingStoragePrivObjPtr>::Type MessagingStoragePrivObject;
53 class MessagingStoragePriv :
54 public MessagingStoragePrivObject,
55 public DeviceAPI::Common::SecurityAccessor
58 MessagingStoragePriv(JSContextRef context, MessagingStoragePrivObjPtr messageStorage) :
59 MessagingStoragePrivObject(context, messageStorage),
60 DeviceAPI::Common::SecurityAccessor()
64 virtual ~MessagingStoragePriv()
69 class JSMessagingStorage {
71 //@struct JSClassDefinition
72 // @abstract This structure contains properties and callbacks that define a type of object. All fields other than the version field are optional. Any pointer may be NULL.
73 static const JSClassDefinition* getClassInfo();
74 static const JSClassRef getClassRef();
78 * The callback invoked when an object is first created.
80 static void initialize(JSContextRef context, JSObjectRef object);
83 * The callback invoked when an object is finalized.
85 static void finalize(JSObjectRef object);
88 * The callback invoked when an object is used as the target of an 'instanceof' expression.
90 static bool hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception);
94 * The callback invoked when determining whether an object has a property.
96 static bool hasProperty(JSContextRef context,
98 JSStringRef propertyName);
102 * The callback invoked when getting a property's value.
104 static JSValueRef getProperty(JSContextRef context,
106 JSStringRef propertyName,
107 JSValueRef* exception);
110 static JSValueRef addDraftMessage(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
111 const JSValueRef arguments[], JSValueRef* exception);
113 static JSValueRef findMessages(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
114 const JSValueRef arguments[], JSValueRef* exception);
116 static JSValueRef findConversations(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
117 const JSValueRef arguments[], JSValueRef* exception);
119 static JSValueRef removeConversations(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
120 const JSValueRef arguments[], JSValueRef* exception);
122 static JSValueRef findFolders(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
123 const JSValueRef arguments[], JSValueRef* exception);
125 static JSValueRef removeMessages(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
126 const JSValueRef arguments[], JSValueRef* exception);
128 static JSValueRef updateMessages(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
129 const JSValueRef arguments[], JSValueRef* exception);
131 static JSValueRef addMessagesChangeListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
132 const JSValueRef arguments[], JSValueRef* exception);
134 static JSValueRef addConversationsChangeListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
135 const JSValueRef arguments[], JSValueRef* exception);
137 static JSValueRef addFoldersChangeListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
138 const JSValueRef arguments[], JSValueRef* exception);
140 static JSValueRef removeChangeListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
141 const JSValueRef arguments[], JSValueRef* exception);
145 * This structure contains properties and callbacks that define a type of object.
147 static JSClassDefinition m_classInfo;
150 * This structure describes a statically declared function property.
152 static JSStaticFunction m_function[];
153 static JSStaticValue m_property[];
154 static JSClassRef m_jsClassRef;
161 #endif //WRTPLUGINS_TIZEN_JS_MESSAGING_SERVICE_MANAGER_H_