6ff46355797f0099b73716d0890a42b613612b38
[framework/web/wrt-plugins-tizen.git] / src / Content / JSContentManager.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 _JS_TIZEN_CONTENTMANAGER_H_
20 #define _JS_TIZEN_CONTENTMANAGER_H_
21
22 #include <JavaScriptCore/JavaScript.h>
23 #include <CommonsJavaScript/PrivateObject.h>
24 #include <CommonsJavaScript/JSCallbackManager.h>
25 #include "IContentManager.h"
26
27 using namespace WrtDeviceApis::Commons;
28 using namespace WrtDeviceApis::CommonsJavaScript;
29
30
31 namespace DeviceAPI {
32 namespace Content {
33
34 typedef PrivateObject<IMediacontentManagerPtr, NoOwnership> MediacontentManagerPrivObject;
35
36 class JSMediacontentManager 
37 {
38 public:
39         static const JSClassDefinition* getClassInfo();
40         static const JSClassRef getClassRef();
41
42 private:
43
44 /*
45 static JSValueRef getMediacontent(
46                                         JSContextRef context,
47                                         JSObjectRef object,
48                                         JSObjectRef thisObject,
49                                         size_t argumentCount,
50                                         const JSValueRef arguments[],
51                                         JSValueRef* exception);
52 */
53         static IMediacontentManagerPtr getContentManagerPrivObject(
54                         JSContextRef ctx,
55                         const JSObjectRef object,
56                         JSValueRef* exception);
57
58             
59         /**
60          * The callback invoked when an object is first created.
61          */
62         static void initialize(JSContextRef context, JSObjectRef object);
63
64         /**
65          * The callback invoked when an object is finalized.
66          */
67         static void finalize(JSObjectRef object);
68
69
70
71         /**
72          * The callback invoked when getting a property's value.
73          */
74         static JSValueRef getProperty(
75                         JSContextRef context, 
76                         JSObjectRef object, 
77                         JSStringRef propertyName, 
78                         JSValueRef* exception);
79
80         /**
81          * The callback invoked when an object is used as the target of an 'instanceof' expression.
82          */
83         static bool hasInstance(
84                         JSContextRef context, 
85                         JSObjectRef constructor, 
86                         JSValueRef possibleInstance, 
87                         JSValueRef* exception);
88
89
90         static JSValueRef getFolders(
91                         JSContextRef context, 
92                         JSObjectRef object,
93                         JSObjectRef thisObject, 
94                         size_t argumentCount,
95                         const JSValueRef arguments[], 
96                         JSValueRef* exception);
97
98         static JSValueRef updateItem(
99                         JSContextRef context,
100                         JSObjectRef object,
101                         JSObjectRef thisObject,
102                         size_t argumentCount,
103                         const JSValueRef arguments[],
104                         JSValueRef* exception);
105
106         static JSValueRef updateItemsBatch(
107                         JSContextRef context,
108                         JSObjectRef object,
109                         JSObjectRef thisObject,
110                         size_t argumentCount,
111                         const JSValueRef arguments[],
112                         JSValueRef* exception);
113                         
114
115         static JSValueRef findItems(
116                         JSContextRef context, 
117                         JSObjectRef object,
118                         JSObjectRef thisObject, 
119                         size_t argumentCount,
120                         const JSValueRef arguments[],
121                         JSValueRef* exception);
122
123         static JSValueRef scanFile(
124                         JSContextRef context,
125                         JSObjectRef object,
126                         JSObjectRef thisObject,
127                         size_t argumentCount,
128                         const JSValueRef arguments[],
129                         JSValueRef* exception);
130
131         static JSValueRef setChangeListener(
132                         JSContextRef context,
133                         JSObjectRef object,
134                         JSObjectRef thisObject,
135                         size_t argumentCount,
136                         const JSValueRef arguments[],
137                         JSValueRef* exception);
138
139         static JSValueRef unsetChangeListener(
140                         JSContextRef context,
141                         JSObjectRef object,
142                         JSObjectRef thisObject,
143                         size_t argumentCount,
144                         const JSValueRef arguments[],
145                         JSValueRef* exception);
146
147
148         /**
149          * This structure contains properties and callbacks that define a type of object.
150          */
151         static JSClassDefinition m_classInfo;
152         static JSStaticFunction m_function[];
153
154         /**
155          * This structure describes a statically declared value property.
156          */
157         static JSStaticValue m_property[];
158
159         static JSClassRef m_jsClassRef;
160 };
161
162
163
164
165 #endif //_JS_TIZEN_CONTENTMANAGER_H_
166