|
1 /* |
|
2 * Copyright (c) 2008 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 "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: Implementation class for WMDRM DLA Browser Container |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <akndef.h> |
|
21 #include <aknview.h> |
|
22 #include <brctlinterface.h> |
|
23 #include "wmdrmdlabrowserview.h" |
|
24 #include "wmdrmdlabrowsercontainer.h" |
|
25 |
|
26 // ======== MEMBER FUNCTIONS ======== |
|
27 |
|
28 // --------------------------------------------------------------------------- |
|
29 // CWmDrmDlaBrowserContainer::ConstructL |
|
30 // --------------------------------------------------------------------------- |
|
31 // |
|
32 void CWmDrmDlaBrowserContainer::ConstructL( |
|
33 MBrCtlSpecialLoadObserver* aObserver ) |
|
34 { |
|
35 CreateWindowL(); |
|
36 SetRect( iView->ClientRect() ); |
|
37 ActivateL(); |
|
38 |
|
39 iBrCtlInterface = CreateBrowserControlL( |
|
40 this, // parent control |
|
41 iView->ClientRect(), // client rect |
|
42 TBrCtlDefs::ECapabilityLoadHttpFw | |
|
43 TBrCtlDefs::ECapabilityDisplayScrollBar | |
|
44 TBrCtlDefs::ECapabilityUseDlMgr | |
|
45 TBrCtlDefs::ECapabilityCursorNavigation, // Capabilities |
|
46 TBrCtlDefs::ECommandIdBase, // command base |
|
47 NULL, // Softkeys observer |
|
48 NULL, // LinkResolver |
|
49 aObserver, // Special load observer |
|
50 NULL, // Layout Observer |
|
51 NULL, // Dialog provider |
|
52 NULL, // window observer |
|
53 NULL // Download observer |
|
54 ); |
|
55 |
|
56 iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsAutoLoadImages, |
|
57 ETrue ); |
|
58 iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsCookiesEnabled, |
|
59 ETrue ); |
|
60 iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsEmbedded, |
|
61 ETrue ); |
|
62 } |
|
63 |
|
64 // --------------------------------------------------------------------------- |
|
65 // CWmDrmDlaBrowserContainer::CWmDrmDlaBrowserContainer |
|
66 // --------------------------------------------------------------------------- |
|
67 // |
|
68 CWmDrmDlaBrowserContainer::CWmDrmDlaBrowserContainer( |
|
69 CAknView* aView ) : iView( aView ) |
|
70 { |
|
71 } |
|
72 |
|
73 // --------------------------------------------------------------------------- |
|
74 // CWmDrmDlaBrowserContainer::NewL |
|
75 // --------------------------------------------------------------------------- |
|
76 // |
|
77 CWmDrmDlaBrowserContainer* CWmDrmDlaBrowserContainer::NewL( |
|
78 CAknView* aView, |
|
79 MBrCtlSpecialLoadObserver* aObserver ) |
|
80 { |
|
81 CWmDrmDlaBrowserContainer* self |
|
82 = CWmDrmDlaBrowserContainer::NewLC( aView, aObserver ); |
|
83 CleanupStack::Pop( self ); |
|
84 return self; |
|
85 } |
|
86 |
|
87 |
|
88 // --------------------------------------------------------------------------- |
|
89 // CWmDrmDlaBrowserContainer::NewLC |
|
90 // --------------------------------------------------------------------------- |
|
91 // |
|
92 CWmDrmDlaBrowserContainer* CWmDrmDlaBrowserContainer::NewLC( |
|
93 CAknView* aView, |
|
94 MBrCtlSpecialLoadObserver* aObserver ) |
|
95 { |
|
96 CWmDrmDlaBrowserContainer* self |
|
97 = new( ELeave ) CWmDrmDlaBrowserContainer( aView ); |
|
98 CleanupStack::PushL( self ); |
|
99 self->ConstructL( aObserver ); |
|
100 return self; |
|
101 } |
|
102 |
|
103 |
|
104 // --------------------------------------------------------------------------- |
|
105 // CWmDrmDlaBrowserContainer::~CWmDrmDlaBrowserContainer |
|
106 // --------------------------------------------------------------------------- |
|
107 // |
|
108 CWmDrmDlaBrowserContainer::~CWmDrmDlaBrowserContainer() |
|
109 { |
|
110 delete iBrCtlInterface; |
|
111 } |
|
112 |
|
113 // --------------------------------------------------------------------------- |
|
114 // CWmDrmDlaBrowserContainer::BrCtlInterface |
|
115 // --------------------------------------------------------------------------- |
|
116 // |
|
117 CBrCtlInterface* CWmDrmDlaBrowserContainer::BrCtlInterface() |
|
118 { |
|
119 return iBrCtlInterface; |
|
120 } |
|
121 |
|
122 // --------------------------------------------------------------------------- |
|
123 // CWmDrmDlaBrowserContainer::CountComponentControls |
|
124 // --------------------------------------------------------------------------- |
|
125 // |
|
126 TInt CWmDrmDlaBrowserContainer::CountComponentControls() const |
|
127 { |
|
128 if ( iBrCtlInterface ) |
|
129 { |
|
130 return 1; |
|
131 } |
|
132 return 0; |
|
133 } |
|
134 |
|
135 // --------------------------------------------------------------------------- |
|
136 // CWmDrmDlaBrowserContainer::SizeChanged |
|
137 // --------------------------------------------------------------------------- |
|
138 // |
|
139 void CWmDrmDlaBrowserContainer::SizeChanged() |
|
140 { |
|
141 if ( iBrCtlInterface ) |
|
142 { |
|
143 iBrCtlInterface->SetRect( Rect() ); |
|
144 } |
|
145 } |
|
146 |
|
147 // --------------------------------------------------------------------------- |
|
148 // CWmDrmDlaBrowserContainer::ComponentControl |
|
149 // --------------------------------------------------------------------------- |
|
150 // |
|
151 CCoeControl* CWmDrmDlaBrowserContainer::ComponentControl( |
|
152 TInt aIndex ) const |
|
153 { |
|
154 switch ( aIndex ) |
|
155 { |
|
156 case 0: |
|
157 return iBrCtlInterface; |
|
158 |
|
159 default: |
|
160 return NULL; |
|
161 } |
|
162 } |
|
163 |
|
164 // --------------------------------------------------------------------------- |
|
165 // CWmDrmDlaBrowserContainer::OfferKeyEventL |
|
166 // --------------------------------------------------------------------------- |
|
167 // |
|
168 TKeyResponse CWmDrmDlaBrowserContainer::OfferKeyEventL( |
|
169 const TKeyEvent& aKeyEvent, |
|
170 TEventCode aType ) |
|
171 { |
|
172 if ( iBrCtlInterface ) |
|
173 { |
|
174 return iBrCtlInterface->OfferKeyEventL( aKeyEvent, aType ); |
|
175 } |
|
176 return EKeyWasNotConsumed; |
|
177 } |
|
178 |
|
179 // --------------------------------------------------------------------------- |
|
180 // CWmDrmDlaBrowserContainer::FocusChanged |
|
181 // --------------------------------------------------------------------------- |
|
182 // |
|
183 void CWmDrmDlaBrowserContainer::FocusChanged( |
|
184 TDrawNow aDrawNow ) |
|
185 { |
|
186 iBrCtlInterface->SetFocus( IsFocused() ); |
|
187 CCoeControl::FocusChanged( aDrawNow ); |
|
188 } |
|
189 |
|
190 // --------------------------------------------------------------------------- |
|
191 // CWmDrmDlaBrowserContainer::HandleResourceChange |
|
192 // --------------------------------------------------------------------------- |
|
193 // |
|
194 void CWmDrmDlaBrowserContainer::HandleResourceChange( |
|
195 TInt aType ) |
|
196 { |
|
197 if ( iBrCtlInterface ) |
|
198 { |
|
199 iBrCtlInterface->HandleResourceChange( aType ); |
|
200 } |
|
201 CCoeControl::HandleResourceChange( aType ); |
|
202 if ( aType == KEikDynamicLayoutVariantSwitch ) |
|
203 { |
|
204 SetRect( iView->ClientRect() ); |
|
205 DrawDeferred(); |
|
206 } |
|
207 } |