Chromium Embedded Framework (CEF)  121.0.1+g7a4b55f+chromium-121.0.6167.16
CefDownloadHandler Class Referenceabstract

Class used to handle file downloads. More...

#include "include/cef_download_handler.h"

Inheritance diagram for CefDownloadHandler:
CefBaseRefCounted

Public Member Functions

virtual bool CanDownload (CefRefPtr< CefBrowser > browser, const CefString &url, const CefString &request_method)
 Called before a download begins in response to a user-initiated action (e.g. More...
 
virtual void OnBeforeDownload (CefRefPtr< CefBrowser > browser, CefRefPtr< CefDownloadItem > download_item, const CefString &suggested_name, CefRefPtr< CefBeforeDownloadCallback > callback)=0
 Called before a download begins. More...
 
virtual void OnDownloadUpdated (CefRefPtr< CefBrowser > browser, CefRefPtr< CefDownloadItem > download_item, CefRefPtr< CefDownloadItemCallback > callback)
 Called when a download's status or progress information has been updated. 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

Class used to handle file downloads.

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

Member Function Documentation

◆ CanDownload()

virtual bool CefDownloadHandler::CanDownload ( CefRefPtr< CefBrowser browser,
const CefString url,
const CefString request_method 
)
inlinevirtual

Called before a download begins in response to a user-initiated action (e.g.

alt + link click or link click that returns a Content-Disposition: attachment response from the server). |url| is the target download URL and |request_method| is the target method (GET, POST, etc). Return true to proceed with the download or false to cancel the download.

◆ OnBeforeDownload()

virtual void CefDownloadHandler::OnBeforeDownload ( CefRefPtr< CefBrowser browser,
CefRefPtr< CefDownloadItem download_item,
const CefString suggested_name,
CefRefPtr< CefBeforeDownloadCallback callback 
)
pure virtual

Called before a download begins.

|suggested_name| is the suggested name for the download file. By default the download will be canceled. Execute |callback| either asynchronously or in this method to continue the download if desired. Do not keep a reference to |download_item| outside of this method.

◆ OnDownloadUpdated()

virtual void CefDownloadHandler::OnDownloadUpdated ( CefRefPtr< CefBrowser browser,
CefRefPtr< CefDownloadItem download_item,
CefRefPtr< CefDownloadItemCallback callback 
)
inlinevirtual

Called when a download's status or progress information has been updated.

This may be called multiple times before and after OnBeforeDownload(). Execute |callback| either asynchronously or in this method to cancel the download if desired. Do not keep a reference to |download_item| outside of this method.


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