1 /* |
|
2 * Copyright (c) 2003 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: Handling of general url loading |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CKUrlLoader_H |
|
21 #define CKUrlLoader_H |
|
22 |
|
23 // INCLUDES |
|
24 #include "urlloader_murlschemehandler.h" |
|
25 #include "BrsrStatusCodes.h" |
|
26 #include "BrCtlDefs.h" |
|
27 |
|
28 |
|
29 // CONSTANTS |
|
30 |
|
31 // MACROS |
|
32 |
|
33 // DATA TYPES |
|
34 |
|
35 // FUNCTION PROTOTYPES |
|
36 |
|
37 // FORWARD DECLARATIONS |
|
38 class MBrCtlSpecialLoadObserver; |
|
39 class MHttpLoader_LinkResolverCallbacks; |
|
40 class CWmlResourceLoadListener; |
|
41 class MWmlInterface; |
|
42 |
|
43 // CLASS DECLARATION |
|
44 /** |
|
45 * Url loader implementation class. |
|
46 * |
|
47 * @lib urlloader.lib |
|
48 * @since 2.0 |
|
49 */ |
|
50 class CKUrlLoader : public MUrlSchemeHandler |
|
51 { |
|
52 public: // Constructors and destructor |
|
53 |
|
54 /** |
|
55 * Two-phased constructor. |
|
56 */ |
|
57 static CKUrlLoader* NewL(MBrCtlSpecialLoadObserver* aSpecialLoadObserver, |
|
58 MHttpLoader_LinkResolverCallbacks* aLinkCallbacks, |
|
59 MWmlInterface* aWKWmlInterface); |
|
60 |
|
61 /** |
|
62 * Destructor. |
|
63 */ |
|
64 virtual ~CKUrlLoader(); |
|
65 |
|
66 public: // New functions |
|
67 |
|
68 |
|
69 /** |
|
70 * Make a generic load request |
|
71 * @since 2.0 |
|
72 * @param aUrl The request URL. |
|
73 * @param aHeader The request headers or NULL if no request specific headers |
|
74 * @param aData The body and body length of the request |
|
75 * @param aMethod The method to use for the request could be |
|
76 * NW_URL_METHOD_GET or NW_URL_METHOD_POST |
|
77 * @param aTransId The request's transaction id |
|
78 * @param aLoadContext Load context that should be returned with the response |
|
79 * @param aLoadCallback The callback to call when the response is ready |
|
80 * @param aPartialLoadCallback The callback to call when a chunk is ready |
|
81 * @param aCacheMode The cache mode is relevant only in case of http or https |
|
82 * @param aDefaultHeadersMask Flag indicating what default headers should be used |
|
83 * @param aLoadType The load type |
|
84 * @param aIsTopLevel Boolean denoting if this url is top level (not images, css) |
|
85 * @return TBrowserStatusCode |
|
86 */ |
|
87 TBrowserStatusCode LoadRequest(const TUint16* aUrl, void* aHeader, TUint8* aData, |
|
88 TUint aDataLen, TUint8 aMethod, TUint16* aTransId, |
|
89 void* aLoadContext, |
|
90 NW_Url_RespCallback_t* aPartialLoadCallback, |
|
91 NW_Cache_Mode_t aCacheMode, TUint aDefaultHeadersMask, |
|
92 TUint8 aLoadType, TBool aIsTopLevel, TBool aIsScript, |
|
93 NW_Uint8 aReason, void* aLoadData); |
|
94 |
|
95 |
|
96 |
|
97 public: // Functions from base classes |
|
98 |
|
99 /** |
|
100 * From MUrlSchemeHandler If the url scheme is not http, https or file, |
|
101 * send the request to the application architecture. |
|
102 * @since 2.0 |
|
103 * @param aUrl The request URL. |
|
104 * @param aHeader The request headers or NULL if no request specific headers |
|
105 * @param aData The body and body length of the request |
|
106 * @param aMethod The method to use for the request could be |
|
107 * NW_URL_METHOD_GET or NW_URL_METHOD_POST |
|
108 * @param aTransId The request's transaction id |
|
109 * @param aLoadContext Load context that should be returned with the response |
|
110 * @param aLoadCallback The callback to call when the response is ready |
|
111 * @param aPartialLoadCallback The callback to call when a chunk is ready |
|
112 * @param aCacheMode The cache mode is relevant only in case of http or https |
|
113 * @param aDefaultHeadersMask Flag indicating what default headers should be used |
|
114 * @param aLoadType The load type |
|
115 * @param aIsTopLevel Boolean denoting if this url is top level (not images, css) |
|
116 * @param aIsScript Is it a WmlScript load event? |
|
117 * @return ETrue if processed the load request, EFalse otherwise |
|
118 */ |
|
119 virtual TBool HandleLoadRequestL(const TUint16* aUrl, void* aHeader, |
|
120 TPtr8& aData, TUint8 aMethod, TUint16 aTransId, |
|
121 void* aLoadContext, |
|
122 NW_Url_RespCallback_t* aPartialLoadCallback, |
|
123 NW_Cache_Mode_t aCacheMode, |
|
124 TUint aDefaultHeadersMask, |
|
125 TUint8 aLoadType, TBool aIsTopLevel, |
|
126 TBool aIsScript, NW_Uint8 aReason, |
|
127 void* aLoadData); |
|
128 |
|
129 /** |
|
130 * Checks if the specified url is in the cache |
|
131 * @since 3.1 |
|
132 * @param aUrl The url of the page |
|
133 * @return TBool ETrue, if url is in the cache, otherwise EFalse |
|
134 */ |
|
135 TBool IsUrlInCache(const TUint16* aUrl); |
|
136 |
|
137 private: |
|
138 |
|
139 /** |
|
140 * C++ default constructor. |
|
141 */ |
|
142 CKUrlLoader(); |
|
143 |
|
144 /** |
|
145 * By default Symbian 2nd phase constructor is private. |
|
146 */ |
|
147 void ConstructL(MBrCtlSpecialLoadObserver* aSpecialLoadObserver, |
|
148 MHttpLoader_LinkResolverCallbacks* aLinkCallbacks, MWmlInterface* aWKWmlInterface); |
|
149 |
|
150 /** |
|
151 * SetOnEnterBackward |
|
152 * @since 3.1 |
|
153 * @param aOnEnterBackward The OnEnterBackward event value |
|
154 */ |
|
155 void SetOnEnterBackward(TBool aOnEnterBackward){iOnEnterBackward = aOnEnterBackward;} |
|
156 |
|
157 void SetOnEnterForward(TBool aOnEnterForward){iOnEnterForward = aOnEnterForward;} |
|
158 /** |
|
159 * OnEnterBackward |
|
160 * @since 3.1 |
|
161 * @return ETrue if processed the OnEnterBackward event, EFalse otherwise |
|
162 */ |
|
163 TBool OnEnterBackward(){return iOnEnterBackward;} |
|
164 TBool OnEnterForward() {return iOnEnterForward;} |
|
165 |
|
166 public: // Data |
|
167 |
|
168 |
|
169 // The capabilities that are supported by the "Browser As Plugin". |
|
170 // This is passed in as a TUint, but maps to TBrCtlDefs::TBrCtlCapabilities. |
|
171 TUint iCapabilities; |
|
172 |
|
173 private: // Data |
|
174 |
|
175 // A pointer to File loader |
|
176 MUrlSchemeHandler* iFileLoader; |
|
177 // A popinter to SpecialLoadObserver |
|
178 MBrCtlSpecialLoadObserver* iSpecialLoadObserver; |
|
179 // The next transaction id to use |
|
180 TUint16 iTransId; |
|
181 //The back link to BrCtl |
|
182 MHttpLoader_LinkResolverCallbacks* iLinkCallbacks; |
|
183 // |
|
184 CWmlResourceLoadListener* iResHandle; |
|
185 // |
|
186 TBool iOnEnterBackward; |
|
187 TBool iOnEnterForward; |
|
188 MWmlInterface* iWKWmlInterface; //Does not own |
|
189 |
|
190 }; |
|
191 |
|
192 #endif // CKUrlLoader_H |
|
193 |
|
194 // End of File |
|