Update change log and spec for wrt-plugins-tizen_0.4.9
[platform/framework/web/wrt-plugins-tizen.git] / src / Application / JSRequestedApplicationControl.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 #ifndef TIZENAPIS_TIZEN_JS_REQUESTED_APPLICATION_CONTROL_H_
20 #define TIZENAPIS_TIZEN_JS_REQUESTED_APPLICATION_CONTROL_H_
21
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"
28
29 namespace DeviceAPI {
30 namespace Application {
31
32 #define TIZEN_INTERFACE_REQUESTED_APPLICATION_CONTROL "RequestedApplicationControl"
33 #define TIZEN_APPLICATION_CONTROL "appControl"
34 #define TIZEN_CALLER_APP_ID "callerAppId"
35
36 typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT<RequestedApplicationControlPtr>::Type JSRequestedApplicationControlPriv;
37
38 class JSRequestedApplicationControl {
39 public:
40         static const JSClassDefinition* getClassInfo();
41
42         static JSClassRef getClassRef();
43
44         /**
45           * create an JSObject for callback function(onAnswerReceived).
46           */
47         static JSObjectRef createJSObject(JSContextRef context,
48                            const RequestedApplicationControlPtr &appsvc);
49
50         /**
51          * The Constructor of ApplicationControl
52          */
53         static JSObjectRef constructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
54
55
56         static bool isObjectOfClass(JSContextRef context, JSValueRef value);
57
58         /**
59          * Send Success Result
60          */
61         static JSValueRef replyResult(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
62                         const JSValueRef arguments[], JSValueRef* exception);
63
64         /**
65          * Send Failure Result
66          */
67         static JSValueRef replyFailure(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
68                         const JSValueRef arguments[], JSValueRef* exception);
69
70         static RequestedApplicationControlPtr getRequestedApplicationControl(JSContextRef context, JSValueRef value);
71
72
73 private:
74         /**
75          * The callback invoked when an object is first created.
76          */
77         static void initialize(JSContextRef context, JSObjectRef object);
78
79    /**
80          * The callback invoked when an object is finalized.
81          */
82         static void finalize(JSObjectRef object);
83
84     static RequestedApplicationControlPtr getPrivData(JSObjectRef object);
85
86
87   /**
88      * The callback invoked when getting a property's value.
89      */
90     static JSValueRef getProperty(JSContextRef context,
91             JSObjectRef object,
92             JSStringRef propertyName,
93             JSValueRef* exception);
94
95   /**
96          * The callback invoked when setting a property's value.
97          */
98
99         static bool setProperty(JSContextRef context,
100                   JSObjectRef object,
101                   JSStringRef propertyName,
102                   JSValueRef value,
103                   JSValueRef* exception);
104
105   /**
106      * The callback invoked when an object is used as the target of an 'instanceof' expression.
107      */
108     static bool hasInstance(JSContextRef context,
109             JSObjectRef constructor,
110             JSValueRef possibleInstance,
111             JSValueRef* exception);
112
113   /**
114      * This structure contains properties and callbacks that define a type of object.
115      */
116     static JSClassDefinition m_classInfo;
117
118   /**
119      * This structure describes a statically declared value property.
120      */
121     static JSStaticValue m_property[];
122
123         /**
124          * This structure describes a statically declared function property.
125          */
126         static JSStaticFunction m_function[];
127
128
129     static JSClassRef m_jsClassRef;
130
131 };
132
133 } //
134 } //TizenApis
135
136 #endif