browserui/browser/BrowserAppInc/BrowserSpecialLoadObserver.h
changeset 51 48e827313edd
parent 37 481242ead638
child 53 f427d27b98d8
equal deleted inserted replaced
37:481242ead638 51:48e827313edd
     1 /*
       
     2 * Copyright (c) 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:  Handle special load events such as network connection,
       
    15 *                deal with non-http or non-html requests
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef BROWSERSPECIALLOADOBSERVER_H
       
    22 #define BROWSERSPECIALLOADOBSERVER_H
       
    23 
       
    24 //  INCLUDES
       
    25 #include <e32base.h>
       
    26 #include <brctlspecialloadobserver.h>
       
    27 #include <apparc.h>
       
    28 #include <badesca.h>
       
    29 #include <AknServerApp.h>
       
    30 
       
    31 class MApiProvider;
       
    32 class CEikDocument;
       
    33 class CSchemeHandler;
       
    34 class CDocumentHandler;
       
    35 class CBrowserContentView;
       
    36 class CAiwGenericParamList;
       
    37 class CBrowserWindow;
       
    38 
       
    39 enum TPopupPreferences
       
    40 	{
       
    41 	EBlockOnce = 0,
       
    42 	EAllowOnce,	
       
    43 	EBlock,
       
    44 	EAllow	
       
    45 	};
       
    46 
       
    47 // CLASS DECLARATION
       
    48 
       
    49 /**
       
    50 *  This observer handles special load events such as network connection, 
       
    51 *  deal with non-http(s) or non-html requests
       
    52 *
       
    53 *  @lib BrowserEngine.lib
       
    54 *  @since 2.8
       
    55 */
       
    56 class CBrowserSpecialLoadObserver : public CBase, 
       
    57                                     public MBrCtlSpecialLoadObserver, 
       
    58                                     public MAknServerAppExitObserver
       
    59     {
       
    60     public: // Constructors and destructors
       
    61 
       
    62         /**
       
    63         * Constructor.
       
    64         */
       
    65         static CBrowserSpecialLoadObserver* NewL(
       
    66             MApiProvider& aApiProvider,
       
    67             CBrowserWindow* aWindow,
       
    68             CEikDocument* aDocument,
       
    69             CBrowserContentView* aContentView );
       
    70 
       
    71         /**
       
    72         * Destructor.
       
    73         */
       
    74         virtual ~CBrowserSpecialLoadObserver();
       
    75 
       
    76     private:
       
    77 
       
    78 #ifdef __WINS__
       
    79         TInt AskIapIdL( TUint32& aId );
       
    80 #endif // __WINS__
       
    81 
       
    82     public: // From MBrCtlSpecialLoadObserver
       
    83 
       
    84         /**
       
    85         * Request to create a network connection.
       
    86         * @since 2.8
       
    87         * @param aConnectionPtr A pointer to the new connection.
       
    88         *        If NULL, the proxy filter will automatically create
       
    89         *        a network connection.
       
    90         * @param aSockSvrHandle A handle to the socket server.
       
    91         * @param aNewConn A flag if a new connection was created.
       
    92         *        If the connection is not new, proxy filter optimization 
       
    93         *        will not read the proxy again from CommsBd.
       
    94         * @return void
       
    95         */
       
    96         virtual void NetworkConnectionNeededL( TInt* aConnectionPtr,
       
    97                                                TInt* aSockSvrHandle,
       
    98                                                TBool* aNewConn,
       
    99                                                TApBearerType* aBearerType );
       
   100 
       
   101         /**
       
   102         * Request the host applicaion to handle non-http request.
       
   103         * @since 2.8
       
   104         * @param aUrl The non-http(s) or file URL
       
   105         * @param aParamList Parameters to pass to the host application. Contain referer header. It could be NULL
       
   106         * @return ETrue is handled by the host application. EFlase if not
       
   107         */
       
   108         virtual TBool HandleRequestL( RArray<TUint>* aTypeArray, 
       
   109                                       CDesCArrayFlat* aDesArray );
       
   110 
       
   111         /**
       
   112         * Request the host applicaion to handle downloads
       
   113         * @since 2.8
       
   114         * @param aTypeArray array of download parameter types
       
   115         * @param aDesArray array of values associated with the types in the type array
       
   116         * @return ETrue is handled by the host application. EFlase if not
       
   117         */
       
   118         virtual TBool HandleDownloadL( RArray<TUint>* aTypeArray, 
       
   119                                        CDesCArrayFlat* aDesArray );
       
   120     
       
   121 
       
   122     public:  // from MAknServerAppExitObserver
       
   123 
       
   124         void HandleServerAppExit( TInt aReason );
       
   125 
       
   126     protected: // Constructors
       
   127 
       
   128         /**
       
   129         * Default C++ constructor.
       
   130         */
       
   131         CBrowserSpecialLoadObserver( MApiProvider& aApiProvider,
       
   132                                      CBrowserWindow* aWindow,
       
   133                                      CEikDocument* aDocument,
       
   134                                      CBrowserContentView* aContentView );
       
   135 
       
   136         /**
       
   137         * 2nd phase constructor. Leaves on failure.
       
   138         */
       
   139         void ConstructL();
       
   140 
       
   141     public: // New functions
       
   142 
       
   143         inline TBool LongZeroStartup() 
       
   144                                 { return iLongZeroStartup; }
       
   145 
       
   146         inline void SetLongZeroStartup( TBool aLongZeroStartup )
       
   147                                 { iLongZeroStartup = aLongZeroStartup; }
       
   148         inline TBool IsConnectionStarted()
       
   149         						{ return iConnectionStarted; }
       
   150         /**
       
   151         * Request for the connection to be cancelled
       
   152         */
       
   153         inline void CancelConnection() { iConnectionCancelled = ETrue; }
       
   154                                       
       
   155 
       
   156     protected: // New functions
       
   157 
       
   158 #ifdef  __RSS_FEEDS
       
   159         /**
       
   160         * Handles the content if it is special Ui content (rss or opml) and returns true, otherwise the method
       
   161         * returns false.
       
   162         * @param aTypeArray array of download parameter types
       
   163         * @param aDesArray array of values associated with the types in the type array
       
   164         * @return ETrue if it handled rss content, EFalse otherwise
       
   165         * @since 3.1
       
   166         */
       
   167     	TBool HandleUiContentL(RArray<TUint>* aTypeArray, 
       
   168                          		CDesCArrayFlat* aDesArray ) const;
       
   169 #endif  // __RSS_FEEDS
       
   170 
       
   171         /**
       
   172         * Make generic parameter list from BrCtl parameter list.
       
   173         * @param aTypeArray array of download parameter types
       
   174         * @param aDesArray array of values associated with the types in the type array
       
   175         * @return The dynamically allocated list.
       
   176         * @since 2.8
       
   177         */
       
   178         CAiwGenericParamList* BrCtlParamList2GenericParamListL( 
       
   179                                  RArray<TUint>* aTypeArray, 
       
   180                                  CDesCArrayFlat* aDesArray ) const;
       
   181 
       
   182         /**
       
   183         * Extract the given BrCtl parameter from the list.
       
   184         * @param aParamTypeToFind Extract this parameter.
       
   185         * @param aTypeArray array of download parameter types.
       
   186         * @param aDesArray array of values associated with the types in the type array.
       
   187         * @param aParamFound Output: ETrue if the parameter was found.
       
   188         * @return A TPtrC pointer for the value.
       
   189         * @since 2.8
       
   190         */
       
   191         TPtrC ExtractBrCtlParam( 
       
   192                                  TUint aParamTypeToFind, 
       
   193                                  RArray<TUint>* aTypeArray,
       
   194                                  CDesCArrayFlat* aDesArray, 
       
   195                                  TBool& aParamFound ) const;
       
   196 
       
   197         /**
       
   198         * Check if the download's content type is in 
       
   199         * KBrowserSelfDownloadContentTypes.
       
   200         * @param aTypeArray array of download parameter types.
       
   201         * @param aDesArray array of values associated with the types in the type array.
       
   202         * @return ETrue, if it is there.
       
   203         * @since 3.0
       
   204         */
       
   205         TBool IsSelfDownloadContentTypeL( RArray<TUint>* aTypeArray, 
       
   206                                                                 CDesCArrayFlat* aDesArray ) const;
       
   207 
       
   208         /**
       
   209         * Open the download embedded with Document Handler.
       
   210         * @param aTypeArray array of download parameter types.
       
   211         * @param aDesArray array of values associated with the types in the type array.
       
   212         * @return None.
       
   213         * @since 3.0
       
   214         */
       
   215         void OpenFileEmbeddedL( RArray<TUint>* aTypeArray, 
       
   216                                                   CDesCArrayFlat* aDesArray );
       
   217 
       
   218         /**
       
   219         * DoRequest the host applicaion to handle non-http request.
       
   220         * @since 2.8
       
   221         * @param aUrl The non-http(s) or file URL
       
   222         * @param aParamList Parameters to pass to the host application. Contain referer header. It could be NULL
       
   223         * @return ETrue is handled by the host application. EFlase if not
       
   224         */
       
   225         virtual TBool DoHandleRequestL( RArray<TUint>* aTypeArray, 
       
   226                                         CDesCArrayFlat* aDesArray );
       
   227                                         
       
   228     private:  // data members
       
   229 
       
   230         MApiProvider *iApiProvider;        // owner app, not owned
       
   231         CBrowserWindow *iWindow;           // owner window, not owned
       
   232         CEikDocument *iDocument;           // document, not owned
       
   233         CSchemeHandler *iSchemeHandler;    // scheme handler
       
   234         CDocumentHandler *iDocHandler;     // Owned.
       
   235         CBrowserContentView* iContentView; // content view, not owned
       
   236         TBool           iSchemeProcessing; // scheme processing
       
   237         
       
   238         /**
       
   239         * Indicated whether the Browser was started using the long zero
       
   240         * key press. This is ONLY valid at start up.
       
   241         **/
       
   242         TBool iLongZeroStartup;        
       
   243         
       
   244         /**
       
   245         * Flag to indicate whether the Browser has started the network connection
       
   246         **/
       
   247         TBool iConnectionStarted;
       
   248         TBool iConnectionCancelled;
       
   249     };
       
   250 
       
   251 #endif      // BROWSERSPECIALLOADOBSERVER_H
       
   252 
       
   253 // End of File