|
1 |
|
2 // Copyright (c) 2005-2009 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 "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 #ifndef _TESTWEBBROWSER_H |
|
18 #define _TESTWEBBROWSER_H |
|
19 |
|
20 #include <http/mhttpauthenticationcallback.h> |
|
21 |
|
22 #include "browsertransaction.h" |
|
23 |
|
24 class CBrowserTransaction; |
|
25 class CHttpExampleUtils; |
|
26 |
|
27 class CTestWebBrowser : public CActive, |
|
28 public MBrowserTransactionObserver, |
|
29 public MHTTPAuthenticationCallback |
|
30 { |
|
31 public: |
|
32 |
|
33 enum THttpClientState |
|
34 { |
|
35 EMainMenu, |
|
36 EEnterUrl, |
|
37 ESelectProxy, |
|
38 EStop, |
|
39 EStartTransaction, |
|
40 ETransactionStarted, |
|
41 ETransactionCompleted |
|
42 }; |
|
43 |
|
44 enum TMenuSelection |
|
45 { |
|
46 EDownloadURL, |
|
47 ESetProxy, |
|
48 EQuit |
|
49 }; |
|
50 virtual ~CTestWebBrowser (); |
|
51 |
|
52 static CTestWebBrowser* NewLC ( CHttpExampleUtils& aUtils ); |
|
53 static CTestWebBrowser* NewL ( CHttpExampleUtils& aUtils ); |
|
54 |
|
55 |
|
56 virtual void OnTransactionCreateL ( const TDesC8& aUri, TBool aParseHtml ); |
|
57 virtual void OnTransactionClose ( CBrowserTransaction* aTrans ); |
|
58 |
|
59 // methods inherited from MHTTPAuthenticationCallback |
|
60 virtual TBool GetCredentialsL ( const TUriC8& aURI, RString aRealm, |
|
61 RStringF aAuthenticationType, |
|
62 RString& aUsername, |
|
63 RString& aPassword ); |
|
64 |
|
65 protected: |
|
66 CTestWebBrowser ( CHttpExampleUtils& aUtils ); |
|
67 void ConstructL (); |
|
68 void IssueAndCompleteRequest(); |
|
69 |
|
70 void ExecuteMainMenuL (); |
|
71 TBool ValidateUri ( const TDesC8& aUri ); |
|
72 |
|
73 HBufC* GenerateFilePathL ( const TUriC8& aUri ); |
|
74 |
|
75 void AcceptUrlL (); |
|
76 void AcceptProxyL (); |
|
77 |
|
78 void OnTransactionCompleted (); |
|
79 |
|
80 void CreateTransactionL ( const TDesC8& aUri, TBool aParseHtml = EFalse ); |
|
81 |
|
82 void SetProxyL ( const TDesC8& aProxyAddr ); |
|
83 |
|
84 private: |
|
85 // Methods from CActive |
|
86 virtual void RunL(); |
|
87 virtual void DoCancel(); |
|
88 |
|
89 private: |
|
90 RPointerArray < CBrowserTransaction > iTransArray; |
|
91 CHttpExampleUtils& iTestUtils; |
|
92 RHTTPSession iHttpSession; |
|
93 |
|
94 THttpClientState iCurrentState; |
|
95 |
|
96 HBufC8* iBaseUri; |
|
97 }; |
|
98 |
|
99 #endif |