epoc32/include/mw/brctlspecialloadobserver.h
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 brctlspecialloadobserver.h
     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:  Handle special load events such as network connection, deal with non-http or non-html requests
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef BRCTLSPECIALLOADOBSERVER_H
       
    20 #define BRCTLSPECIALLOADOBSERVER_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32std.h>
       
    24 #include <e32base.h>
       
    25 #include <apmstd.h> 
       
    26 #include <ApEngineConsts.h>
       
    27 #include <badesca.h>
       
    28 
       
    29 // CONSTANTS
       
    30 
       
    31 // MACROS
       
    32 
       
    33 // DATA TYPES
       
    34 enum TBrCtlDownloadParam
       
    35     {
       
    36     EParamRequestUrl, ///< URL requested
       
    37     EParamRealm, ///< Realm (if www)
       
    38     EParamUsername, ///< User name (if www authentication)
       
    39     EParamPassword, ///< Password (if www authentication)
       
    40     EParamProxyRealm, ///< Realm in the case of proxy authentication
       
    41     EParamProxyUsername, ///< User name (if proxy authentication)
       
    42     EParamProxyPassword, ///< Password (if proxy authentication)
       
    43     EParamRawRequestHeader, ///< Request header in the form: Header:Value
       
    44     EParamReceivedContentType, ///< Type of content received
       
    45     EParamExpectedContentType, ///< Type of content expected to appear in the markup <object> tag.
       
    46     EParamTotalContentLength, ///< Expected length of the content
       
    47     EParamReceivedContentLength, ///< Length of the content already received
       
    48     EParamReceivedContent, ///< Body of the content received
       
    49     EParamRawResponseHeader, ///< Response header in the form: Header: Value
       
    50     EParamLocalFileName, ///< Name of the file containing the content to be downloaded
       
    51     EParamCharset, ///< Character set of the content to be downloaded
       
    52     EParamRefererHeader, ///< Referrer header used in the download request, if applicable
       
    53     EParamTransactionId ///< Transaction ID 
       
    54     };
       
    55 
       
    56 // FUNCTION PROTOTYPES
       
    57 
       
    58 
       
    59 /**
       
    60 * The MBrCtlSpecialLoadObserver class handles special load events, such as 
       
    61 * network connection, non-HTTP(S) load requests, and non-HTML responses.
       
    62 *
       
    63 * Usage:
       
    64 *
       
    65 * @code
       
    66 *  #include <BrCtlSpecialLoadObserver.h>
       
    67 *
       
    68 *  
       
    69 * @see S60 Platform: Browser Control API Developer's Guide Version 2.0
       
    70 * @lib BrowserEngine.lib
       
    71 * @file BrCtlSpecialLoadObserver.h
       
    72 * @endcode     *
       
    73 */
       
    74 class MBrCtlSpecialLoadObserver
       
    75     {
       
    76     public: // New functions
       
    77         /**
       
    78         * Request to create a network connection.
       
    79         * @since 2.8
       
    80         * @param aConnectionPtr Pointer to the network connection. It must 
       
    81         * be type casted to an integer. If NULL, the Proxy Filter creates 
       
    82         * a network connection automatically. It must be type casted to an integer.
       
    83         * @param aSockSvrHandle A handle to the socket server.
       
    84         * @param aNewConn A flag if a new connection was created. If the 
       
    85         * connection is not new, proxy filter optimization will not read 
       
    86         * the proxy again from CommsBd.
       
    87         * ETrue if a new connection was created.
       
    88         * EFalse if a previously created connection was used.
       
    89         * @param aBearerType Bearer type of the new connection. For example, GPRS, WCDMA.
       
    90         * TapBearerType is defined in ApEngineConsts.h.
       
    91         * @return void
       
    92         * @attention This function is called for every HTTP request for which 
       
    93         * the content was not found in the cache. This function is called 
       
    94         * whether or not a connection was established in a previous request. 
       
    95         * The host application determines whether to create a new connection 
       
    96         * or to use an existing connection. 
       
    97         */
       
    98         virtual void NetworkConnectionNeededL(TInt* aConnectionPtr,
       
    99                                               TInt* aSockSvrHandle,
       
   100                                               TBool* aNewConn,
       
   101                                               TApBearerType* aBearerType) = 0;
       
   102 
       
   103         /**
       
   104         * Requests the host application to handle non-HTTP requests. It is expected that the 
       
   105         * host application will call the Scheme Dispatcher to handle these requests.
       
   106         * @since 2.8
       
   107         * @param aTypeArray Array of request parameters. Examples: URL, referrer header
       
   108         * @param aDesArray Array of values corresponding to the types in aTypeArray
       
   109         * @return ETrue if the host application handles the scheme.
       
   110         * EFalse if the host application cannot handle the scheme.
       
   111         * @attention The browser checks the scheme to determine whether or 
       
   112         * not it is supported. The browser supports the following schemes:
       
   113         * File scheme, HTTP scheme or HTTPS scheme
       
   114         * If the URL contains a scheme that the browser does not 
       
   115         * support, such as RTSP, then the host application should pass the 
       
   116         * content to an application that can handle that scheme. 
       
   117         */
       
   118         virtual TBool HandleRequestL(RArray<TUint>* aTypeArray, CDesCArrayFlat* aDesArray) = 0;
       
   119 
       
   120         /**
       
   121         * Request the host applicaion to handle downloads
       
   122         * @since 2.8
       
   123         * @param aTypeArray array of download parameter types
       
   124         * @param aDesArray array of values associated with the types in the type array
       
   125         * @return ETrue if handled by the host application
       
   126         * EFalse if not handled by the host application
       
   127         * @attention The host application should call the Download Manager to 
       
   128         * handle non-HTML content. 
       
   129         * Only GET requests are supported because the Browser Control must 
       
   130         * cancel the transaction before the Download Manager can take over. 
       
   131         * If a POST request is cancelled, the server may enter an unpredictable state.
       
   132         * For POST requests, the Browser Control downloads the content before calling 
       
   133         * this function. It stores the content in a file whose name is passed to the 
       
   134         * host application by using the EParamLocalFileName parameter. The host 
       
   135         * application should check whether this parameter was passed by the 
       
   136         * Browser Control to determine whether the Browser Control already downloaded 
       
   137         * the content. If not, the host application should download the content.
       
   138         */
       
   139         virtual TBool HandleDownloadL(RArray<TUint>* aTypeArray, CDesCArrayFlat* aDesArray) = 0;
       
   140 
       
   141     };
       
   142 
       
   143 #endif      // BRCTLSPECIALLOADOBSERVER_H
       
   144             
       
   145 // End of File