tizen 2.3.1 release
[framework/web/mobile/wrt-plugins-tizen.git] / src / MessagePort / JSMessagePortManager.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 /**
19  * @file        JSMessagePortManager.h
20  * @version     0.1
21  * @brief       Declaration of the JSMessagePortManager class
22  */
23
24 #ifndef _TIZEN_MESSAGE_PORT_JS_MESSAGE_PORT_MANAGER_H_
25 #define _TIZEN_MESSAGE_PORT_JS_MESSAGE_PORT_MANAGER_H_
26
27 #include <JavaScriptCore/JavaScript.h>
28
29 #include <CommonsJavaScript/PrivateObject.h>
30 #include <Commons/IEvent.h>
31 #include "IMessagePortManager.h"
32
33 namespace DeviceAPI {
34 namespace MessagePort {
35
36 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<MessagePortManagerPtr,
37         WrtDeviceApis::CommonsJavaScript::NoOwnership> JSMessagePortManagerPriv;
38
39 class JSMessagePortManager {
40 public:
41     /*
42      * This initializes this JS class in the JS Engine.
43      */
44     static JSClassRef getClassRef();
45
46 private:
47     /**
48      * The callback invoked when an object is first created.
49      */
50     static void Initialize(JSContextRef context, JSObjectRef object);
51
52     /**
53      * The callback invoked when an object is finalized.
54      */
55     static void Finalize(JSObjectRef object);
56
57     /**
58      * This structure contains properties and callbacks that define a type of object.
59      */
60     static JSClassDefinition m_classInfo;
61
62     /**
63      * This structure describes a statically declared function property.
64      */
65     static JSStaticFunction m_functions[];
66
67     /**
68      * This member variable contains the initialization values for the static properties of this class.
69      * The values are given according to the data structure JSPropertySpec
70      */
71     static JSStaticValue m_property[];
72
73     static JSClassRef m_classRef;
74
75     static JSValueRef requestLocalMessagePort(JSContextRef context,
76             JSObjectRef object,
77             JSObjectRef thisObject,
78             size_t argumentCount,
79             const JSValueRef arguments[],
80             JSValueRef* exception);
81
82     static JSValueRef requestTrustedLocalMessagePort(JSContextRef context,
83             JSObjectRef object,
84             JSObjectRef thisObject,
85             size_t argumentCount,
86             const JSValueRef arguments[],
87             JSValueRef* exception);
88
89     static JSValueRef requestRemoteMessagePort(JSContextRef context,
90             JSObjectRef object,
91             JSObjectRef thisObject,
92             size_t argumentCount,
93             const JSValueRef arguments[],
94             JSValueRef* exception);
95
96     static JSValueRef requestTrustedRemoteMessagePort(JSContextRef context,
97             JSObjectRef object,
98             JSObjectRef thisObject,
99             size_t argumentCount,
100             const JSValueRef arguments[],
101             JSValueRef* exception);
102 };
103
104 } // MessagePort
105 } // DeviceAPI
106
107 #endif // _TIZEN_MESSAGE_PORT_JS_MESSAGE_PORT_MANAGER_H_