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