Permalink
Browse files

initial work on wrapping cookie visitor api

  • Loading branch information...
1 parent 541361f commit bf3fc7a858dfc2643ae0127ea559a1c0908bdbb1 @ataranto ataranto committed Jul 31, 2012
Showing with 68 additions and 0 deletions.
  1. +8 −0 CefSharp/CefSharp.h
  2. +12 −0 CefSharp/CefSharp.vcproj
  3. +11 −0 CefSharp/CookieVisitor.cpp
  4. +24 −0 CefSharp/CookieVisitor.h
  5. +13 −0 CefSharp/ICookieVisitor.h
View
@@ -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);
View
@@ -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"
>
View
@@ -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);
+ }
+}
View
@@ -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);
+ };
+}
View
@@ -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);
+ };
+}

0 comments on commit bf3fc7a

Please sign in to comment.