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.
18 #ifndef TIZENAPIS_TIZEN_JS_APPLICATION_MANAGER_H_
19 #define TIZENAPIS_TIZEN_JS_APPLICATION_MANAGER_H_
21 #include <JavaScriptCore/JavaScript.h>
22 #include <CommonsJavaScript/PrivateObject.h>
23 #include "IApplicationManager.h"
26 namespace Application {
28 #define TIZEN_INTERFACE_APPLICATION_MANAGER "ApplicationManager"
30 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject
31 <IApplicationManagerPtr, WrtDeviceApis::CommonsJavaScript::NoOwnership> JSApplicationManagerPriv;
33 class JSApplicationManager {
35 static const JSClassDefinition* getClassInfo();
37 static const JSClassRef getClassRef();
39 static void setTitleProperty(JSContextRef context, std::string propertyValue);
43 * The callback invoked when an object is first created.
45 static void initialize(JSContextRef context, JSObjectRef object);
48 * The callback invoked when an object is finalized.
50 static void finalize(JSObjectRef object);
53 * The callback invoked when an object is used as the target of an 'instanceof' expression.
55 static bool hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception);
58 * Gets a current application
60 static JSValueRef getCurrentApplication(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
61 const JSValueRef arguments[], JSValueRef* exception);
64 * Launches a application with given application id
66 static JSValueRef launch(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
67 const JSValueRef arguments[], JSValueRef* exception);
70 * Kills the application based on application context.
72 static JSValueRef kill(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
73 const JSValueRef arguments[], JSValueRef* exception);
77 * exit current application
79 static JSValueRef setUserAgent(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
80 const JSValueRef arguments[], JSValueRef* exception);
83 * Gets the list of installed packages.
85 static JSValueRef getAppsInfo(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
86 const JSValueRef arguments[], JSValueRef* exception);
89 * Gets the list of running packages.
91 static JSValueRef getAppsContext(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
92 const JSValueRef arguments[], JSValueRef* exception);
95 * Gets the application information of based on the package name.
97 static JSValueRef getAppInfo(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
98 const JSValueRef arguments[], JSValueRef* exception);
101 * Gets the current application Context
103 static JSValueRef getAppContext(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
104 const JSValueRef arguments[], JSValueRef* exception);
107 * Watch for changes on installed applicaiton.
109 static JSValueRef addAppInfoEventListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
110 const JSValueRef arguments[], JSValueRef* exception);
113 * Unset installed Applications listener
115 static JSValueRef removeAppInfoEventListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
116 const JSValueRef arguments[], JSValueRef* exception);
119 * Launch a application control
121 static JSValueRef launchAppControl(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
122 const JSValueRef arguments[], JSValueRef* exception);
125 * Find application info list with application control
127 static JSValueRef findAppControl(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
128 const JSValueRef arguments[], JSValueRef* exception);
131 * Get certificate information of given application
133 static JSValueRef getAppCerts(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
134 const JSValueRef arguments[], JSValueRef* exception);
138 * This structure contains properties and callbacks that define a type of object.
140 static JSClassDefinition m_classInfo;
143 * This structure describes a statically declared function property.
145 static JSStaticFunction m_function[];
147 static JSClassRef m_jsClassRef;