The DownloadHandler class.
More...
#include <WebBrowserCef/DownloadHandler.hpp>
|
| CefRefPtr< CefDownloadHandler > | cefHandler () |
| | cefHandler returns a pointer to a CEF handler object More... |
| |
| virtual bool | continueDownload (const DownloadItemPtr downloadItem)=0 |
| | continueDownload called periodically to update the status of the download More... |
| |
|
| DownloadHandler (const DownloadHandler &)=delete |
| |
|
DownloadHandler & | operator= (const DownloadHandler &)=delete |
| |
| virtual QString | startDownload (const DownloadItemPtr downloadItem, const WebBrowserCef::WebPagePtr webPage)=0 |
| | startDownload is called in a subclass when a download starts More... |
| |
|
|
void | setWebPage (WebPageWeakPtr webPage) |
| |
The DownloadHandler class.
To implement downloads, create a subclass of DownloadHandler and supply implementations of startDownload and continueDownload.
After each WebPage is created, call setDownloadHandler on the webPagePtr passing an instance pointer of the DownloadHandler subclass
| CefRefPtr<CefDownloadHandler> WebBrowserCef::DownloadHandler::cefHandler |
( |
| ) |
|
cefHandler returns a pointer to a CEF handler object
- Returns
- cefHandler NOTE the base class implementation provides a CEF handler object for the underlying browser to use. This method should not be called directly
| virtual bool WebBrowserCef::DownloadHandler::continueDownload |
( |
const DownloadItemPtr |
downloadItem | ) |
|
|
pure virtual |
continueDownload called periodically to update the status of the download
- Parameters
-
| downloadItem | contains information about the download NOTE - this parameter should not be dereferenced outside of this callback. |
- Returns
- to cancel the download, return false from the subclass override
| virtual QString WebBrowserCef::DownloadHandler::startDownload |
( |
const DownloadItemPtr |
downloadItem, |
|
|
const WebBrowserCef::WebPagePtr |
webPage |
|
) |
| |
|
pure virtual |
startDownload is called in a subclass when a download starts
- Parameters
-
| downloadItem | contains information about the download NOTE - this parameter should not be dereferenced outside of this callback. |
| webPage | - a pointer to the web page that initiated the download - NOTE - MUST BE REFERENCED for the duration of the download. This ensures that the download will continue even if the webpage is dismissed from the UI. |
- Returns
- To start the download, return a valid path to save the file to or an empty string to ignore