Files
cefsharp/CefSharp.Core/Internals/CefUrlRequestClientAdapter.cpp
T
David M Iserovich a843407dab Core - Add IURLRequest #1721 (#2881)
* 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
2019-10-01 20:11:10 +10:00

52 lines
1.6 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.
#include "Stdafx.h"
#include "CefUrlRequestClientAdapter.h"
#include "CefUrlRequestWrapper.h"
#include "CefAuthCallbackWrapper.h"
using namespace System::IO;
void CefUrlRequestClientAdapter::OnRequestComplete(CefRefPtr<CefURLRequest> request)
{
_client->OnRequestComplete(gcnew CefUrlRequestWrapper(request));
}
void CefUrlRequestClientAdapter::OnUploadProgress(CefRefPtr<CefURLRequest> request, int64 current, int64 total)
{
_client->OnUploadProgress(gcnew CefUrlRequestWrapper(request), current, total);
}
void CefUrlRequestClientAdapter::OnDownloadProgress(CefRefPtr<CefURLRequest> request, int64 current, int64 total)
{
_client->OnDownloadProgress(gcnew CefUrlRequestWrapper(request), current, total);
}
void CefUrlRequestClientAdapter::OnDownloadData(CefRefPtr<CefURLRequest> request, const void* data, size_t data_length)
{
UnmanagedMemoryStream readStream((Byte*)data, (Int64)data_length, (Int64)data_length, FileAccess::Read);
_client->OnDownloadData(
gcnew CefUrlRequestWrapper(request),
%readStream
);
}
bool CefUrlRequestClientAdapter::GetAuthCredentials(bool isProxy,
const CefString& host,
int port,
const CefString& realm,
const CefString& scheme,
CefRefPtr<CefAuthCallback> callback)
{
return _client->GetAuthCredentials(
isProxy,
StringUtils::ToClr(host),
port,
StringUtils::ToClr(realm),
StringUtils::ToClr(scheme),
gcnew CefAuthCallbackWrapper(callback));
}