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 JSRemoteMessagePort.cpp
21 * @brief Declaration of the JSRemoteMessagePort class
24 #ifndef _TIZEN_MESSAGE_PORT_JS_REMOTE_MESSAGE_PORT_H_
25 #define _TIZEN_MESSAGE_PORT_JS_REMOTE_MESSAGE_PORT_H_
27 #include <JavaScriptCore/JavaScript.h>
28 #include <CommonsJavaScript/PrivateObject.h>
29 #include "IRemoteMessagePort.h"
32 namespace MessagePort {
34 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject
35 <RemoteMessagePortPtr, WrtDeviceApis::CommonsJavaScript::NoOwnership> JSRemoteMessagePortPriv;
37 class JSRemoteMessagePort
41 static const JSClassRef getClassRef();
43 static const JSClassDefinition* getClassInfo();
45 static bool isObjectOfClass(JSContextRef context, JSValueRef value);
47 static RemoteMessagePortPtr getRemoteMessagePort(JSContextRef context, JSValueRef value);
51 * The callback invoked when an object is first created.
53 static void Initialize(JSContextRef context, JSObjectRef object);
56 * The callback invoked when an object is finalized.
58 static void Finalize(JSObjectRef object);
60 static JSClassDefinition m_classInfo;
62 static JSStaticFunction m_function[];
64 static JSStaticValue m_property[];
66 static JSClassRef m_jsClassRef;
68 static RemoteMessagePortPtr getPrivData(JSObjectRef object);
70 static JSValueRef getMessagePortName(JSContextRef context,
72 JSStringRef propertyName,
73 JSValueRef* exception);
75 static JSValueRef getAppId(JSContextRef context,
77 JSStringRef propertyName,
78 JSValueRef* exception);
80 static JSValueRef getIsTrusted(JSContextRef context,
82 JSStringRef propertyName,
83 JSValueRef* exception);
85 static JSValueRef sendMessage(JSContextRef context,
87 JSObjectRef thisObject,
89 const JSValueRef arguments[],
90 JSValueRef* exception);
96 #endif // _TIZEN_MESSAGE_PORT_JS_REMOTE_MESSAGE_PORT_H_