|
1 /* |
|
2 * Copyright (c) 2005 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef WMLCONTROL_H |
|
19 #define WMLCONTROL_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32base.h> |
|
23 #include <w32std.h> |
|
24 #include "BrCtlDefs.h" |
|
25 |
|
26 #include "BrCtl.h" |
|
27 #include "WmlEngineInterface.h" |
|
28 #include "WmlContentInterface.h" |
|
29 |
|
30 // CONSTANTS |
|
31 _LIT ( KCrLf, "\r\n"); |
|
32 _LIT ( KHeaderBoundary, "\r\n\r\n" ); |
|
33 _LIT8( KHeaderBoundary8, "\r\n\r\n" ); |
|
34 _LIT ( KHeaderContentLocation, "Content-Location: " ); |
|
35 _LIT8( KHeaderSavePageProto, "SAVED-PAGE/3.1" ); |
|
36 _LIT8( KMultipartBoundaryMarker, "multipart/mixed; boundary=" ); |
|
37 _LIT8( KPartHeadersData, "Content-Location: %S\r\nContent-Type: %S;charset=%S\r\n\r\n" ); |
|
38 _LIT8( KPartHeadersImg, "Content-Location: %S\r\nContent-Type: %S\r\n\r\n" ); |
|
39 _LIT ( KSavePageDocTop, "SAVED-PAGE/3.1\r\nContent-Location: " ); |
|
40 _LIT8( KSavePageBoundary, "S60BrowserSavedPage" ); |
|
41 _LIT8( KSavedPageContentType, "multipart/mixed" ); |
|
42 |
|
43 // MACROS |
|
44 |
|
45 // DATA TYPES |
|
46 |
|
47 // FUNCTION PROTOTYPES |
|
48 |
|
49 // FORWARD DECLARATIONS |
|
50 class CView; |
|
51 class CShell; |
|
52 |
|
53 // CLASS DECLARATION |
|
54 /** |
|
55 * |
|
56 * @lib resLoader.lib |
|
57 * @since 3.0 |
|
58 */ |
|
59 NONSHARABLE_CLASS(CWmlControl): public CBase, public MWmlEngineInterface |
|
60 { |
|
61 public: // Constructors and destructor |
|
62 |
|
63 /** |
|
64 * Destructor. |
|
65 */ |
|
66 virtual ~CWmlControl(); |
|
67 |
|
68 public: // new functions |
|
69 |
|
70 /** |
|
71 * StartLoadingResource |
|
72 * Public Class Method |
|
73 * Purpose |
|
74 * @since 3.0 |
|
75 * @param MWebCoreResourceLoader& aWebCoreLoader |
|
76 * @param const TDesC& aURL |
|
77 * @param CArrayFix<TWebCoreKeyValuePair>* aCustomHeaders |
|
78 * @return MWebCoreResourceHandle* |
|
79 */ |
|
80 CWmlResourceLoadListener* LoadResourceL( const TDesC& aURL, void* aLoadContext, |
|
81 void* aPartialLoadCallback, TUint16 aTransId ); |
|
82 |
|
83 // Returns a WmlView reference |
|
84 CView* WmlView() {return iWmlView;} |
|
85 // Returns a WmlShell reference |
|
86 CShell* WmlShell() {return iWmlShell;} |
|
87 // Returns a WmlMode to set the right control |
|
88 TBool WmlMode() { return iWmlMode; } |
|
89 // Returns a WmlLink |
|
90 TBool WmlLink() { return iWmlLink; } |
|
91 // Returns the Application Id |
|
92 TInt AppId() { return iApId; } |
|
93 // Sets the AppId |
|
94 void SetAppId(TInt aApId){ iApId = aApId; } |
|
95 // Sets a WmlMode |
|
96 void SetWmlMode(TBool aMode) { iWmlMode = aMode; } |
|
97 // Sets the WmlLink |
|
98 void SetWmlLink(TBool aLink) { iWmlLink = aLink; } |
|
99 // Returns to the Browser Control info about the wml page |
|
100 HBufC* CWmlControl::PageInfoLC(TBrCtlDefs::TBrCtlPageInfo aBrCtlPageInfo); |
|
101 |
|
102 /** |
|
103 * Update a Browser setting |
|
104 * @since 3.1 |
|
105 * @param aSetting The setting to update |
|
106 * @param aValue The new value of the setting |
|
107 * @return void |
|
108 */ |
|
109 void SetBrowserSettingL(TUint aSetting, TUint aValue); |
|
110 |
|
111 /** |
|
112 * Sets a pointer to the active history controller |
|
113 * @since 3.1 |
|
114 * @return void |
|
115 */ |
|
116 void SetHistoryController( HistoryControllerInterface* aHistoryController ) { iHistoryController = aHistoryController; } |
|
117 |
|
118 /** |
|
119 * return history controller |
|
120 * @return history controller |
|
121 */ |
|
122 HistoryControllerInterface& HistoryController() const { return *iHistoryController; } |
|
123 |
|
124 |
|
125 /** |
|
126 * Accessor function to the MWKWmlInterface. |
|
127 * @since 3.1 |
|
128 */ |
|
129 |
|
130 |
|
131 |
|
132 CBrCtl* WmlControlGetBrCtl() const { return iBrCtl; } |
|
133 |
|
134 MWmlInterface* WKWmlInterface() {return iWKWmlInterface; } |
|
135 |
|
136 void InputElementEditComplete( TBool aInputConfirmed ); |
|
137 void GainFocus(); |
|
138 |
|
139 void LoseFocus(); |
|
140 |
|
141 TInt HandleDo( TUint32 aElemId ); |
|
142 |
|
143 TInt ProcessBack(); |
|
144 |
|
145 CArrayFixFlat<TBrCtlImageCarrier>* GetPageImagesL(); |
|
146 |
|
147 TBrCtlDefs::TBrCtlElementType GetFocusedElementType(); |
|
148 |
|
149 TWmlEngineDefs::THistoryStackPosition HistoryStackPosition(); |
|
150 |
|
151 void MakeVisible(TBool aVisible); |
|
152 |
|
153 void SetFocus( TBool aFocus, TDrawNow aDrawNow ); |
|
154 |
|
155 void SetRect( const TRect &aRect ); |
|
156 |
|
157 |
|
158 //TBrowserStatusCode |
|
159 |
|
160 TInt WMLPartialResponse( CWmlContentInterface* aWmlContentInterface, |
|
161 const TUint16* aUri, |
|
162 TPtr8& aBody, |
|
163 void* aHeaders, |
|
164 TUint8* aContentTypeString, |
|
165 TUint8* aContentLocationString, |
|
166 TBool aNoStore, |
|
167 TUint8* aBoundaryString, |
|
168 TUint16* aLastModified, |
|
169 TUint16 aCharset, |
|
170 TUint8* aCharsetString, |
|
171 TUint aHttpStatus, |
|
172 TUint8 aMethod, |
|
173 TUint16 aTransId, |
|
174 TInt aChunkIndex, |
|
175 void* aCertInfo, |
|
176 TUint aContentLength, |
|
177 TInt aErr, |
|
178 void* aLoadContext, |
|
179 void* aPartialCallback ); |
|
180 |
|
181 CCoeControl* coeControl(); |
|
182 void WmlLoadUrlL( const TDesC& aUrl); |
|
183 void LoadImages(); |
|
184 TRect WmlViewRectangle(); |
|
185 void ScrollTo(TPoint aPoint); |
|
186 CWmlControl(); |
|
187 void SetCertInfo( const TCertInfo* aCertInfo ); |
|
188 const TCertInfo* CertInfo() const { return iCertInfo; } |
|
189 void* loadContext() {return iWmlContentInterface->getLoadContext();} |
|
190 void* partialLoadCallback() {return iWmlContentInterface->getPartialCallBack();} |
|
191 TUint16 transId() {return iWmlContentInterface->getTransId();} |
|
192 |
|
193 void WmlParameters( const char* data, int length, TDesC& contentType, TDesC& charset, TInt httpStatus, TInt chunkIndex, TDesC& url ); |
|
194 virtual TSize WMLDocumentSize(); |
|
195 virtual TPoint WMLDocumentPosition(); |
|
196 |
|
197 private: |
|
198 |
|
199 /** |
|
200 * C++ default constructor. |
|
201 */ |
|
202 //CWmlControl(); |
|
203 |
|
204 /** |
|
205 * By default Symbian 2nd phase constructor is private. |
|
206 */ |
|
207 virtual void ConstructL( CBrCtl* aBrCtl, TRect& aRect, MWmlInterface* aWKWmlInterface); |
|
208 |
|
209 /** |
|
210 * For saving is WML page. The function is same as that of |
|
211 * CWebKitControl::GenerateSavedPageL(). |
|
212 */ |
|
213 |
|
214 HBufC* WMLGenerateSavedPageL(); |
|
215 private: |
|
216 // |
|
217 CShell* iWmlShell; // owned |
|
218 // |
|
219 CView* iWmlView; // owned |
|
220 // |
|
221 CBrCtl* iBrCtl; |
|
222 // |
|
223 TInt iApId; |
|
224 // |
|
225 TBool iWmlMode; |
|
226 // |
|
227 TBool iWmlLink; |
|
228 // |
|
229 const TCertInfo* iCertInfo; // owned |
|
230 HistoryControllerInterface* iHistoryController; |
|
231 MWmlInterface* iWKWmlInterface; |
|
232 CWmlContentInterface* iWmlContentInterface; |
|
233 RPointerArray<CWmlContentInterface> m_contentArray; |
|
234 }; |
|
235 |
|
236 #endif // WMLCONTROL_H |
|
237 |
|
238 // End of File |