Skip to content

Commit

Permalink
Add IRequestContext.CloseAllConnections
Browse files Browse the repository at this point in the history
Add IRequestContext.ClearCertificateExceptions
Also forgot to make IRequestContext extend IDisposable

https://bitbucket.org/chromiumembedded/cef/commits/cd7e8a055816f1bfc681c18a2e959ef3e414f265?at=master
  • Loading branch information
amaitland committed Mar 19, 2016
1 parent e4b2f24 commit ee67324
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
30 changes: 30 additions & 0 deletions CefSharp.Core/RequestContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,36 @@ namespace CefSharp
return success;
}

///
// Clears all certificate exceptions that were added as part of handling
// CefRequestHandler::OnCertificateError(). If you call this it is
// recommended that you also call CloseAllConnections() or you risk not
// being prompted again for server certificates if you reconnect quickly.
// If |callback| is non-NULL it will be executed on the UI thread after
// completion.
///
/*--cef(optional_param=callback)--*/
virtual void ClearCertificateExceptions(ICompletionCallback^ callback)
{
CefRefPtr<CefCompletionCallback> wrapper = callback == nullptr ? NULL : new CefCompletionCallbackAdapter(callback);

_requestContext->ClearCertificateExceptions(wrapper);
}

///
// Clears all active and idle connections that Chromium currently has.
// This is only recommended if you have released all other CEF objects but
// don't yet want to call CefShutdown(). If |callback| is non-NULL it will be
// executed on the UI thread after completion.
///
/*--cef(optional_param=callback)--*/
virtual void CloseAllConnections(ICompletionCallback^ callback)
{
CefRefPtr<CefCompletionCallback> wrapper = callback == nullptr ? NULL : new CefCompletionCallbackAdapter(callback);

_requestContext->CloseAllConnections(wrapper);
}

operator CefRefPtr<CefRequestContext>()
{
if(this == nullptr)
Expand Down
22 changes: 21 additions & 1 deletion CefSharp/IRequestContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

using System;
using System.Collections.Generic;

namespace CefSharp
{
public interface IRequestContext
public interface IRequestContext : IDisposable
{
/// <summary>
/// Returns true if this object is pointing to the same context object.
Expand Down Expand Up @@ -131,5 +132,24 @@ public interface IRequestContext
/// <param name="error">out error</param>
/// <returns>Returns true if the value is set successfully and false otherwise.</returns>
bool SetPreference(string name, object value, out string error);

/// <summary>
/// Clears all certificate exceptions that were added as part of handling
/// <see cref="IRequestHandler.OnCertificateError"/>. If you call this it is
/// recommended that you also call <see cref="IRequestContext.CloseAllConnections"/> or you risk not
/// being prompted again for server certificates if you reconnect quickly.
/// </summary>
/// <param name="callback">If is non-NULL it will be executed on the CEF UI thread after
/// completion. This param is optional</param>
void ClearCertificateExceptions(ICompletionCallback callback);

/// <summary>
/// Clears all active and idle connections that Chromium currently has.
/// This is only recommended if you have released all other CEF objects but
/// don't yet want to call Cef.Shutdown().
/// </summary>
/// <param name="callback">If is non-NULL it will be executed on the CEF UI thread after
/// completion. This param is optional</param>
void CloseAllConnections(ICompletionCallback callback);
}
}

0 comments on commit ee67324

Please sign in to comment.