[Release] wrt-plugins-common_0.3.94
[platform/framework/web/wrt-plugins-common.git] / src / js-overlay / deprecated / JSClass / JSStorageEvent.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.0 (the "License");
5  *    you may not use this file except in compliance with the License.
6  *    You may obtain a copy of the License at
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *    Unless required by applicable law or agreed to in writing, software
11  *    distributed under the License is distributed on an "AS IS" BASIS,
12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *    See the License for the specific language governing permissions and
14  *    limitations under the License.
15  */
16 /**
17  *
18  * @file       JSStorageEvent.h
19  * @author     Andrzej Surdej (a.surdej@samsung.com)
20  * @version    0.1
21  * @brief
22  */
23
24 #ifndef _WRT_PLUGIN_JS_STORAGE_EVENT_H_
25 #define _WRT_PLUGIN_JS_STORAGE_EVENT_H_
26
27 #include <JavaScriptCore/JavaScript.h>
28 #include <CommonsJavaScript/PrivateObject.h>
29 #include <StorageEvent/IStorageEvent.h>
30
31 namespace WrtPlugins {
32 namespace W3C {
33 typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT<
34     WrtDeviceApis::StorageEvent::Api::IStorageEventPtr>::Type
35 JSStorageEventPrivateObject;
36
37 class JSStorageEvent
38 {
39   public:
40     /**
41      * This method initializes this in the JS Engine.
42      */
43     static JSClassRef getClassRef();
44
45     /**
46      * Gets object's class description.
47      */
48     static const JSClassDefinition* getClassInfo();
49
50   private:
51     /**
52      * The callback invoked when an object is first created.
53      */
54     static void initialize(JSContextRef context,
55                            JSObjectRef object);
56
57     /**
58      * The callback invoked when an object is finalized.
59      */
60     static void finalize(JSObjectRef object);
61
62     /**
63      * This structure describes a statically declared value property.
64      */
65     static JSStaticValue m_property[];
66
67     /**
68      * This structure contains properties and callbacks that define a type of
69      * object.
70      */
71     static JSClassDefinition m_classInfo;
72
73     static JSClassRef m_jsClassRef;
74
75     // getters for properties
76     static JSValueRef getKey(
77         JSContextRef context,
78         JSObjectRef object,
79         JSStringRef propertyName,
80         JSValueRef* exception);
81     static JSValueRef getOldValue(
82         JSContextRef context,
83         JSObjectRef object,
84         JSStringRef propertyName,
85         JSValueRef* exception);
86     static JSValueRef getNewValue(
87         JSContextRef context,
88         JSObjectRef object,
89         JSStringRef propertyName,
90         JSValueRef* exception);
91     static JSValueRef getUrl(
92         JSContextRef context,
93         JSObjectRef object,
94         JSStringRef propertyName,
95         JSValueRef* exception);
96     static JSValueRef getStorageArea(
97         JSContextRef context,
98         JSObjectRef object,
99         JSStringRef propertyName,
100         JSValueRef* exception);
101
102     static WrtDeviceApis::StorageEvent::Api::IStorageEventPtr
103     getPrivateObject(JSObjectRef arg);
104 };
105 } // W3C
106 } // WrtPlugins
107
108 #endif // _WRT_PLUGIN_JS_STORAGE_EVENT_H_