tizen 2.3.1 release
[framework/web/mobile/wrt-plugins-tizen.git] / src / Download / JSDownloadManager.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 __TIZEN_JS_DOWNLOAD_MANAGER_H__
19 #define __TIZEN_JS_DOWNLOAD_MANAGER_H__
20
21 #include <JavaScriptCore/JavaScript.h>
22
23 namespace DeviceAPI {
24 namespace Download {
25
26 class JSDownloadManager
27 {
28 public:
29     static const JSClassDefinition* getClassInfo();
30     static const JSClassRef getClassRef();
31
32 private:
33
34     /**
35      * This member variable contains the values which has to be passed
36      * when the this class is embedded into JS Engine.
37      */
38     static JSClassDefinition m_classInfo;
39
40     /**
41      * This structure describes a statically declared function property.
42      */
43     static JSStaticFunction m_function[];
44
45     /**
46      * This member variable contains the initialization values for the
47      * properties of this class. The values are given according to
48      * the data structure JSPropertySpec
49      */
50     static JSStaticValue m_property[];
51
52     static JSClassRef m_jsClassRef;
53
54     /**
55      * The callback invoked when an object is first created.
56      */
57     static void initialize(JSContextRef context,
58             JSObjectRef object);
59
60     /**
61      * The callback invoked when an object is finalized.
62      */
63     static void finalize(JSObjectRef object);
64
65     /**
66      * Start a download operation.
67      */
68     static JSValueRef startDownload(JSContextRef context,
69             JSObjectRef object,
70             JSObjectRef thisObject,
71             size_t argumentCount,
72             const JSValueRef arguments[],
73             JSValueRef* exception);
74
75     /**
76      * Cancel a download operation.
77      */
78     static JSValueRef cancelDownload(JSContextRef context,
79             JSObjectRef object,
80             JSObjectRef thisObject,
81             size_t argumentCount,
82             const JSValueRef arguments[],
83             JSValueRef* exception);
84
85     /**
86      * Pause a download operation.
87      */
88     static JSValueRef pauseDownload(JSContextRef context,
89             JSObjectRef object,
90             JSObjectRef thisObject,
91             size_t argumentCount,
92             const JSValueRef arguments[],
93             JSValueRef* exception);
94
95     /**
96      * Resume a paused download operation.
97      */
98     static JSValueRef resumeDownload(JSContextRef context,
99             JSObjectRef object,
100             JSObjectRef thisObject,
101             size_t argumentCount,
102             const JSValueRef arguments[],
103             JSValueRef* exception);
104
105     /**
106      * Get the current state of a download operation.
107      */
108     static JSValueRef getState(JSContextRef context,
109             JSObjectRef object,
110             JSObjectRef thisObject,
111             size_t argumentCount,
112             const JSValueRef arguments[],
113             JSValueRef* exception);
114
115     /**
116      * Get the DownloadRequest of a download operation.
117      */
118     static JSValueRef getDownloadRequest(JSContextRef context,
119             JSObjectRef object,
120             JSObjectRef thisObject,
121             size_t argumentCount,
122             const JSValueRef arguments[],
123             JSValueRef* exception);
124
125     /**
126      * Get the MIME type of a downloaded file.
127      */
128     static JSValueRef getMIMEType(JSContextRef context,
129             JSObjectRef object,
130             JSObjectRef thisObject,
131             size_t argumentCount,
132             const JSValueRef arguments[],
133             JSValueRef* exception);
134
135     /**
136      * Set the listener to the ongoing download operation.
137      */
138     static JSValueRef setListener(JSContextRef context,
139             JSObjectRef object,
140             JSObjectRef thisObject,
141             size_t argumentCount,
142             const JSValueRef arguments[],
143             JSValueRef* exception);
144
145 };
146
147
148 } // Download
149 } // DeviceAPI
150
151 #endif // __TIZEN_JS_DOWNLOAD_MANAGER_H__