Skip to content

Commit e4991c2

Browse files
jozefizsoamaitland
authored andcommitted
Add the RequestContext.ClearHttpCache(callback) method.
This exposes the `CefRequestContext::ClearHttpCache(callback)` from CEF 144 release. See the `cef.sdk\cef\include\cef_request_context.h` file.
1 parent 5d48d8d commit e4991c2

5 files changed

Lines changed: 30 additions & 0 deletions

File tree

CefSharp.Core.Runtime.RefAssembly/CefSharp.Core.Runtime.netcore.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ public RequestContext(CefSharp.IRequestContextHandler requestContextHandler) { }
270270
public virtual bool IsGlobal { get { throw null; } }
271271
public virtual bool CanSetPreference(string name) { throw null; }
272272
public virtual void ClearCertificateExceptions(CefSharp.ICompletionCallback callback) { }
273+
public virtual void ClearHttpCache(CefSharp.ICompletionCallback callback) { }
273274
public virtual void ClearHttpAuthCredentials(CefSharp.ICompletionCallback callback) { }
274275
public virtual bool ClearSchemeHandlerFactories() { throw null; }
275276
public virtual void CloseAllConnections(CefSharp.ICompletionCallback callback) { }

CefSharp.Core.Runtime/RequestContext.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,15 @@ namespace CefSharp
126126
_requestContext->ClearCertificateExceptions(wrapper);
127127
}
128128

129+
void RequestContext::ClearHttpCache(ICompletionCallback^ callback)
130+
{
131+
ThrowIfDisposed();
132+
133+
CefRefPtr<CefCompletionCallback> wrapper = callback == nullptr ? nullptr : new CefCompletionCallbackAdapter(callback);
134+
135+
_requestContext->ClearHttpCache(wrapper);
136+
}
137+
129138
void RequestContext::ClearHttpAuthCredentials(ICompletionCallback^ callback)
130139
{
131140
ThrowIfDisposed();

CefSharp.Core.Runtime/RequestContext.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,13 @@ namespace CefSharp
282282
/// completion. This param is optional</param>
283283
virtual void ClearCertificateExceptions(ICompletionCallback^ callback);
284284

285+
/// <summary>
286+
/// Clears the HTTP cache.
287+
/// </summary>
288+
/// <param name="callback">If is non-NULL it will be executed on the CEF UI thread after
289+
/// completion. This param is optional</param>
290+
virtual void ClearHttpCache(ICompletionCallback^ callback);
291+
285292
/// <summary>
286293
/// Clears all HTTP authentication credentials that were added as part of handling
287294
/// <see cref="IRequestHandler::GetAuthCredentials"/>.

CefSharp.Core/RequestContext.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,12 @@ public void ClearCertificateExceptions(ICompletionCallback callback)
180180
requestContext.ClearCertificateExceptions(callback);
181181
}
182182

183+
/// <inheritdoc/>
184+
public void ClearHttpCache(ICompletionCallback callback = null)
185+
{
186+
requestContext.ClearHttpCache(callback);
187+
}
188+
183189
/// <inheritdoc/>
184190
public void ClearHttpAuthCredentials(ICompletionCallback callback = null)
185191
{

CefSharp/IRequestContext.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,13 @@ public interface IRequestContext : IDisposable
168168
/// completion. This param is optional</param>
169169
void ClearCertificateExceptions(ICompletionCallback callback);
170170

171+
/// <summary>
172+
/// Clears the HTTP cache.
173+
/// </summary>
174+
/// <param name="callback">If is non-NULL it will be executed on the CEF UI thread after
175+
/// completion. This param is optional</param>
176+
void ClearHttpCache(ICompletionCallback callback = null);
177+
171178
/// <summary>
172179
/// Clears all HTTP authentication credentials that were added as part of handling
173180
/// <see cref="IRequestHandler.GetAuthCredentials"/>.

0 commit comments

Comments
 (0)