|
1 /******************************************************************************* |
|
2 * Copyright (c) 2007, 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. This program and the accompanying materials |
|
4 * are made available under the terms of the Eclipse Public License v1.0 |
|
5 * which accompanies this distribution, and is available at |
|
6 * http://www.eclipse.org/legal/epl-v10.html |
|
7 * |
|
8 * Contributors: |
|
9 * Nokia Corporation - S60 implementation |
|
10 *******************************************************************************/ |
|
11 |
|
12 |
|
13 #ifndef SWTBROWSERLOADEVENTOBSERVER_H |
|
14 #define SWTBROWSERLOADEVENTOBSERVER_H |
|
15 |
|
16 |
|
17 #include <brctlinterface.h> |
|
18 #include <swtbrowserdialogsproviderobserver.h> |
|
19 #include "eswt.h" |
|
20 |
|
21 |
|
22 class MBrowserApiProvider; |
|
23 |
|
24 |
|
25 /** |
|
26 * CSwtBrowserLoadEventObserver |
|
27 * Handle load events. |
|
28 * This class implements MBrCtlLoadEventObserver, which registers for load events. |
|
29 * @lib eswt |
|
30 */ |
|
31 NONSHARABLE_CLASS(CSwtBrowserLoadEventObserver) |
|
32 : public CBase |
|
33 , public MBrCtlLoadEventObserver |
|
34 , public MSwtBrowserDialogsProviderObserver |
|
35 { |
|
36 // Types |
|
37 public: |
|
38 enum TBrowserLoadState |
|
39 { |
|
40 ELoadStateIdle = 0x01, |
|
41 ELoadStateContentStart = 0x02, |
|
42 ELoadStateResponseInProgress = 0x04, |
|
43 ELoadStateLoadDone = 0x08 |
|
44 }; |
|
45 |
|
46 enum TBrowserLoadUrlType |
|
47 { |
|
48 ELoadUrlTypeSavedDeck = 0x01, |
|
49 ELoadUrlTypeStartPage, |
|
50 ELoadUrlTypeEmbeddedBrowserWithUrl, |
|
51 ELoadUrlTypeOther |
|
52 }; |
|
53 |
|
54 enum TBrowserLoadStatus |
|
55 { |
|
56 ELoadStatusFirstChunkArrived = 0x0001, |
|
57 ELoadStatusContentDisplayed = 0x0002, |
|
58 ELoadStatusMainError = 0x0004, |
|
59 ELoadStatusSubError = 0x0008, |
|
60 ELoadStatusError = ELoadStatusMainError | ELoadStatusSubError, |
|
61 ELoadStatusTitleAvailable = 0x0010, |
|
62 ELoadStatusFirstChunkDisplayed = 0x0020, |
|
63 ELoadStatusDone = 0x0040, |
|
64 ELoadStatusSecurePage = 0x0080, |
|
65 ELoadStatusSecureItemNonSecurePage = 0x0100, |
|
66 ELoadStatusAllItemIsSecure = 0x0200 |
|
67 }; |
|
68 |
|
69 // Own methods |
|
70 public: |
|
71 /** |
|
72 * Constructor |
|
73 */ |
|
74 CSwtBrowserLoadEventObserver(MBrowserApiProvider* aApiProvider, TSwtPeer aPeer); |
|
75 |
|
76 /** |
|
77 * Destructor |
|
78 */ |
|
79 virtual ~CSwtBrowserLoadEventObserver(); |
|
80 |
|
81 /** |
|
82 * Start loading |
|
83 */ |
|
84 void DoStartLoad(TBrowserLoadUrlType aLoadUrlType); |
|
85 |
|
86 /** |
|
87 * End loading |
|
88 */ |
|
89 void DoEndLoad(TBool aIsUserInitiated = EFalse); |
|
90 |
|
91 /** |
|
92 * Return current Url's type |
|
93 */ |
|
94 TBrowserLoadUrlType LoadUrlType() const; |
|
95 |
|
96 /** |
|
97 * Return current load state. |
|
98 */ |
|
99 TBrowserLoadState LoadState() const; |
|
100 |
|
101 /** |
|
102 * Set the url to load |
|
103 */ |
|
104 void SetUrlL(const TDesC& aUrl); |
|
105 |
|
106 // From MBrCtlLoadEventObserver |
|
107 public: |
|
108 void HandleBrowserLoadEventL(TBrCtlDefs::TBrCtlLoadEvent aLoadEvent, |
|
109 TUint aSize, TUint16 aTransactionId); |
|
110 |
|
111 // From MSwtBrowserDialogsProviderObserver |
|
112 public: |
|
113 void ReportDialogEventL(TInt aType, TInt aFlags); |
|
114 |
|
115 // Own methods |
|
116 private: |
|
117 /** |
|
118 * Handle load event ELoadUrlTypeSavedDeck. |
|
119 */ |
|
120 void HandleLoadEventSavedDeckL(TBrCtlDefs::TBrCtlLoadEvent aLoadEvent, |
|
121 TUint aSize, TUint16 aTransactionId); |
|
122 |
|
123 /** |
|
124 * Handle load event other than ELoadUrlTypeSavedDeck. |
|
125 */ |
|
126 void HandleLoadEventOtherL(TBrCtlDefs::TBrCtlLoadEvent aLoadEvent, |
|
127 TUint aSize, TUint16 aTransactionId); |
|
128 |
|
129 /** |
|
130 * Set load state. |
|
131 */ |
|
132 void StateChange(TBrowserLoadState aNextState); |
|
133 |
|
134 /** |
|
135 * Set specified status.. |
|
136 */ |
|
137 void SetStatus(TUint32 aFlag); |
|
138 |
|
139 /** |
|
140 * Clear specified status |
|
141 */ |
|
142 void ClearStatus(TUint32 aFlag); |
|
143 |
|
144 /** |
|
145 * Reset all status. |
|
146 */ |
|
147 void ClearStatus(); |
|
148 |
|
149 /** |
|
150 * Concatenate two string with one from resource |
|
151 */ |
|
152 HBufC* FormatEventTextLC(TInt aResourceId, const TDesC& aText); |
|
153 |
|
154 // Data |
|
155 private: |
|
156 /** |
|
157 * Load state |
|
158 */ |
|
159 TBrowserLoadState iLoadState; |
|
160 |
|
161 /** |
|
162 * Url's type |
|
163 */ |
|
164 TBrowserLoadUrlType iLoadUrlType; |
|
165 |
|
166 /** |
|
167 * Load status |
|
168 */ |
|
169 TUint32 iStatus; |
|
170 |
|
171 /** |
|
172 * Pointer to browser API provider. |
|
173 * Not own |
|
174 */ |
|
175 MBrowserApiProvider *iApiProvider; |
|
176 |
|
177 /** |
|
178 * Java side peer |
|
179 * Not own |
|
180 */ |
|
181 TSwtPeer iPeer; |
|
182 |
|
183 /** |
|
184 * Transaction ID |
|
185 */ |
|
186 TUint16 iTransactionId; |
|
187 |
|
188 /** |
|
189 * Flag to indicate whether the content needs to be restored |
|
190 */ |
|
191 TBool iRestoreContentFlag; |
|
192 |
|
193 /** |
|
194 * URL to be load |
|
195 * Own |
|
196 */ |
|
197 HBufC* iUrl; |
|
198 }; |
|
199 |
|
200 #endif // SWTBROWSERLOADEVENTOBSERVER_H |