94
|
1 |
/*
|
|
2 |
* Copyright (c) 2000 - 2001 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef NW_HED_CONTENTHANDLER_H
|
|
20 |
#define NW_HED_CONTENTHANDLER_H
|
|
21 |
|
|
22 |
#include "nw_hed_documentnode.h"
|
|
23 |
#include "nw_hed_historyentry.h"
|
|
24 |
#include "nw_hed_urlrequest.h"
|
|
25 |
#include "nw_hed_urlresponse.h"
|
|
26 |
#include "nw_text_ucs2.h"
|
|
27 |
#include "urlloader_urlresponse.h"
|
|
28 |
#include "BrsrStatusCodes.h"
|
|
29 |
|
|
30 |
#ifdef __cplusplus
|
|
31 |
extern "C" {
|
|
32 |
#endif /* __cplusplus */
|
|
33 |
|
|
34 |
/* ------------------------------------------------------------------------- *
|
|
35 |
public constants
|
|
36 |
* ------------------------------------------------------------------------- */
|
|
37 |
typedef enum NW_HED_ContentHandler_Feature_e {
|
|
38 |
NW_HED_ContentHandler_NoFeatures = 0,
|
|
39 |
NW_HED_ContentHandler_HitoryPrevUseStale
|
|
40 |
} NW_HED_ContentHandler_Feature_t;
|
|
41 |
|
|
42 |
/* ------------------------------------------------------------------------- */
|
|
43 |
typedef struct NW_HED_ContentHandler_Class_s NW_HED_ContentHandler_Class_t;
|
|
44 |
typedef struct NW_HED_ContentHandler_s NW_HED_ContentHandler_t;
|
|
45 |
|
|
46 |
/* ------------------------------------------------------------------------- */
|
|
47 |
typedef
|
|
48 |
TBrowserStatusCode
|
|
49 |
(*NW_HED_ContentHandler_PartialNextChunk_t) (NW_HED_ContentHandler_t* thisObj,
|
|
50 |
NW_Int32 chunkIndex,
|
|
51 |
NW_Url_Resp_t* response,
|
|
52 |
void* context);
|
|
53 |
|
|
54 |
typedef
|
|
55 |
const NW_Text_t*
|
|
56 |
(*NW_HED_ContentHandler_GetTitle_t) (NW_HED_ContentHandler_t* thisObj);
|
|
57 |
|
|
58 |
typedef
|
|
59 |
const NW_Text_t*
|
|
60 |
(*NW_HED_ContentHandler_GetURL_t) (NW_HED_ContentHandler_t* thisObj);
|
|
61 |
|
|
62 |
typedef
|
|
63 |
TBrowserStatusCode
|
|
64 |
(*NW_HED_ContentHandler_ResolveURL_t) (NW_HED_ContentHandler_t* thisObj, NW_Text_t* url, NW_Text_t** retUrl);
|
|
65 |
|
|
66 |
typedef
|
|
67 |
NW_HED_HistoryEntry_t*
|
|
68 |
(*NW_HED_ContentHandler_CreateHistoryEntry_t) (NW_HED_ContentHandler_t* thisObj,
|
|
69 |
NW_HED_UrlRequest_t* urlRequest,
|
|
70 |
NW_HED_UrlResponse_t* urlResponse);
|
|
71 |
|
|
72 |
typedef
|
|
73 |
NW_HED_HistoryEntry_t*
|
|
74 |
(*NW_HED_ContentHandler_CreateIntraDocumentHistoryEntry_t) (NW_HED_ContentHandler_t* thisObj,
|
|
75 |
const NW_Text_t* requestUrl,
|
|
76 |
const NW_Text_t* responseUrl);
|
|
77 |
|
|
78 |
typedef
|
|
79 |
NW_HED_UrlResponse_t*
|
|
80 |
(*NW_HED_ContentHandler_NewUrlResponse_t) (NW_HED_ContentHandler_t* thisObj,
|
|
81 |
NW_Url_Resp_t* response);
|
|
82 |
|
|
83 |
typedef
|
|
84 |
TBrowserStatusCode
|
|
85 |
(*NW_HED_ContentHandler_CreateBoxTree_t) (NW_HED_ContentHandler_t* thisObj,
|
|
86 |
NW_LMgr_Box_t** boxTree);
|
|
87 |
|
|
88 |
typedef
|
|
89 |
TBrowserStatusCode
|
|
90 |
(*NW_HED_ContentHandler_HandleRequest_t) (NW_HED_ContentHandler_t* thisObj,
|
|
91 |
NW_HED_UrlRequest_t* urlRequest);
|
|
92 |
|
|
93 |
typedef
|
|
94 |
TBrowserStatusCode
|
|
95 |
(*NW_HED_ContentHandler_FeatureQuery_t) (NW_HED_ContentHandler_t* thisObj,
|
|
96 |
NW_HED_ContentHandler_Feature_t featureId);
|
|
97 |
|
|
98 |
typedef
|
|
99 |
TBrowserStatusCode
|
|
100 |
(*NW_HED_ContentHandler_ResponseComplete_t) (NW_HED_ContentHandler_t* thisObj,
|
|
101 |
NW_Url_Resp_t* response,
|
|
102 |
void* context);
|
|
103 |
|
|
104 |
/* ------------------------------------------------------------------------- */
|
|
105 |
typedef struct NW_HED_ContentHandler_ClassPart_s {
|
|
106 |
NW_HED_ContentHandler_PartialNextChunk_t partialNextChunk;
|
|
107 |
NW_HED_ContentHandler_GetTitle_t getTitle;
|
|
108 |
NW_HED_ContentHandler_GetURL_t getUrl;
|
|
109 |
NW_HED_ContentHandler_ResolveURL_t resolveUrl;
|
|
110 |
NW_HED_ContentHandler_CreateHistoryEntry_t createHistoryEntry;
|
|
111 |
NW_HED_ContentHandler_CreateIntraDocumentHistoryEntry_t createIntraDocumentHistoryEntry;
|
|
112 |
NW_HED_ContentHandler_NewUrlResponse_t newUrlResponse;
|
|
113 |
NW_HED_ContentHandler_CreateBoxTree_t createBoxTree;
|
|
114 |
NW_HED_ContentHandler_HandleRequest_t handleRequest;
|
|
115 |
NW_HED_ContentHandler_FeatureQuery_t featureQuery;
|
|
116 |
NW_HED_ContentHandler_ResponseComplete_t responseComplete;
|
|
117 |
} NW_HED_ContentHandler_ClassPart_t;
|
|
118 |
|
|
119 |
/* ------------------------------------------------------------------------- */
|
|
120 |
struct NW_HED_ContentHandler_Class_s {
|
|
121 |
NW_Object_Core_ClassPart_t NW_Object_Core;
|
|
122 |
NW_Object_Base_ClassPart_t NW_Object_Base;
|
|
123 |
NW_Object_Dynamic_ClassPart_t NW_Object_Dynamic;
|
|
124 |
NW_HED_DocumentNode_ClassPart_t NW_HED_DocumentNode;
|
|
125 |
NW_HED_ContentHandler_ClassPart_t NW_HED_ContentHandler;
|
|
126 |
};
|
|
127 |
|
|
128 |
/* ------------------------------------------------------------------------- */
|
|
129 |
struct NW_HED_ContentHandler_s {
|
|
130 |
NW_HED_DocumentNode_t super;
|
|
131 |
|
|
132 |
/* member variables */
|
|
133 |
NW_HED_HistoryEntry_t* associatedHistoryEntry;
|
|
134 |
NW_LMgr_Box_t* boxTree;
|
|
135 |
NW_Bool isEmbeddable;
|
|
136 |
NW_Int32 outstandingDecoderOps;
|
|
137 |
NW_Bool needsRelayout;
|
|
138 |
NW_Bool initialized;
|
|
139 |
|
|
140 |
// partial buffer
|
|
141 |
NW_Url_Resp_t* response;
|
|
142 |
};
|
|
143 |
|
|
144 |
/* ------------------------------------------------------------------------- */
|
|
145 |
#define NW_HED_ContentHandler_GetClassPart(_object) \
|
|
146 |
(NW_Object_GetClassPart (_object, NW_HED_ContentHandler))
|
|
147 |
|
|
148 |
#define NW_HED_ContentHandlerOf(_object) \
|
|
149 |
(NW_Object_Cast (_object, NW_HED_ContentHandler))
|
|
150 |
|
|
151 |
/* ------------------------------------------------------------------------- */
|
|
152 |
NW_HED_EXPORT const NW_HED_ContentHandler_Class_t NW_HED_ContentHandler_Class;
|
|
153 |
|
|
154 |
/* ------------------------------------------------------------------------- */
|
|
155 |
NW_HED_EXPORT
|
|
156 |
const NW_HED_UrlRequest_t*
|
|
157 |
_NW_HED_ContentHandler_GetUrlRequest(NW_HED_ContentHandler_t* thisObj);
|
|
158 |
|
|
159 |
NW_HED_EXPORT
|
|
160 |
const NW_HED_UrlResponse_t*
|
|
161 |
_NW_HED_ContentHandler_GetUrlResponse(NW_HED_ContentHandler_t* thisObj);
|
|
162 |
|
|
163 |
NW_HED_EXPORT
|
|
164 |
TBrowserStatusCode
|
|
165 |
_NW_HED_ContentHandler_SetAssociatedHistoryEntry (NW_HED_ContentHandler_t* thisObj,
|
|
166 |
NW_HED_HistoryEntry_t* entry);
|
|
167 |
|
|
168 |
NW_HED_EXPORT
|
|
169 |
NW_HED_HistoryEntry_t*
|
|
170 |
_NW_HED_ContentHandler_GetAssociatedHistoryEntry (NW_HED_ContentHandler_t* thisObj);
|
|
171 |
|
|
172 |
/* ------------------------------------------------------------------------- */
|
|
173 |
#define NW_HED_ContentHandler_PartialNextChunk(_object, _chunkIndex, _response, _context) \
|
|
174 |
(NW_Object_Invoke (_object, NW_HED_ContentHandler, partialNextChunk) \
|
|
175 |
(NW_HED_ContentHandlerOf (_object), (_chunkIndex), (_response), (_context)))
|
|
176 |
|
|
177 |
#define NW_HED_ContentHandler_GetTitle(_object) \
|
|
178 |
(NW_Object_Invoke (_object, NW_HED_ContentHandler, getTitle) \
|
|
179 |
(NW_HED_ContentHandlerOf (_object)))
|
|
180 |
|
|
181 |
#define NW_HED_ContentHandler_CreateHistoryEntry(_object, _urlRequest, _urlResponse) \
|
|
182 |
(NW_Object_Invoke (_object, NW_HED_ContentHandler, createHistoryEntry) \
|
|
183 |
(NW_HED_ContentHandlerOf(_object), NW_HED_UrlRequestOf (_urlRequest), \
|
|
184 |
NW_HED_UrlResponseOf (_urlResponse)))
|
|
185 |
|
|
186 |
#define NW_HED_ContentHandler_CreateIntraDocumentHistoryEntry(_object, _requestUrl, _responseUrl) \
|
|
187 |
(NW_Object_Invoke (_object, NW_HED_ContentHandler, createIntraDocumentHistoryEntry) \
|
|
188 |
(NW_HED_ContentHandlerOf(_object), NW_TextOf (_requestUrl), \
|
|
189 |
NW_TextOf (_responseUrl)))
|
|
190 |
|
|
191 |
#define NW_HED_ContentHandler_NewUrlResponse(_object, _response) \
|
|
192 |
(NW_Object_Invoke (_object, NW_HED_ContentHandler, newUrlResponse) \
|
|
193 |
(NW_HED_ContentHandlerOf(_object), (_response)))
|
|
194 |
|
|
195 |
#define NW_HED_ContentHandler_GetURL(_object) \
|
|
196 |
(NW_Object_Invoke (_object, NW_HED_ContentHandler, getUrl) \
|
|
197 |
(NW_HED_ContentHandlerOf (_object)))
|
|
198 |
|
|
199 |
#define NW_HED_ContentHandler_ResolveURL(_object, _url, _retUrl) \
|
|
200 |
(NW_Object_Invoke (_object, NW_HED_ContentHandler, resolveUrl) \
|
|
201 |
(NW_HED_ContentHandlerOf (_object), (_url), (_retUrl)))
|
|
202 |
|
|
203 |
#define NW_HED_ContentHandler_HandleRequest(_object, _urlRequest) \
|
|
204 |
(NW_Object_Invoke (_object, NW_HED_ContentHandler, handleRequest) \
|
|
205 |
(NW_HED_ContentHandlerOf (_object), NW_HED_UrlRequestOf (_urlRequest)))
|
|
206 |
|
|
207 |
#define NW_HED_ContentHandler_FeatureQuery(_object, _featureId) \
|
|
208 |
(NW_Object_Invoke (_object, NW_HED_ContentHandler, featureQuery) \
|
|
209 |
(NW_HED_ContentHandlerOf (_object), _featureId))
|
|
210 |
|
|
211 |
#define NW_HED_ContentHandler_GetUrlRequest(_object) \
|
|
212 |
(_NW_HED_ContentHandler_GetUrlRequest \
|
|
213 |
(NW_HED_ContentHandlerOf (_object)))
|
|
214 |
|
|
215 |
#define NW_HED_ContentHandler_GetUrlResponse(_object) \
|
|
216 |
(_NW_HED_ContentHandler_GetUrlResponse \
|
|
217 |
(NW_HED_ContentHandlerOf (_object)))
|
|
218 |
|
|
219 |
#define NW_HED_ContentHandler_SetAssociatedHistoryEntry(_object, _entry) \
|
|
220 |
(_NW_HED_ContentHandler_SetAssociatedHistoryEntry \
|
|
221 |
(NW_HED_ContentHandlerOf (_object), NW_HED_HistoryEntryOf (_entry)))
|
|
222 |
|
|
223 |
#define NW_HED_ContentHandler_GetAssociatedHistoryEntry(_object) \
|
|
224 |
(_NW_HED_ContentHandler_GetAssociatedHistoryEntry \
|
|
225 |
(NW_HED_ContentHandlerOf (_object)))
|
|
226 |
|
|
227 |
#define NW_HED_ContentHandler_SetIsEmbeddable(_object, _value) \
|
|
228 |
(NW_HED_ContentHandlerOf (_object)->isEmbeddable = (_value))
|
|
229 |
|
|
230 |
#define NW_HED_ContentHandler_ResponseComplete(_object, _response, _context) \
|
|
231 |
(NW_Object_Invoke (_object, NW_HED_ContentHandler, responseComplete) \
|
|
232 |
(NW_HED_ContentHandlerOf (_object), (_response), (_context)))
|
|
233 |
|
|
234 |
#ifdef __cplusplus
|
|
235 |
} // extern "C" {
|
|
236 |
#endif /* __cplusplus */
|
|
237 |
|
|
238 |
#endif /* NW_HED_CONTENTHANDLER_H */
|