web_plat/launcher_api/inc/BrowserLauncher.h
changeset 0 dd21522fd290
child 36 0ed94ceaa377
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2 * Copyright (c) 2002-2004 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:  Browser launcher service. Clients can instruct the Browser to 
       
    15 *                download something.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef BROWSERLAUNCHER_H
       
    22 #define BROWSERLAUNCHER_H
       
    23 
       
    24 //  INCLUDES
       
    25 #include <e32std.h>
       
    26 #include <e32base.h>
       
    27 #include <FavouritesDb.h>
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class CBrowserLauncherExtension;
       
    31 class MDownloadedContentHandler;
       
    32 class MAknServerAppExitObserver;
       
    33 class TBrowserOverriddenSettings;
       
    34 
       
    35 // CLASS DECLARATION
       
    36 
       
    37 /**
       
    38 *  Browser Launcher.
       
    39 *  It launches the Browser application embedded to download the required 
       
    40 *  content. The operation can be cancelled with Cancel().
       
    41 *
       
    42 *  @lib BrowserLauncher.lib
       
    43 *  @since Series 60 2.0
       
    44 */
       
    45 NONSHARABLE_CLASS( CBrowserLauncher ): public CBase
       
    46     {
       
    47 	public: // Constructors and destructor
       
    48 
       
    49 		/** 
       
    50 		* Two-phased constructor. Launch Kimono Browser.
       
    51         * @return The created instance of CBrowserLauncher
       
    52         */
       
    53 		IMPORT_C static CBrowserLauncher* NewL();
       
    54 		
       
    55 		/** 
       
    56 		* Two-phased constructor. Launch Kimono Browser.
       
    57         * @return The created instance of CBrowserLauncher
       
    58         */		
       
    59 		IMPORT_C static CBrowserLauncher* NewLC();
       
    60 
       
    61 		/** 
       
    62 		* Two-phased constructor. Launch BrowserNG.
       
    63 		* DEPRICATED - DO NOT USE
       
    64         * @param aOverrideBrowserUid Uid of BrowseNG
       
    65         * @return The created instance of CBrowserLauncher
       
    66         */
       
    67 		IMPORT_C static CBrowserLauncher* NewL( TInt /*aOverrideBrowserUid*/ );
       
    68 		
       
    69 		/** 
       
    70 		* Two-phased constructor. Launch BrowserNG.
       
    71 		* DEPRICATED - DO NOT USE
       
    72         * @param aOverrideBrowserUid Uid of BrowseNG
       
    73         * @return The created instance of CBrowserLauncher
       
    74         */		
       
    75 		IMPORT_C static CBrowserLauncher* NewLC( TInt /*aOverrideBrowserUid*/ );
       
    76 
       
    77 		/**
       
    78 		* Destructor
       
    79 		*/
       
    80 		IMPORT_C virtual ~CBrowserLauncher();
       
    81 
       
    82 	public: // New functions
       
    83 
       
    84         // Asynchronous methods -----------------------------------------------
       
    85 
       
    86         /**
       
    87         * Launch the Browser embedded with the given parameters. Asynchronous 
       
    88         * operation.
       
    89         * @param aParams Parameters to pass to the browser through the OpenFileL method.
       
    90         * @param aContentHandler Implementation of the file based content handler.
       
    91         * @param aExitObserver Embedded Browser application exit observer.
       
    92         * @param aSettings Overridden user preferences. Ownership is not taken!
       
    93         * @return None
       
    94         */
       
    95         IMPORT_C void LaunchBrowserEmbeddedL
       
    96                       ( const TDesC& aParams, 
       
    97                         MDownloadedContentHandler* aContentHandler = NULL, 
       
    98                         MAknServerAppExitObserver* aExitObserver = NULL, 
       
    99                         TBrowserOverriddenSettings* aSettings = NULL );
       
   100 
       
   101         /**
       
   102         * Launch the Browser embedded with the given parameters. Asynchronous 
       
   103         * operation.
       
   104         * @param aContextId Context ID.
       
   105         * @param aContentHandler Implementation of the file based content handler.
       
   106         * @param aExitObserver Embedded Browser application exit observer.
       
   107         * @param aSettings Overridden user preferences. Ownership is not taken!
       
   108         * @return None
       
   109         */
       
   110         IMPORT_C void LaunchBrowserEmbeddedL
       
   111                       ( TInt aContextId, 
       
   112                         MDownloadedContentHandler* aContentHandler = NULL, 
       
   113                         MAknServerAppExitObserver* aExitObserver = NULL, 
       
   114                         TBrowserOverriddenSettings* aSettings = NULL );
       
   115 
       
   116 
       
   117         // Synchronous methods -----------------------------------------------
       
   118 
       
   119         /**
       
   120         * Launch the Browser embedded with the given parameters. 
       
   121         * The operation is synchronous, and waits until the Browser terminates.
       
   122         * Be careful when using: it uses CActiveSchedulerWait!
       
   123         * @param aParams Parameters to pass to the browser through the 
       
   124         *                OpenFileL method.
       
   125         * @param aContentHandler Implementation of the file based content handler.
       
   126         * @param aSettings Overridden user preferences. Ownership is not taken!
       
   127         * @return Integer error value returned by the embedded Browser.
       
   128         */
       
   129         IMPORT_C TInt LaunchBrowserSyncEmbeddedL
       
   130                       ( const TDesC& aParams, 
       
   131                         MDownloadedContentHandler* aContentHandler = NULL, 
       
   132                         TBrowserOverriddenSettings* aSettings = NULL );
       
   133 
       
   134         /**
       
   135         * Launch the Browser embedded with the given parameters. 
       
   136         * The operation is synchronous, and waits until the Browser terminates.
       
   137         * Be careful when using: it uses CActiveSchedulerWait!
       
   138         * @param aContextId Context ID.
       
   139         * @param aContentHandler Implementation of the file based content handler.
       
   140         * @param aSettings Overridden user preferences. Ownership is not taken!
       
   141         * @return Integer error value returned by the embedded Browser.
       
   142         */
       
   143         IMPORT_C TInt LaunchBrowserSyncEmbeddedL
       
   144                       ( TInt aContextId, 
       
   145                         MDownloadedContentHandler* aContentHandler = NULL, 
       
   146                         TBrowserOverriddenSettings* aSettings = NULL );
       
   147 
       
   148         // Cancel method -----------------------------------------------
       
   149 
       
   150         IMPORT_C void Cancel();
       
   151 
       
   152     private: // Constructors
       
   153     
       
   154     	/**
       
   155     	* Default constructor
       
   156     	*/
       
   157          CBrowserLauncher();
       
   158          
       
   159         /** 
       
   160         * Second phase constructor
       
   161         */
       
   162         void ConstructL();
       
   163 
       
   164     private: // New functions
       
   165 
       
   166         /**
       
   167         * Launch the Browser embedded with the given parameters. Asynchronous 
       
   168         * operation.
       
   169         * @param aParams Parameters to pass to the browser through the OpenFileL method.
       
   170         * @param aContextId Context ID.
       
   171         * @param aContentHandler Implementation of the file based content handler.
       
   172         * @param aExitObserver Embedded Browser application exit observer.
       
   173         * @param aSettings Overridden user preferences. Ownership is not taken!
       
   174         * @return None.
       
   175         */
       
   176         void LaunchBrowserEmbeddedL
       
   177                       ( const TDesC& aParams, 
       
   178                         TInt aContextId, 
       
   179                         MDownloadedContentHandler* aContentHandler, 
       
   180                         MAknServerAppExitObserver* aExitObserver, 
       
   181                         TBrowserOverriddenSettings* aSettings );
       
   182 
       
   183         TInt FolderByContextIdL( TUint32 aContextId );
       
   184         TInt BookmarksIdByFolderIdL( TUint32 aFolderId );
       
   185         TBool EnhancedSeamlessLinkLocalFeaturesSupportedL();
       
   186 
       
   187     private: // Data members
       
   188 
       
   189         // Extension. Owned.
       
   190         CBrowserLauncherExtension* iExtension; 
       
   191         
       
   192         // The Uid of the Browser to lauch. ( KimonoBrowser/BrowserNG )
       
   193         TUid iBrowserUid;
       
   194 
       
   195         RFavouritesSession iFavouritesSess;
       
   196 
       
   197     private:
       
   198 
       
   199         friend class CBrowserLauncherExtension;
       
   200     };
       
   201 
       
   202 // CLASS DECLARATION
       
   203 
       
   204 /**
       
   205 *  TLauncherPackageUtils
       
   206 *  Helper class to pack data on client side, and unpack the same data on server
       
   207 *  side, that was sent through IPC
       
   208 */
       
   209 class TLauncherPackageUtils
       
   210     {
       
   211 	public:
       
   212 		/**
       
   213 		* Client packs the data that is about to send throudh IPC.
       
   214 	    * @param aEmbeddingAppUid The embedding application`s UID		
       
   215 	    * @param aSettings Overridden user preferences. Ownership is not taken!
       
   216 	    * @param aFolderUid The Uid of the folder that the Browser should open.
       
   217 	    * @param seamlessParam	    	    
       
   218 	    * @param aIsContentHandlerRegistered True if a content handler is registered
       
   219 		* @return The packed data that can be send through IPC.
       
   220 		*/		
       
   221 		static HBufC8* PackLauncherDataL( const TUid aEmbeddingAppUid, 
       
   222 										  const TBrowserOverriddenSettings* aSettings, 
       
   223 										  TInt folderUid, 
       
   224 										  const TDesC& seamlessParam, 
       
   225 										  TBool aIsContentHandlerRegistered );
       
   226 		
       
   227 		/**
       
   228 		* Server unpacks the data that was sent from client throudh IPC.
       
   229 		* The method sets the parameters values.
       
   230 	    * @param aEmbeddingAppUid The embedding application`s UID
       
   231 	    * @param aSettings Overridden user preferences. Ownership is not taken!
       
   232 	    * @param aFolderUid The Uid of the folder that the Browser should open.
       
   233 	    * @param aSeamlessParam 
       
   234 	    * @param aData Data to unpack.
       
   235 	    * @param aIsContentHandlerRegistered True if a content handler is registered
       
   236 	    * @param aIsOverriddenSettings True if the client set an overridden setting
       
   237 		*/		
       
   238 		static void UnPackLauncherDataL( TUid& aEmbeddingAppUid, 
       
   239 										 TBrowserOverriddenSettings* aSettings, 
       
   240 										 TInt& aFolderUid, 
       
   241 										 TPtrC& aSeamlessParam, 
       
   242 										 const TDesC8& aData, 
       
   243 										 TBool& aIsContentHandlerRegistered, 
       
   244 										 TBool& aIsOverriddenSettings );
       
   245     };
       
   246 
       
   247 #endif // BROWSERLAUNCHER_H