Update change log and spec for wrt-plugins-tizen_0.4.9
[platform/framework/web/wrt-plugins-tizen.git] / src / Application / JSApplicationInformation.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
19 #ifndef TIZENAPIS_TIZEN_JS_APPLICATION_INFORMATION_H_
20 #define TIZENAPIS_TIZEN_JS_APPLICATION_INFORMATION_H_
21
22 #include <JavaScriptCore/JavaScript.h>
23 #include <CommonsJavaScript/PrivateObject.h>
24 #include <dpl/shared_ptr.h>
25 #include "ApplicationInformation.h"
26
27 namespace DeviceAPI {
28 namespace Application {
29
30 #define TIZEN_INTERFACE_APPLICATION_INFORMATION "ApplicationInformation"
31
32 #define TIZEN_APPLICATION_INFORMATION_ID "id"
33 #define TIZEN_APPLICATION_INFORMATION_NAME "name"
34 #define TIZEN_APPLICATION_INFORMATION_ICONPATH "iconPath"
35 #define TIZEN_APPLICATION_INFORMATION_VERSION "version"
36 #define TIZEN_APPLICATION_INFORMATION_SHOW "show"
37 #define TIZEN_APPLICATION_INFORMATION_CATEGORIES "categories"
38 #define TIZEN_APPLICATION_INFORMATION_INSTALL_DATE "installDate"
39 #define TIZEN_APPLICATION_INFORMATION_INSTALL_SIZE "size"
40 #define TIZEN_APPLICATION_INFORMATION_PACKAGE_ID "packageId"
41
42 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<ApplicationInformationPtr, WrtDeviceApis::CommonsJavaScript::NoOwnership> JSApplicationInformationPriv;
43
44 class JSApplicationInformation {
45 public:
46         /*
47         * This initializes this JS class in the JS Engine.
48         */
49         static JSClassRef getClassRef();
50
51         static JSValueRef createJSObject(JSContextRef context,
52                         const std::string &name,
53                         const std::string &package,
54                         const std::string &iconPath,
55                         const std::string &version,
56                         const bool &show,
57                         const std::vector<std::string> &categories,
58                         const time_t &installDate,
59                         const long &installSize,
60                         const std::string &pkgId);
61
62         static bool isObjectOfClass(JSContextRef context, JSValueRef value);
63
64         static ApplicationInformationPtr 
65                 getApplicationInformation(JSContextRef context, JSValueRef value);
66
67 private:
68    /**
69         * The callback invoked when an object is first created.
70         */
71         static void initialize(JSContextRef context, JSObjectRef object);
72
73    /**
74         * The callback invoked when an object is finalized.
75         */
76         static void finalize(JSObjectRef object);
77
78    /**
79         * This structure contains properties and callbacks that define a type of object.
80         */
81         static JSClassDefinition m_classInfo;
82
83    /**
84         * This structure describes a statically declared function property.
85         */
86         static JSStaticFunction m_functions[];
87
88         /**
89          * This member variable contains the initialization values for the static properties of this class.
90          * The values are given according to the data structure JSPropertySpec
91          */
92         static JSStaticValue m_property[];
93
94         static JSClassRef m_classRef;
95
96         static ApplicationInformationPtr getPrivData(JSObjectRef object);
97
98         static JSValueRef getProperty(JSContextRef context,
99                 JSObjectRef object,
100                 JSStringRef propertyName,
101                 JSValueRef* exception);
102
103 };
104
105 }
106 }
107 #endif