chrome: Add CefDownloadHandler support (see #3681)

Behaves the same as Alloy runtime except that CanDownload is not
called for invalid protocol schemes.
This commit is contained in:
Marshall Greenblatt
2024-04-26 15:21:33 -04:00
parent ed079792b6
commit be6642df3f
23 changed files with 873 additions and 616 deletions

View File

@@ -106,17 +106,19 @@ class CefDownloadHandler : public virtual CefBaseRefCounted {
///
/// 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.
/// 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.
///
/*--cef()--*/
virtual void OnBeforeDownload(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDownloadItem> download_item,
const CefString& suggested_name,
CefRefPtr<CefBeforeDownloadCallback> callback) = 0;
virtual bool OnBeforeDownload(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefDownloadItem> download_item,
const CefString& suggested_name,
CefRefPtr<CefBeforeDownloadCallback> callback) {
return false;
}
///
/// Called when a download's status or progress information has been updated.