|
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: Handle special load events such as network connection, deal with non-http or non-html requests |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDES |
|
20 |
|
21 #include "WmlInterfaceImpl.h" |
|
22 #include "WebView.h" |
|
23 #include "WebFrame.h" |
|
24 #include "PlatformString.h" |
|
25 #include "HttpSessionManager.h" |
|
26 #include "StaticObjectsContainer.h" |
|
27 #include "ResourceLoaderDelegate.h" |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class CWmlContentInterface; |
|
31 |
|
32 using namespace WebCore; |
|
33 // ----------------------------------------------------------------------------- |
|
34 // WKWmlInterfaceImpl::WKWmlInterfaceImpl |
|
35 // C++ default constructor can NOT contain any code, that |
|
36 // might leave. |
|
37 // ----------------------------------------------------------------------------- |
|
38 // |
|
39 CWmlInterfaceImpl::CWmlInterfaceImpl(CBrCtl& aBrCtl):m_brCtl(aBrCtl) |
|
40 { |
|
41 } |
|
42 |
|
43 // ----------------------------------------------------------------------------- |
|
44 // WKWmlInterfaceImpl::WKResetWmlServiceOptions |
|
45 // Set the ResetWmlServiceOptions. |
|
46 // ----------------------------------------------------------------------------- |
|
47 |
|
48 |
|
49 |
|
50 void CWmlInterfaceImpl::resetWmlServiceOptions() |
|
51 { |
|
52 m_brCtl.resetWmlServiceOptions(); |
|
53 } |
|
54 |
|
55 |
|
56 // ----------------------------------------------------------------------------- |
|
57 // WKWmlInterfaceImpl::WKSetWKWmlServiceOptionsAddItemL |
|
58 // Set the ResetWmlServiceOptions. |
|
59 // ----------------------------------------------------------------------------- |
|
60 |
|
61 void CWmlInterfaceImpl::setWmlServiceOptionsAddItemL( |
|
62 const TText* aText, TUint32 aElemID, TInt aElType) |
|
63 { |
|
64 m_brCtl.wmlServiceOptionsAddItemL(aText,aElemID,aElType); |
|
65 } |
|
66 |
|
67 |
|
68 // ----------------------------------------------------------------------------- |
|
69 // WKWmlInterfaceImpl::WKSetWKUpdateSoftkeys() |
|
70 // Set the WKUpdateSoftkeys. |
|
71 // ----------------------------------------------------------------------------- |
|
72 |
|
73 void CWmlInterfaceImpl::setUpdateSoftkeys() |
|
74 { |
|
75 m_brCtl.updateDefaultSoftkeys(); |
|
76 } |
|
77 |
|
78 |
|
79 // ----------------------------------------------------------------------------- |
|
80 // CWmlInterfaceImpl::setWKPostUrlL() |
|
81 // Set the WKPostUrlL. |
|
82 // ----------------------------------------------------------------------------- |
|
83 |
|
84 void CWmlInterfaceImpl::setPostUrlL(TDesC& aUrl, TDesC8& aPostData, TDesC& aContentType) |
|
85 { |
|
86 m_brCtl.postUrlL(aUrl,aPostData,aContentType); |
|
87 } |
|
88 |
|
89 // ----------------------------------------------------------------------------- |
|
90 // CWmlInterfaceImpl::WKFileNameToUrlLC() |
|
91 // Convert the FileNameToUrl. |
|
92 // ----------------------------------------------------------------------------- |
|
93 |
|
94 HBufC* CWmlInterfaceImpl::fileNameToUrlLC(const TDesC& aFileName) |
|
95 { |
|
96 return ( m_brCtl.fileNameToUrlLC( aFileName ) ); |
|
97 } |
|
98 // ----------------------------------------------------------------------------- |
|
99 // WKWmlInterfaceImpl::WKScrollingProviderNotifyLayoutChange |
|
100 // Set the NotifyLayoutChange. |
|
101 // ----------------------------------------------------------------------------- |
|
102 |
|
103 void CWmlInterfaceImpl::scrollingProviderNotifyLayoutChange(TBrCtlLayout aLayout) |
|
104 { |
|
105 //(m_brCtl.BrCtlScrollingProvider())->NotifyLayoutChange(aLayout); |
|
106 } |
|
107 |
|
108 |
|
109 // ----------------------------------------------------------------------------- |
|
110 // WKWmlInterfaceImpl::WKSetWKWmlServiceOptionsAddItemL |
|
111 // Set the UpdateVScrollBarL. |
|
112 // ----------------------------------------------------------------------------- |
|
113 |
|
114 |
|
115 void CWmlInterfaceImpl::setScrollingProviderUpdateVScrollBarL( TInt aDocumentHeight, |
|
116 TInt aDisplayHeight, |
|
117 TInt aDisplayPosY) |
|
118 { |
|
119 //(m_brCtl.BrCtlScrollingProvider())->UpdateVScrollBarL(aDocumentHeight,aDisplayHeight,aDisplayPosY); |
|
120 } |
|
121 |
|
122 |
|
123 |
|
124 // ----------------------------------------------------------------------------- |
|
125 // WKWmlInterfaceImpl::WKSetWKWmlServiceOptionsAddItemL |
|
126 // Set the UpdateHScrollBarL. |
|
127 // ----------------------------------------------------------------------------- |
|
128 |
|
129 |
|
130 void CWmlInterfaceImpl::setScrollingProviderUpdateHScrollBarL( TInt aDocumentWidth, |
|
131 TInt aDisplayWidth, |
|
132 TInt aDisplayPosX ) |
|
133 { |
|
134 //(m_brCtl.BrCtlScrollingProvider())->UpdateHScrollBarL(aDocumentWidth,aDisplayWidth,aDisplayPosX); |
|
135 } |
|
136 |
|
137 |
|
138 void CWmlInterfaceImpl::updateScrollbars(int documentHeight, int displayHeight, int displayPosY, |
|
139 int documentWidth, int displayWidth, int displayPosX) |
|
140 { |
|
141 m_brCtl.updateScrollbars(documentHeight, displayHeight, displayPosY, documentWidth, displayWidth, displayPosX); |
|
142 } |
|
143 |
|
144 // ----------------------------------------------------------------------------- |
|
145 // CWmlInterfaceImpl::WKObjectInfoCreateL |
|
146 // Create object of type CWKObjectInfo(..) |
|
147 // ----------------------------------------------------------------------------- |
|
148 |
|
149 CBrCtlObjectInfo* CWmlInterfaceImpl::objectInfoCreateL() |
|
150 { |
|
151 CBrCtlObjectInfo* objectInfo = new(ELeave)CBrCtlObjectInfo(); |
|
152 return objectInfo; |
|
153 } |
|
154 |
|
155 // ----------------------------------------------------------------------------- |
|
156 // CWmlInterfaceImpl::WKWmlResourceLoadListenerSetUrlL |
|
157 // Create object of type CTempFile(..) |
|
158 // ----------------------------------------------------------------------------- |
|
159 |
|
160 void CWmlInterfaceImpl::resourceLoadListenerSetUrlL(const TDesC& aUrl) |
|
161 { |
|
162 //not implemented |
|
163 } |
|
164 |
|
165 // ----------------------------------------------------------------------------- |
|
166 // CWmlInterfaceImpl::WKWmlResourceLoadListenerLoadWmlResourceL |
|
167 // Create object of type CWKObjectInfo(..) |
|
168 // ----------------------------------------------------------------------------- |
|
169 |
|
170 void CWmlInterfaceImpl::resourceLoadListenerLoadWmlResourceL(const TDesC& aURL) |
|
171 { |
|
172 //not implemented |
|
173 } |
|
174 |
|
175 // ----------------------------------------------------------------------------- |
|
176 // CWmlInterfaceImpl::WKWmlIsUrlInCache |
|
177 // Returns true if the url is in http cache |
|
178 // ----------------------------------------------------------------------------- |
|
179 TBool CWmlInterfaceImpl::wmlIsUrlInCache(TDesC& aUrl) |
|
180 { |
|
181 return m_brCtl.IsUrlInCache(aUrl); |
|
182 } |
|
183 |
|
184 |
|
185 // ----------------------------------------------------------------------------- |
|
186 // CWmlInterfaceImpl::WKWmlLoadUrlL |
|
187 // Returns |
|
188 // ----------------------------------------------------------------------------- |
|
189 void CWmlInterfaceImpl::wmlLoadUrlL( const TDesC& url, TDesC& referrer, TInt /*aApId*/, |
|
190 TBrCtlDefs::TBrCtlCacheMode cachemode) |
|
191 { |
|
192 if (url.Ptr() == NULL || url.Length() == 0) |
|
193 User::Leave(KErrArgument); |
|
194 |
|
195 HttpSessionManager* httpSessionMgr = WebCore::StaticObjectsContainer::instance()->resourceLoaderDelegate()->httpSessionManager(); |
|
196 HBufC8* url8 = HBufC8::NewLC( url.Length() ); |
|
197 url8->Des().Copy( url ); |
|
198 if(httpSessionMgr->refererEnabled()){ |
|
199 m_brCtl.webView()->mainFrame()->loadURL( *url8, (TInt)cachemode, String(referrer) ); |
|
200 } |
|
201 else{ |
|
202 m_brCtl.webView()->mainFrame()->loadURL( *url8, (TInt)cachemode, String() ); |
|
203 } |
|
204 CleanupStack::PopAndDestroy(); |
|
205 } |
|
206 |
|
207 |
|
208 //Destructor |
|
209 CWmlInterfaceImpl::~CWmlInterfaceImpl() |
|
210 { |
|
211 } |
|
212 |
|
213 void CWmlInterfaceImpl::loadResource(TDesC8& url, CWmlContentInterface* content ) |
|
214 { |
|
215 m_brCtl.loadResource(url, content); |
|
216 } |
|
217 // End of File |
|
218 |