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 #ifndef TIZENAPIS_TIZEN_JS_REQUESTED_APPLICATION_CONTROL_H_
20 #define TIZENAPIS_TIZEN_JS_REQUESTED_APPLICATION_CONTROL_H_
22 #include <JavaScriptCore/JavaScript.h>
23 #include <CommonsJavaScript/PrivateObject.h>
24 #include "ApplicationControl.h"
25 #include "RequestedApplicationControl.h"
26 #include "JSApplicationControl.h"
27 #include "JSApplicationControlData.h"
30 namespace Application {
32 #define TIZEN_INTERFACE_REQUESTED_APPLICATION_CONTROL "RequestedApplicationControl"
33 #define TIZEN_APPLICATION_CONTROL "appControl"
34 #define TIZEN_CALLER_APP_ID "callerAppId"
36 typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT<RequestedApplicationControlPtr>::Type JSRequestedApplicationControlPriv;
38 class JSRequestedApplicationControl {
40 static const JSClassDefinition* getClassInfo();
42 static JSClassRef getClassRef();
45 * create an JSObject for callback function(onAnswerReceived).
47 static JSObjectRef createJSObject(JSContextRef context,
48 const RequestedApplicationControlPtr &appsvc);
51 static bool isObjectOfClass(JSContextRef context, JSValueRef value);
56 static JSValueRef replyResult(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
57 const JSValueRef arguments[], JSValueRef* exception);
62 static JSValueRef replyFailure(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
63 const JSValueRef arguments[], JSValueRef* exception);
65 static RequestedApplicationControlPtr getRequestedApplicationControl(JSContextRef context, JSValueRef value);
70 * The callback invoked when an object is first created.
72 static void initialize(JSContextRef context, JSObjectRef object);
75 * The callback invoked when an object is finalized.
77 static void finalize(JSObjectRef object);
79 static RequestedApplicationControlPtr getPrivData(JSObjectRef object);
83 * The callback invoked when getting a property's value.
85 static JSValueRef getProperty(JSContextRef context,
87 JSStringRef propertyName,
88 JSValueRef* exception);
91 * The callback invoked when setting a property's value.
94 static bool setProperty(JSContextRef context,
96 JSStringRef propertyName,
98 JSValueRef* exception);
102 * This structure contains properties and callbacks that define a type of object.
104 static JSClassDefinition m_classInfo;
107 * This structure describes a statically declared value property.
109 static JSStaticValue m_property[];
112 * This structure describes a statically declared function property.
114 static JSStaticFunction m_function[];
117 static JSClassRef m_jsClassRef;