JBCefClient (@NotNull CefDownloadHandler handler, @NotNull CefBrowser browser) { return myDownloadHandler.add(handler, browser, () -> { myCefClient.addDownloadHandler(new CefDownloadHandler() { @Override public void onBeforeDownload(CefBrowser browser, CefDownloadItem downloadItem, String suggestedName, CefBeforeDownloadCallback callback) { myDownloadHandler.handle(browser, handler -> { handler.onBeforeDownload(browser, downloadItem, suggestedName, callback); }); } @Override public void onDownloadUpdated(CefBrowser browser, CefDownloadItem downloadItem, CefDownloadItemCallback callback) { myDownloadHandler.handle(browser, handler -> { handler.onDownloadUpdated(browser, downloadItem, callback); }); } }); }); }