Initialize Tizen 2.3
[framework/web/wrt-plugins-common.git] / src_mobile / 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
36 // PendingOperationPrivateObject;
37
38 class JSPendingOperation
39 {
40   public:
41     /*
42      * This initializes this JS class in the JS Engine.
43      */
44     static JSClassRef getClassRef();
45
46   private:
47     /**
48      * The callback invoked when an object is first created.
49      */
50     static void initialize(JSContextRef context,
51                            JSObjectRef object);
52
53     /**
54      * The callback invoked when an object is finalized.
55      */
56     static void finalize(JSObjectRef object);
57
58     /**
59      * This structure contains properties and callbacks that define a type of
60      * object.
61      */
62     static JSClassDefinition m_classInfo;
63
64     /**
65      * This structure describes a statically declared function property.
66      */
67     static JSStaticFunction m_functions[];
68
69     static JSClassRef m_classRef;
70
71     /**
72      * Cancel the pending operation, if it has yet not completed.
73      */
74     static JSValueRef cancel(JSContextRef context,
75                              JSObjectRef object,
76                              JSObjectRef thisObject,
77                              size_t argumentCount,
78                              const JSValueRef arguments[],
79                              JSValueRef* exception);
80 };
81 } // CommonsJavaScript
82 } // WrtDeviceApis
83
84 #endif // _JS_WAC_PENDINGOPERATION_H_
85