mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-04 10:22:55 +00:00
d66798b03e
* Core - Add IURLRequest #1721 Add IURLRequest, IURLRequestClient, and GetURLRequest to IFrame * Rename URL classes to Url, add xmldoc and licenses * Add UrlRequestClient to CefSharp.Example, more minor cleanup * Getters * Rebase tweaks * Fix filenames, remove unused * Use UnmanagedMemoryStream instead of byte array for IUrlRequestClient.OnDownloadData
47 lines
1.2 KiB
C#
47 lines
1.2 KiB
C#
// Copyright © 2019 The CefSharp Authors. All rights reserved.
|
|
//
|
|
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
|
|
|
|
using System;
|
|
using System.IO;
|
|
|
|
namespace CefSharp.Example
|
|
{
|
|
|
|
public class UrlRequestClient : IUrlRequestClient
|
|
{
|
|
private Action<IUrlRequest, byte[]> CompleteAction;
|
|
private MemoryStream ResponseBody = new MemoryStream();
|
|
|
|
public UrlRequestClient(Action<IUrlRequest, byte[]> completeAction)
|
|
{
|
|
CompleteAction = completeAction;
|
|
}
|
|
public bool GetAuthCredentials(bool isProxy, string host, int port, string realm, string scheme, IAuthCallback callback)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public void OnDownloadData(IUrlRequest request, Stream data)
|
|
{
|
|
data.CopyTo(ResponseBody);
|
|
}
|
|
|
|
public void OnDownloadProgress(IUrlRequest request, long current, long total)
|
|
{
|
|
return;
|
|
}
|
|
|
|
public void OnRequestComplete(IUrlRequest request)
|
|
{
|
|
|
|
CompleteAction(request, ResponseBody.ToArray());
|
|
}
|
|
|
|
public void OnUploadProgress(IUrlRequest request, long current, long total)
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
}
|