Update change log and spec for wrt-plugins-tizen_0.4.70
[framework/web/wrt-plugins-tizen.git] / src / Application / JSApplicationManager.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 #ifndef TIZENAPIS_TIZEN_JS_APPLICATION_MANAGER_H_
19 #define TIZENAPIS_TIZEN_JS_APPLICATION_MANAGER_H_
20
21 #include <JavaScriptCore/JavaScript.h>
22 #include <CommonsJavaScript/PrivateObject.h>
23 #include "IApplicationManager.h"
24
25 namespace DeviceAPI {
26 namespace Application {
27
28 #define TIZEN_INTERFACE_APPLICATION_MANAGER "ApplicationManager"
29
30 class JSApplicationManager {
31 public:
32         static const JSClassDefinition* getClassInfo();
33
34         static const JSClassRef getClassRef();
35
36         //static void setTitleProperty(JSContextRef context, std::string propertyValue);
37
38 private:
39         /**
40          * The callback invoked when an object is first created.
41          */
42         static void initialize(JSContextRef context, JSObjectRef object);
43
44         /**
45          * The callback invoked when an object is finalized.
46          */
47         static void finalize(JSObjectRef object);
48
49         /**
50          * Gets a current application
51          */
52         static JSValueRef getCurrentApplication(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
53                         const JSValueRef arguments[], JSValueRef* exception);
54
55         /**
56          * Launches a application with given application id
57          */
58         static JSValueRef launch(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
59                         const JSValueRef arguments[], JSValueRef* exception);
60
61         /**
62          * Kills the application based on application context.
63          */
64         static JSValueRef kill(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
65                         const JSValueRef arguments[], JSValueRef* exception);
66
67
68         /**
69          * exit current application
70          */
71         static JSValueRef setUserAgent(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
72                         const JSValueRef arguments[], JSValueRef* exception);
73
74         /**
75          * Gets the list of installed packages.
76          */
77         static JSValueRef getAppsInfo(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
78                         const JSValueRef arguments[], JSValueRef* exception);
79
80         /**
81          * Gets the list of running packages.
82          */
83         static JSValueRef getAppsContext(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
84                         const JSValueRef arguments[], JSValueRef* exception);   
85
86         /**
87          * Gets the application information of based on the package name.
88          */
89         static JSValueRef getAppInfo(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
90                         const JSValueRef arguments[], JSValueRef* exception);
91
92         /**
93          * Gets the current application Context
94          */
95         static JSValueRef getAppContext(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
96                         const JSValueRef arguments[], JSValueRef* exception);
97
98         /**
99          * Watch for changes on installed applicaiton.
100          */
101         static JSValueRef addAppInfoEventListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
102                         const JSValueRef arguments[], JSValueRef* exception);
103
104         /**
105          * Unset installed Applications listener
106          */
107         static JSValueRef removeAppInfoEventListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
108                         const JSValueRef arguments[], JSValueRef* exception);
109
110         /**
111          * Launch a application control
112          */
113         static JSValueRef launchAppControl(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
114                         const JSValueRef arguments[], JSValueRef* exception);
115
116         /**
117          * Find application info list with application control
118          */
119         static JSValueRef findAppControl(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
120                         const JSValueRef arguments[], JSValueRef* exception);
121
122         /**
123          * Get certificate information of given application
124          */
125         static JSValueRef getAppCerts(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
126                         const JSValueRef arguments[], JSValueRef* exception);
127
128         /**
129          * Get shared directory URI of specific application
130          */
131         static JSValueRef getAppSharedURI(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
132                         const JSValueRef arguments[], JSValueRef* exception);
133
134         /**
135          * Get meta data of specific application
136          */
137         static JSValueRef getAppMetaData(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
138                         const JSValueRef arguments[], JSValueRef* exception);
139
140         /**
141          * This structure contains properties and callbacks that define a type of object.
142          */
143         static JSClassDefinition m_classInfo;
144
145         /**
146          * This structure describes a statically declared function property.
147          */
148         static JSStaticFunction m_function[];
149
150         static JSClassRef m_jsClassRef;
151 };
152
153 }
154 }
155 #endif