mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
- Add download handling support via new CefDownloadHandler and CefDownloadItem interfaces (issue #516).
- Fix setting of CefKeyEvent.focus_on_editable_field when the underlying RenderViewHost changes. - Fix potential crash if URLRequest objects are still in-progress upon shutdown. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@715 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@ -67,6 +67,13 @@ typedef struct _cef_client_t {
|
||||
struct _cef_display_handler_t* (CEF_CALLBACK *get_display_handler)(
|
||||
struct _cef_client_t* self);
|
||||
|
||||
///
|
||||
// Return the handler for download events. If no handler is returned downloads
|
||||
// will not be allowed.
|
||||
///
|
||||
struct _cef_download_handler_t* (CEF_CALLBACK *get_download_handler)(
|
||||
struct _cef_client_t* self);
|
||||
|
||||
///
|
||||
// Return the handler for focus events.
|
||||
///
|
||||
|
124
include/capi/cef_download_handler_capi.h
Normal file
124
include/capi/cef_download_handler_capi.h
Normal file
@ -0,0 +1,124 @@
|
||||
// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool and should not edited
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_DOWNLOAD_HANDLER_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_DOWNLOAD_HANDLER_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
|
||||
|
||||
///
|
||||
// Callback structure used to asynchronously continue a download.
|
||||
///
|
||||
typedef struct _cef_before_download_callback_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_t base;
|
||||
|
||||
///
|
||||
// Call to continue the download. Set |download_path| to the full file path
|
||||
// for the download including the file name or leave blank to use the
|
||||
// suggested name and the default temp directory. Set |show_dialog| to true
|
||||
// (1) if you do wish to show the default "Save As" dialog.
|
||||
///
|
||||
void (CEF_CALLBACK *cont)(struct _cef_before_download_callback_t* self,
|
||||
const cef_string_t* download_path, int show_dialog);
|
||||
} cef_before_download_callback_t;
|
||||
|
||||
|
||||
///
|
||||
// Callback structure used to asynchronously cancel a download.
|
||||
///
|
||||
typedef struct _cef_download_item_callback_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_t base;
|
||||
|
||||
///
|
||||
// Call to cancel the download.
|
||||
///
|
||||
void (CEF_CALLBACK *cancel)(struct _cef_download_item_callback_t* self);
|
||||
} cef_download_item_callback_t;
|
||||
|
||||
|
||||
///
|
||||
// Structure used to handle file downloads. The functions of this structure will
|
||||
// called on the browser process UI thread.
|
||||
///
|
||||
typedef struct _cef_download_handler_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_t base;
|
||||
|
||||
///
|
||||
// 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.
|
||||
///
|
||||
void (CEF_CALLBACK *on_before_download)(struct _cef_download_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_download_item_t* download_item,
|
||||
const cef_string_t* suggested_name,
|
||||
struct _cef_before_download_callback_t* callback);
|
||||
|
||||
///
|
||||
// Called when a download's status or progress information has been updated.
|
||||
// Execute |callback| either asynchronously or in this function to cancel the
|
||||
// download if desired. Do not keep a reference to |download_item| outside of
|
||||
// this function.
|
||||
///
|
||||
void (CEF_CALLBACK *on_download_updated)(struct _cef_download_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_download_item_t* download_item,
|
||||
struct _cef_download_item_callback_t* callback);
|
||||
} cef_download_handler_t;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_DOWNLOAD_HANDLER_CAPI_H_
|
162
include/capi/cef_download_item_capi.h
Normal file
162
include/capi/cef_download_item_capi.h
Normal file
@ -0,0 +1,162 @@
|
||||
// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool and should not edited
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_DOWNLOAD_ITEM_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_DOWNLOAD_ITEM_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
|
||||
|
||||
///
|
||||
// Structure used to represent a download item.
|
||||
///
|
||||
typedef struct _cef_download_item_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_t base;
|
||||
|
||||
///
|
||||
// Returns true (1) if this object is valid. Do not call any other functions
|
||||
// if this function returns false (0).
|
||||
///
|
||||
int (CEF_CALLBACK *is_valid)(struct _cef_download_item_t* self);
|
||||
|
||||
///
|
||||
// Returns true (1) if the download is in progress.
|
||||
///
|
||||
int (CEF_CALLBACK *is_in_progress)(struct _cef_download_item_t* self);
|
||||
|
||||
///
|
||||
// Returns true (1) if the download is complete.
|
||||
///
|
||||
int (CEF_CALLBACK *is_complete)(struct _cef_download_item_t* self);
|
||||
|
||||
///
|
||||
// Returns true (1) if the download has been canceled or interrupted.
|
||||
///
|
||||
int (CEF_CALLBACK *is_canceled)(struct _cef_download_item_t* self);
|
||||
|
||||
///
|
||||
// Returns a simple speed estimate in bytes/s.
|
||||
///
|
||||
int64 (CEF_CALLBACK *get_current_speed)(struct _cef_download_item_t* self);
|
||||
|
||||
///
|
||||
// Returns the rough percent complete or -1 if the receive total size is
|
||||
// unknown.
|
||||
///
|
||||
int (CEF_CALLBACK *get_percent_complete)(struct _cef_download_item_t* self);
|
||||
|
||||
///
|
||||
// Returns the total number of bytes.
|
||||
///
|
||||
int64 (CEF_CALLBACK *get_total_bytes)(struct _cef_download_item_t* self);
|
||||
|
||||
///
|
||||
// Returns the number of received bytes.
|
||||
///
|
||||
int64 (CEF_CALLBACK *get_received_bytes)(struct _cef_download_item_t* self);
|
||||
|
||||
///
|
||||
// Returns the time that the download started.
|
||||
///
|
||||
cef_time_t (CEF_CALLBACK *get_start_time)(struct _cef_download_item_t* self);
|
||||
|
||||
///
|
||||
// Returns the time that the download ended.
|
||||
///
|
||||
cef_time_t (CEF_CALLBACK *get_end_time)(struct _cef_download_item_t* self);
|
||||
|
||||
///
|
||||
// Returns the full path to the downloaded or downloading file.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t (CEF_CALLBACK *get_full_path)(
|
||||
struct _cef_download_item_t* self);
|
||||
|
||||
///
|
||||
// Returns the unique identifier for this download.
|
||||
///
|
||||
int32 (CEF_CALLBACK *get_id)(struct _cef_download_item_t* self);
|
||||
|
||||
///
|
||||
// Returns the URL.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t (CEF_CALLBACK *get_url)(
|
||||
struct _cef_download_item_t* self);
|
||||
|
||||
///
|
||||
// Returns the suggested file name.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t (CEF_CALLBACK *get_suggested_file_name)(
|
||||
struct _cef_download_item_t* self);
|
||||
|
||||
///
|
||||
// Returns the content disposition.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t (CEF_CALLBACK *get_content_disposition)(
|
||||
struct _cef_download_item_t* self);
|
||||
|
||||
///
|
||||
// Returns the mime type.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t (CEF_CALLBACK *get_mime_type)(
|
||||
struct _cef_download_item_t* self);
|
||||
|
||||
///
|
||||
// Returns the referrer character set.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t (CEF_CALLBACK *get_referrer_charset)(
|
||||
struct _cef_download_item_t* self);
|
||||
} cef_download_item_t;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_DOWNLOAD_ITEM_CAPI_H_
|
@ -41,6 +41,7 @@
|
||||
#include "include/cef_base.h"
|
||||
#include "include/cef_context_menu_handler.h"
|
||||
#include "include/cef_display_handler.h"
|
||||
#include "include/cef_download_handler.h"
|
||||
#include "include/cef_focus_handler.h"
|
||||
#include "include/cef_geolocation_handler.h"
|
||||
#include "include/cef_jsdialog_handler.h"
|
||||
@ -73,6 +74,15 @@ class CefClient : public virtual CefBase {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
///
|
||||
// Return the handler for download events. If no handler is returned downloads
|
||||
// will not be allowed.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefDownloadHandler> GetDownloadHandler() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
///
|
||||
// Return the handler for focus events.
|
||||
///
|
||||
|
111
include/cef_download_handler.h
Normal file
111
include/cef_download_handler.h
Normal file
@ -0,0 +1,111 @@
|
||||
// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// The contents of this file must follow a specific format in order to
|
||||
// support the CEF translator tool. See the translator.README.txt file in the
|
||||
// tools directory for more information.
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CEF_DOWNLOAD_HANDLER_H_
|
||||
#define CEF_INCLUDE_CEF_DOWNLOAD_HANDLER_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_base.h"
|
||||
#include "include/cef_browser.h"
|
||||
#include "include/cef_download_item.h"
|
||||
|
||||
|
||||
///
|
||||
// Callback interface used to asynchronously continue a download.
|
||||
///
|
||||
/*--cef(source=library)--*/
|
||||
class CefBeforeDownloadCallback : public virtual CefBase {
|
||||
public:
|
||||
///
|
||||
// Call to continue the download. Set |download_path| to the full file path
|
||||
// for the download including the file name or leave blank to use the
|
||||
// suggested name and the default temp directory. Set |show_dialog| to true
|
||||
// if you do wish to show the default "Save As" dialog.
|
||||
///
|
||||
/*--cef(capi_name=cont)--*/
|
||||
virtual void Continue(const CefString& download_path, bool show_dialog) =0;
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
// Callback interface used to asynchronously cancel a download.
|
||||
///
|
||||
/*--cef(source=library)--*/
|
||||
class CefDownloadItemCallback : public virtual CefBase {
|
||||
public:
|
||||
///
|
||||
// Call to cancel the download.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void Cancel() =0;
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
// Class used to handle file downloads. The methods of this class will called
|
||||
// on the browser process UI thread.
|
||||
///
|
||||
/*--cef(source=client)--*/
|
||||
class CefDownloadHandler : public virtual CefBase {
|
||||
public:
|
||||
///
|
||||
// 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.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnBeforeDownload(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefDownloadItem> download_item,
|
||||
const CefString& suggested_name,
|
||||
CefRefPtr<CefBeforeDownloadCallback> callback) =0;
|
||||
|
||||
///
|
||||
// Called when a download's status or progress information has been updated.
|
||||
// Execute |callback| either asynchronously or in this method to cancel the
|
||||
// download if desired. Do not keep a reference to |download_item| outside of
|
||||
// this method.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnDownloadUpdated(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefDownloadItem> download_item,
|
||||
CefRefPtr<CefDownloadItemCallback> callback) {}
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_DOWNLOAD_HANDLER_H_
|
154
include/cef_download_item.h
Normal file
154
include/cef_download_item.h
Normal file
@ -0,0 +1,154 @@
|
||||
// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// The contents of this file must follow a specific format in order to
|
||||
// support the CEF translator tool. See the translator.README.txt file in the
|
||||
// tools directory for more information.
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CEF_DOWNLOAD_ITEM_H_
|
||||
#define CEF_INCLUDE_CEF_DOWNLOAD_ITEM_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_base.h"
|
||||
|
||||
///
|
||||
// Class used to represent a download item.
|
||||
///
|
||||
/*--cef(source=library)--*/
|
||||
class CefDownloadItem : public virtual CefBase {
|
||||
public:
|
||||
///
|
||||
// Returns true if this object is valid. Do not call any other methods if this
|
||||
// function returns false.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool IsValid() =0;
|
||||
|
||||
///
|
||||
// Returns true if the download is in progress.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool IsInProgress() =0;
|
||||
|
||||
///
|
||||
// Returns true if the download is complete.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool IsComplete() =0;
|
||||
|
||||
///
|
||||
// Returns true if the download has been canceled or interrupted.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool IsCanceled() =0;
|
||||
|
||||
///
|
||||
// Returns a simple speed estimate in bytes/s.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual int64 GetCurrentSpeed() =0;
|
||||
|
||||
///
|
||||
// Returns the rough percent complete or -1 if the receive total size is
|
||||
// unknown.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual int GetPercentComplete() =0;
|
||||
|
||||
///
|
||||
// Returns the total number of bytes.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual int64 GetTotalBytes() =0;
|
||||
|
||||
///
|
||||
// Returns the number of received bytes.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual int64 GetReceivedBytes() =0;
|
||||
|
||||
///
|
||||
// Returns the time that the download started.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefTime GetStartTime() =0;
|
||||
|
||||
///
|
||||
// Returns the time that the download ended.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefTime GetEndTime() =0;
|
||||
|
||||
///
|
||||
// Returns the full path to the downloaded or downloading file.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefString GetFullPath() =0;
|
||||
|
||||
///
|
||||
// Returns the unique identifier for this download.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual int32 GetId() =0;
|
||||
|
||||
///
|
||||
// Returns the URL.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefString GetURL() =0;
|
||||
|
||||
///
|
||||
// Returns the suggested file name.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefString GetSuggestedFileName() =0;
|
||||
|
||||
///
|
||||
// Returns the content disposition.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefString GetContentDisposition() =0;
|
||||
|
||||
///
|
||||
// Returns the mime type.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefString GetMimeType() =0;
|
||||
|
||||
///
|
||||
// Returns the referrer character set.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefString GetReferrerCharset() =0;
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_DOWNLOAD_ITEM_H_
|
Reference in New Issue
Block a user