Chromium Embedded Framework (CEF)  129.0.1+g463bda9+chromium-129.0.6668.12
CefResponseFilter Class Referenceabstract

Implement this interface to filter resource response content. More...

#include "include/cef_response_filter.h"

Inheritance diagram for CefResponseFilter:
CefBaseRefCounted

Public Types

typedef cef_response_filter_status_t FilterStatus
 

Public Member Functions

virtual bool InitFilter ()=0
 Initialize the response filter. More...
 
virtual FilterStatus Filter (void *data_in, size_t data_in_size, size_t &data_in_read, void *data_out, size_t data_out_size, size_t &data_out_written)=0
 Called to filter a chunk of 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

Implement this interface to filter resource response content.

The methods of this class will be called on the browser process IO thread.

Member Typedef Documentation

◆ FilterStatus

Member Function Documentation

◆ Filter()

virtual FilterStatus CefResponseFilter::Filter ( void *  data_in,
size_t  data_in_size,
size_t &  data_in_read,
void *  data_out,
size_t  data_out_size,
size_t &  data_out_written 
)
pure virtual

Called to filter a chunk of data.

Expected usage is as follows:

  1. Read input data from |data_in| and set |data_in_read| to the number of bytes that were read up to a maximum of |data_in_size|. |data_in| will be NULL if |data_in_size| is zero.
  2. Write filtered output data to |data_out| and set |data_out_written| to the number of bytes that were written up to a maximum of |data_out_size|. If no output data was written then all data must be read from |data_in| (user must set |data_in_read| = |data_in_size|).
  3. Return RESPONSE_FILTER_DONE if all output data was written or RESPONSE_FILTER_NEED_MORE_DATA if output data is still pending.

This method will be called repeatedly until the input buffer has been fully read (user sets |data_in_read| = |data_in_size|) and there is no more input data to filter (the resource response is complete). This method may then be called an additional time with an empty input buffer if the user filled the output buffer (set |data_out_written| = |data_out_size|) and returned RESPONSE_FILTER_NEED_MORE_DATA to indicate that output data is still pending.

Calls to this method will stop when one of the following conditions is met:

  1. There is no more input data to filter (the resource response is complete) and the user sets |data_out_written| = 0 or returns RESPONSE_FILTER_DONE to indicate that all data has been written, or;
  2. The user returns RESPONSE_FILTER_ERROR to indicate an error.

Do not keep a reference to the buffers passed to this method.

◆ InitFilter()

virtual bool CefResponseFilter::InitFilter ( )
pure virtual

Initialize the response filter.

Will only be called a single time. The filter will not be installed if this method returns false.


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