tizen 2.3.1 release
[framework/web/wearable/wrt-plugins-tizen.git] / src / Filesystem / JSFilesystemManager.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  * @file        JSFilesystemManager.h
20  */
21
22 #ifndef TIZENAPIS_TIZEN_JSFILESYSTEMMANAGER_H_
23 #define TIZENAPIS_TIZEN_JSFILESYSTEMMANAGER_H_
24
25 #include <JavaScriptCore/JavaScript.h>
26 #include <CommonsJavaScript/PrivateObject.h>
27
28 #include <SecurityAccessor.h>
29 #include "Manager.h"
30
31 namespace DeviceAPI {
32 namespace Filesystem {
33
34 class JSFilesystemManager
35 {
36   public:
37     static const JSClassDefinition* getClassInfo();
38     static const JSClassRef getClassRef();
39
40   private:
41     static Manager* getPrivateObject(JSContextRef context, JSValueRef value);
42
43     /**
44      * newPriv - WARNING: pointer is not owned
45      *                    (use for example with &Manager::getInstance())
46      */
47     static void setPrivateObject(JSObjectRef object, Manager* newPriv);
48
49     /**
50      * The callback invoked when an object is first created.
51      */
52     static void initialize(JSContextRef context,
53             JSObjectRef object);
54
55     /**
56      * The callback invoked when an object is finalized.
57      */
58     static void finalize(JSObjectRef object);
59
60     /**
61      * The callback invoked when getting a property's value.
62      */
63     static JSValueRef getMaxPathLength(JSContextRef context,
64             JSObjectRef object,
65             JSStringRef propertyName,
66             JSValueRef* exception);
67
68     /**
69      * Resolves a location to a File handle.
70      */
71     static JSValueRef resolve(JSContextRef context,
72             JSObjectRef object,
73             JSObjectRef thisObject,
74             size_t argc,
75             const JSValueRef argv[],
76             JSValueRef* exception);
77
78     /**
79      * Get information about a storage based on it's label.
80      */
81     static JSValueRef getStorage(JSContextRef context,
82             JSObjectRef object,
83             JSObjectRef thisObject,
84             size_t argc,
85             const JSValueRef argv[],
86             JSValueRef* exception);
87
88     /**
89      * List the available storages on the device.
90      * Get the list of available internal and external storage devices.
91      */
92     static JSValueRef getStorageList(JSContextRef context,
93             JSObjectRef object,
94             JSObjectRef thisObject,
95             size_t argc,
96             const JSValueRef argv[],
97             JSValueRef* exception);
98
99     static JSValueRef addStorageStateListener(JSContextRef context,
100             JSObjectRef object,
101             JSObjectRef thisObject,
102             size_t argc,
103             const JSValueRef argv[],
104             JSValueRef* exception) ;
105
106     static JSValueRef removeStorageStateListener(JSContextRef context,
107             JSObjectRef object,
108             JSObjectRef thisObject,
109             size_t argc,
110             const JSValueRef argv[],
111             JSValueRef* exception);
112
113   private:
114     /**
115      * This structure describes a statically declared function property.
116      */
117     static JSStaticFunction m_functions[];
118
119     /**
120      * This structure describes a statically declared value property.
121      */
122     static JSStaticValue m_properties[];
123
124     /**
125      * This structure contains properties and callbacks that define a type of object.
126      */
127     static JSClassDefinition m_classInfo;
128
129     static JSClassRef m_classRef;
130 };
131 }
132 }
133
134 #endif