|
94
|
1 |
/*
|
|
|
2 |
* Copyright (c) 2002 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: Provides an interface to the browser. This module
|
|
|
15 |
* has mostly glue logic to integrate various components of Rainbow.
|
|
|
16 |
* It exposes a initialization function that create and intializes
|
|
|
17 |
* the WAE components.
|
|
|
18 |
*
|
|
|
19 |
*/
|
|
|
20 |
|
|
|
21 |
/*
|
|
|
22 |
**-------------------------------------------------------------------------
|
|
|
23 |
** Include Files
|
|
|
24 |
**-------------------------------------------------------------------------
|
|
|
25 |
*/
|
|
|
26 |
#include "nwx_logger.h"
|
|
|
27 |
#include "wml_scrproxy.h"
|
|
|
28 |
#include "wml_core.h"
|
|
|
29 |
#include "nwx_ctx.h"
|
|
|
30 |
#include "wml_decoder.h"
|
|
|
31 |
#include "nw_loadreq.h"
|
|
|
32 |
#include "nw_wmlscriptch_wmlscriptcontenthandler.h"
|
|
|
33 |
#include "nw_wml1x_epoc32contenthandler.h"
|
|
|
34 |
#include "nwx_http_defs.h"
|
|
|
35 |
#include "BrsrStatusCodes.h"
|
|
|
36 |
#include "CReferrerHelper.h"
|
|
|
37 |
|
|
|
38 |
#include "urlloader_urlloaderint.h"
|
|
|
39 |
|
|
|
40 |
/*
|
|
|
41 |
**-------------------------------------------------------------------------
|
|
|
42 |
** Internal Types
|
|
|
43 |
**-------------------------------------------------------------------------
|
|
|
44 |
*/
|
|
|
45 |
|
|
|
46 |
/*
|
|
|
47 |
**-------------------------------------------------------------------------
|
|
|
48 |
** Internal Prototypes
|
|
|
49 |
**-------------------------------------------------------------------------
|
|
|
50 |
*/
|
|
|
51 |
|
|
|
52 |
/*
|
|
|
53 |
**-------------------------------------------------------------------------
|
|
|
54 |
** File Scoped Static Variables
|
|
|
55 |
**-------------------------------------------------------------------------
|
|
|
56 |
*/
|
|
|
57 |
|
|
|
58 |
|
|
|
59 |
/*
|
|
|
60 |
**-------------------------------------------------------------------------
|
|
|
61 |
** Internal Functions
|
|
|
62 |
**-------------------------------------------------------------------------
|
|
|
63 |
*/
|
|
|
64 |
|
|
|
65 |
/*
|
|
|
66 |
**-------------------------------------------------------------------------
|
|
|
67 |
** External Public (Exported) Functions
|
|
|
68 |
**-------------------------------------------------------------------------
|
|
|
69 |
*/
|
|
|
70 |
|
|
|
71 |
/*****************************************************************
|
|
|
72 |
|
|
|
73 |
Name: NW_WaeUsrAgent_New()
|
|
|
74 |
|
|
|
75 |
Description: Create and initialize a new wae user agent
|
|
|
76 |
|
|
|
77 |
Parameters:
|
|
|
78 |
|
|
|
79 |
Return Value: pointer to the wae user agent
|
|
|
80 |
|
|
|
81 |
******************************************************************/
|
|
|
82 |
NW_WaeUsrAgent_t* NW_WaeUsrAgent_New()
|
|
|
83 |
{
|
|
|
84 |
NW_WaeUsrAgent_t *waeUsrAgent = NULL;
|
|
|
85 |
|
|
|
86 |
waeUsrAgent = (NW_WaeUsrAgent_t*) NW_Mem_Malloc(sizeof(NW_WaeUsrAgent_t));
|
|
|
87 |
if (waeUsrAgent != NULL) {
|
|
|
88 |
waeUsrAgent->wml = NULL;
|
|
|
89 |
waeUsrAgent->scrProxy = NULL;
|
|
|
90 |
waeUsrAgent->authApi = NULL;
|
|
|
91 |
waeUsrAgent->loadProgApi = NULL;
|
|
|
92 |
waeUsrAgent->errorApi = NULL;
|
|
|
93 |
waeUsrAgent->wtaiApi = NULL;
|
|
|
94 |
waeUsrAgent->uiCtx = NULL;
|
|
|
95 |
waeUsrAgent->evLogApi = NULL;
|
|
|
96 |
waeUsrAgent->userRedirection = NULL;
|
|
|
97 |
}
|
|
|
98 |
return waeUsrAgent;
|
|
|
99 |
}
|
|
|
100 |
|
|
|
101 |
/*****************************************************************
|
|
|
102 |
|
|
|
103 |
Name: NW_WaeUsrAgent_Free()
|
|
|
104 |
|
|
|
105 |
Description: Free the Wae user agent. This function will shutdown the
|
|
|
106 |
URL Loader, WML Interpreter, Image Loader and the script proxy.
|
|
|
107 |
|
|
|
108 |
Parameters: pointer to the wae user agent
|
|
|
109 |
|
|
|
110 |
Return Value:
|
|
|
111 |
|
|
|
112 |
******************************************************************/
|
|
|
113 |
void NW_WaeUsrAgent_Free(NW_WaeUsrAgent_t *waeUsrAgent)
|
|
|
114 |
{
|
|
|
115 |
if (waeUsrAgent != NULL) {
|
|
|
116 |
if (waeUsrAgent->scrProxy != NULL) {
|
|
|
117 |
NW_ScrProxy_Free(waeUsrAgent->scrProxy);
|
|
|
118 |
}
|
|
|
119 |
|
|
|
120 |
NW_Mem_Free(waeUsrAgent);
|
|
|
121 |
}
|
|
|
122 |
|
|
|
123 |
return;
|
|
|
124 |
}
|
|
|
125 |
|
|
|
126 |
/************************************************************************
|
|
|
127 |
Function: NW_Wae_UnRegisterWml
|
|
|
128 |
Purpose: Register the wml interpreter with the wae user agent.
|
|
|
129 |
|
|
|
130 |
Parameters:
|
|
|
131 |
wae - wae browser
|
|
|
132 |
wml - pointer to the wml interpreter
|
|
|
133 |
|
|
|
134 |
Return Values:Return Values:KBrsrSuccess
|
|
|
135 |
KBrsrOutOfMemory
|
|
|
136 |
**************************************************************************/
|
|
|
137 |
TBrowserStatusCode NW_Wae_RegisterWml(NW_WaeUsrAgent_t *wae, NW_Wml_t *wml)
|
|
|
138 |
{
|
|
|
139 |
NW_ASSERT(wae != NULL);
|
|
|
140 |
NW_ASSERT(wml != NULL);
|
|
|
141 |
wae->wml = wml;
|
|
|
142 |
|
|
|
143 |
return KBrsrSuccess;
|
|
|
144 |
}
|
|
|
145 |
|
|
|
146 |
/************************************************************************
|
|
|
147 |
Function: NW_Wae_UnRegisterWml
|
|
|
148 |
Purpose: Unregister the wml interpreter with the wae user agent
|
|
|
149 |
|
|
|
150 |
Parameters:
|
|
|
151 |
wae - wae browser
|
|
|
152 |
|
|
|
153 |
Return Values:KBrsrSuccess
|
|
|
154 |
KBrsrNotFound if not previously registered
|
|
|
155 |
**************************************************************************/
|
|
|
156 |
TBrowserStatusCode NW_Wae_UnRegisterWml(NW_WaeUsrAgent_t *wae)
|
|
|
157 |
{
|
|
|
158 |
if (wae)
|
|
|
159 |
{
|
|
|
160 |
wae->wml = NULL;
|
|
|
161 |
}
|
|
|
162 |
|
|
|
163 |
return KBrsrSuccess;
|
|
|
164 |
}
|
|
|
165 |
|
|
|
166 |
/************************************************************************
|
|
|
167 |
Function: NW_Wae_RegisterWmlScriptProxy
|
|
|
168 |
Purpose: Register the script proxy with the wae user agent
|
|
|
169 |
|
|
|
170 |
Parameters:
|
|
|
171 |
wae - wae browser
|
|
|
172 |
|
|
|
173 |
Return Values:KBrsrSuccess
|
|
|
174 |
**************************************************************************/
|
|
|
175 |
TBrowserStatusCode NW_Wae_RegisterWmlScriptProxy(NW_WaeUsrAgent_t *wae,
|
|
|
176 |
NW_ScrProxy_t *scrProxy)
|
|
|
177 |
{
|
|
|
178 |
wae->scrProxy = scrProxy;
|
|
|
179 |
return KBrsrSuccess;
|
|
|
180 |
}
|
|
|
181 |
|
|
|
182 |
/************************************************************************
|
|
|
183 |
Function: NW_Wae_UnRegisterWmlScriptProxy
|
|
|
184 |
Purpose: UnRegister the script proxy with the wae user agent
|
|
|
185 |
|
|
|
186 |
Parameters:
|
|
|
187 |
wae - wae browser
|
|
|
188 |
|
|
|
189 |
Return Values:KBrsrSuccess
|
|
|
190 |
**************************************************************************/
|
|
|
191 |
TBrowserStatusCode NW_Wae_UnRegisterWmlScriptProxy(NW_WaeUsrAgent_t *wae)
|
|
|
192 |
{
|
|
|
193 |
wae->scrProxy = NULL;
|
|
|
194 |
return KBrsrSuccess;
|
|
|
195 |
}
|
|
|
196 |
|
|
|
197 |
/************************************************************************
|
|
|
198 |
Function: NW_WaeUsrAgent_RegisterGenDlg
|
|
|
199 |
Purpose: Register callback functions for generic dialogs.
|
|
|
200 |
|
|
|
201 |
Parameters:
|
|
|
202 |
wae - wae browser
|
|
|
203 |
genDlgapi - generic dialogs api
|
|
|
204 |
|
|
|
205 |
Return Values: KBrsrSuccess
|
|
|
206 |
**************************************************************************/
|
|
|
207 |
TBrowserStatusCode
|
|
|
208 |
NW_WaeUsrAgent_RegisterGenDlg(NW_WaeUsrAgent_t *wae,
|
|
|
209 |
const NW_GenDlgApi_t *genDlgapi)
|
|
|
210 |
{
|
|
|
211 |
wae->genDlgApi = genDlgapi;
|
|
|
212 |
return KBrsrSuccess;
|
|
|
213 |
}
|
|
|
214 |
|
|
|
215 |
/************************************************************************
|
|
|
216 |
Function: NW_WaeUsrAgent_UnRegisterGenDlg
|
|
|
217 |
Purpose: UnRegister callback functions for generic dialogs.
|
|
|
218 |
|
|
|
219 |
Parameters:
|
|
|
220 |
wae - wae browser
|
|
|
221 |
|
|
|
222 |
Return Values: KBrsrSuccess
|
|
|
223 |
**************************************************************************/
|
|
|
224 |
TBrowserStatusCode
|
|
|
225 |
NW_WaeUsrAgent_UnRegisterGenDlg(NW_WaeUsrAgent_t *wae)
|
|
|
226 |
{
|
|
|
227 |
wae->genDlgApi = NULL;
|
|
|
228 |
return KBrsrSuccess;
|
|
|
229 |
}
|
|
|
230 |
|
|
|
231 |
/*****************************************************************
|
|
|
232 |
|
|
|
233 |
Name: NW_WaeUsrAgent_GetScript()
|
|
|
234 |
|
|
|
235 |
Description: Get a pointer to the WML Script Proxy. The caller of
|
|
|
236 |
this function should not free the returned pointer.
|
|
|
237 |
|
|
|
238 |
Parameters: *wae - pointer to the wae browser
|
|
|
239 |
|
|
|
240 |
Return Value: pointer to the script proxy
|
|
|
241 |
|
|
|
242 |
******************************************************************/
|
|
|
243 |
NW_ScrProxy_t * NW_WaeUsrAgent_GetScript(NW_WaeUsrAgent_t *wae)
|
|
|
244 |
{
|
|
|
245 |
if (wae != NULL) {
|
|
|
246 |
return wae->scrProxy;
|
|
|
247 |
}
|
|
|
248 |
return NULL;
|
|
|
249 |
}
|
|
|
250 |
|
|
|
251 |
/*****************************************************************
|
|
|
252 |
|
|
|
253 |
Name: NW_Wml_CanNavigateToUri()
|
|
|
254 |
|
|
|
255 |
Description: Is it allowed to navigate to a new card. This behaviour
|
|
|
256 |
is defined by the wml scripts running asynchronously.
|
|
|
257 |
If a script has not completed and the user tries to
|
|
|
258 |
navigate to a new card, the navigation is canceled.
|
|
|
259 |
|
|
|
260 |
Parameters: result - result from the user.
|
|
|
261 |
|
|
|
262 |
Return Value: KBrsrSuccess
|
|
|
263 |
KBrsrWaeNavigationCancelled
|
|
|
264 |
|
|
|
265 |
******************************************************************/
|
|
|
266 |
TBrowserStatusCode NW_Wml_CanNavigateToUri()
|
|
|
267 |
{
|
|
|
268 |
TBrowserStatusCode status = KBrsrSuccess;
|
|
|
269 |
NW_Bool running;
|
|
|
270 |
NW_WaeUsrAgent_t *wae;
|
|
|
271 |
|
|
|
272 |
wae = (NW_WaeUsrAgent_t*) NW_Ctx_Get(NW_CTX_WML_CORE, 0);
|
|
|
273 |
NW_ASSERT(wae != NULL);
|
|
|
274 |
|
|
|
275 |
/* The script proxy registers dynamically in Rainbow 3.0 */
|
|
|
276 |
if (!wae->scrProxy) return KBrsrSuccess;
|
|
|
277 |
|
|
|
278 |
/* check if a script is running */
|
|
|
279 |
if ((status = NW_ScrProxy_IsScriptRunning(wae->scrProxy, &running))
|
|
|
280 |
== KBrsrSuccess) {
|
|
|
281 |
if (running == NW_TRUE) {
|
|
|
282 |
status = KBrsrWaeNavigationCancelled;
|
|
|
283 |
}
|
|
|
284 |
}
|
|
|
285 |
|
|
|
286 |
return status;
|
|
|
287 |
}
|
|
|
288 |
|
|
|
289 |
/*****************************************************************
|
|
|
290 |
|
|
|
291 |
Name: NW_Wml_DoPrevLoad()
|
|
|
292 |
|
|
|
293 |
Description: Sets History to the previous entry and issues Url load request.
|
|
|
294 |
Returns KBrsrFailure if no previous entry
|
|
|
295 |
|
|
|
296 |
Parameters: Wml Content handler pointer
|
|
|
297 |
|
|
|
298 |
Return Value: KBrsrSuccess
|
|
|
299 |
KBrsrFailure
|
|
|
300 |
KBrsrOutOfMemory
|
|
|
301 |
|
|
|
302 |
******************************************************************/
|
|
|
303 |
TBrowserStatusCode NW_Wml_DoPrevLoad(void *wml1xCH)
|
|
|
304 |
{
|
|
|
305 |
NW_HED_HistoryEntry_t *prevEntry;
|
|
|
306 |
NW_HED_DocumentRoot_t *dr;
|
|
|
307 |
const NW_HED_UrlRequest_t *urlRequest;
|
|
|
308 |
TBrowserStatusCode status = KBrsrFailure;
|
|
|
309 |
|
|
|
310 |
dr = (NW_HED_DocumentRoot_t*) NW_HED_DocumentNode_GetRootNode (wml1xCH);
|
|
|
311 |
prevEntry = NW_HED_HistoryStack_GetEntry(dr->historyStack,
|
|
|
312 |
NW_HED_HistoryStack_Direction_Previous);
|
|
|
313 |
if (prevEntry) {
|
|
|
314 |
urlRequest = NW_HED_HistoryEntry_GetUrlRequest(prevEntry);
|
|
|
315 |
|
|
|
316 |
if ((KBrsrSuccess ==
|
|
|
317 |
NW_HED_UrlRequest_SetReason((NW_HED_UrlRequest_t*)urlRequest,
|
|
|
318 |
NW_HED_UrlRequest_Reason_DocPrev)) &&
|
|
|
319 |
(KBrsrSuccess ==
|
|
|
320 |
NW_HED_UrlRequest_SetCacheMode((NW_HED_UrlRequest_t*)urlRequest,
|
|
|
321 |
NW_CACHE_HISTPREV))) {
|
|
|
322 |
/*
|
|
|
323 |
** update the history to point to the new current entry. It is important
|
|
|
324 |
** that this is done BEFORE StartRequest.
|
|
|
325 |
*/
|
|
|
326 |
NW_HED_HistoryStack_SetCurrent(dr->historyStack,
|
|
|
327 |
NW_HED_HistoryStack_Direction_Previous);
|
|
|
328 |
|
|
|
329 |
/* Do the load */
|
|
|
330 |
status = NW_HED_DocumentRoot_StartRequest(dr,
|
|
|
331 |
NW_HED_DocumentNodeOf( dr ), // top level request is owned by document root.
|
|
|
332 |
urlRequest,
|
|
|
333 |
(void *)&NW_Wml1x_Epoc32ContentHandler_Class );
|
|
|
334 |
}
|
|
|
335 |
}
|
|
|
336 |
return status;
|
|
|
337 |
}
|
|
|
338 |
|
|
|
339 |
/*****************************************************************
|
|
|
340 |
|
|
|
341 |
Name: NW_Wml_UrlLoad()
|
|
|
342 |
|
|
|
343 |
Description: Load a Url.
|
|
|
344 |
|
|
|
345 |
Parameters: url - url to load
|
|
|
346 |
postfields - pointer to postfield data struct,
|
|
|
347 |
OR NULL, if no postfield data exists
|
|
|
348 |
|
|
|
349 |
Return Value: KBrsrSuccess
|
|
|
350 |
KBrsrFailure
|
|
|
351 |
|
|
|
352 |
******************************************************************/
|
|
|
353 |
TBrowserStatusCode NW_Wml_UrlLoad(void *wml1xCH,
|
|
|
354 |
const NW_Ucs2 *url,
|
|
|
355 |
NW_NVPair_t *postfields,
|
|
|
356 |
const NW_Cache_Mode_t cacheMode,
|
|
|
357 |
NW_Ucs2* referrerUrl)
|
|
|
358 |
{
|
|
|
359 |
NW_Text_UCS2_t *urlObj = NULL;
|
|
|
360 |
NW_HED_UrlRequest_t *urlRequest = NULL;
|
|
|
361 |
NW_Ucs2 *req_url = NULL;
|
|
|
362 |
TBrowserStatusCode status = KBrsrSuccess;
|
|
|
363 |
NW_HED_DocumentRoot_t *dr;
|
|
|
364 |
|
|
|
365 |
dr = (NW_HED_DocumentRoot_t*) NW_HED_DocumentNode_GetRootNode (wml1xCH);
|
|
|
366 |
|
|
|
367 |
if ( !NW_NVPair_IsEmpty(postfields) ) {
|
|
|
368 |
status = NW_LoadReq_BuildQuery(url, postfields, &req_url, NULL, NULL);
|
|
|
369 |
if (status != KBrsrSuccess) {
|
|
|
370 |
NW_THROW_ERROR();
|
|
|
371 |
}
|
|
|
372 |
} else {
|
|
|
373 |
req_url = NW_Str_Newcpy(url);
|
|
|
374 |
if (req_url == NULL) {
|
|
|
375 |
status = KBrsrOutOfMemory;
|
|
|
376 |
NW_THROW_ERROR();
|
|
|
377 |
}
|
|
|
378 |
}
|
|
|
379 |
|
|
|
380 |
urlObj = NW_Text_UCS2_New(req_url, 0, 0);
|
|
|
381 |
if (!urlObj) {
|
|
|
382 |
status = KBrsrOutOfMemory;
|
|
|
383 |
NW_THROW_ERROR();
|
|
|
384 |
}
|
|
|
385 |
|
|
|
386 |
urlRequest = NW_HED_UrlRequest_New(NW_TextOf (urlObj),
|
|
|
387 |
NW_URL_METHOD_GET,
|
|
|
388 |
NULL, NULL,
|
|
|
389 |
NW_HED_UrlRequest_Reason_DocLoad,
|
|
|
390 |
NW_HED_UrlRequest_LoadNormal,
|
|
|
391 |
NW_UrlRequest_Type_Any);
|
|
|
392 |
|
|
|
393 |
if (referrerUrl) {
|
|
|
394 |
SetReferrerHeader(urlRequest, referrerUrl);
|
|
|
395 |
}
|
|
|
396 |
|
|
|
397 |
if (!urlRequest) {
|
|
|
398 |
status = KBrsrOutOfMemory;
|
|
|
399 |
NW_THROW_ERROR();
|
|
|
400 |
}
|
|
|
401 |
|
|
|
402 |
(void)NW_HED_UrlRequest_SetCacheMode(urlRequest, cacheMode);
|
|
|
403 |
|
|
|
404 |
|
|
|
405 |
status = NW_HED_DocumentRoot_StartRequest(dr,
|
|
|
406 |
NW_HED_DocumentNodeOf( dr ), // top level request is owned by document root.
|
|
|
407 |
urlRequest,
|
|
|
408 |
(void *)&NW_Wml1x_Epoc32ContentHandler_Class );
|
|
|
409 |
|
|
|
410 |
if (status == KBrsrSuccess) {
|
|
|
411 |
urlRequest = NULL; /* To prevent freeing it when exiting the function */
|
|
|
412 |
}
|
|
|
413 |
|
|
|
414 |
NW_CATCH_ERROR
|
|
|
415 |
NW_Str_Delete(req_url);
|
|
|
416 |
NW_Object_Delete(urlObj);
|
|
|
417 |
if (urlRequest) {
|
|
|
418 |
NW_Object_Delete (urlRequest);
|
|
|
419 |
}
|
|
|
420 |
return status;
|
|
|
421 |
}
|
|
|
422 |
|
|
|
423 |
/*****************************************************************
|
|
|
424 |
|
|
|
425 |
Name: NW_Wml_HttpLoad()
|
|
|
426 |
|
|
|
427 |
Description: Do a HTTP load.
|
|
|
428 |
|
|
|
429 |
Parameters: usrAgent - wae browser
|
|
|
430 |
*url - url to load
|
|
|
431 |
is_method_post - HTTP method
|
|
|
432 |
referer - referer to the url
|
|
|
433 |
accept_charset -
|
|
|
434 |
postfields - name/value pairs
|
|
|
435 |
enctype - urlencoded or multipart/form-data
|
|
|
436 |
|
|
|
437 |
Return Value: KBrsrSuccess
|
|
|
438 |
KBrsrFailure
|
|
|
439 |
KBrsrUnsupportedFormCharset
|
|
|
440 |
KBrsrOutOfMemory
|
|
|
441 |
|
|
|
442 |
******************************************************************/
|
|
|
443 |
TBrowserStatusCode NW_Wml_HttpLoad(void *wml1xCH,
|
|
|
444 |
const NW_Ucs2 *url,
|
|
|
445 |
NW_Bool is_method_post,
|
|
|
446 |
const NW_Ucs2 *referer,
|
|
|
447 |
const NW_Ucs2 *accept_charset,
|
|
|
448 |
NW_Http_Header_t *header,
|
|
|
449 |
NW_NVPair_t *postfields,
|
|
|
450 |
const NW_Ucs2 *enctype,
|
|
|
451 |
const NW_Cache_Mode_t cacheMode)
|
|
|
452 |
{
|
|
|
453 |
NW_Buffer_t *body = NULL;
|
|
|
454 |
NW_Ucs2 *resultUrl = NULL;
|
|
|
455 |
NW_HED_UrlRequest_t *urlRequest = NULL;
|
|
|
456 |
NW_Text_UCS2_t *urlObj = NULL;
|
|
|
457 |
NW_Uint8 method;
|
|
|
458 |
TBrowserStatusCode status;
|
|
|
459 |
NW_WaeUsrAgent_t *wae;
|
|
|
460 |
NW_HED_DocumentRoot_t *dr;
|
|
|
461 |
|
|
|
462 |
dr = (NW_HED_DocumentRoot_t*) NW_HED_DocumentNode_GetRootNode (wml1xCH);
|
|
|
463 |
|
|
|
464 |
wae = (NW_WaeUsrAgent_t*) NW_Ctx_Get(NW_CTX_WML_CORE, 0);
|
|
|
465 |
|
|
|
466 |
NW_ASSERT(wae != NULL);
|
|
|
467 |
NW_ASSERT(url != NULL);
|
|
|
468 |
|
|
|
469 |
status = NW_LoadReq_Create(url, is_method_post, referer,
|
|
|
470 |
accept_charset, postfields, enctype,
|
|
|
471 |
NW_DeckDecoder_GetEncoding (wae->wml->decoder),
|
|
|
472 |
&header, &resultUrl, &method, &body, NULL, NULL);
|
|
|
473 |
|
|
|
474 |
if (status != KBrsrSuccess) {
|
|
|
475 |
NW_THROW_ERROR();
|
|
|
476 |
}
|
|
|
477 |
|
|
|
478 |
urlObj = NW_Text_UCS2_New (resultUrl, 0, 0);
|
|
|
479 |
|
|
|
480 |
if (!urlObj) {
|
|
|
481 |
status = KBrsrOutOfMemory;
|
|
|
482 |
NW_THROW_ERROR();
|
|
|
483 |
}
|
|
|
484 |
urlRequest = NW_HED_UrlRequest_New(NW_TextOf (urlObj),
|
|
|
485 |
method,
|
|
|
486 |
header,
|
|
|
487 |
body,
|
|
|
488 |
NW_HED_UrlRequest_Reason_DocLoad,
|
|
|
489 |
NW_HED_UrlRequest_LoadNormal,
|
|
|
490 |
NW_UrlRequest_Type_Any);
|
|
|
491 |
|
|
|
492 |
if (!urlRequest) {
|
|
|
493 |
UrlLoader_HeadersFree(header);//R->ul
|
|
|
494 |
NW_Buffer_Free(body);
|
|
|
495 |
status = KBrsrOutOfMemory;
|
|
|
496 |
NW_THROW_ERROR();
|
|
|
497 |
}
|
|
|
498 |
|
|
|
499 |
(void)NW_HED_UrlRequest_SetCacheMode(urlRequest, cacheMode);
|
|
|
500 |
/* Do the load */
|
|
|
501 |
status = NW_HED_DocumentRoot_StartRequest(dr,
|
|
|
502 |
NW_HED_DocumentNodeOf( dr ), // top level request is owned by document root.
|
|
|
503 |
urlRequest,
|
|
|
504 |
(void *)&NW_Wml1x_Epoc32ContentHandler_Class );
|
|
|
505 |
if (status == KBrsrSuccess) {
|
|
|
506 |
urlRequest = NULL; /* To prevent freeing it when exiting the function */
|
|
|
507 |
}
|
|
|
508 |
|
|
|
509 |
NW_CATCH_ERROR
|
|
|
510 |
NW_Str_Delete(resultUrl);
|
|
|
511 |
NW_Object_Delete(urlObj);
|
|
|
512 |
if (urlRequest) {
|
|
|
513 |
NW_Object_Delete (urlRequest);
|
|
|
514 |
}
|
|
|
515 |
return status;
|
|
|
516 |
}
|
|
|
517 |
|
|
|
518 |
/*****************************************************************
|
|
|
519 |
|
|
|
520 |
Name: NW_WaeUsrAgent_DlgListSelect()
|
|
|
521 |
|
|
|
522 |
Purpose: Call the list select dialog box.
|
|
|
523 |
|
|
|
524 |
Parameters:
|
|
|
525 |
wae - wae browser
|
|
|
526 |
data - structure to pass to the dialog
|
|
|
527 |
callbackCtx - callback context
|
|
|
528 |
callback - the callback to cal after the dialog box exits
|
|
|
529 |
|
|
|
530 |
Return Values:
|
|
|
531 |
KBrsrSuccess
|
|
|
532 |
KBrsrNotImplemented
|
|
|
533 |
|
|
|
534 |
******************************************************************/
|
|
|
535 |
TBrowserStatusCode NW_WaeUsrAgent_DlgListSelect(NW_WaeUsrAgent_t *wae,
|
|
|
536 |
NW_Dlg_ListSelect_t *data,
|
|
|
537 |
void *callbackCtx,
|
|
|
538 |
NW_Dlg_ListSelectCB_t callback)
|
|
|
539 |
{
|
|
|
540 |
TBrowserStatusCode status = KBrsrSuccess;
|
|
|
541 |
NW_ASSERT(wae != NULL);
|
|
|
542 |
if (wae->genDlgApi != NULL) {
|
|
|
543 |
NW_ASSERT(wae->genDlgApi->DialogListSelect != NULL);
|
|
|
544 |
(wae->genDlgApi->DialogListSelect) (data, callbackCtx, callback);
|
|
|
545 |
} else {
|
|
|
546 |
status = KBrsrNotImplemented;
|
|
|
547 |
NW_ASSERT(0); /* dialog not implemented. */
|
|
|
548 |
}
|
|
|
549 |
return status;
|
|
|
550 |
}
|
|
|
551 |
|
|
|
552 |
/*****************************************************************
|
|
|
553 |
|
|
|
554 |
Name: NW_WaeUsrAgent_DlgPrompt()
|
|
|
555 |
|
|
|
556 |
Purpose: Call the prompt dialog box.
|
|
|
557 |
|
|
|
558 |
Parameters:
|
|
|
559 |
wae - wae browser
|
|
|
560 |
data - structure to pass to the dialog
|
|
|
561 |
callbackCtx - callback context
|
|
|
562 |
callback - the callback to cal after the dialog box exits
|
|
|
563 |
|
|
|
564 |
Return Values:
|
|
|
565 |
KBrsrSuccess
|
|
|
566 |
KBrsrNotImplemented
|
|
|
567 |
|
|
|
568 |
******************************************************************/
|
|
|
569 |
TBrowserStatusCode NW_WaeUsrAgent_DlgPrompt(NW_WaeUsrAgent_t *wae,
|
|
|
570 |
NW_Dlg_Prompt_t *data,
|
|
|
571 |
void *callbackCtx,
|
|
|
572 |
NW_Dlg_PromptCB_t callback)
|
|
|
573 |
{
|
|
|
574 |
TBrowserStatusCode status = KBrsrSuccess;
|
|
|
575 |
NW_ASSERT(wae != NULL);
|
|
|
576 |
if (wae->genDlgApi != NULL) {
|
|
|
577 |
NW_ASSERT(wae->genDlgApi->DialogPrompt != NULL);
|
|
|
578 |
(wae->genDlgApi->DialogPrompt) (data, callbackCtx, callback);
|
|
|
579 |
} else {
|
|
|
580 |
status = KBrsrNotImplemented;
|
|
|
581 |
NW_ASSERT(0); /* dialog not implemented. */
|
|
|
582 |
}
|
|
|
583 |
return status;
|
|
|
584 |
}
|
|
|
585 |
|
|
|
586 |
/*****************************************************************
|
|
|
587 |
|
|
|
588 |
Name: NW_WaeUsrAgent_DlgInputPrompt()
|
|
|
589 |
|
|
|
590 |
Purpose: Call the input prompt dialog box.
|
|
|
591 |
|
|
|
592 |
Parameters:
|
|
|
593 |
wae - wae browser
|
|
|
594 |
data - structure to pass to the dialog
|
|
|
595 |
callbackCtx - callback context
|
|
|
596 |
callback - the callback to cal after the dialog box exits
|
|
|
597 |
|
|
|
598 |
Return Values:
|
|
|
599 |
KBrsrSuccess
|
|
|
600 |
KBrsrNotImplemented
|
|
|
601 |
|
|
|
602 |
******************************************************************/
|
|
|
603 |
TBrowserStatusCode NW_WaeUsrAgent_DlgInputPrompt(NW_WaeUsrAgent_t *wae,
|
|
|
604 |
NW_Dlg_InputPrompt_t *data,
|
|
|
605 |
void *callbackCtx,
|
|
|
606 |
NW_Dlg_InputPromptCB_t callback)
|
|
|
607 |
{
|
|
|
608 |
TBrowserStatusCode status = KBrsrSuccess;
|
|
|
609 |
NW_ASSERT(wae != NULL);
|
|
|
610 |
if (wae->genDlgApi != NULL) {
|
|
|
611 |
NW_ASSERT(wae->genDlgApi->DialogInputPrompt != NULL);
|
|
|
612 |
(wae->genDlgApi->DialogInputPrompt) (data, callbackCtx, callback);
|
|
|
613 |
} else {
|
|
|
614 |
status = KBrsrNotImplemented;
|
|
|
615 |
NW_ASSERT(0); /* dialog not implemented. */
|
|
|
616 |
}
|
|
|
617 |
return status;
|
|
|
618 |
}
|
|
|
619 |
|
|
|
620 |
/*****************************************************************
|
|
|
621 |
|
|
|
622 |
Name: NW_WaeUsrAgent_RegisterError()
|
|
|
623 |
|
|
|
624 |
Purpose: register callbacks for error handling.
|
|
|
625 |
|
|
|
626 |
Parameters:
|
|
|
627 |
wae - wae browser
|
|
|
628 |
errorApi - error api
|
|
|
629 |
|
|
|
630 |
Return Values:
|
|
|
631 |
KBrsrSuccess
|
|
|
632 |
|
|
|
633 |
******************************************************************/
|
|
|
634 |
TBrowserStatusCode NW_WaeUsrAgent_RegisterError(NW_WaeUsrAgent_t *wae,
|
|
|
635 |
const NW_ErrorApi_t *errorApi)
|
|
|
636 |
{
|
|
|
637 |
NW_ASSERT(wae != NULL);
|
|
|
638 |
NW_ASSERT(errorApi != NULL);
|
|
|
639 |
wae->errorApi = errorApi;
|
|
|
640 |
return KBrsrSuccess;
|
|
|
641 |
}
|
|
|
642 |
|
|
|
643 |
/*****************************************************************
|
|
|
644 |
|
|
|
645 |
Name: NW_WaeUsrAgent_RegisterLoadProgress()
|
|
|
646 |
|
|
|
647 |
Purpose: register callbacks for error handling.
|
|
|
648 |
|
|
|
649 |
Parameters:
|
|
|
650 |
wae - wae browser
|
|
|
651 |
errorApi - error api
|
|
|
652 |
|
|
|
653 |
Return Values:
|
|
|
654 |
KBrsrSuccess
|
|
|
655 |
|
|
|
656 |
******************************************************************/
|
|
|
657 |
TBrowserStatusCode NW_WaeUsrAgent_RegisterLoadProgress(NW_WaeUsrAgent_t *wae,
|
|
|
658 |
const NW_UrlLoadProgressApi_t *loadProgApi)
|
|
|
659 |
{
|
|
|
660 |
NW_ASSERT(wae != NULL);
|
|
|
661 |
NW_ASSERT(loadProgApi != NULL);
|
|
|
662 |
wae->loadProgApi = loadProgApi;
|
|
|
663 |
return KBrsrSuccess;
|
|
|
664 |
}
|
|
|
665 |
|
|
|
666 |
/************************************************************************
|
|
|
667 |
Function: NW_WaeUsrAgent_RegisterEvLog
|
|
|
668 |
Purpose: Register event log API.
|
|
|
669 |
|
|
|
670 |
Parameters:
|
|
|
671 |
wae - wae browser
|
|
|
672 |
evLogApi - event log api
|
|
|
673 |
|
|
|
674 |
Return Values: KBrsrSuccess
|
|
|
675 |
**************************************************************************/
|
|
|
676 |
TBrowserStatusCode
|
|
|
677 |
NW_WaeUsrAgent_RegisterEvLog(NW_WaeUsrAgent_t *wae,
|
|
|
678 |
const NW_EvLogApi_t *evLogApi)
|
|
|
679 |
{
|
|
|
680 |
NW_ASSERT(wae != NULL);
|
|
|
681 |
NW_ASSERT(evLogApi != NULL);
|
|
|
682 |
wae->evLogApi = evLogApi;
|
|
|
683 |
return KBrsrSuccess;
|
|
|
684 |
}
|
|
|
685 |
|
|
|
686 |
/************************************************************************
|
|
|
687 |
Function: NW_WaeUsrAgent_UnRegisterEvLog
|
|
|
688 |
Purpose: UnRegister event log API.
|
|
|
689 |
|
|
|
690 |
Parameters:
|
|
|
691 |
wae - wae browser
|
|
|
692 |
|
|
|
693 |
Return Values: KBrsrSuccess
|
|
|
694 |
**************************************************************************/
|
|
|
695 |
TBrowserStatusCode
|
|
|
696 |
NW_WaeUsrAgent_UnRegisterEvLog(NW_WaeUsrAgent_t *wae)
|
|
|
697 |
{
|
|
|
698 |
wae->evLogApi = NULL;
|
|
|
699 |
return KBrsrSuccess;
|
|
|
700 |
}
|
|
|
701 |
|
|
|
702 |
/************************************************************************
|
|
|
703 |
Function: NW_WaeUsrAgent_RegisterUserRedirection
|
|
|
704 |
Purpose: Register callback functions for user redirection.
|
|
|
705 |
|
|
|
706 |
Parameters:
|
|
|
707 |
wae - wae browser
|
|
|
708 |
authapi - NW_UserRedirectionApi_t
|
|
|
709 |
|
|
|
710 |
Return Values: KBrsrSuccess
|
|
|
711 |
**************************************************************************/
|
|
|
712 |
TBrowserStatusCode
|
|
|
713 |
NW_WaeUsrAgent_RegisterUserRedirection(NW_WaeUsrAgent_t *wae,
|
|
|
714 |
const NW_UserRedirectionApi_t *userRedirectionapi)
|
|
|
715 |
{
|
|
|
716 |
wae->userRedirection = userRedirectionapi;
|
|
|
717 |
return KBrsrSuccess;
|
|
|
718 |
}
|
|
|
719 |
|
|
|
720 |
/************************************************************************
|
|
|
721 |
Function: NW_WaeUsrAgent_UnRegisterUserRedirection
|
|
|
722 |
Purpose: UnRegister callback functions for user redirection.
|
|
|
723 |
|
|
|
724 |
Parameters:
|
|
|
725 |
wae - wae browser
|
|
|
726 |
|
|
|
727 |
Return Values: KBrsrSuccess
|
|
|
728 |
**************************************************************************/
|
|
|
729 |
TBrowserStatusCode
|
|
|
730 |
NW_WaeUsrAgent_UnRegisterUserRedirection(NW_WaeUsrAgent_t *wae)
|
|
|
731 |
{
|
|
|
732 |
wae->userRedirection = NULL;
|
|
|
733 |
return KBrsrSuccess;
|
|
|
734 |
}
|
|
|
735 |
|
|
|
736 |
/*****************************************************************
|
|
|
737 |
|
|
|
738 |
Name: NW_WaeUsrAgent_GetEvLog
|
|
|
739 |
|
|
|
740 |
Description: Return pointer to EvLogApi of wae
|
|
|
741 |
|
|
|
742 |
Parameters: wae pointer
|
|
|
743 |
|
|
|
744 |
Return Value: EvLogApi of wae
|
|
|
745 |
|
|
|
746 |
*****************************************************************/
|
|
|
747 |
const NW_EvLogApi_t *NW_WaeUsrAgent_GetEvLog(NW_WaeUsrAgent_t *wae)
|
|
|
748 |
{
|
|
|
749 |
return (wae->evLogApi);
|
|
|
750 |
}
|