2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef TIZENAPIS_TIZEN_JS_APPLICATION_SERVICE_H_
18 #define TIZENAPIS_TIZEN_JS_APPLICATION_SERVICE_H_
20 #include <JavaScriptCore/JavaScript.h>
21 #include <CommonsJavaScript/PrivateObject.h>
22 #include <API/Application/ApplicationService.h>
23 #include "JSApplicationServiceData.h"
27 namespace Application {
29 typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT<Api::Application::ApplicationServicePtr>::Type JSApplicationServicePriv;
31 class JSApplicationService {
33 static const JSClassDefinition* getClassInfo();
35 static const JSClassRef getClassRef();
38 * create an JSObject for callback function(onAnswerReceived).
40 static JSObjectRef createJSObject(JSContextRef context,
41 const Api::Application::ApplicationServicePtr &appsvc);
44 * The Constructor of ApplicationService
46 static JSObjectRef constructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
49 static bool isObjectOfClass(JSContextRef context, JSValueRef value);
51 static Api::Application::ApplicationServicePtr getApplicationService(JSContextRef context, JSValueRef value);
55 static Api::Application::ApplicationServicePtr getPrivateData(JSObjectRef object);
60 static JSValueRef replyResult(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
61 const JSValueRef arguments[], JSValueRef* exception);
66 static JSValueRef replyFailure(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
67 const JSValueRef arguments[], JSValueRef* exception);
71 * The callback invoked when an object is first created.
73 static void initialize(JSContextRef context, JSObjectRef object);
76 * The callback invoked when an object is finalized.
78 static void finalize(JSObjectRef object);
81 * The callback invoked when getting a property's value.
83 static JSValueRef getProperty(JSContextRef context,
85 JSStringRef propertyName,
86 JSValueRef* exception);
89 * The callback invoked when an object is used as the target of an 'instanceof' expression.
91 static bool hasInstance(JSContextRef context,
92 JSObjectRef constructor,
93 JSValueRef possibleInstance,
94 JSValueRef* exception);
97 * This structure contains properties and callbacks that define a type of object.
99 static JSClassDefinition m_classInfo;
102 * This structure describes a statically declared value property.
104 static JSStaticValue m_property[];
106 static JSClassRef m_jsClassRef;