示例#1
0
void SetCookieUsage(const EA::WebKit::CookieInfo& cookieInfo)
{
	if (!cookieInfo.mCookieFilePath || !cookieInfo.mCookieFilePath[0] ) 
	{
		EAW_ASSERT_MSG(false,"Cookies persistence disabled. Invalid cookie file path.");
		return;
	}
	
	const char8_t* pCookieFilePath = cookieInfo.mCookieFilePath;

	EA::IO::Path::PathString8 fullPath;
	if(pCookieFilePath)
	{
        fullPath.assign(GetFullPath(pCookieFilePath, true));
		if(!fullPath.empty())
		{
			pCookieFilePath = fullPath.c_str();
		}
	}

	WebCore::ResourceHandleManager* pRHM = WebCore::ResourceHandleManager::sharedInstance();
	EA::WebKit::CookieManager* pCM = pRHM->GetCookieManager();   
	CookieManagerParameters    params(pCookieFilePath, cookieInfo.mMaxIndividualCookieSize, 
									cookieInfo.mDiskCookieStorageSize, cookieInfo.mMaxCookieCount);
	pCM->SetParametersAndInitialize(params);
}
示例#2
0
// This function would be called by the application if it wants to display the current setting.
// As of this writing, our application doesn't call this function. It could also be called if 
// the page references the 'navigator.cookieEnabled' DOM property.
bool cookiesEnabled(const Document* /*document*/)
{
    EA::WebKit::CookieManager* cookieManager = WKAL::ResourceHandleManager::sharedInstance()->GetCookieManager();

    const EA::WebKit::CookieManagerParameters& params = cookieManager->GetParameters();

    return (params.mMaxCookieCount > 0);
}
示例#3
0
uint16_t ReadCookies(char8_t** rawCookieData, uint16_t numCookiesToRead)
{
	if(!rawCookieData)
		return 0;

	WebCore::ResourceHandleManager* pRHM = WebCore::ResourceHandleManager::sharedInstance();
	EA::WebKit::CookieManager* pCM = pRHM->GetCookieManager();   
	return pCM->EnumerateCookies(rawCookieData, numCookiesToRead);
}
示例#4
0
void AddCookie(const char8_t* pHeaderValue, const char8_t* pURI)
{
	if(!pHeaderValue || !pURI)
		return;

	WebCore::ResourceHandleManager* pRHM = WebCore::ResourceHandleManager::sharedInstance();
	EA::WebKit::CookieManager* pCM = pRHM->GetCookieManager();   
	pCM->ProcessCookieHeader(pHeaderValue, pURI);
}
示例#5
0
void CookiesReceived(TransportInfo* pTInfo)
{
	if(!pTInfo)
		return;

	//Attach new cookies
	WebCore::ResourceHandleManager* pRHM = WebCore::ResourceHandleManager::sharedInstance();
	EAW_ASSERT(pRHM);

	EA::WebKit::CookieManager* pCM = pRHM->GetCookieManager();   
	pCM->OnHeadersRead(pTInfo);

}
示例#6
0
// This function would be called by the application if it wants to put up a dialog box to 
// display the currently recognized cookies for a URI. This is not currently called by 
// the transport system prior to sending an HTTP page request. As of this writing, our
// application doesn't call this function.
String cookies(const Document* /*document*/, const KURL& url)
{
    EA::WebKit::CookieManager* cookieManager = WKAL::ResourceHandleManager::sharedInstance()->GetCookieManager();
    if(cookieManager)
    {
        EA::WebKit::FixedString8_256 cookieStr8 = cookieManager->GetCookieTextForURL(url,true); 
        //EA::WebKit::FixedString16_256 cookieStr16;
        //EA::WebKit::ConvertToString16(cookieStr8, cookieStr16);
        //String cookieStr(cookieStr16.c_str());
        return String(cookieStr8.c_str());
    }
    else
    {
        return String();
    }
}
示例#7
0
void ReattachCookies(TransportInfo* pTInfo)
{
	if(!pTInfo)
		return;

	//Remove existing cookies from the transport headers
	EA::WebKit::HeaderMap::iterator it;
	while((it = GetHeaderMap(pTInfo->mHeaderMapOut)->find_as(EA_CHAR16("Cookie"), EA::WebKit::str_iless())) != GetHeaderMap(pTInfo->mHeaderMapOut)->end())
		GetHeaderMap(pTInfo->mHeaderMapOut)->erase(it);

	//Attach new cookies
	WebCore::ResourceHandleManager* pRHM = WebCore::ResourceHandleManager::sharedInstance();
	EAW_ASSERT(pRHM);

	EA::WebKit::CookieManager* pCM = pRHM->GetCookieManager();   
	pCM->OnHeadersSend(pTInfo);
}
示例#8
0
// This function is called by the Document or JSDocument when the page itself specifies
// a cookie. We want to relay this to our central cookie manager.
void setCookies(Document* /*document*/, const KURL& url, const KURL& /*policyURL*/, const String& value)
{
    EA::WebKit::CookieManager* cookieManager = WKAL::ResourceHandleManager::sharedInstance()->GetCookieManager();
    
    if(cookieManager)
    {
        EA::WebKit::FixedString16_256 urlStr16;
        urlStr16.assign(url.string().characters(),url.string().length());
        EA::WebKit::FixedString8_256 url8; 
        EA::WebKit::ConvertToString8(urlStr16,url8);

        EA::WebKit::FixedString16_256 valueStr16;
        valueStr16.assign(value.characters(),value.length());
        EA::WebKit::FixedString8_256 valueStr8; 
        EA::WebKit::ConvertToString8(valueStr16, valueStr8);
        cookieManager->ProcessCookieHeader(valueStr8.c_str(),url8.c_str());
    }
}
示例#9
0
void RemoveCookies()
{
	WebCore::ResourceHandleManager* pRHM = WebCore::ResourceHandleManager::sharedInstance();
	EA::WebKit::CookieManager* pCM = pRHM->GetCookieManager();   
	pCM->RemoveCookies();
}