|
S60 3rd Edition SDK for Symbian OS Example Applications Guide |
#include <BrCtlSampleAppSpecialLoadObserver.h>
Public Member Functions | |
| ~CBrCtlSampleAppSpecialLoadObserver () | |
| void | NetworkConnectionNeededL (TInt *, TInt *, TBool *, TApBearerType *) |
| TBool | HandleRequestL (RArray< TUint > *aTypeArray, CDesCArrayFlat *aDesArray) |
| TBool | HandleDownloadL (RArray< TUint > *aTypeArray, CDesCArrayFlat *aDesArray) |
Static Public Member Functions | |
| static CBrCtlSampleAppSpecialLoadObserver * | NewL () |
Private Member Functions | |
| void | ConstructL () |
Private Attributes | |
| CDocumentHandler * | iHandler |
Definition at line 33 of file BrCtlSampleAppSpecialLoadObserver.h.
|
|
Destructor. Definition at line 145 of file BrCtlSampleAppSpecialLoadObserver.cpp. References iHandler. 00146 { 00147 delete iHandler; 00148 }
|
|
|
Two-phased constructor. Definition at line 155 of file BrCtlSampleAppSpecialLoadObserver.cpp. References ConstructL(). 00156 { 00157 CBrCtlSampleAppSpecialLoadObserver* self = new(ELeave)CBrCtlSampleAppSpecialLoadObserver; 00158 CleanupStack::PushL(self); 00159 self->ConstructL(); 00160 CleanupStack::Pop(); 00161 return self; 00162 }
|
|
||||||||||||||||||||
|
Request to create a network connection.
Definition at line 33 of file BrCtlSampleAppSpecialLoadObserver.cpp.
|
|
||||||||||||
|
Request the host applicaion to handle non-http request.
Definition at line 44 of file BrCtlSampleAppSpecialLoadObserver.cpp. 00045 { 00046 TInt i; 00047 // The 2 arrays must be in sync. Each element in iTypeArray 00048 // identifies the type of the corresponding element in iDesArray. 00049 if( aTypeArray->Count() != aDesArray->Count() ) 00050 { 00051 User::Leave( KErrArgument ); 00052 } 00053 00054 // Get url 00055 HBufC* url = NULL; 00056 // Search url in the param list 00057 for( i = 0; i < aTypeArray->Count(); i++ ) 00058 { 00059 if( (*aTypeArray)[i] == EParamRequestUrl ) 00060 { 00061 // the url is found 00062 url = HBufC::NewLC( (*aDesArray)[i].Length() ); 00063 url->Des().Copy( (*aDesArray)[i] ); 00064 break; 00065 } 00066 } 00067 if( !url ) 00068 { 00069 // The url wasn't found. 00070 User::Leave( KErrArgument ); 00071 } 00072 00073 // Get referrer header 00074 HBufC* refererHeader = NULL; 00075 // Search url in the param list 00076 for( i = 0; i < aTypeArray->Count(); i++ ) 00077 { 00078 if( (*aTypeArray)[i] == EParamRefererHeader ) 00079 { 00080 // the referer Header is found 00081 refererHeader = HBufC::NewLC( (*aDesArray)[i].Length() ); 00082 refererHeader->Des().Copy( (*aDesArray)[i] ); 00083 break; 00084 } 00085 } 00086 00087 // This is where you would place your scheme handling code 00088 // For example a scheme could be "rtsp://" or "sms:" 00089 // The scheme handler is then responsible for dispatching the request to 00090 // the correct component. 00091 00092 if( refererHeader ) 00093 { 00094 CleanupStack::PopAndDestroy( 1 ); // refererHeader 00095 } 00096 00097 CleanupStack::PopAndDestroy( 1 ); // url 00098 return ETrue; 00099 }
|
|
||||||||||||
|
Request the host applicaion to handle downloads
Definition at line 105 of file BrCtlSampleAppSpecialLoadObserver.cpp. References iHandler. 00106 { 00107 TInt i = 0; 00108 TInt count = aTypeArray->Count(); 00109 for (i = 0; i < count; i++) 00110 { 00111 if ((*aTypeArray)[i] == EParamLocalFileName && aDesArray[i].Length() > 0) 00112 { 00113 TInt j = 0; 00114 for (j = 0; j < count; j++) 00115 { 00116 if ((*aTypeArray)[j] == EParamReceivedContentType) 00117 { 00118 HBufC8* dataType8 = HBufC8::NewLC((*aDesArray)[j].Length()); 00119 dataType8->Des().Copy((*aDesArray)[j]); 00120 TDataType dataType(*dataType8); 00121 iHandler->OpenFileEmbeddedL((*aDesArray)[i], dataType); 00122 CleanupStack::PopAndDestroy(); 00123 break; 00124 } 00125 } 00126 break; 00127 } 00128 } 00129 return EFalse; 00130 }
|
|
|
By default Symbian 2nd phase constructor is private. Definition at line 136 of file BrCtlSampleAppSpecialLoadObserver.cpp. References iHandler. 00137 { 00138 iHandler = CDocumentHandler::NewL() ; 00139 }
|
|
© Nokia 2006 |