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 __TIZEN_JS_DOWNLOAD_MANAGER_H__
19 #define __TIZEN_JS_DOWNLOAD_MANAGER_H__
21 #include <JavaScriptCore/JavaScript.h>
26 class JSDownloadManager
29 static const JSClassDefinition* getClassInfo();
30 static const JSClassRef getClassRef();
35 * This member variable contains the values which has to be passed
36 * when the this class is embedded into JS Engine.
38 static JSClassDefinition m_classInfo;
41 * This structure describes a statically declared function property.
43 static JSStaticFunction m_function[];
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
50 static JSStaticValue m_property[];
52 static JSClassRef m_jsClassRef;
55 * The callback invoked when an object is first created.
57 static void initialize(JSContextRef context,
61 * The callback invoked when an object is finalized.
63 static void finalize(JSObjectRef object);
66 * Start a download operation.
68 static JSValueRef startDownload(JSContextRef context,
70 JSObjectRef thisObject,
72 const JSValueRef arguments[],
73 JSValueRef* exception);
76 * Cancel a download operation.
78 static JSValueRef cancelDownload(JSContextRef context,
80 JSObjectRef thisObject,
82 const JSValueRef arguments[],
83 JSValueRef* exception);
86 * Pause a download operation.
88 static JSValueRef pauseDownload(JSContextRef context,
90 JSObjectRef thisObject,
92 const JSValueRef arguments[],
93 JSValueRef* exception);
96 * Resume a paused download operation.
98 static JSValueRef resumeDownload(JSContextRef context,
100 JSObjectRef thisObject,
101 size_t argumentCount,
102 const JSValueRef arguments[],
103 JSValueRef* exception);
106 * Get the current state of a download operation.
108 static JSValueRef getState(JSContextRef context,
110 JSObjectRef thisObject,
111 size_t argumentCount,
112 const JSValueRef arguments[],
113 JSValueRef* exception);
116 * Get the DownloadRequest of a download operation.
118 static JSValueRef getDownloadRequest(JSContextRef context,
120 JSObjectRef thisObject,
121 size_t argumentCount,
122 const JSValueRef arguments[],
123 JSValueRef* exception);
126 * Get the MIME type of a downloaded file.
128 static JSValueRef getMIMEType(JSContextRef context,
130 JSObjectRef thisObject,
131 size_t argumentCount,
132 const JSValueRef arguments[],
133 JSValueRef* exception);
136 * Set the listener to the ongoing download operation.
138 static JSValueRef setListener(JSContextRef context,
140 JSObjectRef thisObject,
141 size_t argumentCount,
142 const JSValueRef arguments[],
143 JSValueRef* exception);
151 #endif // __TIZEN_JS_DOWNLOAD_MANAGER_H__