|
1 /******************************************************************************* |
|
2 * Copyright (c) 2007, 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. This program and the accompanying materials |
|
4 * are made available under the terms of the Eclipse Public License v1.0 |
|
5 * which accompanies this distribution, and is available at |
|
6 * http://www.eclipse.org/legal/epl-v10.html |
|
7 * |
|
8 * Contributors: |
|
9 * Nokia Corporation - S60 implementation |
|
10 *******************************************************************************/ |
|
11 |
|
12 |
|
13 #ifndef SWTBROWSERSPECIALLOADOBSERVER_H |
|
14 #define SWTBROWSERSPECIALLOADOBSERVER_H |
|
15 |
|
16 |
|
17 #include <brctlspecialloadobserver.h> |
|
18 #include <AknServerApp.h> |
|
19 |
|
20 |
|
21 class CDocumentHandler; |
|
22 class CSwtBrowserSchemeHandler; |
|
23 class CSwtBrowser; |
|
24 class CAiwGenericParamList; |
|
25 |
|
26 |
|
27 /** |
|
28 * CSwtBrowserSpecialLoadObserver |
|
29 * This observer handles special load events such as network connection, |
|
30 * deal with non-http(s) or non-html requests. |
|
31 * This class mainly implements MBrCtlSpecialLoadObserver, |
|
32 * which registers for special load events. |
|
33 * @lib eswt |
|
34 */ |
|
35 NONSHARABLE_CLASS(CSwtBrowserSpecialLoadObserver) |
|
36 : public CBase |
|
37 , public MBrCtlSpecialLoadObserver |
|
38 , public MAknServerAppExitObserver |
|
39 { |
|
40 public: |
|
41 /** |
|
42 * Two-phased constructor. |
|
43 * param aContainer The pointer points to the browser Api provider |
|
44 */ |
|
45 static CSwtBrowserSpecialLoadObserver* NewL(CSwtBrowser* aBrowser); |
|
46 |
|
47 /** |
|
48 * Destructor. |
|
49 */ |
|
50 virtual ~CSwtBrowserSpecialLoadObserver(); |
|
51 |
|
52 // From MBrCtlSpecialLoadObserver |
|
53 virtual void NetworkConnectionNeededL(TInt* aConnectionPtr, TInt* aSockSvrHandle, |
|
54 TBool* aNewConn, TApBearerType* aBearerType); |
|
55 TBool HandleRequestL(RArray<TUint>* aTypeArray, CDesCArrayFlat* aDesArray); |
|
56 TBool HandleDownloadL(RArray<TUint>* aTypeArray, CDesCArrayFlat* aDesArray); |
|
57 |
|
58 // From MAknServerAppExitObserver |
|
59 void HandleServerAppExit(TInt aReason); |
|
60 |
|
61 private: |
|
62 /** |
|
63 * Constructor. |
|
64 * param aContainer The pointer points to the browser Api provider |
|
65 */ |
|
66 CSwtBrowserSpecialLoadObserver(CSwtBrowser* aBrowser); |
|
67 |
|
68 /** |
|
69 * Symbian 2nd phase constructor is private. |
|
70 */ |
|
71 void ConstructL(); |
|
72 |
|
73 /** |
|
74 * Request the host applicaion to handle non-http request. |
|
75 * @param aTypeArray The non-http(s) or file URL |
|
76 * @param aDesArray Parameters to pass to the host application. Contain referer header. |
|
77 * @return ETrue is handled by the host application. EFlase if not |
|
78 */ |
|
79 virtual TBool DoHandleRequestL(RArray<TUint>* aTypeArray, CDesCArrayFlat* aDesArray); |
|
80 |
|
81 /** |
|
82 * Make generic parameter list from BrCtl parameter list. |
|
83 * @param aTypeArray array of download parameter types |
|
84 * @param aDesArray array of values associated with the types in the type array |
|
85 * @return The dynamically allocated list. |
|
86 */ |
|
87 CAiwGenericParamList* BrCtlParamList2GenericParamListL(RArray<TUint>* aTypeArray, |
|
88 CDesCArrayFlat* aDesArray) const; |
|
89 |
|
90 /** |
|
91 * Extract the given BrCtl parameter from the list. |
|
92 * @param aParamTypeToFind Extract this parameter. |
|
93 * @param aTypeArray array of download parameter types. |
|
94 * @param aDesArray array of values associated with the types in the type array. |
|
95 * @param aParamFound Output: ETrue if the parameter was found. |
|
96 * @return A TPtrC pointer for the value. |
|
97 */ |
|
98 TPtrC ExtractBrCtlParam(TUint aParamTypeToFind, RArray<TUint>* aTypeArray, |
|
99 CDesCArrayFlat* aDesArray, TBool& aParamFound) const; |
|
100 |
|
101 private: //Data |
|
102 /** |
|
103 * Scheme processing. |
|
104 */ |
|
105 TBool iSchemeProcessing; |
|
106 |
|
107 /** |
|
108 * Used to send the content to the proper application. |
|
109 * Own |
|
110 */ |
|
111 CDocumentHandler* iHandler; |
|
112 |
|
113 /** |
|
114 * scheme handler |
|
115 * Own |
|
116 */ |
|
117 CSwtBrowserSchemeHandler *iSchemeHandler; |
|
118 |
|
119 /** |
|
120 * Pointer to browser API provider. |
|
121 * Not own |
|
122 */ |
|
123 CSwtBrowser *iBrowser; |
|
124 }; |
|
125 |
|
126 #endif // SWTBROWSERSPECIALLOADOBSERVER_H |