Beta merge 2
[profile/ivi/wrt-plugins-tizen.git] / src / standards / Tizen / Application / JSApplication.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #ifndef TIZENAPIS_TIZEN_JS_APPLICATION_H_
18 #define TIZENAPIS_TIZEN_JS_APPLICATION_H_
19
20 #include <JavaScriptCore/JavaScript.h>
21 #include <CommonsJavaScript/PrivateObject.h>
22 #include <API/Application/IApplication.h>
23
24 namespace TizenApis {
25 namespace Tizen1_0 {
26 namespace Application {
27
28 typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT<Api::Application::IApplicationPtr>::Type JSApplicationPriv;
29
30 class JSApplication {
31 public:
32         static const JSClassDefinition* getClassInfo();
33
34         static const JSClassRef getClassRef();
35
36 private:
37         /**
38          * The callback invoked when an object is first created.
39          */
40         static void initialize(JSContextRef context, JSObjectRef object);
41
42         /**
43          * The callback invoked when an object is finalized.
44          */
45         static void finalize(JSObjectRef object);
46
47         /**
48          * The callback invoked when an object is used as the target of an 'instanceof' expression.
49          */
50         static bool hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception);
51
52         /**
53          * Launches a application with given application id
54          */
55         static JSValueRef launch(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
56                         const JSValueRef arguments[], JSValueRef* exception);
57
58         /**
59          * Kills the application based on application context.
60          */
61         static JSValueRef kill(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
62                         const JSValueRef arguments[], JSValueRef* exception);
63
64         /**
65          * hide the application based on application context.
66          */
67         static JSValueRef hide(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
68                         const JSValueRef arguments[], JSValueRef* exception);
69
70         /**
71          * exit current application
72          */
73         static JSValueRef exit(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
74                         const JSValueRef arguments[], JSValueRef* exception);
75
76         /**
77          * Gets the list of installed packages.
78          */
79         static JSValueRef getApplicationInformations(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
80                         const JSValueRef arguments[], JSValueRef* exception);
81
82         /**
83          * Gets the list of running packages.
84          */
85         static JSValueRef getRunningApplicationContexts(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
86                         const JSValueRef arguments[], JSValueRef* exception);   
87
88         /**
89          * Gets the application information of based on the package name.
90          */
91         static JSValueRef getApplicationInformation(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
92                         const JSValueRef arguments[], JSValueRef* exception);
93
94         /**
95          * Gets the current application Context
96          */
97         static JSValueRef getCurrentApplicationContext(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
98                         const JSValueRef arguments[], JSValueRef* exception);
99
100         /**
101          * Watch for changes on installed applicaiton.
102          */
103         static JSValueRef addApplicationInformationEventListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
104                         const JSValueRef arguments[], JSValueRef* exception);
105
106         /**
107          * Unset installed Applications listener
108          */
109         static JSValueRef removeApplicationInformationEventListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
110                         const JSValueRef arguments[], JSValueRef* exception);
111
112         /**
113          * Launch a service
114          */
115         static JSValueRef launchService(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
116                         const JSValueRef arguments[], JSValueRef* exception);
117
118         /**
119          * get request application service
120          */
121         static JSValueRef getApplicationService(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
122                         const JSValueRef arguments[], JSValueRef* exception);
123
124         /**
125          * This structure contains properties and callbacks that define a type of object.
126          */
127         static JSClassDefinition m_classInfo;
128
129         /**
130          * This structure describes a statically declared function property.
131          */
132         static JSStaticFunction m_function[];
133
134         static JSClassRef m_jsClassRef;
135
136 };
137
138 }
139 }
140 }
141 #endif