3
|
1 |
/*
|
|
2 |
* Copyright (c) 2006 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: Handle scrollbar and tab events
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
#ifndef BRCTLBCTESTOBSERVER_H
|
|
21 |
#define BRCTLBCTESTOBSERVER_H
|
|
22 |
|
|
23 |
// INCLUDES
|
|
24 |
#include <BrCtlLayoutObserver.h>
|
|
25 |
#include <BrCtlSoftkeysObserver.h>
|
|
26 |
#include <BrCtlSpecialLoadObserver.h>
|
|
27 |
#include <BrCtlDownloadObserver.h>
|
|
28 |
#include <BrCtlInterface.h>
|
|
29 |
#include <DocumentHandler.h>
|
|
30 |
#include <flogger.h>
|
|
31 |
|
|
32 |
class CBrCtlApiTestObserver :
|
|
33 |
public CBase,
|
|
34 |
public MBrCtlLayoutObserver,
|
|
35 |
public MBrCtlSoftkeysObserver,
|
|
36 |
public MBrCtlSpecialLoadObserver,
|
|
37 |
public MBrCtlLoadEventObserver,
|
|
38 |
public MBrCtlLinkResolver,
|
|
39 |
public MBrCtlDownloadObserver,
|
|
40 |
public MBrCtlWindowObserver // Added for Widget Extension Test
|
|
41 |
{
|
|
42 |
public: // Constructors and destructor
|
|
43 |
|
|
44 |
/**
|
|
45 |
* Two-phased constructor.
|
|
46 |
*/
|
|
47 |
static CBrCtlApiTestObserver* NewL();
|
|
48 |
|
|
49 |
/**
|
|
50 |
* Destructor.
|
|
51 |
*/
|
|
52 |
~CBrCtlApiTestObserver();
|
|
53 |
|
|
54 |
|
|
55 |
/**
|
|
56 |
* Update the position of vertical scrollbar.
|
|
57 |
* @since 2.8
|
|
58 |
* @param aDocumentHeight The total height of the markup page
|
|
59 |
* @param aDisplayHeight The height of the display
|
|
60 |
* @param aDisplayPosY The current Y position
|
|
61 |
* @return void
|
|
62 |
*/
|
|
63 |
void UpdateBrowserVScrollBarL(TInt /*aDocumentHeight*/,
|
|
64 |
TInt /*aDisplayHeight*/,
|
|
65 |
TInt /*aDisplayPosY*/ ) ;
|
|
66 |
|
|
67 |
/**
|
|
68 |
* Update the position of horizontal scrollbar.
|
|
69 |
* @since 2.8
|
|
70 |
* @param aDocumentWidth The total width of the markup page
|
|
71 |
* @param aDisplayWidth The width of the display
|
|
72 |
* @param aDisplayPosX The current X position
|
|
73 |
* @return void
|
|
74 |
*/
|
|
75 |
void UpdateBrowserHScrollBarL(TInt /*aDocumentWidth*/,
|
|
76 |
TInt /*aDisplayWidth*/,
|
|
77 |
TInt /*aDisplayPosX*/ ) ;
|
|
78 |
|
|
79 |
/**
|
|
80 |
* Inform the layout of the page: right to left or left to right. Useful when the application draws the scrollbar itself.
|
|
81 |
* @since 2.8
|
|
82 |
* @param aNewLayout RTL or LTR
|
|
83 |
* @return void
|
|
84 |
*/
|
|
85 |
void NotifyLayoutChange( TBrCtlLayout /*aNewLayout*/ ) ;
|
|
86 |
|
|
87 |
/**
|
|
88 |
* Update the title of the page in history view
|
|
89 |
* @since 3.0
|
|
90 |
* @param aTitle Title of the page
|
|
91 |
* @return void
|
|
92 |
*/
|
|
93 |
void UpdateTitleL( const TDesC& aTitle );
|
|
94 |
|
|
95 |
/**
|
|
96 |
* Browser Control requests to update a softkey
|
|
97 |
* @since 2.8
|
|
98 |
* @param aKeySoftkey Update the left softkey or the right softkey
|
|
99 |
* @param aLabel The label associated with the softkey update
|
|
100 |
* @param aCommandId The command to use if the softkey is selected by the user
|
|
101 |
* @param aBrCtlSoftkeyChangeReason The reason for the softkey change
|
|
102 |
* @return void
|
|
103 |
*/
|
|
104 |
void UpdateSoftkeyL(TBrCtlKeySoftkey /*aKeySoftkey*/,
|
|
105 |
const TDesC& /*aLabel*/,
|
|
106 |
TUint32 /*aCommandId*/,
|
|
107 |
TBrCtlSoftkeyChangeReason /*aBrCtlSoftkeyChangeReason*/) ;
|
|
108 |
|
|
109 |
/**
|
|
110 |
* Request to create a network connection.
|
|
111 |
* @since 2.8
|
|
112 |
* @param aConnectionPtr A pointer to the new connection. If NULL, the proxy filter will automatically create a network connection
|
|
113 |
* @param aSockSvrHandle A handle to the socket server.
|
|
114 |
* @param aNewConn A flag if a new connection was created. If the connection is not new, proxy filter optimization will not read the proxy again from CommsBd
|
|
115 |
* @param aBearerType The bearer type of the new connection
|
|
116 |
* @return void
|
|
117 |
*/
|
|
118 |
void NetworkConnectionNeededL(TInt* /*aConnectionPtr*/,
|
|
119 |
TInt* /*aSockSvrHandle*/,
|
|
120 |
TBool* /*aNewConn*/,
|
|
121 |
TApBearerType* /*aBearerType*/) ;
|
|
122 |
|
|
123 |
/**
|
|
124 |
* Request the host applicaion to handle non-http request.
|
|
125 |
* @since 2.8
|
|
126 |
* @param aUrl The non-http(s) or file URL
|
|
127 |
* @param aParamList Parameters to pass to the host application. Contain referer header. It could be NULL
|
|
128 |
* @return ETrue is handled by the host application. EFlase if not
|
|
129 |
*/
|
|
130 |
TBool HandleRequestL(RArray<TUint>* aTypeArray, CDesCArrayFlat* aDesArray);
|
|
131 |
|
|
132 |
/**
|
|
133 |
* Request the host applicaion to handle downloads
|
|
134 |
* @since 2.8
|
|
135 |
* @param aTypeArray array of download parameter types
|
|
136 |
* @param aDesArray array of values associated with the types in the type array
|
|
137 |
* @return ETrue is handled by the host application. EFlase if not
|
|
138 |
*/
|
|
139 |
TBool HandleDownloadL(RArray<TUint>* aTypeArray, CDesCArrayFlat* aDesArray);
|
|
140 |
|
|
141 |
/**
|
|
142 |
* A load events notification
|
|
143 |
* @since 2.8
|
|
144 |
* @param aLoadEvent The load event
|
|
145 |
* @param aSize Size depends on the event
|
|
146 |
* @param aTransactionId The transaction id of the transaction that had this event
|
|
147 |
* @return void
|
|
148 |
*/
|
|
149 |
void HandleBrowserLoadEventL(TBrCtlDefs::TBrCtlLoadEvent aLoadEvent, TUint aSize, TUint16 aTransactionId) ;
|
|
150 |
|
|
151 |
/**
|
|
152 |
* Browser plug-in calls this method when embedded link is found. Used with ECapabilityClientResolveEmbeddedURL
|
|
153 |
* @since 2.8
|
|
154 |
* @param aEmbeddedUrl The url of the embedded content
|
|
155 |
* @param aCurrentUrl The url of the current page
|
|
156 |
* @param aLoadContentType The expected type of the embedded content
|
|
157 |
* @param aEmbeddedLinkContent a callback interface to return the embedded content
|
|
158 |
* @return EFalse, browser will resolve the link
|
|
159 |
*/
|
|
160 |
TBool ResolveEmbeddedLinkL(const TDesC& aEmbeddedUrl,
|
|
161 |
const TDesC& aCurrentUrl,
|
|
162 |
TBrCtlLoadContentType aLoadContentType,
|
|
163 |
MBrCtlLinkContent& aEmbeddedLinkContent) ;
|
|
164 |
|
|
165 |
/**
|
|
166 |
* Browser plug-in calls this method when the user requests to load content via selecting a link, or any other way. Used with ECapabilityClientNotifyURL
|
|
167 |
* @since 2.8
|
|
168 |
* @param aUrl The requested url
|
|
169 |
* @param aCurrentUrl The url of the current page
|
|
170 |
* @param aBrCtlLinkContent a callback interface to return the embedded content
|
|
171 |
* @return EFalse, browser will resolve the link
|
|
172 |
*/
|
|
173 |
TBool ResolveLinkL(const TDesC& aUrl, const TDesC& aCurrentUrl,
|
|
174 |
MBrCtlLinkContent& aBrCtlLinkContent) ;
|
|
175 |
|
|
176 |
/**
|
|
177 |
* Cancel all outstanding resolving operations
|
|
178 |
* @since 2.8
|
|
179 |
* @return void
|
|
180 |
*/
|
|
181 |
void CancelAll() ;
|
|
182 |
|
|
183 |
/**
|
|
184 |
* Inform the host application that a new download has started using the Download Manager
|
|
185 |
* @since 3.0
|
|
186 |
* @param aTransactionID The ID of the transaction, it is unique as long as the transaction is on-going
|
|
187 |
* @param aFileName The name of file in which the content is stored/
|
|
188 |
* @param aContentType The content type of the downloaded content
|
|
189 |
* @param aUrl The Url of the request to be done in the new window
|
|
190 |
* @return Return ETrue if the file is handled progressively, EFalse otherwise
|
|
191 |
*/
|
|
192 |
TBool NewDownloadL(TUint aTransactionID,
|
|
193 |
const TDesC& aFileName,
|
|
194 |
const TDesC& aContentType,
|
|
195 |
const TDesC& aUrl);
|
|
196 |
|
|
197 |
|
|
198 |
/**
|
|
199 |
* Inform the host application that a new download has started using the Download Manager
|
|
200 |
* @since 3.0
|
|
201 |
* @param aTransactionID The ID of the transaction, it is unique as long as the transaction is on-going
|
|
202 |
* @param aFileName The name of file in which the content is stored/
|
|
203 |
* @param aContentType The content type of the downloaded content
|
|
204 |
* @param aUrl The Url of the request to be done in the new window
|
|
205 |
* @return Return ETrue if the file is handled progressively, EFalse otherwise
|
|
206 |
*/
|
|
207 |
void ResumeDownloadL(TUint aTransactionID,
|
|
208 |
TUint aLength,
|
|
209 |
const TDesC& aFileName,
|
|
210 |
const TDesC& aContentType,
|
|
211 |
const TDesC& aUrl);
|
|
212 |
|
|
213 |
/**
|
|
214 |
* Inform the host application of a progress event related to a download
|
|
215 |
* @since 3.0
|
|
216 |
* @param aTransactionID The ID of the transaction, it is unique as long as the transaction is on-going
|
|
217 |
* @param aDownloadEvent The event to be reported
|
|
218 |
* @param aValue The value depends on the event
|
|
219 |
* @return void
|
|
220 |
*/
|
|
221 |
void HandleDownloadEventL(TUint aTransactionID,
|
|
222 |
TBrCtlDownloadEvent aDownloadEvent,
|
|
223 |
TUint aValue);
|
|
224 |
|
|
225 |
// Functions from CBrCtlWindowObserver class - Added for Widget Extension Test
|
|
226 |
|
|
227 |
/**
|
|
228 |
* Request the host applicaion to open the URL in a new window
|
|
229 |
* @since 3.0
|
|
230 |
* @param aUrl The Url of the request to be done in the new window
|
|
231 |
* @param aTargetName The name of the new window
|
|
232 |
* @param aUserInitiated ETrue if the new window is initiated by a user event (click)
|
|
233 |
* @param aMethod The method to be used for fetching the supplied url
|
|
234 |
* @param aContentType If the method is POST, this is the content type of the data to be posted
|
|
235 |
* @param aPostData If the method is POST, this is the data to be posted
|
|
236 |
* @param aBoundary The boundary used if the content is multipart/form-data
|
|
237 |
* @param aReserved For future use
|
|
238 |
* @return Return Value is the new browser control associated with the new window
|
|
239 |
*/
|
|
240 |
CBrCtlInterface* OpenWindowL(TDesC& aUrl, TDesC* aTargetName, TBool aUserInitiated,
|
|
241 |
TAny* aReserved);
|
|
242 |
|
|
243 |
/**
|
|
244 |
* Find a window by target name
|
|
245 |
* @since 3.0
|
|
246 |
* @param aTargetName name of the window to find
|
|
247 |
* @return Return Value is the browser control associated with the window name
|
|
248 |
*/
|
|
249 |
CBrCtlInterface* FindWindowL( const TDesC& aTargetName ) const;
|
|
250 |
|
|
251 |
/**
|
|
252 |
* Handle window events such as close/focus etc
|
|
253 |
* @since 3.0
|
|
254 |
* @param aTargetName name of the window to send the event to
|
|
255 |
* @param aCommand Command to pass to the window
|
|
256 |
* @return void
|
|
257 |
*/
|
|
258 |
void HandleWindowCommandL( const TDesC& aTargetName, TBrCtlWindowCommand aCommand );
|
|
259 |
|
|
260 |
private:
|
|
261 |
/**
|
|
262 |
* By default Symbian 2nd phase constructor is private.
|
|
263 |
*/
|
|
264 |
void ConstructL();
|
|
265 |
|
|
266 |
/**
|
|
267 |
* Find if the scheme if file://
|
|
268 |
*/
|
|
269 |
TBool IsFileScheme(const TDesC& aFileName);
|
|
270 |
|
|
271 |
/**
|
|
272 |
* Read the file.
|
|
273 |
*/
|
|
274 |
HBufC8* ReadFileLC(const TDesC& aFileName);
|
|
275 |
|
|
276 |
/**
|
|
277 |
* Rcognize the mime type.
|
|
278 |
*/
|
|
279 |
HBufC* RecognizeLC(const TDesC& aFileName, const TDesC8& aData);
|
|
280 |
|
|
281 |
/**
|
|
282 |
* Translate the file name from a URL to a valid file name in the system..
|
|
283 |
*/
|
|
284 |
TBool GetFileNameL(const TDesC& aFileName);
|
|
285 |
|
|
286 |
private: // data
|
|
287 |
|
|
288 |
// The loaded file's name. This is different from the URL. It does not contain the scheme.
|
|
289 |
HBufC* iFileName;
|
|
290 |
CDocumentHandler* iHandler;
|
|
291 |
};
|
|
292 |
|
|
293 |
#endif // BRCTLBCTESTOBSERVER_H
|
|
294 |
|
|
295 |
// End of File
|
|
296 |
|