mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-05 11:42:36 +00:00
Exposing the cookies flushstore method
This commit is contained in:
@@ -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"
|
||||
@@ -333,6 +334,24 @@ namespace CefSharp
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Flush the backing store (if any) to disk and execute the specified |handler| on the IO thread when done. Returns </summary>
|
||||
/// <param name="visitor">A user-provided Cookie Visitor implementation.</param>
|
||||
/// <return>Returns false if cookies cannot be accessed.</return>
|
||||
static bool FlushStore(IComplete^ handler)
|
||||
{
|
||||
CefRefPtr<CompletionHandler> wrapper = new CompletionHandler(handler);
|
||||
CefRefPtr<CefCookieManager> manager = CefCookieManager::GetGlobalManager();
|
||||
|
||||
if (manager != nullptr)
|
||||
{
|
||||
manager->FlushStore(static_cast<CefRefPtr<CefCompletionHandler>>(wrapper));
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/// <summary>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).
|
||||
/// </summary>
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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<IComplete^> _handler;
|
||||
|
||||
public:
|
||||
CompletionHandler(IComplete^ handler)
|
||||
{
|
||||
_handler = handler;
|
||||
}
|
||||
|
||||
virtual void OnComplete() OVERRIDE;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CompletionHandler);
|
||||
};
|
||||
}
|
||||
@@ -97,6 +97,7 @@
|
||||
<Compile Include="KeyType.cs" />
|
||||
<Compile Include="LoadErrorEventHandler.cs" />
|
||||
<Compile Include="NavStateChangedEventArgs.cs" />
|
||||
<Compile Include="IComplete.cs" />
|
||||
<Compile Include="Internals\BitmapInfo.cs" />
|
||||
<Compile Include="Internals\ManagedCefApp.cs" />
|
||||
<Compile Include="CefCustomScheme.cs" />
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
using System.Net;
|
||||
|
||||
namespace CefSharp
|
||||
{
|
||||
public interface IComplete
|
||||
{
|
||||
void OnComplete();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user