Exemple #1
0
        // void (*)(_cef_download_handler_t* self, _cef_browser_t* browser, _cef_download_item_t* download_item, const cef_string_t* suggested_name, _cef_before_download_callback_t* callback)*
        private static unsafe void OnBeforeDownloadImpl(cef_download_handler_t *self, cef_browser_t *browser, cef_download_item_t *download_item, cef_string_t *suggested_name, cef_before_download_callback_t *callback)
        {
            var instance = GetInstance((IntPtr)self) as CefDownloadHandler;

            if (instance == null || ((ICefDownloadHandlerPrivate)instance).AvoidOnBeforeDownload())
            {
                ReleaseIfNonNull((cef_base_ref_counted_t *)browser);
                ReleaseIfNonNull((cef_base_ref_counted_t *)download_item);
                ReleaseIfNonNull((cef_base_ref_counted_t *)callback);
                return;
            }
            instance.OnBeforeDownload(CefBrowser.Wrap(CefBrowser.Create, browser), CefDownloadItem.Wrap(CefDownloadItem.Create, download_item), CefString.Read(suggested_name), CefBeforeDownloadCallback.Wrap(CefBeforeDownloadCallback.Create, callback));
        }
Exemple #2
0
 /// <summary>
 /// 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 function to continue the
 /// download if desired. Do not keep a reference to |download_item| outside of
 /// this function.
 /// </summary>
 protected internal unsafe virtual void OnBeforeDownload(CefBrowser browser, CefDownloadItem downloadItem, string suggestedName, CefBeforeDownloadCallback callback)
 {
 }