httpfilters/cookie/ManagerSrc/CookieManagerClient.cpp
branchRCL_3
changeset 7 2611c08ee28e
parent 6 fa2fd8b2d6cc
child 9 9015645363c8
equal deleted inserted replaced
6:fa2fd8b2d6cc 7:2611c08ee28e
    21 #include <e32std.h>
    21 #include <e32std.h>
    22 // #include <thttphdrval.h>
    22 // #include <thttphdrval.h>
    23 
    23 
    24 	// User includes
    24 	// User includes
    25 #include "cookie.h"
    25 #include "cookie.h"
       
    26 #include "CookieArray.h"
    26 #include "cookieipc.h"
    27 #include "cookieipc.h"
    27 #include "CookieCommonConstants.h"
    28 #include "CookieCommonConstants.h"
    28 #include "CookieLogger.h"
    29 #include "CookieLogger.h"
    29 #include "cookiemanagerclient.h"
    30 #include "cookiemanagerclient.h"
    30 #include "CookieManagerServer.h"
    31 #include "CookieManagerServer.h"
    31 #include "CookieManagerStart.h"
    32 #include "CookieManagerStart.h"
    32 #include "CookieServerDef.h"
    33 #include "CookieServerDef.h"
    33 
    34 #include "CookieClientDataArray.h"
       
    35 #include "CookieClientData.h"
    34 // CONSTANTS
    36 // CONSTANTS
    35 
       
    36 // TBD : do we have to set limits to the number of cookies at all?
    37 // TBD : do we have to set limits to the number of cookies at all?
    37 // Possible answer : as we store cookies in an RPointerArray that has a
    38 // Possible answer : as we store cookies in an RPointerArray that has a
    38 // restriction on the number of elements (max. 640 can be stored in an RArray
    39 // restriction on the number of elements (max. 640 can be stored in an RArray
    39 // or RPointerArray), we have to bother with it.
    40 // or RPointerArray), we have to bother with it.
    40 // TODO :
    41 // TODO :
    78 // ---------------------------------------------------------
    79 // ---------------------------------------------------------
    79 //
    80 //
    80 EXPORT_C TInt RCookieManager::Connect()
    81 EXPORT_C TInt RCookieManager::Connect()
    81     {
    82     {
    82     CLOG( ( EClientConnect, 0, _L( "-> RCookieManager::Connect" ) ) );
    83     CLOG( ( EClientConnect, 0, _L( "-> RCookieManager::Connect" ) ) );
    83 
    84     CCookieClientDataArray::GetInstance()->Ref();
    84     TInt error = KErrNone;
    85     TInt error = KErrNone;
    85     RProcess server;
    86     RProcess server;
    86     error = server.Create( KCookieServerExe, TPtr( NULL, 0 ),
    87     error = server.Create( KCookieServerExe, TPtr( NULL, 0 ),
    87                            TUidType( KNullUid, KNullUid, KCookieServerExeUid ) );
    88                            TUidType( KNullUid, KNullUid, KCookieServerExeUid ) );
    88     CLOG( ( EClientConnect, 0,
    89     CLOG( ( EClientConnect, 0,
   114     CLOG( ( EClientConnect, 0, _L( "<- RCookieManager::Connect" ) ) );
   115     CLOG( ( EClientConnect, 0, _L( "<- RCookieManager::Connect" ) ) );
   115     return error;
   116     return error;
   116     }
   117     }
   117 
   118 
   118 // ---------------------------------------------------------
   119 // ---------------------------------------------------------
   119 // RCookieManager::GetCookies
   120 // RCookieManager::DoGetCookies
   120 // ---------------------------------------------------------
   121 // ---------------------------------------------------------
   121 //
   122 //
   122 TInt RCookieManager::DoGetCookies( TDes8& aBuffer ) const
   123 TInt RCookieManager::DoGetCookies( TDes8& aBuffer ) const
   123 	{
   124 	{
   124 	return SendReceive( EGetCookies, TIpcArgs( &aBuffer ) );
   125 	return SendReceive( EGetCookies, TIpcArgs( &aBuffer ) );
   125 	}
   126 	}
   126 
   127 
   127 // ---------------------------------------------------------
   128 // ---------------------------------------------------------
   128 // RCookieManager::GetCookieSize
   129 // RCookieManager::GetCookieSharableFlagFromServer
       
   130 // ---------------------------------------------------------
       
   131 //
       
   132 TInt RCookieManager::GetCookieSharableFlagFromServer(TBool& aCookieSharableFlag )const
       
   133     {
       
   134     TPckg<TBool> cookieSharableFlag(aCookieSharableFlag);
       
   135     return SendReceive( EGetCookieSharableFlag, TIpcArgs( &cookieSharableFlag ) );
       
   136     }
       
   137 
       
   138 // ---------------------------------------------------------
       
   139 // RCookieManager::DoGetCookieSize
   129 // ---------------------------------------------------------
   140 // ---------------------------------------------------------
   130 //
   141 //
   131 TInt RCookieManager::DoGetCookieSize( const TDesC8& aRequestUri,
   142 TInt RCookieManager::DoGetCookieSize( const TDesC8& aRequestUri,
   132 									  TPckg<TInt>& aPkgSize ) const
   143 									  TPckg<TInt>& aPkgSize,TDesC& aAppuidPtr ) const
   133 	{
   144 	{
   134     return SendReceive( EGetCookieSize, TIpcArgs( aRequestUri.Length(), 
   145     return SendReceive( EGetCookieSize, TIpcArgs( &aAppuidPtr,aRequestUri.Length(), 
   135                                                   &aRequestUri, &aPkgSize ) );
   146                                                   &aRequestUri, &aPkgSize ) );
   136 	}
   147 	}
       
   148 // ---------------------------------------------------------
       
   149 // RCookieManager::DestroyCookiesFromMemory
       
   150 // ---------------------------------------------------------
       
   151 //
       
   152 TInt RCookieManager::DestroyCookiesFromMemory( TInt& aDeleteStatus )
       
   153     {
       
   154     CLOG(( EClient, 0, _L("-> RCookieManager::DestroyCookies") ));
       
   155 
       
   156     TPckg<TInt> pkgStatus( aDeleteStatus );
       
   157     TInt ret = SendReceive( EDestroyCookies, TIpcArgs( &pkgStatus ) ) ;
       
   158 
       
   159     CLOG(( EClient, 0, 
       
   160         _L("<- RCookieManager::DestroyCookies cleared %d cookies, errcode%d"),
       
   161         aDeleteStatus, ret ) );
       
   162 
       
   163     return ret;
       
   164 
       
   165     }
   137 
   166 
   138 // ---------------------------------------------------------
   167 // ---------------------------------------------------------
   139 // RCookieManager::DoStoreCookie
   168 // RCookieManager::DoStoreCookie
   140 // ---------------------------------------------------------
   169 // ---------------------------------------------------------
   141 //
   170 //
   142 TInt RCookieManager::DoStoreCookie( const TDesC8& aPackedCookie,
   171 TInt RCookieManager::DoStoreCookie( const TDesC8& aPackedCookie,
   143 								   const TDesC8& aUri ) const
   172 								   const TDesC8& aUri,TDesC& aAppUidPtr ) const
   144 	{
   173 	{
   145     return SendReceive( EStoreCookie, TIpcArgs( aPackedCookie.Length(), 
   174     return SendReceive( EStoreCookie, TIpcArgs( aPackedCookie.Length(), 
   146                                       &aPackedCookie, aUri.Length(), &aUri ) );
   175                                       &aPackedCookie, &aUri,&aAppUidPtr ) );
   147 	}
   176 	}
   148 
   177 
   149 // ---------------------------------------------------------
   178 // ---------------------------------------------------------
   150 // RCookieManager::GetCookiesL
   179 // RCookieManager::GetCookiesL
   151 // ---------------------------------------------------------
   180 // ---------------------------------------------------------
   153 EXPORT_C void RCookieManager::GetCookiesL( const TDesC8& aUri,
   182 EXPORT_C void RCookieManager::GetCookiesL( const TDesC8& aUri,
   154 										RPointerArray<CCookie>& aCookies,
   183 										RPointerArray<CCookie>& aCookies,
   155 										TBool& aCookie2Reqd )
   184 										TBool& aCookie2Reqd )
   156     {
   185     {
   157     CLOG( ( EClient, 0, _L( "-> RCookieManager::GetCookiesL" ) ) );
   186     CLOG( ( EClient, 0, _L( "-> RCookieManager::GetCookiesL" ) ) );
   158 
   187     TBool cookiefound(EFalse);
       
   188     CCookieClientDataArray* cookieclientdataarray = CCookieClientDataArray::GetInstance();
       
   189     if(cookieclientdataarray) // redundant check
       
   190         {
       
   191     TInt clientarraycount = cookieclientdataarray->Count();
       
   192     if ( clientarraycount!=0 )
       
   193         {
       
   194         TInt clerr = GetClientSideCookies(aUri,aCookies,cookiefound,0);
       
   195         }
       
   196       } 
       
   197 
       
   198     if(!cookiefound)
       
   199         {
   159 	aCookie2Reqd = EFalse;
   200 	aCookie2Reqd = EFalse;
   160 
   201 
   161 	TInt size = 0;
   202 	TInt size = 0;
   162 	TPckg<TInt> pkgSize( size );
   203 	TPckg<TInt> pkgSize( size );
   163 	User::LeaveIfError( DoGetCookieSize( aUri, pkgSize ) );
   204 	//Appuid value only takes 8 chars
   164 
   205     HBufC* appbuf = HBufC::New(8);
       
   206     TPtr ptr(appbuf->Des());
       
   207     TUint32 appUid(0);
       
   208     ptr.AppendNum(appUid,EHex);    
       
   209 	User::LeaveIfError( DoGetCookieSize( aUri, pkgSize,ptr ) );
       
   210     delete appbuf;
   165 	if ( size )
   211 	if ( size )
   166 		{
   212 		{
   167 		HBufC8* buf = HBufC8::NewLC( size );
   213 		HBufC8* buf = HBufC8::NewLC( size );
   168 
   214 
   169 		TPtr8 des( buf->Des() );
   215 		TPtr8 des( buf->Des() );
   194 			aCookie2Reqd = ETrue;
   240 			aCookie2Reqd = ETrue;
   195 			}
   241 			}
   196 
   242 
   197 		CleanupStack::PopAndDestroy();	// buf
   243 		CleanupStack::PopAndDestroy();	// buf
   198 		}
   244 		}
   199 
   245       }
   200     CLOG( ( EClient, 0, _L( "<- RCookieManager::GetCookiesL" ) ) );
   246     CLOG( ( EClient, 0, _L( "<- RCookieManager::GetCookiesL" ) ) );
   201     }
   247     }
   202 
   248 
   203 // ---------------------------------------------------------
   249 // ---------------------------------------------------------
   204 // RCookieManager::StoreCookie
   250 // RCookieManager::StoreCookie
   221 
   267 
   222 		TPtr8 bufDes( buf->Des() );
   268 		TPtr8 bufDes( buf->Des() );
   223 		err = iCookiePacker.CliPackCookie( bufDes, aCookie );
   269 		err = iCookiePacker.CliPackCookie( bufDes, aCookie );
   224 		if ( !err )
   270 		if ( !err )
   225 			{
   271 			{
   226 			err = DoStoreCookie( *buf, aUri.UriDes() );
   272 			//Appuid value only takes 8 chars
       
   273             HBufC* appbuf = HBufC::New(8); // harendra: 8 chars needed
       
   274             TPtr ptr(appbuf->Des());
       
   275             TUint32 appUid(0);
       
   276             ptr.AppendNum(appUid,EHex);    
       
   277             err = DoStoreCookie( *buf, aUri.UriDes(),ptr );
       
   278             delete appbuf;
       
   279 			//err = DoStoreCookie( *buf, aUri.UriDes() );
   227 			}
   280 			}
   228 
   281 
   229 		delete buf;
   282 		delete buf;
   230 		}
   283 		}
   231 	else
   284 	else
   251                       KCookieServerMinorVersionNumber, 
   304                       KCookieServerMinorVersionNumber, 
   252                       KCookieServerBuildVersionNumber ));
   305                       KCookieServerBuildVersionNumber ));
   253     }
   306     }
   254     
   307     
   255 // ---------------------------------------------------------
   308 // ---------------------------------------------------------
   256 // RCookieManager::SetAppUidL
   309 // RCookieManager::SetAppUidL This method is no longer being 
       
   310 // used in CookieFilter.As this method is exported so in order
       
   311 // to provide backward compatibilty this API implementation is changed 
   257 // ---------------------------------------------------------
   312 // ---------------------------------------------------------
   258 //
   313 //
   259 EXPORT_C TInt RCookieManager::SetAppUidL( const TUint32& aAppUid )
   314 EXPORT_C TInt RCookieManager::SetAppUidL( const TUint32& aAppUid )
   260     {
   315     {
   261     CLOG(( EClient, 0, _L("->RCookieManager::SetAppUid") ));   
   316     CLOG(( EClient, 0, _L("->RCookieManager::SetAppUid") ));   
   262     HBufC* buf = HBufC::NewLC(128);
   317     TUint32 groupid = RProcess().SecureId().iId;
       
   318     CCookieClientData* cookieclientdata = CCookieClientDataArray::GetInstance()->Find(groupid, const_cast<TUint32&> (aAppUid));
       
   319     if(cookieclientdata)
       
   320         {
       
   321         cookieclientdata->SetWidgetUid(aAppUid);
       
   322         }
       
   323     else
       
   324         {
       
   325         TBool cookieSharableFlag(EFalse);
       
   326         TInt err = GetCookieSharableFlagFromServer(cookieSharableFlag);
       
   327         CCookieClientData* cookieclientdata = CCookieClientData::NewL(groupid, aAppUid, cookieSharableFlag,ETrue);
       
   328         cookieclientdata->SetInitFlag(ETrue);
       
   329         CCookieClientDataArray::GetInstance()->AddClientGroupDataL(cookieclientdata);
       
   330         }
       
   331     //Appuid value only takes 8 chars
       
   332     HBufC* buf = HBufC::NewLC(8);
   263     TPtr ptr(buf->Des());
   333     TPtr ptr(buf->Des());
   264     ptr.AppendNum(aAppUid,EHex);    
   334     ptr.AppendNum(aAppUid,EHex);    
   265     TInt error = SendReceive(ESetAppUid,TIpcArgs(ptr.Length(),&ptr)); 
   335     TInt error = SendReceive(ESetAppUid,TIpcArgs(ptr.Length(),&ptr)); 
   266     CleanupStack::PopAndDestroy();
   336     CleanupStack::PopAndDestroy();
   267     CLOG(( EClient, 0, _L("<-RCookieManager::SetAppUid") ));
   337     CLOG(( EClient, 0, _L("<-RCookieManager::SetAppUid") ));
   268     return error;
   338     return error;
   269     }
   339     }
       
   340 // ---------------------------------------------------------
       
   341 // RCookieManager::Close
       
   342 // ---------------------------------------------------------
       
   343 //
       
   344 
       
   345 EXPORT_C void RCookieManager::Close()
       
   346     {
       
   347     CLOG(( EClient, 0, _L("-> RCookieManager::Close") ));
       
   348     CCookieClientDataArray::GetInstance()->DeRef();
       
   349     TInt deletestatus =0;
       
   350     DestroyCookiesFromMemory(deletestatus);
       
   351     CLOG(( EClient, 0, _L("-> RCookieManager::Close deletestatus = %d"), deletestatus ));
       
   352     RSessionBase::Close();
       
   353     CLOG(( EClient, 0, _L("<- RCookieManager::Close") ));
       
   354     }
       
   355 // ---------------------------------------------------------
       
   356 // RCookieManager::StoreCookie Newly Added
       
   357 // ---------------------------------------------------------
       
   358 //
       
   359 EXPORT_C TInt RCookieManager::StoreCookie( const CCookie& aCookie,
       
   360                                  const TUriC8& aUri,TUint32& aAppUid )
       
   361     {
       
   362     CLOG( ( EClient, 0, _L( "-> RCookieManager::StoreCookie" ) ) );
       
   363     StoreCookieAtClientSide(&aCookie,aUri.UriDes(),aAppUid);
       
   364     TInt err;
       
   365 
       
   366     TInt cookieSize = aCookie.Size( EFalse );
       
   367     HBufC8* buf = HBufC8::New( cookieSize );
       
   368     if ( buf )
       
   369         {
       
   370         CLOG( ( EClient, 0,
       
   371                 _L( "RCookieManager::StoreCookie, cookie size:%d" ), 
       
   372                 cookieSize ) );
       
   373 
       
   374         TPtr8 bufDes( buf->Des() );
       
   375         err = iCookiePacker.CliPackCookie( bufDes, aCookie );
       
   376         
       
   377         if ( !err )
       
   378             {
       
   379             //Appuid value only takes 8 chars
       
   380             HBufC* appbuf = HBufC::New(8);
       
   381             TPtr ptr(appbuf->Des());
       
   382             ptr.AppendNum(aAppUid,EHex);    
       
   383             err = DoStoreCookie( *buf, aUri.UriDes(),ptr );
       
   384             delete appbuf;
       
   385             }
       
   386 
       
   387         delete buf;
       
   388         }
       
   389     else
       
   390         {
       
   391         err = KErrNoMemory;
       
   392         }
       
   393 
       
   394     CLOG( ( EClient, 0,
       
   395             _L( "<- RCookieManager::StoreCookie errcode%d" ), err ) );
       
   396 
       
   397     return err;
       
   398     }
       
   399 
       
   400 // ---------------------------------------------------------
       
   401 // RCookieManager::GetCookiesL Newly Added
       
   402 // ---------------------------------------------------------
       
   403 //
       
   404 EXPORT_C void RCookieManager::GetCookiesL( const TDesC8& aUri,
       
   405                                         RPointerArray<CCookie>& aCookies,
       
   406                                         TBool& aCookie2Reqd,TUint32& aAppUid )
       
   407     {
       
   408     CLOG( ( EClient, 0, _L( "-> RCookieManager::GetCookiesL" ) ) );
       
   409     TBool cookiefound(EFalse);
       
   410     CCookieClientDataArray* cookieclientdataarray = CCookieClientDataArray::GetInstance();
       
   411     if(cookieclientdataarray)
       
   412         {
       
   413          TInt clientarraycount = cookieclientdataarray->Count();
       
   414          if (clientarraycount == 0)
       
   415            {
       
   416             TUint32 groupid = RProcess().SecureId().iId;
       
   417             TBool cookieSharableFlag(EFalse);
       
   418             TInt err = GetCookieSharableFlagFromServer(cookieSharableFlag);
       
   419             CCookieClientData* cookieclientdata = CCookieClientData::NewL(groupid, aAppUid, cookieSharableFlag,ETrue);
       
   420             cookieclientdata->SetInitFlag(ETrue);
       
   421             cookieclientdataarray->AddClientGroupDataL(cookieclientdata);
       
   422            }
       
   423          else
       
   424            {
       
   425         
       
   426             CLOG( ( EClient, 0, _L( "-> RCookieManager::GetClientSideCookies:" ) ) );
       
   427             //Gets the Cookie objects for aUri in case it is present
       
   428             //TInt clerr = cookieclientdata->GetClientSideCookies(aUri,aCookies,cookiefound);
       
   429             TInt clerr = GetClientSideCookies(aUri,aCookies,cookiefound,aAppUid);
       
   430             CLOG( ( EClient, 0, _L( "RCookieManager::GetClientSideCookies:cookiefound = %d" ), cookiefound ) );
       
   431         
       
   432            }
       
   433         } 
       
   434     if(!cookiefound)
       
   435         {
       
   436             aCookie2Reqd = EFalse;
       
   437             //Appuid value only takes 8 chars
       
   438             HBufC* appuidbuf = HBufC::NewL(8);
       
   439             TPtr ptr(appuidbuf->Des());
       
   440             ptr.AppendNum(aAppUid,EHex);    
       
   441             TInt size = 0;
       
   442             TPckg<TInt> pkgSize( size );
       
   443             User::LeaveIfError( DoGetCookieSize( aUri, pkgSize, ptr ) );
       
   444             delete appuidbuf;
       
   445         if ( size )
       
   446             {
       
   447             HBufC8* buf = HBufC8::NewLC( size );
       
   448     
       
   449             TPtr8 des( buf->Des() );
       
   450             User::LeaveIfError( DoGetCookies( des ) );
       
   451     
       
   452             // it seems this is the only place where we cannot avoid leaving
       
   453             // ==> we allocate memory for cookies when we fill up the cookie array.
       
   454             iCookiePacker.UnpackCookiesFromBufferL( *buf, aCookies );
       
   455     
       
   456             TInt count = aCookies.Count();
       
   457             for(TInt j=0; j<count; j++)
       
   458                 {
       
   459                 CLOG( ( EClient, 0, _L( "-> RCookieManager::StoreClientSideCookies: aUri=%S" ), &aUri ) );
       
   460                 //cookieclientdata->StoreCookieAtClientSide( aCookies[j],aUri );
       
   461                 StoreCookieAtClientSide( aCookies[j],aUri,aAppUid );
       
   462                 }
       
   463             TInt i = 0;
       
   464             TBool anyCookie2( EFalse );
       
   465             TBool anyUnknownVersion( EFalse );
       
   466             for ( ; i < count; i++ )
       
   467                 {
       
   468                 if ( aCookies[i]->FromCookie2() )
       
   469                     {
       
   470                     anyCookie2 = ETrue;
       
   471                     anyUnknownVersion |= aCookies[i]->IsUnknownVersion();
       
   472                     }
       
   473                 }
       
   474     
       
   475             // if there were no new-style cookies or a new version info is detected
       
   476             // then we have to send an extra cookie header indicating that we're 
       
   477             // able to process new-style cookies
       
   478             if ( !anyCookie2 || anyUnknownVersion )
       
   479                 {
       
   480                 aCookie2Reqd = ETrue;
       
   481                 }
       
   482     
       
   483             CleanupStack::PopAndDestroy();  // buf
       
   484             }
       
   485       }
       
   486     CLOG( ( EClient, 0, _L( "<- RCookieManager::GetCookiesL" ) ) );
       
   487     }
       
   488 
       
   489 // ---------------------------------------------------------
       
   490 // RCookieManager::Close for Widget related destruction during 
       
   491 //uninstallation process of a widget
       
   492 // ---------------------------------------------------------
       
   493 //
       
   494 EXPORT_C TInt RCookieManager::ClearAllAppUidCookies(const TUint32& aAppUid)
       
   495     {
       
   496     CLOG(( EClient, 0, _L("-> RCookieManager::ClearCookies") ));
       
   497     //Client side cookie deletion specific to a appuid
       
   498     CCookieClientDataArray::GetInstance()->DestroyClientData(aAppUid);
       
   499     //Server side Cookie deletion specific to a appuid
       
   500     //Appuid value only takes 8 chars
       
   501     HBufC* buf = HBufC::NewLC(8);
       
   502     TPtr ptr(buf->Des());
       
   503     ptr.AppendNum(aAppUid,EHex);
       
   504     TInt error = SendReceive(EClearAppUidCookies,TIpcArgs(ptr.Length(),&ptr)); 
       
   505     CleanupStack::PopAndDestroy();
       
   506     return error;
       
   507     }
       
   508 
       
   509 // ---------------------------------------------------------
       
   510 // RCookieManager::StoreCookieAtClientSide
       
   511 // ---------------------------------------------------------
       
   512 //
       
   513 void RCookieManager::StoreCookieAtClientSide( const CCookie* aCookie, const TDesC8& aUri,TUint32 aWidgetUid )
       
   514     {
       
   515     CLOG( ( EClient, 0, _L( "-> RCookieManager::StoreCookieAtClientSide" ) ) );
       
   516     TUint32 groupid = RProcess().SecureId().iId;
       
   517     CCookieClientDataArray* cookieclientdataarray = CCookieClientDataArray::GetInstance();
       
   518     TInt count = cookieclientdataarray->Count();
       
   519     TInt itemIndex =0;
       
   520     for(TInt i=0; i<count; i++)
       
   521         {
       
   522           if (cookieclientdataarray->At(i)->GetGroupId() == groupid 
       
   523                   && cookieclientdataarray->At(i)->GetCookieSharableFlag())
       
   524               {
       
   525               itemIndex = i;
       
   526               break;
       
   527               }
       
   528           else if(cookieclientdataarray->At(i)->GetGroupId() == groupid
       
   529                   && !(cookieclientdataarray->At(i)->GetCookieSharableFlag()) 
       
   530                   && cookieclientdataarray->At(i)->GetWidgetUid() == aWidgetUid)
       
   531               {
       
   532               itemIndex = i;
       
   533               break;
       
   534               }
       
   535         }
       
   536     CCookieClientData* cookieclientdata = cookieclientdataarray->At(itemIndex);
       
   537     cookieclientdata->StoreCookieAtClientSideL(aCookie,aUri);
       
   538     CLOG( ( EClient, 0, _L( "<- RCookieManager::StoreCookieAtClientSide" ) ) );
       
   539     }
       
   540 
       
   541 // ---------------------------------------------------------
       
   542 // RCookieManager::GetClientSideCookies
       
   543 // ---------------------------------------------------------
       
   544 //
       
   545 TInt RCookieManager::GetClientSideCookies( const TDesC8& aRequestUri,RPointerArray<CCookie>& aCookies
       
   546                 ,TBool& aCookieFound, TUint32 aWidgetUid )
       
   547     {
       
   548     CLOG( ( EClient, 0, _L( "-> RCookieManager::GetClientSideCookies" ) ) );
       
   549     TUint32 groupid = RProcess().SecureId().iId;
       
   550     //TInt itemIndex =0;
       
   551     CCookieClientData* cookieclientdata = NULL;
       
   552     CCookieClientDataArray* cookieclientdataarray = CCookieClientDataArray::GetInstance();
       
   553     TInt count = cookieclientdataarray->Count();
       
   554     if (count == 0)
       
   555         {
       
   556         TBool cookieSharableFlag(EFalse);
       
   557         TInt err = GetCookieSharableFlagFromServer(cookieSharableFlag);
       
   558         cookieclientdata = CCookieClientData::NewL(groupid, aWidgetUid, cookieSharableFlag,ETrue);
       
   559         cookieclientdata->SetInitFlag(ETrue);
       
   560         cookieclientdataarray->AddClientGroupDataL(cookieclientdata);
       
   561         } else 
       
   562            {
       
   563            //harendra: move this for loop in CCookieClientDataArray::Find(), it should index or object
       
   564            cookieclientdata = cookieclientdataarray->Find(groupid, aWidgetUid);
       
   565            }
       
   566      if(cookieclientdata)
       
   567         {
       
   568          if(!cookieclientdata->GetInitFlag())
       
   569            {
       
   570             TBool cookieSharableFlag(EFalse);
       
   571             TInt err = GetCookieSharableFlagFromServer(cookieSharableFlag);
       
   572             cookieclientdata->SetCookieCookieSharableFlag(cookieSharableFlag);
       
   573            }
       
   574            //cookieclientdata->SetInitFlag(ETrue);
       
   575            return cookieclientdata->GetClientSideCookies( aRequestUri,aCookies, aCookieFound );
       
   576          } else 
       
   577               {
       
   578                TBool cookieSharableFlag(EFalse);
       
   579                TInt err = GetCookieSharableFlagFromServer(cookieSharableFlag);
       
   580                if(err == KErrNone)
       
   581                  {
       
   582                    CCookieClientData* cookieclientdata 
       
   583                     = CCookieClientData::NewL(groupid, aWidgetUid, cookieSharableFlag,ETrue);
       
   584                     cookieclientdataarray->AddClientGroupDataL(cookieclientdata);
       
   585                   }
       
   586                }
       
   587     CLOG( ( EClient, 0, _L( "<- RCookieManager::GetClientSideCookies" ) ) );
       
   588     return KErrNone;
       
   589     }
       
   590 
   270 // End of file
   591 // End of file