diff --git a/CefSharp.Core/Cef.h b/CefSharp.Core/Cef.h
index e3aa592efe..0ba1bd434f 100644
--- a/CefSharp.Core/Cef.h
+++ b/CefSharp.Core/Cef.h
@@ -10,6 +10,7 @@
#include "Internals/CefSharpApp.h"
#include "Internals/CookieVisitor.h"
+#include "Internals/CompletionHandler.h"
#include "Internals/StringUtils.h"
#include "ManagedCefBrowserAdapter.h"
#include "CefSettings.h"
@@ -316,6 +317,24 @@ namespace CefSharp
}
}
+ /// Flush the backing store (if any) to disk and execute the specified |handler| on the IO thread when done. Returns
+ /// A user-provided Cookie Visitor implementation.
+ /// Returns false if cookies cannot be accessed.
+ static bool FlushStore(IComplete^ handler)
+ {
+ CefRefPtr wrapper = new CompletionHandler(handler);
+ CefRefPtr manager = CefCookieManager::GetGlobalManager();
+
+ if (manager != nullptr)
+ {
+ manager->FlushStore(static_cast>(wrapper));
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
/// Shuts down CefSharp and the underlying CEF infrastructure. This method is safe to call multiple times; it will only
/// shut down CEF on the first call (all subsequent calls will be ignored).
///
diff --git a/CefSharp.Core/CefSharp.Core.vcxproj b/CefSharp.Core/CefSharp.Core.vcxproj
index 7534c1db48..6c6856662c 100644
--- a/CefSharp.Core/CefSharp.Core.vcxproj
+++ b/CefSharp.Core/CefSharp.Core.vcxproj
@@ -217,8 +217,9 @@
-
+
+
@@ -235,6 +236,7 @@
+
diff --git a/CefSharp.Core/CefSharp.Core.vcxproj.filters b/CefSharp.Core/CefSharp.Core.vcxproj.filters
index 96ff8d2839..71cd04b540 100644
--- a/CefSharp.Core/CefSharp.Core.vcxproj.filters
+++ b/CefSharp.Core/CefSharp.Core.vcxproj.filters
@@ -23,9 +23,6 @@
Source Files
-
- Source Files
-
Source Files
@@ -47,6 +44,12 @@
Source Files
+
+ Source Files
+
+
+ Source Files
+
@@ -115,6 +118,9 @@
Header Files
+
+ Header Files
+
diff --git a/CefSharp.Core/Internals/CompletionHandler.cpp b/CefSharp.Core/Internals/CompletionHandler.cpp
new file mode 100644
index 0000000000..f4dcbf29df
--- /dev/null
+++ b/CefSharp.Core/Internals/CompletionHandler.cpp
@@ -0,0 +1,18 @@
+// Copyright © 2010-2014 The CefSharp Authors. All rights reserved.
+//
+// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
+
+#pragma once
+
+#include "Stdafx.h"
+#include "CompletionHandler.h"
+
+using namespace System::Net;
+
+namespace CefSharp
+{
+ void CompletionHandler::OnComplete()
+ {
+ _handler->OnComplete();
+ }
+}
\ No newline at end of file
diff --git a/CefSharp.Core/Internals/CompletionHandler.h b/CefSharp.Core/Internals/CompletionHandler.h
new file mode 100644
index 0000000000..f7307a0def
--- /dev/null
+++ b/CefSharp.Core/Internals/CompletionHandler.h
@@ -0,0 +1,27 @@
+// Copyright © 2010-2014 The CefSharp Authors. All rights reserved.
+//
+// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
+
+#pragma once
+
+#include "Stdafx.h"
+#include "include/cef_cookie.h"
+
+namespace CefSharp
+{
+ private class CompletionHandler : public CefCompletionHandler
+ {
+ private:
+ gcroot _handler;
+
+ public:
+ CompletionHandler(IComplete^ handler)
+ {
+ _handler = handler;
+ }
+
+ virtual void OnComplete() OVERRIDE;
+
+ IMPLEMENT_REFCOUNTING(CompletionHandler);
+ };
+}
\ No newline at end of file
diff --git a/CefSharp/CefSharp.csproj b/CefSharp/CefSharp.csproj
index e8c37f99bb..9763682404 100644
--- a/CefSharp/CefSharp.csproj
+++ b/CefSharp/CefSharp.csproj
@@ -86,6 +86,7 @@
+
diff --git a/CefSharp/IComplete.cs b/CefSharp/IComplete.cs
new file mode 100644
index 0000000000..dffb1bb2b1
--- /dev/null
+++ b/CefSharp/IComplete.cs
@@ -0,0 +1,9 @@
+using System.Net;
+
+namespace CefSharp
+{
+ public interface IComplete
+ {
+ void OnComplete();
+ }
+}