mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-06 12:09:40 +00:00
Add GetSource and GetText methods that take an IStringVisitor
This commit is contained in:
@@ -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.
|
||||
///
|
||||
|
||||
@@ -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.
|
||||
///
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace CefSharp
|
||||
|
||||
~StringVisitor()
|
||||
{
|
||||
delete _visitor;
|
||||
_visitor = nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -39,5 +39,10 @@ namespace CefSharp
|
||||
{
|
||||
get { return taskCompletionSource.Task; }
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user