[WK2] Apply quota policy for LocalFileSystem
[framework/web/webkit-efl.git] / Source / WebKit2 / UIProcess / API / C / efl / tizen / WKPageTizen.h
1 /*
2  * Copyright (C) 2011 Samsung Electronics
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23  * THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 #ifndef WKPageTizen_h
27 #define WKPageTizen_h
28
29 #include <Eina.h>
30 #include <WebKit2/WKBase.h>
31 #include <WebKit2/WKGeometry.h>
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37 // html5 external video callback
38 typedef void (*WKPageHTML5VideoCallback)(WKPageRef page, WKStringRef url, WKStringRef cookie, const void* clientInfo);
39 // #if ENABLE(TIZEN_APPLICATION_CACHE)
40 typedef bool (*WKPageDecidePolicyForApplicationCachePermissionRequestCallback)(WKPageRef page, WKSecurityOriginRef origin, WKFrameRef frame, const void *clientInfo);
41 // #endif
42 // #if ENABLE(TIZEN_MEDIA_STREAM)
43 typedef void (*WKPageDecidePolicyForUserMediaPermissionRequestCallback)(WKPageRef page, WKUserMediaPermissionRequestRef permissionRequest, const void *clientInfo);
44 // #endif
45 // callback for jsbridge.
46 typedef void (*WKPageJSBridgePluginCallback)(WKPageRef page, WKStringRef request, WKStringRef message, const void* clientInfo);
47 // #if ENABLE(TIZEN_CERTIFICATE_HANDLING)
48 typedef bool (*WKPageDecidePolicyForCertificateErrorCallback)(WKPageRef page, WKStringRef url, WKStringRef certificate, int error, const void *clientInfo);
49 // #endif
50 //#if ENABLE(TIZEN_INDEXED_DATABASE)
51 typedef bool (*WKPageExceededIndexedDatabaseQuotaCallback)(WKPageRef page, WKSecurityOriginRef origin, long long currentUsage, WKFrameRef frame, const void* clientInfo);
52 //#endif
53 //#if ENABLE(TIZEN_FILE_SYSTEM)
54 typedef bool (*WKPageExceededLocalFileSystemQuotaCallback)(WKPageRef page, WKSecurityOriginRef origin, long long currentUsage, WKFrameRef frame, const void* clientInfo);
55 //#endif
56
57 struct WKPageTizenClient {
58     int                                                                 version;
59     const void *                                                        clientInfo;
60
61     // Version 0
62     // html5 video external player
63     WKPageHTML5VideoCallback                                            processHTML5Video;
64     // #if ENABLE(TIZEN_APPLICATION_CACHE)
65     WKPageDecidePolicyForApplicationCachePermissionRequestCallback      decidePolicyForApplicationCachePermissionRequest;
66     // #endif
67     // userMedia permission
68     // #if ENABLE(TIZEN_MEDIA_STREAM)
69     WKPageDecidePolicyForUserMediaPermissionRequestCallback             decidePolicyForUserMediaPermissionRequest;
70     // #endif
71     // jsbridge support the special call which can be reached from JS to Browser App.
72     WKPageJSBridgePluginCallback                                        processJSBridgePlugin;
73     // #if ENABLE(TIZEN_CERTIFICATE_HANDLING)
74     WKPageDecidePolicyForCertificateErrorCallback               decidePolicyForCertificateError;
75     // #endif
76     //#if ENABLE(TIZEN_INDEXED_DATABASE)
77     WKPageExceededIndexedDatabaseQuotaCallback                                  exceededIndexedDatabaseQuota;
78     //#endif
79     //#if ENABLE(TIZEN_FILE_SYSTEM)
80     WKPageExceededLocalFileSystemQuotaCallback                                  exceededLocalFileSystemQuota;
81     //#endif
82 };
83 typedef struct WKPageTizenClient WKPageTizenClient;
84
85 enum { kWKPageTizenClientCurrentVersion = 0 };
86
87 WK_EXPORT void WKPageSetPageTizenClient(WKPageRef page, const WKPageTizenClient* client);
88
89 /* Tizen Experimental feature */
90 WK_EXPORT WKImageRef WKPageCreateSnapshot(WKPageRef page, WKRect viewArea, float scaleFactor);
91 WK_EXPORT void WKPageGetSnapshotPdfFile(WKPageRef page, WKSize surfaceSize, WKSize contentsSize, WKStringRef fileName);
92
93 /* WK2 Recording Surface features */
94 WK_EXPORT void WKPageRecordingSurfaceSetEnable(WKPageRef page, bool enable);
95
96 /* WK2 ContextMenu Additional API */
97 WK_EXPORT WKStringRef WKPageContextMenuCopyAbsoluteLinkURLString(WKPageRef page);
98 WK_EXPORT WKStringRef WKPageContextMenuCopyAbsoluteImageURLString(WKPageRef page);
99
100 WK_EXPORT bool WKPageScrollBy(WKPageRef page, WKSize scrollOffset);
101
102 /* WK2 WebStorage APIs and callback */
103 // #if ENABLE(TIZEN_WEBKIT2_NUMBER_TYPE_SUPPORT)
104 typedef void (*WKPageGetWebStorageQuotaFunction)(WKUInt32Ref quota, WKErrorRef, void*);
105 WK_EXPORT void WKPageGetWebStorageQuota(WKPageRef page, void* context, WKPageGetWebStorageQuotaFunction function);
106 // #endif
107 WK_EXPORT void WKPageSetWebStorageQuota(WKPageRef page, uint32_t quota);
108
109 /* WK2 Meta Tag APIs and callback */
110 // #if ENABLE(TIZEN_SUPPORT_WEBAPP_META_TAG)
111 typedef void (*WKPageGetWebAppCapableFunction)(WKBooleanRef capable, WKErrorRef, void*);
112 WK_EXPORT void WKPageGetWebAppCapable(WKPageRef page, void* context, WKPageGetWebAppCapableFunction function);
113 typedef void (*WKPageGetWebAppIconURLFunction)(WKStringRef iconURL, WKErrorRef, void*);
114 WK_EXPORT void WKPageGetWebAppIconURL(WKPageRef page, void* context, WKPageGetWebAppIconURLFunction function);
115 typedef void (*WKPageGetWebAppIconURLsFunction)(WKDictionaryRef iconURLs, WKErrorRef, void*);
116 WK_EXPORT void WKPageGetWebAppIconURLs(WKPageRef page, void* context, WKPageGetWebAppIconURLsFunction function);
117 // #endif
118
119 WK_EXPORT void WKPageExecuteCommandWithArgument(WKPageRef page, WKStringRef command, WKStringRef argument);
120
121 // #if ENABLE(TIZEN_APPLICATION_CACHE)
122 WK_EXPORT void WKPageReplyApplicationCachePermission(WKPageRef page, bool allow);
123 // #endif
124
125 //#if ENABLE(TIZEN_INDEXED_DATABASE)
126 WK_EXPORT void WKPageReplyExceededIndexedDatabaseQuota(WKPageRef page, bool allow);
127 //#endif
128
129 // #if ENABLE(TIZEN_SQL_DATABASE)
130 WK_EXPORT void WKPageReplyExceededDatabaseQuota(WKPageRef page, bool allow);
131 // #endif
132
133 //#if ENABLE(TIZEN_FILE_SYSTEM)
134 WK_EXPORT void WKPageReplyExceededLocalFileSystemQuota(WKPageRef page, bool allow);
135 //#endif
136
137 #ifdef __cplusplus
138 }
139 #endif
140
141 #endif /* WKPageTizen_h */