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 * @file JSMessagePortManager.h
21 * @brief Declaration of the JSMessagePortManager class
24 #ifndef _TIZEN_MESSAGE_PORT_JS_MESSAGE_PORT_MANAGER_H_
25 #define _TIZEN_MESSAGE_PORT_JS_MESSAGE_PORT_MANAGER_H_
27 #include <JavaScriptCore/JavaScript.h>
29 #include <CommonsJavaScript/PrivateObject.h>
30 #include <Commons/IEvent.h>
31 #include "IMessagePortManager.h"
34 namespace MessagePort {
36 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<MessagePortManagerPtr,
37 WrtDeviceApis::CommonsJavaScript::NoOwnership> JSMessagePortManagerPriv;
39 class JSMessagePortManager {
42 * This initializes this JS class in the JS Engine.
44 static JSClassRef getClassRef();
48 * The callback invoked when an object is first created.
50 static void Initialize(JSContextRef context, JSObjectRef object);
53 * The callback invoked when an object is finalized.
55 static void Finalize(JSObjectRef object);
58 * This structure contains properties and callbacks that define a type of object.
60 static JSClassDefinition m_classInfo;
63 * This structure describes a statically declared function property.
65 static JSStaticFunction m_functions[];
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
71 static JSStaticValue m_property[];
73 static JSClassRef m_classRef;
75 static JSValueRef requestLocalMessagePort(JSContextRef context,
77 JSObjectRef thisObject,
79 const JSValueRef arguments[],
80 JSValueRef* exception);
82 static JSValueRef requestTrustedLocalMessagePort(JSContextRef context,
84 JSObjectRef thisObject,
86 const JSValueRef arguments[],
87 JSValueRef* exception);
89 static JSValueRef requestRemoteMessagePort(JSContextRef context,
91 JSObjectRef thisObject,
93 const JSValueRef arguments[],
94 JSValueRef* exception);
96 static JSValueRef requestTrustedRemoteMessagePort(JSContextRef context,
98 JSObjectRef thisObject,
100 const JSValueRef arguments[],
101 JSValueRef* exception);
107 #endif // _TIZEN_MESSAGE_PORT_JS_MESSAGE_PORT_MANAGER_H_