Chromium Embedded Framework (CEF)  126.2.0+g5c56e98+chromium-126.0.6478.62
CefStreamResourceHandler Class Reference

Implementation of the CefResourceHandler class for reading from a CefStream. More...

#include "include/wrapper/cef_stream_resource_handler.h"

Inheritance diagram for CefStreamResourceHandler:
CefResourceHandler CefBaseRefCounted

Public Member Functions

 CefStreamResourceHandler (const CefString &mime_type, CefRefPtr< CefStreamReader > stream)
 Create a new object with default response values. More...
 
 CefStreamResourceHandler (int status_code, const CefString &status_text, const CefString &mime_type, CefResponse::HeaderMap header_map, CefRefPtr< CefStreamReader > stream)
 Create a new object with explicit response values. More...
 
 CefStreamResourceHandler (const CefStreamResourceHandler &)=delete
 
CefStreamResourceHandleroperator= (const CefStreamResourceHandler &)=delete
 
bool Open (CefRefPtr< CefRequest > request, bool &handle_request, CefRefPtr< CefCallback > callback) override
 Open the response stream. More...
 
void GetResponseHeaders (CefRefPtr< CefResponse > response, int64_t &response_length, CefString &redirectUrl) override
 Retrieve response header information. More...
 
bool Read (void *data_out, int bytes_to_read, int &bytes_read, CefRefPtr< CefResourceReadCallback > callback) override
 Read response data. More...
 
void Cancel () override
 Request processing has been canceled. More...
 
- Public Member Functions inherited from CefResourceHandler
virtual bool ProcessRequest (CefRefPtr< CefRequest > request, CefRefPtr< CefCallback > callback)
 Begin processing the request. More...
 
virtual bool Skip (int64_t bytes_to_skip, int64_t &bytes_skipped, CefRefPtr< CefResourceSkipCallback > callback)
 Skip response data when requested by a Range header. More...
 
virtual bool ReadResponse (void *data_out, int bytes_to_read, int &bytes_read, CefRefPtr< CefCallback > callback)
 Read response data. More...
 
- Public Member Functions inherited from CefBaseRefCounted
virtual void AddRef () const =0
 Called to increment the reference count for the object. More...
 
virtual bool Release () const =0
 Called to decrement the reference count for the object. More...
 
virtual bool HasOneRef () const =0
 Returns true if the reference count is 1. More...
 
virtual bool HasAtLeastOneRef () const =0
 Returns true if the reference count is at least 1. More...
 

Additional Inherited Members

- Protected Member Functions inherited from CefBaseRefCounted
virtual ~CefBaseRefCounted ()
 

Detailed Description

Implementation of the CefResourceHandler class for reading from a CefStream.

Constructor & Destructor Documentation

◆ CefStreamResourceHandler() [1/3]

CefStreamResourceHandler::CefStreamResourceHandler ( const CefString mime_type,
CefRefPtr< CefStreamReader stream 
)

Create a new object with default response values.

◆ CefStreamResourceHandler() [2/3]

CefStreamResourceHandler::CefStreamResourceHandler ( int  status_code,
const CefString status_text,
const CefString mime_type,
CefResponse::HeaderMap  header_map,
CefRefPtr< CefStreamReader stream 
)

Create a new object with explicit response values.

◆ CefStreamResourceHandler() [3/3]

CefStreamResourceHandler::CefStreamResourceHandler ( const CefStreamResourceHandler )
delete

Member Function Documentation

◆ Cancel()

void CefStreamResourceHandler::Cancel ( )
overridevirtual

Request processing has been canceled.

Implements CefResourceHandler.

◆ GetResponseHeaders()

void CefStreamResourceHandler::GetResponseHeaders ( CefRefPtr< CefResponse response,
int64_t &  response_length,
CefString redirectUrl 
)
overridevirtual

Retrieve response header information.

If the response length is not known set |response_length| to -1 and ReadResponse() will be called until it returns false. If the response length is known set |response_length| to a positive value and ReadResponse() will be called until it returns false or the specified number of bytes have been read. Use the |response| object to set the mime type, http status code and other optional header values. To redirect the request to a new URL set |redirectUrl| to the new URL. |redirectUrl| can be either a relative or fully qualified URL. It is also possible to set |response| to a redirect http status code and pass the new URL via a Location header. Likewise with |redirectUrl| it is valid to set a relative or fully qualified URL as the Location header value. If an error occured while setting up the request you can call SetError() on |response| to indicate the error condition.

Implements CefResourceHandler.

◆ Open()

bool CefStreamResourceHandler::Open ( CefRefPtr< CefRequest request,
bool &  handle_request,
CefRefPtr< CefCallback callback 
)
overridevirtual

Open the response stream.

To handle the request immediately set |handle_request| to true and return true. To decide at a later time set |handle_request| to false, return true, and execute |callback| to continue or cancel the request. To cancel the request immediately set |handle_request| to true and return false. This method will be called in sequence but not from a dedicated thread. For backwards compatibility set |handle_request| to false and return false and the ProcessRequest method will be called.

Reimplemented from CefResourceHandler.

◆ operator=()

CefStreamResourceHandler& CefStreamResourceHandler::operator= ( const CefStreamResourceHandler )
delete

◆ Read()

bool CefStreamResourceHandler::Read ( void *  data_out,
int  bytes_to_read,
int &  bytes_read,
CefRefPtr< CefResourceReadCallback callback 
)
overridevirtual

Read response data.

If data is available immediately copy up to |bytes_to_read| bytes into |data_out|, set |bytes_read| to the number of bytes copied, and return true. To read the data at a later time keep a pointer to |data_out|, set |bytes_read| to 0, return true and execute |callback| when the data is available (|data_out| will remain valid until the callback is executed). To indicate response completion set |bytes_read| to 0 and return false. To indicate failure set |bytes_read| to < 0 (e.g. -2 for ERR_FAILED) and return false. This method will be called in sequence but not from a dedicated thread. For backwards compatibility set |bytes_read| to -1 and return false and the ReadResponse method will be called.

Reimplemented from CefResourceHandler.


The documentation for this class was generated from the following file: