mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-04 19:25:01 +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
52 lines
1.6 KiB
C++
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));
|
|
}
|
|
|