web_pub/browser_control_api/inc/BrCtlInterface.h
changeset 0 dd21522fd290
child 36 0ed94ceaa377
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Definition of the Browser Control API
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef BRCTLINTERFACE_H
       
    20 #define BRCTLINTERFACE_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <../bidi.h>
       
    24 #include <e32std.h>
       
    25 #include <e32base.h>
       
    26 #include <coecntrl.h>
       
    27 #include <eikmenup.h>
       
    28 #include <ssl.h>
       
    29 
       
    30 #include <BrCtlDialogsProvider.h>
       
    31 #include <BrCtlLayoutObserver.h>
       
    32 #include <BrCtlLinkResolver.h>
       
    33 #include <BrCtlSoftkeysObserver.h>
       
    34 #include <BrCtlSpecialLoadObserver.h>
       
    35 #include <BrCtlWindowObserver.h>
       
    36 #include <BrCtlDownloadObserver.h>
       
    37 #include <BrCtlDefs.h>
       
    38 
       
    39 // DATA TYPES
       
    40 
       
    41 // FORWARD DECLARATIONS
       
    42 class MBrCtlDataLoadSupplier;
       
    43 class MBrCtlDataLoadConsumer;
       
    44 class MBrCtlLoadEventObserver;
       
    45 class MBrCtlDialogsProvider;
       
    46 class TBrCtlWmlServiceOption;
       
    47 class TBrCtlSubscribeTo;
       
    48 class MBrCtlStateChangeObserver;
       
    49 class MBrCtlCommandObserver;
       
    50 class MWidgetCallback;
       
    51 class MWidgetExtension;
       
    52 class CBrCtlInterface;
       
    53 class CPluginInfo;
       
    54 class TBrCtlImageCarrier;
       
    55 
       
    56 /**
       
    57 * Creates the browser control.
       
    58 *
       
    59 * @param aParent                      Parent window of the browser control
       
    60 * @param aRect                        Bounding rectangle for the browser control
       
    61 * @param aBrCtlCapabilities           Desired capabilities of the browser control.
       
    62 * For example, displaying scroll bars, allowing network access for HTTP requests.
       
    63 * @see For a complete list of capability options, see TBrCtlCapabilities
       
    64 * @param aCommandIdBase               Base values for Command IDs for Browser Control.
       
    65 * These are added to ensure that each Command ID is unique; Browser Control command IDs must be different from the host application command IDs.
       
    66 * @see For more information, see TBrCtlCommandId
       
    67 * @param aBrCtlSoftkeysObserver       Softkeys observer.
       
    68 * Default: the host application does not update the softkeys.
       
    69 * @see For more information, see MBrCtlSoftkeysObserver class
       
    70 * @param aBrCtlLinkResolver           Link Resolver. Must be provided if ECapabilityClient
       
    71 * ResolveEmbeddedURL or ECapabilityClientNotifyURL is set.
       
    72 * @see For more information, see MBrCtlLinkResolver class.
       
    73 * @param aBrCtlSpecialLoadObserver    Special Load Observer.
       
    74 * @see MBrCtlSpecialLoadObserver class for more details of special load observer.
       
    75 * @param aBrCtlLayoutObserver         Layout Observer.
       
    76 * Default:
       
    77 * Non-markup pages are not handled by the browser.
       
    78 * Non-HTTP(S) schemes are not handled by the browser.
       
    79 * Connection is created by the Proxy Filter.
       
    80 * @see For more information, see MBrCtlLayoutObserver class
       
    81 * @param aBrCtlDialogsProvider        Dialogs Provider.
       
    82 * @see For more information, see MBrCtlDialogsProvider class
       
    83 * @param aBrCtlWindowObserver         Window Observer.
       
    84 * @see For more information, see MBrCtlWindowObserver class
       
    85 * @param aBrCtlDownloadObserver       Downlaod observer
       
    86 * @see For more information,  MBrCtlDownloadObserver class
       
    87 * @return a pointer to CBrCtlInterface class or NULL if this function fails.
       
    88 */
       
    89 IMPORT_C CBrCtlInterface* CreateBrowserControlL(CCoeControl* aParent, TRect aRect,
       
    90     TUint aBrCtlCapabilities, TUint aCommandIdBase = TBrCtlDefs::ECommandIdBase,
       
    91     MBrCtlSoftkeysObserver* aBrCtlSoftkeysObserver = NULL,
       
    92     MBrCtlLinkResolver* aBrCtlLinkResolver = NULL,
       
    93     MBrCtlSpecialLoadObserver* aBrCtlSpecialLoadObserver = NULL,
       
    94     MBrCtlLayoutObserver* aBrCtlLayoutObserver = NULL,
       
    95     MBrCtlDialogsProvider* aBrCtlDialogsProvider = NULL,
       
    96     MBrCtlWindowObserver* aBrCtlWindowObserver = NULL,
       
    97   MBrCtlDownloadObserver* aBrCtlDownloadObserver = NULL );
       
    98 
       
    99 /**
       
   100 * The CBrCtlInterface class is the base class of the Browser Control API.
       
   101 * All clients of browser control must use this class. The functions defined
       
   102 * in the CBrCtlInterface class implement basic Browser Control functionality.
       
   103 * You can customize the Browser Control to extend its functionality by
       
   104 * implementing additional interface classes in the host application. Examples
       
   105 * of such classes are MBrCtlDataLoadSupplier, MBrCtlDialogsProvider,
       
   106 * MBrCtlDialogsProvider etc.
       
   107 *
       
   108 * Usage:
       
   109 *
       
   110 * @code
       
   111 *  #include <BrCtlInterface.h>
       
   112 *  // Interface that provides dialogs used by the Browser Control.
       
   113 *  #include <BrCtlDialogsProvider.h>
       
   114 *  // Interface used to receive scrolling events.
       
   115 *  #include <BrCtlLayoutObserver.h>
       
   116 *  //Interface that provides a callback mechanism for receiving the
       
   117 *  //content of an embedded link or the content of a user-initiated
       
   118 *  //load request.
       
   119 *  #include <BrCtlLinkResolver.h>
       
   120 *  //Interface that handles requests to change the softkeys.
       
   121 *  #include <BrCtlSoftkeysObserver.h>
       
   122 *  //Interface that handles special load needs.
       
   123 *  #include <BrCtlSpecialLoadObserver.h>
       
   124 *  //Reserved for future use.
       
   125 *  #include <BrCtlWindowObserver.h>
       
   126 *  //Interface that passes download events from the
       
   127 *  //Download Manager through the Browser Control to the
       
   128 *  //host application.
       
   129 *  #include <BrCtlDownloadObserver.h>
       
   130 *  Enum Definition of the Browser Control API.
       
   131 *  #include <BrCtlDefs.h>
       
   132 *
       
   133 *
       
   134 *   The following types of things you can do with the Browser Control API.
       
   135 *
       
   136 * Creating a basic Browser Control
       
   137 * Creating a Browser Control with observer interfaces
       
   138 * Loading content
       
   139 * Passing content incrementally
       
   140 * Receiving load progress events
       
   141 * Handling special load requests
       
   142 * Customizing dialogs
       
   143 * Specifying the softkeys
       
   144 * Resolving links
       
   145 * Customizing scroll bars
       
   146 * Receiving change-of-state events
       
   147 *
       
   148 * @see S60 Platform: Browser Control API Developer's Guide Version 2.0
       
   149 * @lib BrowserEngine.lib
       
   150 * @since 2.8
       
   151 * @file BrCtlInterface.h
       
   152 * @endcode     *
       
   153 */
       
   154 class CBrCtlInterface : public CCoeControl
       
   155     {
       
   156     public:  // Constructors and destructor
       
   157 
       
   158         /**
       
   159         * Destructor.
       
   160         */
       
   161       inline virtual ~CBrCtlInterface() {}
       
   162 
       
   163     public: // New functions
       
   164 
       
   165         /**
       
   166         * Passes a command to the Browser Control..
       
   167         * @since 2.8
       
   168         * @param aCommand The command that the Browser Control should process
       
   169         * @return void
       
   170         * @see TBrCtlCommands, For a complete list of commands,
       
   171         */
       
   172         IMPORT_C virtual void HandleCommandL(TInt aCommand) = 0;
       
   173 
       
   174         /**
       
   175         * Return the display size that would be needed to see all the content
       
   176         * @since 2.8
       
   177         * @return The display size that would be needed to see all the content
       
   178         */
       
   179         IMPORT_C virtual TSize ContentSize() = 0;
       
   180 
       
   181         /**
       
   182         * Update a Browser Control setting
       
   183         * @since 2.8
       
   184         * @param aSetting The setting to update
       
   185         * @param aValue The new value of the setting
       
   186         * @leave KErrArgument if the value of aSetting is out of range.
       
   187         * @return void
       
   188         */
       
   189         IMPORT_C virtual void SetBrowserSettingL(TUint aSetting, TUint aValue) = 0;
       
   190 
       
   191         /**
       
   192         * Get a setting from the Browser Control
       
   193         * @since 2.8
       
   194         * @param aSetting The setting to get
       
   195         * @leave KErrArgument if the value of aSetting is out of range.
       
   196         * @return The value of the setting
       
   197         */
       
   198         IMPORT_C virtual TUint BrowserSettingL(TUint aSetting) = 0;
       
   199 
       
   200         /**
       
   201         * Request the Browser Control to display the content of a buffer
       
   202         * @since 2.8
       
   203         * @param aUrl A url that refers to the data. If a url scheme is used, it must be "data:"
       
   204         * @param aData The content to display. Browser Control does not take ownership
       
   205         * @param aDataType The data type of the data
       
   206         * @param aCharsetUid The UID of the character converter of the content's charset 0 assumed Latin-1
       
   207         * @return void
       
   208         * @attention If you use this function, the Browser Control does not keep
       
   209         * track of the history. If the data is not markup, Browser Control uses
       
   210         * the Special Load Observer to pass the content back to the Host Application.
       
   211         * The Special Load Observer uses the Document Handler to send the content
       
   212         * to the proper application.
       
   213         */
       
   214         IMPORT_C virtual void LoadDataL(const TDesC& aUrl,
       
   215                                 const TDesC8& aData,
       
   216                                 const TDataType& aDataType,
       
   217                                 TUid aCharsetUid) = 0;
       
   218 
       
   219         /**
       
   220         * Request the Browser Control to display content incrementaly
       
   221         * @since 2.8
       
   222         * @param aUrl A url that refers to the data. If a url scheme is used, it must be "data:"
       
   223         * @param aDataType The data type of the data
       
   224         * @param aCharsetUid The UID of the character converter of the content's charset 0 assumed Latin-1
       
   225         * @param aContentLength The length of the content.
       
   226         * @param aBrCtlDataLoadSupplier A callback interface to stop passing data if an error occured in the Browser Control
       
   227         * @param aBrCtlDataLoadConsumer A callback interface returned by the browser. Data should be passed to that interface
       
   228         * @return void
       
   229         * @attension If you use this function, the Browser Control does not keep
       
   230         * track of the history.If the content type of the data is not markup, Browser
       
   231         * Control uses the Special Load Observer to pass the content back to the Host
       
   232         * Application. The Special Load Observer uses the Document Handler to send
       
   233         * the content to the proper application.
       
   234         */
       
   235         // The url scheme must be "data:" The url is needed as reference to this load request
       
   236         IMPORT_C virtual void InitLoadDataL(const TDesC& aUrl,
       
   237                                     const TDataType& aDataType,
       
   238                                     TUid aCharsetUid,
       
   239                                     TUint aContentLength,
       
   240                                     MBrCtlDataLoadSupplier* aBrCtlDataLoadSupplier,
       
   241                                     MBrCtlDataLoadConsumer** aBrCtlDataLoadConsumer) = 0;
       
   242 
       
   243         /**
       
   244         * Request the Browser Control to load a url
       
   245         * @since 2.8
       
   246         * @param aUrl The url to load
       
   247         * @param aApId The Access Point Id to use
       
   248         * @param aCacheMode The cache mode to use.
       
   249         * Values: One of the following:
       
   250         *            ECacheModeNormal
       
   251         *            ECacheModeHistory
       
   252         *            ECacheModeNoCache
       
   253         *            ECacheModeOnlyCache
       
   254         * @see For a description of each of these values, see TBrCtlCacheMode
       
   255         * @return void
       
   256         */
       
   257         IMPORT_C virtual void LoadUrlL( const TDesC& aUrl,
       
   258                                         TInt aApId = -1,
       
   259                                         TBrCtlDefs::TBrCtlCacheMode aBrCtlCacheMode = TBrCtlDefs::ECacheModeNormal) = 0;
       
   260 
       
   261         /**
       
   262         * Request the Browser Control to load and display a file from the file system
       
   263         * @since 2.8
       
   264         * @param aFileName The name of the file
       
   265         * @return void
       
   266         */
       
   267         IMPORT_C virtual void LoadFileL(const TDesC& aFileName) = 0;
       
   268 
       
   269         /**
       
   270         * Request the Browser Control to load and display a file from the file system
       
   271         * @since 2.8
       
   272         * @param aFileHandle The handle of the file
       
   273         * @return void
       
   274         */
       
   275         IMPORT_C virtual void LoadFileL(RFile& aFileHandle) = 0;
       
   276 
       
   277         /*                                        
       
   278         * Return the WML Options for the current page
       
   279         * @since 2.8
       
   280         * @param
       
   281         * @return The WML Options for the current page
       
   282         */
       
   283         IMPORT_C virtual RPointerArray<TBrCtlWmlServiceOption>* WMLOptionMenuItemsL()  = 0;
       
   284 
       
   285         /**
       
   286         * Request the Browser Control to add its own options to the option menu
       
   287         * @since 2.8
       
   288         * @param aMenuPane Handle of the menu that will contain the options
       
   289         * @param aResourceId The resource ID of the menu
       
   290         * @param aAfter WML options should be added after that index
       
   291         * @return void
       
   292         */
       
   293         IMPORT_C virtual void AddOptionMenuItemsL(CEikMenuPane& aMenuPane, TInt aResourceId, TInt aAfter=-1 ) = 0;
       
   294 
       
   295         /**
       
   296         * Request the Browser Control to clear the cache
       
   297         * @since 2.8
       
   298         * @return The number of bytes that were freed from cache.
       
   299         */
       
   300         IMPORT_C virtual TUint ClearCache() = 0;
       
   301 
       
   302         /**
       
   303         * Ask the Browser Control if a URL is in cache
       
   304         * @since 2.8
       
   305         * @param aUrl The Url
       
   306         * @return ETrue, if a specific Url is in cache
       
   307         * EFalse if the URL is not in the cache
       
   308         */
       
   309         IMPORT_C virtual TBool IsUrlInCache(TDesC& aUrl) = 0;
       
   310 
       
   311         /**
       
   312         * Ask the Browser Control to clear a URL from the cache
       
   313         * @since 2.8
       
   314         * @param aUrl The Url
       
   315         * @return KErrNone if the URL is cleared from the cache
       
   316         * Error message is the URL has not been cleared.
       
   317         */
       
   318         IMPORT_C virtual TInt ClearItemInCache(TDesC& aUrl) = 0;
       
   319 
       
   320         /**
       
   321         * Request the Browser Control to return info about the page. The info is returned on the Cleanup Stack.
       
   322         * @since 2.8
       
   323         * @param aBrCtlPageInfo The type of requested info
       
   324         * @return A descriptor containing the requested page info
       
   325         * @attention The information is returned on the Cleanup stack.
       
   326         */
       
   327         IMPORT_C virtual HBufC* PageInfoLC(TBrCtlDefs::TBrCtlPageInfo aBrCtlPageInfo ) = 0;
       
   328 
       
   329         /**
       
   330         * From CBrCtlInterface Query the Browser Control
       
   331         * if there is a previous or next (depending on aDirection) element in history stack
       
   332         * @param aDirection
       
   333         * ENavigationBack if you wish to query whether there is a previous element
       
   334         * in the history stack.
       
   335         * ENavigationForward if you wish to query whether there is a subsequent
       
   336         * element in the history stack.
       
   337         * @since 2.8
       
   338         * @return ETrue if can go aDirection, EFalse otherwise
       
   339         */
       
   340         IMPORT_C virtual TBool NavigationAvailable( TBrCtlDefs::TBrCtlNavigationDirection aDirection ) = 0;
       
   341 
       
   342         /**
       
   343         * Request the Browser Control to save the current content to a file
       
   344         * @since 2.8
       
   345         * @param aFileName The name of the file to use for saving the content
       
   346         * @return The number of bytes in the saved file
       
   347         */
       
   348         IMPORT_C virtual TUint16 SaveToFileL(const TDesC& aFileName) = 0;
       
   349 
       
   350         /**
       
   351         * Request the Browser Control to pass the server's certificate info for the current page
       
   352         * @since 2.8
       
   353         * @return Certificate info of the server of the current page
       
   354         */
       
   355         IMPORT_C virtual const TCertInfo* CertInfo() = 0;
       
   356 
       
   357         /**
       
   358         * Request the Browser Control to register for load events
       
   359         * @since 2.8
       
   360         * @param aBrCtlLoadEventObserver A load events observer to add
       
   361         * @return void
       
   362         * @attenstion Call this function immediately after creating the Browser Control.
       
   363         * For multiple registrations, the host application may call this function more than once.
       
   364         * Observers must unregister before deleting the Browser Control.
       
   365         */
       
   366         IMPORT_C virtual void AddLoadEventObserverL(MBrCtlLoadEventObserver* aBrCtlLoadEventObserver) = 0;
       
   367 
       
   368         /**
       
   369         * Request the Browser Control to unregister for load events
       
   370         * @since 2.8
       
   371         * @param aBrCtlLoadEventObserver A load events observer to remove
       
   372         * @return void
       
   373         * @attenstion Call this function for each Load Observer that was previously registered.
       
   374 
       
   375 
       
   376         */
       
   377         IMPORT_C virtual void RemoveLoadEventObserver(MBrCtlLoadEventObserver* aBrCtlLoadEventObserver) = 0;
       
   378 
       
   379         /**
       
   380         * Return the number of images in the current page
       
   381         * @since 2.8
       
   382         * @param
       
   383         * @return The number of images in the current page
       
   384         */
       
   385         IMPORT_C virtual TInt ImageCountL() = 0;
       
   386 
       
   387         /**
       
   388         * Returns the focused element
       
   389         * @since 2.8
       
   390         * @return The type of the focused element
       
   391         * @attension The host application may need to perform special processing,
       
   392         * such as updating the softkeys, when a specific element has the focus.
       
   393         */
       
   394         IMPORT_C virtual TBrCtlDefs::TBrCtlElementType FocusedElementType() = 0;
       
   395 
       
   396         /**
       
   397         * Register an observer for state changes
       
   398         * @since 2.8
       
   399         * @param aBrCtlStateChangeObserver The observer to register
       
   400         * @return void
       
   401         * @attenstion The Observer must unregister before deleting the Browser Control.
       
   402         */
       
   403         IMPORT_C virtual void AddStateChangeObserverL(MBrCtlStateChangeObserver* aBrCtlStateChangeObserver) = 0;
       
   404 
       
   405         /**
       
   406         * Unregister an observer for state changes
       
   407         * @since 2.8
       
   408         * @param The observer to unregister
       
   409         * @return void
       
   410         */
       
   411         IMPORT_C virtual void RemoveStateChangeObserver(MBrCtlStateChangeObserver* aBrCtlStateChangeObserver) = 0;
       
   412 
       
   413         /**
       
   414         * Request the Browser Control to return info about the Browser Control version. The info is returned on the Cleanup Stack.
       
   415         * @since 2.8
       
   416         * @param aVersionInfo The type of requested info
       
   417         * @return A descriptor containing the requested page info
       
   418         * @attention The information is returned on the Cleanup Stack.
       
   419         */
       
   420         IMPORT_C virtual HBufC* VersionInfoLC(TBrCtlDefs::TBrCtlVersionInfo aVersionInfo) = 0;
       
   421 
       
   422         /**
       
   423         * Pass a list of content types to the Browser Control.
       
   424         * These content types will not be using the download manager.
       
   425         * The list must be separated by ';' e.g. "text/html;text/wml"
       
   426         * @since 2.8
       
   427         * @param aContentTypes The content types that should not use Download Manager
       
   428         * @return void
       
   429         * @deprecated This function is deprecated. Use the
       
   430         * EParamsSelfDownloadableTypes parameter of the SetParamL function instead.
       
   431         */
       
   432         IMPORT_C virtual void SetSelfDownloadContentTypesL(TDesC& aContentTypes) = 0;
       
   433 
       
   434         /**
       
   435         * Update a Browser Control parameter. consequent calls with the
       
   436         * same aParam will replace the value, and not append to it.
       
   437         * @since 2.8
       
   438         * @param aParam The parameter to update
       
   439         * @param aValue The new value of the parameter
       
   440         *        EParamsSelfDownoadableTypes: Pass a list of content types to the
       
   441         *        Browser Control. These content types will not be using the
       
   442         *        download manager. The list must be separated by ';' e.g.
       
   443         *        "text/html;text/wml"
       
   444         *
       
   445         *        EParamsRequestHeaders: Pass a list of headers that the
       
   446         *        Browser Control. These headers will be added to each request.
       
   447         *        The list must be separated by '\r'. The header name and value must be
       
   448         *        separated by ':'  e.g.
       
   449         *        "x-myheader: myvalue\rx-myotherheader: myothervalue"
       
   450         * @return void
       
   451         */
       
   452         IMPORT_C virtual void SetParamL(TBrCtlDefs::TBrCtlParams aParam, const TDesC& aValue) = 0;
       
   453 
       
   454         /**
       
   455         * Request the Browser Control to load a saved page.
       
   456         * @since 3.0
       
   457         * @param aUid a unique identifier for the saved page
       
   458         * @param aSavedPageBuffer buffer which contains the content of the saved page
       
   459         * @return void
       
   460         */
       
   461         IMPORT_C virtual void LoadSavedPageL(const TDesC& aUid, TDesC& aSavedPageBuffer) = 0;
       
   462 
       
   463         /**
       
   464         * Return the zoom levels index
       
   465         * @since 3.0
       
   466         * @return The zoom levels array.
       
   467         */
       
   468         IMPORT_C virtual RArray<TUint>* ZoomLevels() const = 0;
       
   469 
       
   470        /**
       
   471         * Perform the incremental find operation
       
   472         * @param aKeyword String to be find.
       
   473         * @since 3.0
       
   474         * @return TBrCtlFindResponse
       
   475         */
       
   476         IMPORT_C virtual int FindKeyword( const TDesC& aKeyword ) = 0;
       
   477 
       
   478         /**
       
   479         * Continue the incremental find operation
       
   480         * @since 3.0
       
   481         * @param aFowardDirection TRUE if search is in forword direction.
       
   482         * For backword direction, it is FALSE.
       
   483         * @return TBrCtlFindResponse
       
   484         * @attention Method that is called when the user searches for the next
       
   485         * keyword in the doc.
       
   486         *
       
   487         */
       
   488         IMPORT_C virtual TBrCtlDefs::TBrCtlFindResponse FindKeywordAgain( TBool aFowardDirection ) = 0;
       
   489 
       
   490         /**
       
   491         * Return information about the linked feeds in the current page - used to
       
   492         * build a "Subscribe to" submenu.
       
   493         * @since 3.0
       
   494         * @return Information about the linked feeds in the current page.  The
       
   495         *         caller adopts the result.
       
   496         */
       
   497         IMPORT_C virtual const RPointerArray<TBrCtlSubscribeTo>& SubscribeToMenuItemsL() = 0;
       
   498 
       
   499 
       
   500 
       
   501     public: // Functions from base classes
       
   502 
       
   503         // Functions from CCoeControl
       
   504 
       
   505         /**
       
   506         * From CCoeControl Return the minimum size the Browser Control can use
       
   507         * @since 2.8
       
   508         * @return The minimum size that the Browser Control can use.
       
   509         * @attention This function is inherited from the Symbian CCoeControl class.
       
   510         */
       
   511         IMPORT_C virtual TSize MinimumSize() = 0;
       
   512 
       
   513         /**
       
   514         * From CCoeControl Pass key events to the Browser Control
       
   515         * @since 2.8
       
   516         * @param aKeyEvent The key event
       
   517         * @param aType The key code
       
   518         * @return If the Browser Control consumed the key event or not
       
   519         * @attention This function is inherited from the Symbian CCoeControl class.
       
   520         */
       
   521         IMPORT_C virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) = 0;
       
   522 
       
   523         /**
       
   524         * From CCoeControl Sets that the Browser Control has keyboard focus.
       
   525         * @since 2.8
       
   526         * @param aFocus If the Browser Control gets or loses focus
       
   527         * @param ENoDrawNow If the Browser Control should redraw itself as result of focus change
       
   528         * @return void
       
   529         * @attention This function is inherited from the Symbian CCoeControl class.
       
   530         */
       
   531         IMPORT_C virtual void SetFocus(TBool aFocus, TDrawNow aDrawNow = ENoDrawNow) = 0;
       
   532 
       
   533         /*
       
   534         * This method calls to download manager in order to display query "Cancel
       
   535         * outstanding downloads?" and cancel if it requested by user
       
   536         * @param none
       
   537         * @return ETrue if it is OK to exit; EFalse - if it is not OK to exit
       
   538         */
       
   539         IMPORT_C virtual TBool OkToExit() = 0;
       
   540 
       
   541 
       
   542         /**
       
   543         * This method calls to download manager in order to send the commands (EDownloadCmdPause,DownloadCmdResume,
       
   544     * EDownloadCmdCancel, EDownloadCmdMarkAsProgressive, EDownloadCmdMarkAsNotProgressive )
       
   545         * @param aCommand The command that the Browser Control should process
       
   546         * @param aTransId The transaction Id associated with this command
       
   547         * @return void
       
   548         */
       
   549     IMPORT_C virtual void HandleDownloadCommandL(TUint16 aTransId, TBrCtlDefs::TBrCtlDownloadCmd aCommand) = 0;
       
   550 
       
   551      /**
       
   552         * Request icon for the given url
       
   553         * @since 3.1
       
   554         * @param aUrl url to a favicon or a page
       
   555         * @param aBitmapInfo info on whether to retun a favicon or a page icon
       
   556         * @return favion icon or page icon
       
   557         */
       
   558     IMPORT_C virtual CGulIcon* GetBitmapData(const TDesC& aUrl, TBrCtlDefs::TBrCtlBitmapInfo aBitmapInfo) = 0;
       
   559 
       
   560         /**
       
   561         * Register a client command interface for the browser engine
       
   562         * @since 3.1
       
   563         * @param The observer to register
       
   564         * @return void
       
   565         */
       
   566         IMPORT_C virtual void AddCommandObserverL(MBrCtlCommandObserver* aBrCtlCommandObserver) = 0;
       
   567 
       
   568         /**
       
   569         * Unregister a client command interface for the browser engine
       
   570         * @since 3.1
       
   571         * @param The observer to unregister
       
   572         * @return void
       
   573         */
       
   574         IMPORT_C virtual void RemoveCommandObserver(MBrCtlCommandObserver* aBrCtlCommandObserver) = 0;
       
   575 
       
   576         /**
       
   577         * Unregister a client command interface for the browser engine
       
   578         * @since 3.1
       
   579         * @param The observer to unregister
       
   580         * @return void
       
   581         */
       
   582         IMPORT_C virtual MWidgetExtension* CreateWidgetExtensionL(MWidgetCallback& aWidgetCallback) = 0;
       
   583 
       
   584         /**
       
   585         * Get information about the focused image. The function leaves if the focus is not on an image
       
   586         * @since 3.2
       
   587         * @param
       
   588         * @return The requested information
       
   589         */
       
   590         IMPORT_C virtual TBrCtlImageCarrier* FocusedImageLC() = 0;
       
   591 
       
   592         /**
       
   593         * Requests the Browser Control to POST to a URL
       
   594         * @since 5.0
       
   595         * @param aUrl URL to which the Browser Control sends the POST request
       
   596         * @param aContentType Content type of the data to be posted
       
   597         * @param aPostData Data to be posted
       
   598         * @param aBoundary Boundary for form-data or multi-part content. 
       
   599         * @param aReserved For future use only
       
   600         * @return void
       
   601         */        
       
   602         IMPORT_C virtual void PostUrlL (const TDesC& aUrl, 
       
   603                                         const TDesC8& aContentType, 
       
   604                                         const TDesC8& aPostData, 
       
   605                                         const TDesC8* aBoundary, 
       
   606                                         TAny* aReserved) = 0;
       
   607         /**
       
   608         * Requests the Browser Control for offscreen bitmap
       
   609         * @since 5.0
       
   610         * @ fills offscreen bitmap.The bitmap memory has to be set and freed by the api calling that function.
       
   611         * @return void. 
       
   612         */
       
   613         IMPORT_C virtual void TakeSnapshotL(CFbsBitmap& snapshot) = 0; 
       
   614     };
       
   615 
       
   616 
       
   617 /**
       
   618 * The MBrCtlDataLoadSupplier class is a callback interface that
       
   619 * provides the Browser Control with the ability to display content incrementally.
       
   620 * It does this by providing a means for the Browser Control to cancel the load operation
       
   621 * if an error occurs.
       
   622 * For example, if the Browser Control runs out of memory during the
       
   623 * load operation, it can cancel that operation by means of this interface.
       
   624 *
       
   625 * Usage:
       
   626 *
       
   627 * @code
       
   628 *  #include <BrCtlInterface.h>
       
   629 * @see S60 Platform: Browser Control API Developer's Guide Version 2.0
       
   630 * @lib BrowserEngine.lib
       
   631 * @since 2.8
       
   632 * @file BrCtlInterface.h
       
   633 * @endcode     *
       
   634 */
       
   635 class MBrCtlDataLoadSupplier
       
   636     {
       
   637     public: // New functions
       
   638         /**
       
   639         * Cancel the load operation
       
   640         * @since 2.8
       
   641         * @return void
       
   642         */
       
   643     virtual void CancelLoad() = 0;
       
   644     };
       
   645 
       
   646 
       
   647 
       
   648 /**
       
   649 * The MBrCtlDataLoadConsumer class is a callback interface that provides
       
   650 * the Browser Control with the ability to receive content incrementally.
       
   651 *
       
   652 * @code
       
   653 *  #include <BrCtlInterface.h>
       
   654 * @see S60 Platform: Browser Control API Developer's Guide Version 2.0
       
   655 * @lib BrowserEngine.lib
       
   656 * @since 2.8
       
   657 * @file BrCtlInterface.h
       
   658 * @endcode     *
       
   659 */
       
   660 class MBrCtlDataLoadConsumer
       
   661     {
       
   662     public: // New functions
       
   663         /**
       
   664         * Pass the next data chunk
       
   665         * @since 2.8
       
   666         * @param aData The data chunk to process
       
   667         * @return void
       
   668         */
       
   669         virtual void HandleNextDataChunk(const TDesC8& aData) = 0;
       
   670 
       
   671         /**
       
   672         * Inform the Browser Control about completion of data load
       
   673         * @since 2.8
       
   674         * @return void
       
   675         */
       
   676         virtual void HandleLoadComplete() = 0;
       
   677 
       
   678         /**
       
   679         * Inform the Browser Control that an error occured
       
   680         * if HandleError() is called, then LoadComplete() is infered.
       
   681         * @since 2.8
       
   682         * @param aError The error code
       
   683         * @return void
       
   684         */
       
   685         virtual void HandleError(TInt aError) = 0;
       
   686     };
       
   687 
       
   688 /**
       
   689 * The MBrCtlLoadEventObserver interface receives load progress events.
       
   690 * The host application can implement this interface.
       
   691 *
       
   692 * @code
       
   693 *  #include <BrCtlInterface.h>
       
   694 * @see S60 Platform: Browser Control API Developer's Guide Version 2.0
       
   695 * @lib BrowserEngine.lib
       
   696 * @since 2.8
       
   697 * @file BrCtlInterface.h
       
   698 * @endcode     *
       
   699 */
       
   700 class MBrCtlLoadEventObserver
       
   701     {
       
   702     public: // New functions
       
   703         /**
       
   704         * A load events notification
       
   705         * @since 2.8
       
   706         * @param aLoadEvent The load event
       
   707         * @param aSize Size depends on the event
       
   708         * @param aTransactionId The transaction id of the transaction that had this event
       
   709         * @return void
       
   710         */
       
   711         virtual void HandleBrowserLoadEventL(TBrCtlDefs::TBrCtlLoadEvent aLoadEvent, TUint aSize, TUint16 aTransactionId) = 0;
       
   712     };
       
   713 
       
   714 /**
       
   715 * The TBrCtlWmlServiceOption class wraps information about the WML DO elements.
       
   716 * For more information about the DO tag, see http://www.w3schools.com/wap/tag_do.asp.
       
   717 * @code
       
   718 *  #include <BrCtlInterface.h>
       
   719 * @lib BrowserEngine.lib
       
   720 * @since 2.8
       
   721 * @file BrCtlInterface.h
       
   722 * @endcode     *
       
   723 */
       
   724 class TBrCtlWmlServiceOption
       
   725     {
       
   726     public:
       
   727         /**
       
   728         * Constructor
       
   729         * @since 2.8
       
   730         * @param aText The text to display in the WML service options
       
   731         * @param aElemID The element Id to use when the user selects this command
       
   732         * @param aActualElemID Internal to the Browser Control. The host
       
   733         * application should not modify this parameter.
       
   734         */
       
   735         TBrCtlWmlServiceOption(HBufC* aText, TUint aElemID, TUint aActualElemID);
       
   736         /**
       
   737         * Displays the text for the WML service options
       
   738         * @since 2.8
       
   739         * @return Text to display for the WML service options
       
   740         */
       
   741         inline const TDesC& Text() {return *iText;}
       
   742         /**
       
   743         * Gets the command ID to use when the user selects this command
       
   744         * @since 2.8
       
   745         * @return Element ID employed when the user selects this command
       
   746         */
       
   747         inline TUint ElemID(){return iElemID;}
       
   748         /**
       
   749         * Gets the actual element ID defined in the WML page.
       
   750         * @since 2.8
       
   751         * @return Actual element ID
       
   752         * @attention This parameter is internal to the Browser Control.
       
   753         * The host application should not modify this parameter.
       
   754         */
       
   755         inline TUint ActualElemID(){return iActualElemID;}
       
   756 
       
   757         /**
       
   758         * Destructor.
       
   759         */
       
   760         ~TBrCtlWmlServiceOption();
       
   761 
       
   762     private:    // Data
       
   763         /**
       
   764         * Default constructor
       
   765         * @since 2.8
       
   766         */
       
   767         TBrCtlWmlServiceOption() {};
       
   768 
       
   769         // The text to display in the WML service options
       
   770         HBufC* iText;
       
   771         // The element Id to use when the user selects this command
       
   772         TUint iElemID;
       
   773         // The actual element Id
       
   774         TUint iActualElemID;
       
   775     };
       
   776 
       
   777 /**
       
   778 * The TBrCtlSubscribeTo class provides information of Subscribe to items.
       
   779 * @code
       
   780 *  #include <BrCtlInterface.h>
       
   781 * @lib BrowserEngine.lib
       
   782 * @since 2.8
       
   783 * @file BrCtlInterface.h
       
   784 * @endcode     *
       
   785 */
       
   786 class TBrCtlSubscribeTo
       
   787     {
       
   788     public:
       
   789         /**
       
   790         * Constructor
       
   791         * @since 3.0
       
   792         * @param aText The text to display in the subscribe to option.  aText
       
   793         *              is adopted.
       
   794         * @param aCommandID The menu command Id to use when the user selects it.
       
   795         */
       
   796         TBrCtlSubscribeTo(const TPtrC& aTitle, const TPtrC& aUrl, TUint aCommandID);
       
   797 
       
   798         /**
       
   799         * Returns the title.
       
   800         * @since 3.0
       
   801         * @return The title.
       
   802         */
       
   803         inline const TPtrC& Title() {return iTitle;}
       
   804 
       
   805         /**
       
   806         * Returns the url.
       
   807         * @since 3.0
       
   808         * @return The url.
       
   809         */
       
   810         inline const TPtrC& Url() {return iUrl;}
       
   811 
       
   812         /**
       
   813         * Returns the command.
       
   814         * @since 3.0
       
   815         * @return The command.
       
   816         */
       
   817         inline TUint CommandID() {return iCommandID;}
       
   818 
       
   819     private:
       
   820         /**
       
   821         * Default constructor
       
   822         * @since 3.0
       
   823         */
       
   824         TBrCtlSubscribeTo();
       
   825 
       
   826     private:    // Data
       
   827         const TPtrC iTitle;
       
   828         const TPtrC iUrl;
       
   829 
       
   830         TUint iCommandID;
       
   831     };
       
   832 
       
   833 /**
       
   834 * The MBrCtlStateChangeObserver class receives state-changed events.
       
   835 * At the present time, there is only one state-changed event.
       
   836 * This event is generated when the browser switches to and from
       
   837 * the Image Map view. In Image Map view, only an image map is displayed,
       
   838 * which enables the user to navigate. The host application can
       
   839 * implement this interface in order to find out when the view
       
   840 * changes to and from the Image Map view.
       
   841 * @code
       
   842 *  #include <BrCtlInterface.h>
       
   843 * @lib BrowserEngine.lib
       
   844 * @since 2.8
       
   845 * @file BrCtlInterface.h
       
   846 * @endcode     *
       
   847 */
       
   848 class MBrCtlStateChangeObserver
       
   849     {
       
   850     public:
       
   851         /**
       
   852         * Notifies the Browser Control of a state-changed event.
       
   853         * @param aState Indicates whether or not the browser is in Image Map view.
       
   854         * Value:EStateImageMapView
       
   855         * @param aValue Indicates the state being changed.
       
   856         * Values:
       
   857         * ETrue indicates entering Image Map view
       
   858         * EFalse indicates exiting Image Map view
       
   859         * @since 2.8
       
   860         * @return void
       
   861         */
       
   862         virtual void StateChanged(TBrCtlDefs::TBrCtlState aState, TInt aValue) = 0;
       
   863     };
       
   864 
       
   865 // CLASS DECLARATION
       
   866 /**
       
   867 *  This class provides a mechanism for the browser engine to pass commands to the client
       
   868 *
       
   869 *  @lib BrowserEngine.lib
       
   870 *  @since 3.1
       
   871 */
       
   872 class MBrCtlCommandObserver
       
   873     {
       
   874     public: // New functions
       
   875         /**
       
   876         * Method to call client to execute commands
       
   877         * @since 3.1
       
   878         * @param A callback command
       
   879         * @param Array of attribute names
       
   880         * @param Array of attribute values
       
   881         * @return void
       
   882         */
       
   883         virtual void HandleCommandL(TBrCtlDefs::TBrCtlClientCommands aCommand, const CArrayFix<TPtrC>& aAttributesNames,
       
   884                                      const CArrayFix<TPtrC>& aAttributeValues) = 0;
       
   885     };
       
   886 
       
   887 // CLASS DECLARATION
       
   888 /**
       
   889 *  This class provides a mechanism for the browser engine to interact with the widget host application
       
   890 *
       
   891 *  @lib BrowserEngine.lib
       
   892 *  @since 3.2
       
   893 */
       
   894 class MWidgetCallback
       
   895     {
       
   896     public:
       
   897         /**
       
   898         * Navigates through your file system and selects a file of specific mime type;
       
   899         * analogous to the Browse command in Windows.
       
   900         * @since 3.2
       
   901         * @param aSelectedFileName The selected file name.
       
   902         * @param aMimeType The accepted mime type.
       
   903         * @return ETrue if the user selected a file
       
   904         * EFalse if the user cancelled the transaction and did not select a file.
       
   905         * @attiontion Returned on cleanup stack. Browser control will free the buffer.
       
   906         */
       
   907         virtual TBool DialogMimeFileSelectLC(HBufC*& aSelectedFileName,
       
   908                                  const TDesC& aMimeType) = 0;
       
   909 
       
   910        /**
       
   911         * Called to show or hide softkeys
       
   912         * @since 3.1
       
   913         * @param aVisible ETrue to show softkeys, EFalse when full screen is needed
       
   914         */
       
   915         virtual void SetSoftkeysVisible(TBool aVisible) = 0;
       
   916 
       
   917         /**
       
   918         * Called to change the display orientation to landscape
       
   919         * @since 3.1
       
   920         */
       
   921         virtual void SetDisplayMode(TBrCtlDefs::TBrCtlOrientation aOrientation) = 0;
       
   922 
       
   923         //Reserved for future use
       
   924         virtual TInt Reserved_1(TAny*& a0, TAny* a1, TAny* a2) = 0;
       
   925         virtual TInt Reserved_2(TAny*& a0, TAny* a1, TAny* a2) = 0;
       
   926         virtual TInt Reserved_3(TAny*& a0, TAny* a1, TAny* a2) = 0;
       
   927         virtual TInt Reserved_4(TAny*& a0, TAny* a1, TAny* a2) = 0;
       
   928         virtual TInt Reserved_5(TAny*& a0, TAny* a1, TAny* a2) = 0;
       
   929         virtual TInt Reserved_6(TAny*& a0, TAny* a1, TAny* a2) = 0;
       
   930         virtual TInt Reserved_7(TAny*& a0, TAny* a1, TAny* a2) = 0;
       
   931         virtual TInt Reserved_8(TAny*& a0, TAny* a1, TAny* a2) = 0;
       
   932         virtual TInt Reserved_9(TAny*& a0, TAny* a1, TAny* a2) = 0;
       
   933         virtual TInt Reserved_10(TAny*& a0, TAny* a1, TAny* a2) = 0;
       
   934     };
       
   935 
       
   936 // CLASS DECLARATION
       
   937 /**
       
   938 *  This class provides an extension mechanism for the widget host app to interact with the browser engine
       
   939 *  This class includes the Widget specific extension needed in the browser engine
       
   940 *  @lib BrowserEngine.lib
       
   941 *  @since 3.2
       
   942 */
       
   943 class MWidgetExtension
       
   944     {
       
   945     public: // New functions
       
   946         /**
       
   947         * Method to set parameters in the browser engine
       
   948         * @since 3.2
       
   949         * @param The widget identifier
       
   950         * @param The value for the paramater
       
   951         * @return void
       
   952         */
       
   953         virtual void SetParamL(TBrCtlDefs::TBrCtlWidgetParams aParam, const TDesC& aValue) = 0;
       
   954 
       
   955         /**
       
   956         * Method to set parameters in the browser engine
       
   957         * @since 3.2
       
   958         * @param The widget parameter aParam
       
   959         * @param The value for the paramater
       
   960         * @return void
       
   961         */
       
   962         virtual void SetParamL(TBrCtlDefs::TBrCtlWidgetParams aParam, TUint aValue) = 0;
       
   963 
       
   964         /**
       
   965         * Method to invoke callback function for right soft key
       
   966         * @since 3.2
       
   967         * @param none
       
   968         * @return ETrue if there is a rightsoftkey callback, else EFalse
       
   969         */
       
   970         virtual TBool HandleCommandL( TInt aCommandId ) = 0;
       
   971 
       
   972     };
       
   973 #endif      // BRCTLINTERFACE_H
       
   974 
       
   975 // End of File