0f7597099619d0f46a56ab0dc2e7424059589c12
[platform/framework/web/wrt-plugins-common.git] / src / CommonsJavaScript / JSPendingOperation.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  * @file        JSPendingOperation.h
18  * @author      Pete Cole (peter.cole@partner.samsung.com)
19  * @version     0.1
20  *              0.2 k.majewski@samsung.com
21  * @brief       Declaration of the JSPendingOperation class
22  */
23
24 #ifndef WRTDEVICEAPIS_COMMONSJAVASCRIPT_JS_PENDINGOPERATION_H_
25 #define WRTDEVICEAPIS_COMMONSJAVASCRIPT_JS_PENDINGOPERATION_H_
26
27 #include <JavaScriptCore/JavaScript.h>
28 #include <dpl/shared_ptr.h>
29 #include <Commons/IEvent.h>
30 #include <CommonsJavaScript/PrivateObject.h>
31 #include <CommonsJavaScript/JSPendingOperationPrivateObject.h>
32
33 namespace WrtDeviceApis {
34 namespace CommonsJavaScript {
35 //typedef Commons::PrivateObjectT<IJSPendingOperationPrivateObject*>::Type PendingOperationPrivateObject;
36
37 class JSPendingOperation
38 {
39   public:
40     /*
41      * This initializes this JS class in the JS Engine.
42      */
43     static JSClassRef getClassRef();
44
45   private:
46     /**
47      * The callback invoked when an object is first created.
48      */
49     static void initialize(JSContextRef context,
50             JSObjectRef object);
51
52     /**
53      * The callback invoked when an object is finalized.
54      */
55     static void finalize(JSObjectRef object);
56
57     /**
58      * This structure contains properties and callbacks that define a type of object.
59      */
60     static JSClassDefinition m_classInfo;
61
62     /**
63      * This structure describes a statically declared function property.
64      */
65     static JSStaticFunction m_functions[];
66
67     static JSClassRef m_classRef;
68
69     /**
70      * Cancel the pending operation, if it has yet not completed.
71      */
72     static JSValueRef cancel(JSContextRef context,
73             JSObjectRef object,
74             JSObjectRef thisObject,
75             size_t argumentCount,
76             const JSValueRef arguments[],
77             JSValueRef* exception);
78 };
79 } // CommonsJavaScript
80 } // WrtDeviceApis
81
82 #endif // _JS_WAC_PENDINGOPERATION_H_
83