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