wlanutilities/wlansniffer/model/inc/wsfapplauncher.h
changeset 19 10810c91db26
parent 3 ff3b37722600
child 22 498f36116140
equal deleted inserted replaced
3:ff3b37722600 19:10810c91db26
     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 class CMDBSession;
       
    30 
       
    31 
       
    32 /**
       
    33 * Browser launching states
       
    34 */
       
    35 enum TWsfLaunchState
       
    36     {
       
    37     EIdle,
       
    38     EShuttingDown,
       
    39     EStartingUp,
       
    40     ECompleted,
       
    41     EFinished
       
    42     };
       
    43 
       
    44 
       
    45 
       
    46 //  CLASS DEFINITION
       
    47 /**
       
    48  * Class to manage browser launching and closure.
       
    49  *
       
    50  * @lib wsfmodel.lib
       
    51  * @since S60 5.0
       
    52  */
       
    53 NONSHARABLE_CLASS( CWsfAppLauncher ): public CActive 
       
    54     {
       
    55     public: // Constuctors and destructors
       
    56 
       
    57         /**
       
    58         * Factory function.
       
    59         * @since S60 5.0
       
    60         * @return Class instance
       
    61         */
       
    62         IMPORT_C static CWsfAppLauncher* NewL();
       
    63 
       
    64         /**
       
    65         * Factory function.
       
    66         * @since S60 5.0
       
    67         * @return Class instance
       
    68         */
       
    69         IMPORT_C static CWsfAppLauncher* NewLC();
       
    70 
       
    71         /**
       
    72         * Destructor
       
    73         * @since S60 5.0
       
    74         */
       
    75         virtual ~CWsfAppLauncher();
       
    76 
       
    77 
       
    78     private: //Constuctors
       
    79 
       
    80         /**
       
    81         * Constructor
       
    82         * @since S60 5.0
       
    83         */
       
    84         CWsfAppLauncher();
       
    85 
       
    86         /**
       
    87         * Second-phase constructor
       
    88         * @since S60 5.0
       
    89         */
       
    90         void ConstructL();
       
    91         
       
    92 
       
    93     public: //New public functions
       
    94 
       
    95         /**
       
    96         * Launches Browser application asynchronously using selected iap
       
    97         * @since S60 5.0
       
    98         * @param aObserver Observer to be notified about launch completion
       
    99         * @param aIapId IAP id passed as a parameter
       
   100         */
       
   101         void LaunchBrowserL( MWsfBrowserLaunchObserver& aObserver, 
       
   102                              TUint aIapId );
       
   103 
       
   104         /**
       
   105         * Launches Browser application asynchronously using selected iap and 
       
   106         * user defined URL
       
   107         * @since S60 5.0
       
   108         * @param aObserver Observer to be notified about launch completion
       
   109         * @param aIapId IAP id passed as a parameter
       
   110         * @param aWapId WAP id passed as a parameter
       
   111         * @param aURL User defined WWW address to be used as start-up page    
       
   112         */
       
   113         void LaunchBrowserL( MWsfBrowserLaunchObserver& aObserver, 
       
   114                              TUint aIapId,
       
   115                              TUint aWapId,
       
   116                              const TDesC& aURL ); 
       
   117 
       
   118         /**
       
   119         * Switches Browser application to foreground
       
   120         * @since S60 5.0
       
   121         */
       
   122         void ContinueBrowsingL();
       
   123         
       
   124         /**
       
   125         * Switches Browser application to foreground
       
   126         * @since S60 5.0
       
   127         * @param aObserver Observer to be notified about launch completion
       
   128         * @param aIapId IAP id passed as a parameter
       
   129         */
       
   130         void ContinueBrowsingL( MWsfBrowserLaunchObserver& aObserver, 
       
   131                                 TUint aIapId );
       
   132         
       
   133         /**
       
   134         * Query launching state
       
   135         * @since S60 5.0
       
   136         * @return Lauching state
       
   137         */
       
   138         TWsfLaunchState Launching();
       
   139         
       
   140         
       
   141         /**
       
   142         * Returns the IAP which was last passed to the browser
       
   143         * @since S60 5.0
       
   144         * @return The IAP id passed to the browser.
       
   145         */
       
   146         TUint32 BrowserIap() const;
       
   147         
       
   148 
       
   149     private: // New private functions
       
   150 
       
   151         /**
       
   152         * Kills browser application if the one is already lauched
       
   153         * @since S60 5.0
       
   154         * @return ETrue if browser was killed, EFalse otherwise
       
   155         */
       
   156         TBool KillBrowserIfAlreadyExists();
       
   157 
       
   158         /**
       
   159         * Launches the browser asynchronously.
       
   160         * @since S60 5.0
       
   161         */
       
   162         void DoLaunchBrowserL();
       
   163 
       
   164         /**
       
   165         * Checks if Browser exists
       
   166         * @since S60 5.0
       
   167         * @return ETrue if the browser exists
       
   168         */
       
   169         TBool BrowserExists();
       
   170 
       
   171         /**
       
   172         * Checks what the default homepage is (URL) 
       
   173         * @since S60 5.0
       
   174         * @param aHomePageURL URL of the default homepage
       
   175         * @return KErrNone if successful, KErrNotFound if HomePage is 
       
   176         *         not defined
       
   177         */
       
   178         TInt BrowserHomepage( TDes& aHomePageURL );
       
   179 
       
   180         /**
       
   181         * Gets the access point selection mode
       
   182         * @since S60 5.0
       
   183         * @return 0=User defined, 1=Always ask, 2=Destination
       
   184         */
       
   185         TInt ApSelectionMode();
       
   186 
       
   187         /**
       
   188         * Defines the access point selection mode
       
   189         * @since S60 5.0
       
   190         * @param aEnable Selection mode: 0=User defined, 1=Always ask,  
       
   191         *                2=Destination
       
   192         */
       
   193         void SetApSelectionMode( TInt aApSelectionMode );
       
   194         
       
   195         /**
       
   196         * Restores Access Point selection mode
       
   197         * @since S60 5.0
       
   198         */   
       
   199         void RestoreApSelectionMode();
       
   200 
       
   201         /**
       
   202         * Configures browser access point using central repository
       
   203         * @since S60 5.0
       
   204         * @param aAccessPointId Access Point's IAP id
       
   205         */   
       
   206         void SetAccessPoint( TUint aAccessPointId );
       
   207         
       
   208         /*
       
   209         * Restores original accesspoint id if one is set
       
   210         * @since S60 5.0
       
   211         */
       
   212         void RestoreAccessPoint();
       
   213         
       
   214 
       
   215     private:    // From CActive
       
   216         
       
   217         /**
       
   218         * Implements cancellation of an outstanding request.
       
   219         * @since S60 5.0
       
   220     	*/
       
   221     	void DoCancel();
       
   222 
       
   223         /**
       
   224         * Handles an active object's request completion event.
       
   225         * @since S60 5.0
       
   226     	*/
       
   227         void RunL();
       
   228 
       
   229         /**
       
   230         * Handles a leave occurring in RunL().
       
   231         * @since S60 5.0
       
   232         * @param aError Leave code
       
   233         * @return aError
       
   234     	*/
       
   235         TInt RunError( TInt aError );
       
   236 
       
   237 
       
   238     private: // data
       
   239 
       
   240         /**
       
   241         * Observer to be notified about launch completion. Not owned.
       
   242         */
       
   243         MWsfBrowserLaunchObserver* iObserver;
       
   244         
       
   245         /**
       
   246         * Window session
       
   247         */
       
   248         RWsSession iWsSession;
       
   249 
       
   250         /**
       
   251         * IAP id to use
       
   252         */
       
   253         TUint iIapId;
       
   254         
       
   255         /**
       
   256         * WAP id for browser's default connection id
       
   257         */
       
   258         TUint iWapId; 
       
   259 
       
   260         /**
       
   261         * State of browser launching
       
   262         */
       
   263         TWsfLaunchState iLaunchState;  
       
   264 
       
   265         /**
       
   266         * Stored original selection mode
       
   267         */
       
   268         TBool iRestoreSelectionMode;
       
   269 
       
   270         /**
       
   271         * Indicates whether to restore access point
       
   272         */
       
   273         TBool iRestoreAccessPoint;
       
   274 
       
   275         /**
       
   276         * The original IAP id used by the browser
       
   277         */
       
   278         TUint iOriginalApId;
       
   279 
       
   280         /**
       
   281         * Indicates whether to launch bookmarks page 
       
   282         * (if homepage is not set)
       
   283         */
       
   284         TBool iLaunchBookMarks;
       
   285 
       
   286         /**
       
   287         * Browser app's UID
       
   288         */
       
   289         TUid iBrowserUid;
       
   290 
       
   291         /**
       
   292         * Key number for browser's default homepage
       
   293         */
       
   294         TUint iHomepageKey;
       
   295 
       
   296         /**
       
   297         * Handle to a repository. Owned.
       
   298         */
       
   299         CRepository* iRepository;
       
   300 
       
   301         /**
       
   302         * URL of the homepage. Owned.
       
   303         */
       
   304         HBufC* iURL;
       
   305 
       
   306         /**
       
   307         * Timer to wait for browser startup etc.
       
   308         */
       
   309         RTimer iTimer;     
       
   310 
       
   311         /**
       
   312         * Indicates which AP selection mode was originally used.
       
   313         */
       
   314         TUint iOriginalApSelectionMode;
       
   315 
       
   316         /**
       
   317         * Browser's cenrep key number for the homepage
       
   318         */
       
   319         TUint iBrowserHomePageKey;
       
   320 
       
   321         /**
       
   322         * Browser's cenrep key number for the starting page
       
   323         */
       
   324         TUint iBrowserStartingPageKey;
       
   325         
       
   326         /**
       
   327         * The id of the broser thread
       
   328         */
       
   329         TThreadId iThreadId;
       
   330         
       
   331         /**
       
   332         * The browser thread
       
   333         */
       
   334         RThread iThread;
       
   335     };
       
   336 
       
   337 
       
   338 #endif // C_WSFAPPLAUNCHER_H
       
   339