// Copyright © 2014 The CefSharp Authors. All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. namespace CefSharp { /// /// Class used to handle file downloads. /// The methods of this class will called on the CEF UI thread. /// public interface IDownloadHandler { /// /// 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). /// /// the ChromiumWebBrowser control /// The browser instance /// is the target download URL /// is the target method (GET, POST, etc) /// Return true to proceed with the download or false to cancel the download. bool CanDownload(IWebBrowser chromiumWebBrowser, IBrowser browser, string url, string requestMethod); /// /// Called before a download begins. /// /// the ChromiumWebBrowser control /// The browser instance /// Represents the file being downloaded. /// Callback interface used to asynchronously continue a download. /// Return true and execute 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). bool OnBeforeDownload(IWebBrowser chromiumWebBrowser, IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback); /// /// Called when a download's status or progress information has been updated. This may be called multiple times before and after . /// /// the ChromiumWebBrowser control /// The browser instance /// Represents the file being downloaded. /// The callback used to Cancel/Pause/Resume the process void OnDownloadUpdated(IWebBrowser chromiumWebBrowser, IBrowser browser, DownloadItem downloadItem, IDownloadItemCallback callback); } }