williamr@2: /*
williamr@2: * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
williamr@2: * All rights reserved.
williamr@2: * This component and the accompanying materials are made available
williamr@2: * under the terms of the License "Eclipse Public License v1.0"
williamr@2: * which accompanies this distribution, and is available
williamr@2: * at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2: *
williamr@2: * Initial Contributors:
williamr@2: * Nokia Corporation - initial contribution.
williamr@2: *
williamr@2: * Contributors:
williamr@2: *
williamr@2: * Description:  Handle special load events such as network connection, deal with non-http or non-html requests
williamr@2: *
williamr@2: */
williamr@2: 
williamr@2: 
williamr@2: #ifndef BRCTLSPECIALLOADOBSERVER_H
williamr@2: #define BRCTLSPECIALLOADOBSERVER_H
williamr@2: 
williamr@2: //  INCLUDES
williamr@2: #include <e32std.h>
williamr@2: #include <e32base.h>
williamr@2: #include <apmstd.h> 
williamr@2: #include <ApEngineConsts.h>
williamr@2: #include <badesca.h>
williamr@2: 
williamr@2: // CONSTANTS
williamr@2: 
williamr@2: // MACROS
williamr@2: 
williamr@2: // DATA TYPES
williamr@2: enum TBrCtlDownloadParam
williamr@2:     {
williamr@2:     EParamRequestUrl, ///< URL requested
williamr@2:     EParamRealm, ///< Realm (if www)
williamr@2:     EParamUsername, ///< User name (if www authentication)
williamr@2:     EParamPassword, ///< Password (if www authentication)
williamr@2:     EParamProxyRealm, ///< Realm in the case of proxy authentication
williamr@2:     EParamProxyUsername, ///< User name (if proxy authentication)
williamr@2:     EParamProxyPassword, ///< Password (if proxy authentication)
williamr@2:     EParamRawRequestHeader, ///< Request header in the form: Header:Value
williamr@2:     EParamReceivedContentType, ///< Type of content received
williamr@2:     EParamExpectedContentType, ///< Type of content expected to appear in the markup <object> tag.
williamr@2:     EParamTotalContentLength, ///< Expected length of the content
williamr@2:     EParamReceivedContentLength, ///< Length of the content already received
williamr@2:     EParamReceivedContent, ///< Body of the content received
williamr@2:     EParamRawResponseHeader, ///< Response header in the form: Header: Value
williamr@2:     EParamLocalFileName, ///< Name of the file containing the content to be downloaded
williamr@2:     EParamCharset, ///< Character set of the content to be downloaded
williamr@2:     EParamRefererHeader, ///< Referrer header used in the download request, if applicable
williamr@2:     EParamTransactionId ///< Transaction ID 
williamr@2:     };
williamr@2: 
williamr@2: // FUNCTION PROTOTYPES
williamr@2: 
williamr@2: 
williamr@2: /**
williamr@2: * The MBrCtlSpecialLoadObserver class handles special load events, such as 
williamr@2: * network connection, non-HTTP(S) load requests, and non-HTML responses.
williamr@2: *
williamr@2: * Usage:
williamr@2: *
williamr@2: * @code
williamr@2: *  #include <BrCtlSpecialLoadObserver.h>
williamr@2: *
williamr@2: *  
williamr@2: * @see S60 Platform: Browser Control API Developer's Guide Version 2.0
williamr@2: * @lib BrowserEngine.lib
williamr@2: * @file BrCtlSpecialLoadObserver.h
williamr@2: * @endcode     *
williamr@2: */
williamr@2: class MBrCtlSpecialLoadObserver
williamr@2:     {
williamr@2:     public: // New functions
williamr@2:         /**
williamr@2:         * Request to create a network connection.
williamr@2:         * @since 2.8
williamr@2:         * @param aConnectionPtr Pointer to the network connection. It must 
williamr@2:         * be type casted to an integer. If NULL, the Proxy Filter creates 
williamr@2:         * a network connection automatically. It must be type casted to an integer.
williamr@2:         * @param aSockSvrHandle A handle to the socket server.
williamr@2:         * @param aNewConn A flag if a new connection was created. If the 
williamr@2:         * connection is not new, proxy filter optimization will not read 
williamr@2:         * the proxy again from CommsBd.
williamr@2:         * ETrue if a new connection was created.
williamr@2:         * EFalse if a previously created connection was used.
williamr@2:         * @param aBearerType Bearer type of the new connection. For example, GPRS, WCDMA.
williamr@2:         * TapBearerType is defined in ApEngineConsts.h.
williamr@2:         * @return void
williamr@2:         * @attention This function is called for every HTTP request for which 
williamr@2:         * the content was not found in the cache. This function is called 
williamr@2:         * whether or not a connection was established in a previous request. 
williamr@2:         * The host application determines whether to create a new connection 
williamr@2:         * or to use an existing connection. 
williamr@2:         */
williamr@2:         virtual void NetworkConnectionNeededL(TInt* aConnectionPtr,
williamr@2:                                               TInt* aSockSvrHandle,
williamr@2:                                               TBool* aNewConn,
williamr@2:                                               TApBearerType* aBearerType) = 0;
williamr@2: 
williamr@2:         /**
williamr@2:         * Requests the host application to handle non-HTTP requests. It is expected that the 
williamr@2:         * host application will call the Scheme Dispatcher to handle these requests.
williamr@2:         * @since 2.8
williamr@2:         * @param aTypeArray Array of request parameters. Examples: URL, referrer header
williamr@2:         * @param aDesArray Array of values corresponding to the types in aTypeArray
williamr@2:         * @return ETrue if the host application handles the scheme.
williamr@2:         * EFalse if the host application cannot handle the scheme.
williamr@2:         * @attention The browser checks the scheme to determine whether or 
williamr@2:         * not it is supported. The browser supports the following schemes:
williamr@2:         * File scheme, HTTP scheme or HTTPS scheme
williamr@2:         * If the URL contains a scheme that the browser does not 
williamr@2:         * support, such as RTSP, then the host application should pass the 
williamr@2:         * content to an application that can handle that scheme. 
williamr@2:         */
williamr@2:         virtual TBool HandleRequestL(RArray<TUint>* aTypeArray, CDesCArrayFlat* aDesArray) = 0;
williamr@2: 
williamr@2:         /**
williamr@2:         * Request the host applicaion to handle downloads
williamr@2:         * @since 2.8
williamr@2:         * @param aTypeArray array of download parameter types
williamr@2:         * @param aDesArray array of values associated with the types in the type array
williamr@2:         * @return ETrue if handled by the host application
williamr@2:         * EFalse if not handled by the host application
williamr@2:         * @attention The host application should call the Download Manager to 
williamr@2:         * handle non-HTML content. 
williamr@2:         * Only GET requests are supported because the Browser Control must 
williamr@2:         * cancel the transaction before the Download Manager can take over. 
williamr@2:         * If a POST request is cancelled, the server may enter an unpredictable state.
williamr@2:         * For POST requests, the Browser Control downloads the content before calling 
williamr@2:         * this function. It stores the content in a file whose name is passed to the 
williamr@2:         * host application by using the EParamLocalFileName parameter. The host 
williamr@2:         * application should check whether this parameter was passed by the 
williamr@2:         * Browser Control to determine whether the Browser Control already downloaded 
williamr@2:         * the content. If not, the host application should download the content.
williamr@2:         */
williamr@2:         virtual TBool HandleDownloadL(RArray<TUint>* aTypeArray, CDesCArrayFlat* aDesArray) = 0;
williamr@2: 
williamr@2:     };
williamr@2: 
williamr@2: #endif      // BRCTLSPECIALLOADOBSERVER_H
williamr@2:             
williamr@2: // End of File