williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
3 |
* All rights reserved.
|
williamr@2
|
4 |
* This component and the accompanying materials are made available
|
williamr@2
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
williamr@2
|
6 |
* which accompanies this distribution, and is available
|
williamr@2
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
8 |
*
|
williamr@2
|
9 |
* Initial Contributors:
|
williamr@2
|
10 |
* Nokia Corporation - initial contribution.
|
williamr@2
|
11 |
*
|
williamr@2
|
12 |
* Contributors:
|
williamr@2
|
13 |
*
|
williamr@2
|
14 |
* Description: Handle special load events such as network connection, deal with non-http or non-html requests
|
williamr@2
|
15 |
*
|
williamr@2
|
16 |
*/
|
williamr@2
|
17 |
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#ifndef BRCTLSPECIALLOADOBSERVER_H
|
williamr@2
|
20 |
#define BRCTLSPECIALLOADOBSERVER_H
|
williamr@2
|
21 |
|
williamr@2
|
22 |
// INCLUDES
|
williamr@2
|
23 |
#include <e32std.h>
|
williamr@2
|
24 |
#include <e32base.h>
|
williamr@2
|
25 |
#include <apmstd.h>
|
williamr@2
|
26 |
#include <ApEngineConsts.h>
|
williamr@2
|
27 |
#include <badesca.h>
|
williamr@2
|
28 |
|
williamr@2
|
29 |
// CONSTANTS
|
williamr@2
|
30 |
|
williamr@2
|
31 |
// MACROS
|
williamr@2
|
32 |
|
williamr@2
|
33 |
// DATA TYPES
|
williamr@2
|
34 |
enum TBrCtlDownloadParam
|
williamr@2
|
35 |
{
|
williamr@2
|
36 |
EParamRequestUrl, ///< URL requested
|
williamr@2
|
37 |
EParamRealm, ///< Realm (if www)
|
williamr@2
|
38 |
EParamUsername, ///< User name (if www authentication)
|
williamr@2
|
39 |
EParamPassword, ///< Password (if www authentication)
|
williamr@2
|
40 |
EParamProxyRealm, ///< Realm in the case of proxy authentication
|
williamr@2
|
41 |
EParamProxyUsername, ///< User name (if proxy authentication)
|
williamr@2
|
42 |
EParamProxyPassword, ///< Password (if proxy authentication)
|
williamr@2
|
43 |
EParamRawRequestHeader, ///< Request header in the form: Header:Value
|
williamr@2
|
44 |
EParamReceivedContentType, ///< Type of content received
|
williamr@2
|
45 |
EParamExpectedContentType, ///< Type of content expected to appear in the markup <object> tag.
|
williamr@2
|
46 |
EParamTotalContentLength, ///< Expected length of the content
|
williamr@2
|
47 |
EParamReceivedContentLength, ///< Length of the content already received
|
williamr@2
|
48 |
EParamReceivedContent, ///< Body of the content received
|
williamr@2
|
49 |
EParamRawResponseHeader, ///< Response header in the form: Header: Value
|
williamr@2
|
50 |
EParamLocalFileName, ///< Name of the file containing the content to be downloaded
|
williamr@2
|
51 |
EParamCharset, ///< Character set of the content to be downloaded
|
williamr@2
|
52 |
EParamRefererHeader, ///< Referrer header used in the download request, if applicable
|
williamr@2
|
53 |
EParamTransactionId ///< Transaction ID
|
williamr@2
|
54 |
};
|
williamr@2
|
55 |
|
williamr@2
|
56 |
// FUNCTION PROTOTYPES
|
williamr@2
|
57 |
|
williamr@2
|
58 |
|
williamr@2
|
59 |
/**
|
williamr@2
|
60 |
* The MBrCtlSpecialLoadObserver class handles special load events, such as
|
williamr@2
|
61 |
* network connection, non-HTTP(S) load requests, and non-HTML responses.
|
williamr@2
|
62 |
*
|
williamr@2
|
63 |
* Usage:
|
williamr@2
|
64 |
*
|
williamr@2
|
65 |
* @code
|
williamr@4
|
66 |
* #include <brctlspecialloadobserver.h>
|
williamr@2
|
67 |
*
|
williamr@2
|
68 |
*
|
williamr@2
|
69 |
* @see S60 Platform: Browser Control API Developer's Guide Version 2.0
|
williamr@2
|
70 |
* @lib BrowserEngine.lib
|
williamr@4
|
71 |
* @file brctlspecialloadobserver.h
|
williamr@2
|
72 |
* @endcode *
|
williamr@2
|
73 |
*/
|
williamr@2
|
74 |
class MBrCtlSpecialLoadObserver
|
williamr@2
|
75 |
{
|
williamr@2
|
76 |
public: // New functions
|
williamr@2
|
77 |
/**
|
williamr@2
|
78 |
* Request to create a network connection.
|
williamr@2
|
79 |
* @since 2.8
|
williamr@2
|
80 |
* @param aConnectionPtr Pointer to the network connection. It must
|
williamr@2
|
81 |
* be type casted to an integer. If NULL, the Proxy Filter creates
|
williamr@2
|
82 |
* a network connection automatically. It must be type casted to an integer.
|
williamr@2
|
83 |
* @param aSockSvrHandle A handle to the socket server.
|
williamr@2
|
84 |
* @param aNewConn A flag if a new connection was created. If the
|
williamr@2
|
85 |
* connection is not new, proxy filter optimization will not read
|
williamr@2
|
86 |
* the proxy again from CommsBd.
|
williamr@2
|
87 |
* ETrue if a new connection was created.
|
williamr@2
|
88 |
* EFalse if a previously created connection was used.
|
williamr@2
|
89 |
* @param aBearerType Bearer type of the new connection. For example, GPRS, WCDMA.
|
williamr@2
|
90 |
* TapBearerType is defined in ApEngineConsts.h.
|
williamr@2
|
91 |
* @return void
|
williamr@2
|
92 |
* @attention This function is called for every HTTP request for which
|
williamr@2
|
93 |
* the content was not found in the cache. This function is called
|
williamr@2
|
94 |
* whether or not a connection was established in a previous request.
|
williamr@2
|
95 |
* The host application determines whether to create a new connection
|
williamr@2
|
96 |
* or to use an existing connection.
|
williamr@2
|
97 |
*/
|
williamr@2
|
98 |
virtual void NetworkConnectionNeededL(TInt* aConnectionPtr,
|
williamr@2
|
99 |
TInt* aSockSvrHandle,
|
williamr@2
|
100 |
TBool* aNewConn,
|
williamr@2
|
101 |
TApBearerType* aBearerType) = 0;
|
williamr@2
|
102 |
|
williamr@2
|
103 |
/**
|
williamr@2
|
104 |
* Requests the host application to handle non-HTTP requests. It is expected that the
|
williamr@2
|
105 |
* host application will call the Scheme Dispatcher to handle these requests.
|
williamr@2
|
106 |
* @since 2.8
|
williamr@2
|
107 |
* @param aTypeArray Array of request parameters. Examples: URL, referrer header
|
williamr@2
|
108 |
* @param aDesArray Array of values corresponding to the types in aTypeArray
|
williamr@2
|
109 |
* @return ETrue if the host application handles the scheme.
|
williamr@2
|
110 |
* EFalse if the host application cannot handle the scheme.
|
williamr@2
|
111 |
* @attention The browser checks the scheme to determine whether or
|
williamr@2
|
112 |
* not it is supported. The browser supports the following schemes:
|
williamr@2
|
113 |
* File scheme, HTTP scheme or HTTPS scheme
|
williamr@2
|
114 |
* If the URL contains a scheme that the browser does not
|
williamr@2
|
115 |
* support, such as RTSP, then the host application should pass the
|
williamr@2
|
116 |
* content to an application that can handle that scheme.
|
williamr@2
|
117 |
*/
|
williamr@2
|
118 |
virtual TBool HandleRequestL(RArray<TUint>* aTypeArray, CDesCArrayFlat* aDesArray) = 0;
|
williamr@2
|
119 |
|
williamr@2
|
120 |
/**
|
williamr@2
|
121 |
* Request the host applicaion to handle downloads
|
williamr@2
|
122 |
* @since 2.8
|
williamr@2
|
123 |
* @param aTypeArray array of download parameter types
|
williamr@2
|
124 |
* @param aDesArray array of values associated with the types in the type array
|
williamr@2
|
125 |
* @return ETrue if handled by the host application
|
williamr@2
|
126 |
* EFalse if not handled by the host application
|
williamr@2
|
127 |
* @attention The host application should call the Download Manager to
|
williamr@2
|
128 |
* handle non-HTML content.
|
williamr@2
|
129 |
* Only GET requests are supported because the Browser Control must
|
williamr@2
|
130 |
* cancel the transaction before the Download Manager can take over.
|
williamr@2
|
131 |
* If a POST request is cancelled, the server may enter an unpredictable state.
|
williamr@2
|
132 |
* For POST requests, the Browser Control downloads the content before calling
|
williamr@2
|
133 |
* this function. It stores the content in a file whose name is passed to the
|
williamr@2
|
134 |
* host application by using the EParamLocalFileName parameter. The host
|
williamr@2
|
135 |
* application should check whether this parameter was passed by the
|
williamr@2
|
136 |
* Browser Control to determine whether the Browser Control already downloaded
|
williamr@2
|
137 |
* the content. If not, the host application should download the content.
|
williamr@2
|
138 |
*/
|
williamr@2
|
139 |
virtual TBool HandleDownloadL(RArray<TUint>* aTypeArray, CDesCArrayFlat* aDesArray) = 0;
|
williamr@2
|
140 |
|
williamr@2
|
141 |
};
|
williamr@2
|
142 |
|
williamr@2
|
143 |
#endif // BRCTLSPECIALLOADOBSERVER_H
|
williamr@2
|
144 |
|
williamr@2
|
145 |
// End of File
|