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

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 bool OnBeforeDownload (CefRefPtr< CefBrowser > browser, CefRefPtr< CefDownloadItem > download_item, const CefString &suggested_name, CefRefPtr< CefBeforeDownloadCallback > callback)
 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 bool CefDownloadHandler::OnBeforeDownload ( CefRefPtr< CefBrowser browser,
CefRefPtr< CefDownloadItem download_item,
const CefString suggested_name,
CefRefPtr< CefBeforeDownloadCallback callback 
)
inlinevirtual

Called before a download begins.

|suggested_name| is the suggested name for the download file. Return true and execute |callback| either asynchronously or in this method to continue or cancel the download. Return false to proceed with default handling (cancel with Alloy style, download shelf with Chrome style). 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: