Skip to content
This repository
Browse code

initial work on wrapping cookie visitor api

  • Loading branch information...
commit bf3fc7a858dfc2643ae0127ea559a1c0908bdbb1 1 parent 541361f
anthony authored July 30, 2012
8  CefSharp/CefSharp.h
@@ -7,6 +7,7 @@
7 7
 #include "include/cef_runnable.h"
8 8
 #include "include/cef_version.h"
9 9
 #include "include/cef_task.h"
  10
+#include "CookieVisitor.h"
10 11
 #include "Settings.h"
11 12
 #include "SchemeHandler.h"
12 13
 #include "StringUtil.h"
@@ -119,6 +120,13 @@ namespace CefSharp
119 120
             return true;
120 121
         }
121 122
 
  123
+        static bool VisitAllCookies(ICookieVisitor^ visitor)
  124
+        {
  125
+            CefRefPtr<CookieVisitor> cookieVisitor = new CookieVisitor(visitor);
  126
+            return CefCookieManager::GetGlobalManager()->
  127
+                VisitAllCookies(static_cast<CefRefPtr<CefCookieVisitor>>(cookieVisitor));
  128
+        }
  129
+
122 130
         static bool SetCookie(String^ url, String^ name, String^ value, String^ domain, String^ path, bool secure, bool httponly, bool has_expires, DateTime expires)
123 131
         {
124 132
             msclr::lock l(_sync);
12  CefSharp/CefSharp.vcproj
@@ -205,6 +205,10 @@
205 205
 				>
206 206
 			</File>
207 207
 			<File
  208
+				RelativePath=".\CookieVisitor.cpp"
  209
+				>
  210
+			</File>
  211
+			<File
208 212
 				RelativePath=".\RenderClientAdapter.cpp"
209 213
 				>
210 214
 			</File>
@@ -291,6 +295,14 @@
291 295
 				>
292 296
 			</File>
293 297
 			<File
  298
+				RelativePath=".\CookieVisitor.h"
  299
+				>
  300
+			</File>
  301
+			<File
  302
+				RelativePath=".\ICookieVisitor.h"
  303
+				>
  304
+			</File>
  305
+			<File
294 306
 				RelativePath=".\IKeyboardHandler.h"
295 307
 				>
296 308
 			</File>
11  CefSharp/CookieVisitor.cpp
... ...
@@ -0,0 +1,11 @@
  1
+#include "stdafx.h"
  2
+
  3
+#include "CookieVisitor.h"
  4
+
  5
+namespace CefSharp
  6
+{
  7
+    bool CookieVisitor::Visit(const CefCookie& cookie, int count, int total, bool& deleteCookie)
  8
+    {
  9
+        return _visitor->Visit(gcnew Cookie(), count, total, deleteCookie);
  10
+    }
  11
+}
24  CefSharp/CookieVisitor.h
... ...
@@ -0,0 +1,24 @@
  1
+#include "stdafx.h"
  2
+#pragma once
  3
+
  4
+#include "include/cef_cookie.h"
  5
+#include "ICookieVisitor.h"
  6
+
  7
+namespace CefSharp
  8
+{
  9
+    public class CookieVisitor : public CefCookieVisitor
  10
+    {
  11
+    private:
  12
+        gcroot<ICookieVisitor^> _visitor;
  13
+
  14
+    public:
  15
+        CookieVisitor(ICookieVisitor^ visitor)
  16
+        {
  17
+            _visitor = visitor;
  18
+        }
  19
+
  20
+        virtual bool Visit(const CefCookie& cookie, int count, int total, bool& deleteCookie) OVERRIDE;
  21
+
  22
+        IMPLEMENT_REFCOUNTING(CookieVisitor);
  23
+    };
  24
+}
13  CefSharp/ICookieVisitor.h
... ...
@@ -0,0 +1,13 @@
  1
+#include "stdafx.h"
  2
+#pragma once
  3
+
  4
+using namespace System::Net;
  5
+
  6
+namespace CefSharp
  7
+{
  8
+    public interface class ICookieVisitor
  9
+    {
  10
+    public:
  11
+        bool Visit(Cookie^ cookie, int count, int total, bool%  deleteCookie);
  12
+    };
  13
+}

0 notes on commit bf3fc7a

Please sign in to comment.
Something went wrong with that request. Please try again.