25
|
1 |
/*
|
|
2 |
* Copyright (c) 2007-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: Class header for CWsfAppLauncher
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
#ifndef C_WSFAPPLAUNCHER_H
|
|
22 |
#define C_WSFAPPLAUNCHER_H
|
|
23 |
|
|
24 |
#include <e32std.h>
|
|
25 |
#include <w32std.h>
|
|
26 |
|
|
27 |
class MWsfBrowserLaunchObserver;
|
|
28 |
class CRepository;
|
|
29 |
|
|
30 |
|
|
31 |
/**
|
|
32 |
* Browser launching states
|
|
33 |
*/
|
|
34 |
enum TWsfLaunchState
|
|
35 |
{
|
|
36 |
EIdle,
|
|
37 |
EShuttingDown,
|
|
38 |
EStartingUp,
|
|
39 |
ECompleted,
|
|
40 |
EFinished
|
|
41 |
};
|
|
42 |
|
|
43 |
|
|
44 |
|
|
45 |
// CLASS DEFINITION
|
|
46 |
/**
|
|
47 |
* Class to manage browser launching and closure.
|
|
48 |
*
|
|
49 |
* @lib wsfmodel.lib
|
|
50 |
* @since S60 5.0
|
|
51 |
*/
|
|
52 |
NONSHARABLE_CLASS( CWsfAppLauncher ): public CActive
|
|
53 |
{
|
|
54 |
public: // Constuctors and destructors
|
|
55 |
|
|
56 |
/**
|
|
57 |
* Factory function.
|
|
58 |
* @since S60 5.0
|
|
59 |
* @return Class instance
|
|
60 |
*/
|
|
61 |
IMPORT_C static CWsfAppLauncher* NewL();
|
|
62 |
|
|
63 |
/**
|
|
64 |
* Factory function.
|
|
65 |
* @since S60 5.0
|
|
66 |
* @return Class instance
|
|
67 |
*/
|
|
68 |
IMPORT_C static CWsfAppLauncher* NewLC();
|
|
69 |
|
|
70 |
/**
|
|
71 |
* Destructor
|
|
72 |
* @since S60 5.0
|
|
73 |
*/
|
|
74 |
virtual ~CWsfAppLauncher();
|
|
75 |
|
|
76 |
|
|
77 |
private: //Constuctors
|
|
78 |
|
|
79 |
/**
|
|
80 |
* Constructor
|
|
81 |
* @since S60 5.0
|
|
82 |
*/
|
|
83 |
CWsfAppLauncher();
|
|
84 |
|
|
85 |
/**
|
|
86 |
* Second-phase constructor
|
|
87 |
* @since S60 5.0
|
|
88 |
*/
|
|
89 |
void ConstructL();
|
|
90 |
|
|
91 |
|
|
92 |
public: //New public functions
|
|
93 |
|
|
94 |
/**
|
|
95 |
* Launches Browser application asynchronously using selected iap
|
|
96 |
* @since S60 5.0
|
|
97 |
* @param aObserver Observer to be notified about launch completion
|
|
98 |
* @param aIapId IAP id passed as a parameter
|
|
99 |
*/
|
|
100 |
void LaunchBrowserL( MWsfBrowserLaunchObserver& aObserver,
|
|
101 |
TUint aIapId );
|
|
102 |
|
|
103 |
/**
|
|
104 |
* Launches Browser application asynchronously using selected iap and
|
|
105 |
* user defined URL
|
|
106 |
* @since S60 5.0
|
|
107 |
* @param aObserver Observer to be notified about launch completion
|
|
108 |
* @param aIapId IAP id passed as a parameter
|
|
109 |
* @param aURL User defined WWW address to be used as start-up page
|
|
110 |
*/
|
|
111 |
void LaunchBrowserL( MWsfBrowserLaunchObserver& aObserver,
|
|
112 |
TUint aIapId,
|
|
113 |
const TDesC& aURL );
|
|
114 |
|
|
115 |
/**
|
|
116 |
* Switches Browser application to foreground
|
|
117 |
* @since S60 5.0
|
|
118 |
*/
|
|
119 |
void ContinueBrowsingL();
|
|
120 |
|
|
121 |
/**
|
|
122 |
* Switches Browser application to foreground
|
|
123 |
* @since S60 5.0
|
|
124 |
* @param aObserver Observer to be notified about launch completion
|
|
125 |
* @param aIapId IAP id passed as a parameter
|
|
126 |
*/
|
|
127 |
void ContinueBrowsingL( MWsfBrowserLaunchObserver& aObserver,
|
|
128 |
TUint aIapId );
|
|
129 |
|
|
130 |
/**
|
|
131 |
* Query launching state
|
|
132 |
* @since S60 5.0
|
|
133 |
* @return Lauching state
|
|
134 |
*/
|
|
135 |
TWsfLaunchState Launching();
|
|
136 |
|
|
137 |
|
|
138 |
/**
|
|
139 |
* Returns the IAP which was last passed to the browser
|
|
140 |
* @since S60 5.0
|
|
141 |
* @return The IAP id passed to the browser.
|
|
142 |
*/
|
|
143 |
TUint32 BrowserIap() const;
|
|
144 |
|
|
145 |
|
|
146 |
private: // New private functions
|
|
147 |
|
|
148 |
/**
|
|
149 |
* Kills browser application if the one is already lauched
|
|
150 |
* @since S60 5.0
|
|
151 |
* @return ETrue if browser was killed, EFalse otherwise
|
|
152 |
*/
|
|
153 |
TBool KillBrowserIfAlreadyExists();
|
|
154 |
|
|
155 |
/**
|
|
156 |
* Launches the browser asynchronously.
|
|
157 |
* @since S60 5.0
|
|
158 |
*/
|
|
159 |
void DoLaunchBrowserL();
|
|
160 |
|
|
161 |
/**
|
|
162 |
* Checks if Browser exists
|
|
163 |
* @since S60 5.0
|
|
164 |
* @return ETrue if the browser exists
|
|
165 |
*/
|
|
166 |
TBool BrowserExists();
|
|
167 |
|
|
168 |
/**
|
|
169 |
* Checks what the default homepage is (URL)
|
|
170 |
* @since S60 5.0
|
|
171 |
* @param aHomePageURL URL of the default homepage
|
|
172 |
* @return KErrNone if successful, KErrNotFound if HomePage is
|
|
173 |
* not defined
|
|
174 |
*/
|
|
175 |
TInt BrowserHomepage( TDes& aHomePageURL );
|
|
176 |
|
|
177 |
|
|
178 |
private: // From CActive
|
|
179 |
|
|
180 |
/**
|
|
181 |
* Implements cancellation of an outstanding request.
|
|
182 |
* @since S60 5.0
|
|
183 |
*/
|
|
184 |
void DoCancel();
|
|
185 |
|
|
186 |
/**
|
|
187 |
* Handles an active object's request completion event.
|
|
188 |
* @since S60 5.0
|
|
189 |
*/
|
|
190 |
void RunL();
|
|
191 |
|
|
192 |
/**
|
|
193 |
* Handles a leave occurring in RunL().
|
|
194 |
* @since S60 5.0
|
|
195 |
* @param aError Leave code
|
|
196 |
* @return aError
|
|
197 |
*/
|
|
198 |
TInt RunError( TInt aError );
|
|
199 |
|
|
200 |
|
|
201 |
private: // data
|
|
202 |
|
|
203 |
/**
|
|
204 |
* Observer to be notified about launch completion. Not owned.
|
|
205 |
*/
|
|
206 |
MWsfBrowserLaunchObserver* iObserver;
|
|
207 |
|
|
208 |
/**
|
|
209 |
* Window session
|
|
210 |
*/
|
|
211 |
RWsSession iWsSession;
|
|
212 |
|
|
213 |
/**
|
|
214 |
* IAP id to use
|
|
215 |
*/
|
|
216 |
TUint iIapId;
|
|
217 |
|
|
218 |
/**
|
|
219 |
* State of browser launching
|
|
220 |
*/
|
|
221 |
TWsfLaunchState iLaunchState;
|
|
222 |
|
|
223 |
/**
|
|
224 |
* Indicates whether to launch bookmarks page
|
|
225 |
* (if homepage is not set)
|
|
226 |
*/
|
|
227 |
TBool iLaunchBookMarks;
|
|
228 |
|
|
229 |
/**
|
|
230 |
* Browser app's UID
|
|
231 |
*/
|
|
232 |
TUid iBrowserUid;
|
|
233 |
|
|
234 |
/**
|
|
235 |
* Key number for browser's default homepage
|
|
236 |
*/
|
|
237 |
TUint iHomepageKey;
|
|
238 |
|
|
239 |
/**
|
|
240 |
* Handle to a repository. Owned.
|
|
241 |
*/
|
|
242 |
CRepository* iRepository;
|
|
243 |
|
|
244 |
/**
|
|
245 |
* URL of the homepage. Owned.
|
|
246 |
*/
|
|
247 |
HBufC* iURL;
|
|
248 |
|
|
249 |
/**
|
|
250 |
* Timer to wait for browser startup etc.
|
|
251 |
*/
|
|
252 |
RTimer iTimer;
|
|
253 |
|
|
254 |
/**
|
|
255 |
* Browser's cenrep key number for the homepage
|
|
256 |
*/
|
|
257 |
TUint iBrowserHomePageKey;
|
|
258 |
|
|
259 |
/**
|
|
260 |
* Browser's cenrep key number for the starting page
|
|
261 |
*/
|
|
262 |
TUint iBrowserStartingPageKey;
|
|
263 |
|
|
264 |
/**
|
|
265 |
* The id of the broser thread
|
|
266 |
*/
|
|
267 |
TThreadId iThreadId;
|
|
268 |
|
|
269 |
/**
|
|
270 |
* The browser thread
|
|
271 |
*/
|
|
272 |
RThread iThread;
|
|
273 |
};
|
|
274 |
|
|
275 |
|
|
276 |
#endif // C_WSFAPPLAUNCHER_H
|
|
277 |
|