Update change log and spec for wrt-plugins-tizen_0.4.70
[framework/web/wrt-plugins-tizen.git] / src / Messaging / JSMessagingServiceManager.h
1 //
2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
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.
16 //
17
18 #ifndef WRTPLUGINS_TIZEN_JS_MESSAGING_SERVICE_MANAGER_H_
19 #define WRTPLUGINS_TIZEN_JS_MESSAGING_SERVICE_MANAGER_H_
20
21 #include <JavaScriptCore/JavaScript.h>
22 #include <CommonsJavaScript/PrivateObject.h>
23 #include <Security.h>
24 #include "IMessagingServiceManager.h"
25
26 namespace DeviceAPI {
27 namespace Messaging {
28
29 typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT<DeviceAPI::Messaging::IMessagingServiceManagerPtr>::Type JSMessagingServiceManagerPrivObject;
30
31 class JSMessagingServiceManagerPriv :
32     public JSMessagingServiceManagerPrivObject,
33     public DeviceAPI::Common::SecurityAccessor
34 {
35 public:
36     JSMessagingServiceManagerPriv(JSContextRef context, IMessagingServiceManagerPtr messagingServiceManager) :
37         JSMessagingServiceManagerPrivObject(context, messagingServiceManager),
38         DeviceAPI::Common::SecurityAccessor()
39     {
40     }
41
42     virtual ~JSMessagingServiceManagerPriv()
43     {
44     }
45 };
46
47 class JSMessagingServiceManager {
48 public:
49 //@struct JSClassDefinition
50 //      @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.
51         static const JSClassDefinition* getClassInfo();
52         static const JSClassRef getClassRef();
53
54 private:
55         /**
56          * The callback invoked when an object is first created.
57          */
58         static void initialize(JSContextRef context, JSObjectRef object);
59
60         /**
61          * The callback invoked when an object is finalized.
62          */
63         static void finalize(JSObjectRef object);
64
65         /**
66          * The callback invoked when an object is used as the target of an 'instanceof' expression.
67          */
68         static bool hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception);
69
70
71           /**
72           * The callback invoked when determining whether an object has a property.
73           */
74          static bool hasProperty(JSContextRef context,
75                          JSObjectRef object,
76                          JSStringRef propertyName);
77   
78          /**
79           * The callback invoked when getting a property's value.
80           */
81
82         static JSValueRef getProperty(JSContextRef context,
83                          JSObjectRef object,
84                          JSStringRef propertyName,
85                          JSValueRef* exception);
86
87         static JSValueRef getMessagingServices(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
88          const JSValueRef arguments[], JSValueRef* exception);
89
90         static JSValueRef getMessagingService(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
91         const JSValueRef arguments[], JSValueRef* exception);
92         
93         /**
94          * This structure contains properties and callbacks that define a type of object.
95          */
96         static JSClassDefinition m_classInfo;
97
98         /**
99          * This structure describes a statically declared function property.
100          */
101         static JSStaticFunction m_function[];
102         static JSStaticValue m_property[];
103         static JSClassRef m_jsClassRef;
104
105 private:
106         enum{
107                 GET_MESSAGING_SERVICE_ALL = 1,
108                 GET_MESSAGING_SERVICE_ACOUNT = 2
109         };
110
111 };
112
113
114 } //WrtPlugins
115
116 #endif //WRTPLUGINS_TIZEN_JS_MESSAGING_SERVICE_MANAGER_H_
117