initial work on wrapping cookie visitor api

This commit is contained in:
anthony taranto
2012-07-30 19:28:12 -07:00
parent 541361fcce
commit bf3fc7a858
5 changed files with 68 additions and 0 deletions
+8
View File
@@ -7,6 +7,7 @@
#include "include/cef_runnable.h"
#include "include/cef_version.h"
#include "include/cef_task.h"
#include "CookieVisitor.h"
#include "Settings.h"
#include "SchemeHandler.h"
#include "StringUtil.h"
@@ -119,6 +120,13 @@ namespace CefSharp
return true;
}
static bool VisitAllCookies(ICookieVisitor^ visitor)
{
CefRefPtr<CookieVisitor> cookieVisitor = new CookieVisitor(visitor);
return CefCookieManager::GetGlobalManager()->
VisitAllCookies(static_cast<CefRefPtr<CefCookieVisitor>>(cookieVisitor));
}
static bool SetCookie(String^ url, String^ name, String^ value, String^ domain, String^ path, bool secure, bool httponly, bool has_expires, DateTime expires)
{
msclr::lock l(_sync);
+12
View File
@@ -204,6 +204,10 @@
RelativePath=".\ClientAdapter.cpp"
>
</File>
<File
RelativePath=".\CookieVisitor.cpp"
>
</File>
<File
RelativePath=".\RenderClientAdapter.cpp"
>
@@ -290,6 +294,14 @@
RelativePath=".\ConsoleMessageEventArgs.h"
>
</File>
<File
RelativePath=".\CookieVisitor.h"
>
</File>
<File
RelativePath=".\ICookieVisitor.h"
>
</File>
<File
RelativePath=".\IKeyboardHandler.h"
>
+11
View File
@@ -0,0 +1,11 @@
#include "stdafx.h"
#include "CookieVisitor.h"
namespace CefSharp
{
bool CookieVisitor::Visit(const CefCookie& cookie, int count, int total, bool& deleteCookie)
{
return _visitor->Visit(gcnew Cookie(), count, total, deleteCookie);
}
}
+24
View File
@@ -0,0 +1,24 @@
#include "stdafx.h"
#pragma once
#include "include/cef_cookie.h"
#include "ICookieVisitor.h"
namespace CefSharp
{
public class CookieVisitor : public CefCookieVisitor
{
private:
gcroot<ICookieVisitor^> _visitor;
public:
CookieVisitor(ICookieVisitor^ visitor)
{
_visitor = visitor;
}
virtual bool Visit(const CefCookie& cookie, int count, int total, bool& deleteCookie) OVERRIDE;
IMPLEMENT_REFCOUNTING(CookieVisitor);
};
}
+13
View File
@@ -0,0 +1,13 @@
#include "stdafx.h"
#pragma once
using namespace System::Net;
namespace CefSharp
{
public interface class ICookieVisitor
{
public:
bool Visit(Cookie^ cookie, int count, int total, bool% deleteCookie);
};
}