From c193020c726466a0cc7176554e844acdacac9acc Mon Sep 17 00:00:00 2001 From: amaitland Date: Fri, 5 Jun 2015 12:17:12 +1000 Subject: [PATCH] Change public API to use Continue and Cancel methods - callback is then somewhat more consistent with other callback wrappers --- CefSharp.Core/ResourceHandlerResponse.h | 9 +++++++-- CefSharp.Example/CefSharpSchemeHandler.cs | 2 +- CefSharp/IResourceHandlerResponse.cs | 8 ++++++-- CefSharp/ResourceHandler.cs | 2 +- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/CefSharp.Core/ResourceHandlerResponse.h b/CefSharp.Core/ResourceHandlerResponse.h index b82276eba..db7b02176 100644 --- a/CefSharp.Core/ResourceHandlerResponse.h +++ b/CefSharp.Core/ResourceHandlerResponse.h @@ -71,9 +71,14 @@ namespace CefSharp _resourceHandlerWrapper = nullptr; } - virtual void ProcessRequestCallback(bool cancel) + virtual void Continue() { - _resourceHandlerWrapper->ProcessRequestCallback(this, cancel); + _resourceHandlerWrapper->ProcessRequestCallback(this, false); + } + + virtual void Cancel() + { + _resourceHandlerWrapper->ProcessRequestCallback(this, true); } }; }; diff --git a/CefSharp.Example/CefSharpSchemeHandler.cs b/CefSharp.Example/CefSharpSchemeHandler.cs index a19b2ea34..45460b674 100644 --- a/CefSharp.Example/CefSharpSchemeHandler.cs +++ b/CefSharp.Example/CefSharpSchemeHandler.cs @@ -51,7 +51,7 @@ namespace CefSharp.Example response.ResponseStream = new MemoryStream(bytes); response.MimeType = GetMimeType(fileName); - response.ProcessRequestCallback(false); + response.Continue(); }); return true; diff --git a/CefSharp/IResourceHandlerResponse.cs b/CefSharp/IResourceHandlerResponse.cs index 31ea8927a..0b10e4239 100644 --- a/CefSharp/IResourceHandlerResponse.cs +++ b/CefSharp/IResourceHandlerResponse.cs @@ -53,7 +53,11 @@ namespace CefSharp /// /// Execute this method when processing is complete. Can be called on any thread. /// - /// True to cancel the request or False to continue. - void ProcessRequestCallback(bool cancel); + void Continue(); + + /// + /// Execute this method to cancel processing. Can be called on any thread. + /// + void Cancel(); } } diff --git a/CefSharp/ResourceHandler.cs b/CefSharp/ResourceHandler.cs index 1544df3eb..8b95e2a26 100644 --- a/CefSharp/ResourceHandler.cs +++ b/CefSharp/ResourceHandler.cs @@ -780,7 +780,7 @@ namespace CefSharp response.ContentLength = memoryStream.Length; } - response.ProcessRequestCallback(false); + response.Continue(); }); // If we have a MemoryStream (which is likely to be very common),