|
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: Definition of CHttpCacheSupply |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CHTTPCACHESUPPLY_H |
|
20 #define CHTTPCACHESUPPLY_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <BrCtlDefs.h> |
|
25 #include "HttpCacheManager.h" |
|
26 |
|
27 // CONSTANTS |
|
28 |
|
29 // MACROS |
|
30 |
|
31 // DATA TYPES |
|
32 |
|
33 // FUNCTION PROTOTYPES |
|
34 |
|
35 // FORWARD DECLARATIONS |
|
36 class HttpConnection; |
|
37 class CPeriodic; |
|
38 class CHttpCacheDataSupplier; |
|
39 |
|
40 // CLASS DECLARATION |
|
41 |
|
42 /** |
|
43 * This class handles http transactions. |
|
44 * @lib resLoader.lib |
|
45 * @since 3.1 |
|
46 */ |
|
47 class CHttpCacheSupply : public CBase |
|
48 { |
|
49 public: // Constructors and destructor |
|
50 |
|
51 /** |
|
52 * Two-phased constructor. |
|
53 * @param |
|
54 * @param |
|
55 * @param |
|
56 * @return Http cache object. |
|
57 */ |
|
58 static CHttpCacheSupply* NewL( HttpConnection* aHttpTransaction ); |
|
59 |
|
60 /** |
|
61 * Destructor. |
|
62 */ |
|
63 virtual ~CHttpCacheSupply(); |
|
64 |
|
65 public: // new functions |
|
66 |
|
67 /** |
|
68 * |
|
69 * @since 3.1 |
|
70 * @param |
|
71 * @return |
|
72 */ |
|
73 TInt StartRequestL( TBrCtlDefs::TBrCtlCacheMode aCacheMode ); |
|
74 |
|
75 /** |
|
76 * |
|
77 * @since 3.1 |
|
78 * @param |
|
79 * @return |
|
80 */ |
|
81 void CloseRequest(); |
|
82 |
|
83 /** |
|
84 * |
|
85 * @since 3.1 |
|
86 * @param |
|
87 * @return |
|
88 */ |
|
89 void HeadersReceivedL(); |
|
90 |
|
91 /** |
|
92 * |
|
93 * @since 3.1 |
|
94 * @param |
|
95 * @return |
|
96 */ |
|
97 void BodyReceivedL(); |
|
98 |
|
99 /** |
|
100 * |
|
101 * @since 3.1 |
|
102 * @param |
|
103 * @return |
|
104 */ |
|
105 void ResponseCompleteL(); |
|
106 |
|
107 /** |
|
108 * |
|
109 * @since 3.1 |
|
110 * @param |
|
111 * @return |
|
112 */ |
|
113 TInt ResponseState() const { return m_reponseState;} |
|
114 |
|
115 /** |
|
116 * |
|
117 * @since 3.1 |
|
118 * @param |
|
119 * @return |
|
120 */ |
|
121 TBool IsSupplying() { return m_responseTimer!=0; } |
|
122 |
|
123 /** |
|
124 * |
|
125 * @since 3.1 |
|
126 * @param |
|
127 * @return |
|
128 */ |
|
129 void PauseSupply(); |
|
130 |
|
131 /** |
|
132 * |
|
133 * @since 3.1 |
|
134 * @param |
|
135 * @return |
|
136 */ |
|
137 void ResumeSupply(); |
|
138 |
|
139 private: |
|
140 |
|
141 /** |
|
142 * Construct. |
|
143 * @param |
|
144 * @param |
|
145 * @parem |
|
146 * @return |
|
147 */ |
|
148 CHttpCacheSupply( HttpConnection* aHttpTransaction ); |
|
149 |
|
150 /** |
|
151 * By default Symbian 2nd phase constructor is private. |
|
152 */ |
|
153 void ConstructL(); |
|
154 |
|
155 private: // |
|
156 |
|
157 /** |
|
158 * Callback for async response |
|
159 * @since 3.1 |
|
160 * @param aAny this pinter |
|
161 * @return TInt KErrNone |
|
162 */ |
|
163 static TInt ResponseCallbackL( TAny* aAny ); |
|
164 |
|
165 /** |
|
166 * |
|
167 * @since 3.1 |
|
168 * @param |
|
169 * @return |
|
170 */ |
|
171 void SupplyResponseL(); |
|
172 |
|
173 /** |
|
174 * |
|
175 * @since 3.1 |
|
176 * @param |
|
177 * @return |
|
178 */ |
|
179 void SendBodyL(); |
|
180 |
|
181 private: // Data |
|
182 |
|
183 // |
|
184 CHttpCacheManager* m_cacheManager; // not owned |
|
185 // |
|
186 HttpConnection* m_httpTransaction; // not owned |
|
187 // |
|
188 TInt m_reponseState; |
|
189 // |
|
190 CPeriodic* m_responseTimer; // owned |
|
191 // |
|
192 TBool m_failed; |
|
193 // |
|
194 TBool m_notModified; |
|
195 // |
|
196 THttpCacheEntry m_cacheEntry; |
|
197 // ETrue if the cache object is closed |
|
198 TBool m_closed; |
|
199 |
|
200 CHttpCacheDataSupplier* m_dataSupplier; |
|
201 }; |
|
202 |
|
203 #endif // CHTTPCACHESUPPLY_H |
|
204 |
|
205 // End of File |