Add GetSource and GetText methods that take an IStringVisitor

This commit is contained in:
amaitland
2016-05-29 22:21:32 +10:00
parent a94bbdd593
commit bc298f6415
6 changed files with 64 additions and 2 deletions
+27 -1
View File
@@ -135,6 +135,19 @@ Task<String^>^ CefFrameWrapper::GetSourceAsync()
return taskStringVisitor->Task;
}
///
// Retrieve this frame's HTML source as a string sent to the specified
// visitor.
///
/*--cef()--*/
void CefFrameWrapper::GetSource(IStringVisitor^ visitor)
{
ThrowIfDisposed();
ThrowIfFrameInvalid();
_frame->GetSource(new StringVisitor(visitor));
}
///
// Retrieve this frame's display text as a string sent to the specified
// visitor.
@@ -150,7 +163,20 @@ Task<String^>^ CefFrameWrapper::GetTextAsync()
return taskStringVisitor->Task;
}
// TODO: Do we need this?
///
// Retrieve this frame's display text as a string sent to the specified
// visitor.
///
/*--cef()--*/
void CefFrameWrapper::GetText(IStringVisitor^ visitor)
{
ThrowIfDisposed();
ThrowIfFrameInvalid();
_frame->GetText(new StringVisitor(visitor));
}
///
// Load the request represented by the |request| object.
///
+14
View File
@@ -122,6 +122,13 @@ namespace CefSharp
/*--cef()--*/
virtual Task<String^>^ GetSourceAsync();
///
// Retrieve this frame's HTML source as a string sent to the specified
// visitor.
///
/*--cef()--*/
virtual void GetSource(IStringVisitor^ visitor);
///
// Retrieve this frame's display text as a string sent to the specified
// visitor.
@@ -129,6 +136,13 @@ namespace CefSharp
/*--cef()--*/
virtual Task<String^>^ GetTextAsync();
///
// Retrieve this frame's display text as a string sent to the specified
// visitor.
///
/*--cef()--*/
virtual void GetText(IStringVisitor^ visitor);
///
/// Load the request represented by the |request| object.
///
+1
View File
@@ -22,6 +22,7 @@ namespace CefSharp
~StringVisitor()
{
delete _visitor;
_visitor = nullptr;
}
+14
View File
@@ -67,6 +67,13 @@ namespace CefSharp
/// </returns>
Task<string> GetSourceAsync();
/// <summary>
/// Retrieve this frame's HTML source as a string sent to the specified visitor.
/// Use the <see cref="GetSourceAsync"/> method for a Task based async wrapper
/// </summary>
/// <param name="visitor">visitor will recieve string values asynchronously</param>
void GetSource(IStringVisitor visitor);
/// <summary>
/// Retrieve this frame's display text as a string sent to the specified visitor.
/// </summary>
@@ -75,6 +82,13 @@ namespace CefSharp
/// </returns>
Task<string> GetTextAsync();
/// <summary>
/// Retrieve this frame's display text as a string sent to the specified visitor.
/// Use the <see cref="GetTextAsync"/> method for a Task based async wrapper
/// </summary>
/// <param name="visitor">visitor will recieve string values asynchronously</param>
void GetText(IStringVisitor visitor);
/// <summary>
/// Load the custom request.
/// </summary>
+3 -1
View File
@@ -2,12 +2,14 @@
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
using System;
namespace CefSharp
{
/// <summary>
/// Implement this interface to receive string values asynchronously.
/// </summary>
public interface IStringVisitor
public interface IStringVisitor : IDisposable
{
/// <summary>
/// Method that will be executed.
+5
View File
@@ -39,5 +39,10 @@ namespace CefSharp
{
get { return taskCompletionSource.Task; }
}
public void Dispose()
{
}
}
}