Files
cefsharp/CefSharp/Internals/ByteArrayResourceHandler.cs
T
amaitland 73a156fdc5 Initial version 75 upgrade and NetworkService changes
Compiles, that's about it at this point, there are major CEF breaking changes, and lots to be addressed.

Browser Process (main process)
- Removed IResourceHandlerFactory as it no longer fits with the structure that CEF provides
- New IResourceRequestHandler interface added, not plumbed in yet
- CefSettings - Add RootCachePath and ApplicationClientIdForFileScanning

BrowserSubprocess (render process)
- SendProcessMessage was moved from CefBrowser to CefFrame
- OnBrowserCreated added extraInfo param

The BrowserSubprocess changes for this upgrade should be complete
2019-06-25 19:24:57 +10:00

81 lines
2.5 KiB
C#

// Copyright © 2017 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
{
/// <summary>
/// ByteArrayResourceHandler is used as a placeholder class which uses native CEF implementations.
/// CefStreamReader::CreateForData(); reads the byte array that is passed to a new instance
/// of CefStreamResourceHandler
/// TODO: Move this class into Handler namespace
/// </summary>
public class ByteArrayResourceHandler : IResourceHandler
{
/// <summary>
/// Underlying byte array that represents the data
/// </summary>
public byte[] Data { get; private set; }
/// <summary>
/// Gets or sets the Mime Type.
/// </summary>
public string MimeType { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="ByteArrayResourceHandler"/> class.
/// </summary>
/// <param name="mimeType">mimeType</param>
/// <param name="data">byte array</param>
public ByteArrayResourceHandler(string mimeType, byte[] data)
{
if (string.IsNullOrEmpty(mimeType))
{
throw new ArgumentNullException("mimeType", "Please provide a valid mimeType");
}
if (data == null)
{
throw new ArgumentNullException("data", "Please provide a valid array");
}
MimeType = mimeType;
Data = data;
}
bool IResourceHandler.ProcessRequest(IRequest request, ICallback callback)
{
//Should never be called
throw new NotImplementedException("This method should never be called");
}
void IResourceHandler.GetResponseHeaders(IResponse response, out long responseLength, out string redirectUrl)
{
//Should never be called
throw new NotImplementedException("This method should never be called");
}
bool IResourceHandler.ReadResponse(Stream dataOut, out int bytesRead, ICallback callback)
{
//Should never be called
throw new NotImplementedException("This method should never be called");
}
void IResourceHandler.Cancel()
{
//Should never be called
throw new NotImplementedException("This method should never be called");
}
void IDisposable.Dispose()
{
//NOOP
}
}
}