b3247ae015fc999b52449607dd4156df969b593e
[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          * Gets the list of installed packages.
54          */
55         static JSValueRef listInstalledApplications(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
56                         const JSValueRef arguments[], JSValueRef* exception);
57
58         /**
59          * Gets the list of running packages.
60          */
61         static JSValueRef listRunningApplications(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
62                         const JSValueRef arguments[], JSValueRef* exception);   
63
64         /**
65          * Gets the application information of based on the package name.
66          */
67         static JSValueRef getApplicationInformation(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
68                         const JSValueRef arguments[], JSValueRef* exception);
69
70         /**
71          * Watch for changes on installed applicaiton.
72          */
73         static JSValueRef addApplicationListChangeListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
74                         const JSValueRef arguments[], JSValueRef* exception);
75
76         /**
77          * Unset installed Applications listener
78          */
79         static JSValueRef removeApplicationListChangeListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
80                         const JSValueRef arguments[], JSValueRef* exception);
81
82         /**
83          * Launch a service
84          */
85         static JSValueRef launchService(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
86                         const JSValueRef arguments[], JSValueRef* exception);
87
88         /**
89          * This structure contains properties and callbacks that define a type of object.
90          */
91         static JSClassDefinition m_classInfo;
92
93         /**
94          * This structure describes a statically declared function property.
95          */
96         static JSStaticFunction m_function[];
97
98         static JSClassRef m_jsClassRef;
99
100 };
101
102 }
103 }
104 }
105 #endif