webengine/osswebengine/WebCore/platform/network/symbian/SelfDownloadContentHandler.cpp
branchRCL_3
changeset 48 79859ed3eea9
parent 47 e1bea15f9a39
child 49 919f36ff910f
equal deleted inserted replaced
47:e1bea15f9a39 48:79859ed3eea9
    17 
    17 
    18 
    18 
    19 // INCLUDE FILES
    19 // INCLUDE FILES
    20 #include "BrCtl.h"
    20 #include "BrCtl.h"
    21 #include "SelfDownloadContentHandler.h"
    21 #include "SelfDownloadContentHandler.h"
    22 #include <brctlspecialloadobserver.h>
    22 #include <BrCtlSpecialLoadObserver.h>
    23 #include <brctldefs.h>
    23 #include <BrCtlDefs.h>
    24 #include <apmstd.h>
    24 #include <apmstd.h>
    25 #include <eikenv.h>
    25 #include <eikenv.h>
    26 #include "ResourceRequest.h"
    26 #include "ResourceRequest.h"
    27 #include "ResourceResponse.h"
    27 #include "ResourceResponse.h"
    28 #include "WebFrame.h"
    28 #include "WebFrame.h"
    29 #include "StaticObjectsContainer.h"
    29 #include "StaticObjectsContainer.h"
    30 #include "ResourceLoaderDelegate.h"
    30 #include "ResourceLoaderDelegate.h"
    31 #include "HttpSessionManager.h"
    31 #include "HttpSessionManager.h"
    32 #include "httpfiltercommonstringsext.h"
    32 #include "httpfiltercommonstringsext.h"
    33 #include <Uri8.h>
    33 #include <uri8.h>
    34 #include <http/rhttptransaction.h>
    34 #include <http/rhttptransaction.h>
    35 #include <http/mhttpdatasupplier.h>
    35 #include <http/mhttpdatasupplier.h>
    36 #include <http/rhttpsession.h>
    36 #include <http/rhttpsession.h>
    37 
    37 
    38 // CONSTANTS
    38 // CONSTANTS
   264         case THTTPEvent::EFailed:
   264         case THTTPEvent::EFailed:
   265         case THTTPEvent::EUnrecoverableError:
   265         case THTTPEvent::EUnrecoverableError:
   266         case KErrAbort:
   266         case KErrAbort:
   267         default: {
   267         default: {
   268             HandleError(httpEvent.iStatus);
   268             HandleError(httpEvent.iStatus);
   269             httpTransaction.Close();
       
   270             break;
   269             break;
   271         }
   270         }
   272     }
   271     }
   273 }
   272 }
   274 
   273 
   409 
   408 
   410 		propSet.RemoveProperty( strPool.StringF(HttpFilterCommonStringsExt::ESelfDownloadCallback,
   409 		propSet.RemoveProperty( strPool.StringF(HttpFilterCommonStringsExt::ESelfDownloadCallback,
   411                                     HttpFilterCommonStringsExt::GetTable()) );
   410                                     HttpFilterCommonStringsExt::GetTable()) );
   412     }
   411     }
   413 	StaticObjectsContainer::instance()->resourceLoaderDelegate()->httpSessionManager()->ResetOutstandingSelfDl();
   412 	StaticObjectsContainer::instance()->resourceLoaderDelegate()->httpSessionManager()->ResetOutstandingSelfDl();
   414     httpTransaction.Close();
       
   415     return status;
   413     return status;
   416 }
   414 }
   417 
   415 
   418 // -----------------------------------------------------------------------------
   416 // -----------------------------------------------------------------------------
   419 // SelfDownloadContentHandler::HandleError
   417 // SelfDownloadContentHandler::HandleError
   436 TBool SelfDownloadContentHandler::IsSelfDownloadContent(
   434 TBool SelfDownloadContentHandler::IsSelfDownloadContent(
   437     TDesC& contentType)
   435     TDesC& contentType)
   438 {
   436 {
   439     // Check if the Host Application included this MIME type in the self-download
   437     // Check if the Host Application included this MIME type in the self-download
   440     // content types
   438     // content types
   441     TInt cTLength = contentType.Length();
   439     TInt index(m_SelfDlMimeTypes->FindF(contentType));
   442     TBool isSelfDownloadContentType = EFalse;
   440     return (index != KErrNotFound);
   443     TInt index = KErrNotFound;
   441     }
   444     const TChar KBrowserSpecLoadObsSemicolon = ';';
       
   445     TPtrC selfDownloadCTs=m_SelfDlMimeTypes->Des();
       
   446     index = selfDownloadCTs.FindF( contentType );
       
   447     while( index != KErrNotFound )
       
   448           {
       
   449           // check for ';' on the left KSemicolon
       
   450           if ( index == 0 ||selfDownloadCTs[ index - 1 ] == KBrowserSpecLoadObsSemicolon )
       
   451               {
       
   452               // check for ';' on the right
       
   453               index += cTLength;
       
   454               if ( index == selfDownloadCTs.Length() || selfDownloadCTs[ index ] == KBrowserSpecLoadObsSemicolon )
       
   455                   {
       
   456                   isSelfDownloadContentType = ETrue;
       
   457                   break;
       
   458                   }
       
   459               }
       
   460           selfDownloadCTs.Set( selfDownloadCTs.Mid( index ) );
       
   461           index = selfDownloadCTs.FindF( contentType );
       
   462           }
       
   463     return (isSelfDownloadContentType);
       
   464 }
       
   465 
   442 
   466 // -----------------------------------------------------------------------------
   443 // -----------------------------------------------------------------------------
   467 // SelfDownloadContentHandler::ReinitializeSpecialLoadObserver
   444 // SelfDownloadContentHandler::ReinitializeSpecialLoadObserver
   468 // -----------------------------------------------------------------------------
   445 // -----------------------------------------------------------------------------
   469 void SelfDownloadContentHandler::ReinitializeSpecialLoadObserver(WebFrame* webFrame)
   446 void SelfDownloadContentHandler::ReinitializeSpecialLoadObserver(WebFrame* webFrame)