Add CefDownloadItem::GetOriginalUrl method (issue #1201).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1976 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2015-01-20 22:48:32 +00:00
parent 8a35083b8f
commit c71cae325f
7 changed files with 51 additions and 0 deletions

View File

@ -125,6 +125,13 @@ typedef struct _cef_download_item_t {
cef_string_userfree_t (CEF_CALLBACK *get_url)(
struct _cef_download_item_t* self);
///
// Returns the original URL before any redirections.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_original_url)(
struct _cef_download_item_t* self);
///
// Returns the suggested file name.
///

View File

@ -126,6 +126,12 @@ class CefDownloadItem : public virtual CefBase {
/*--cef()--*/
virtual CefString GetURL() =0;
///
// Returns the original URL before any redirections.
///
/*--cef()--*/
virtual CefString GetOriginalUrl() =0;
///
// Returns the suggested file name.
///

View File

@ -86,6 +86,11 @@ CefString CefDownloadItemImpl::GetURL() {
return const_value().GetURL().spec();
}
CefString CefDownloadItemImpl::GetOriginalUrl() {
CEF_VALUE_VERIFY_RETURN(false, CefString());
return const_value().GetOriginalUrl().spec();
}
CefString CefDownloadItemImpl::GetSuggestedFileName() {
CEF_VALUE_VERIFY_RETURN(false, CefString());
return const_value().GetSuggestedFilename();

View File

@ -33,6 +33,7 @@ class CefDownloadItemImpl
CefString GetFullPath() override;
uint32 GetId() override;
CefString GetURL() override;
CefString GetOriginalUrl() override;
CefString GetSuggestedFileName() override;
CefString GetContentDisposition() override;
CefString GetMimeType() override;

View File

@ -206,6 +206,21 @@ cef_string_userfree_t CEF_CALLBACK download_item_get_url(
return _retval.DetachToUserFree();
}
cef_string_userfree_t CEF_CALLBACK download_item_get_original_url(
struct _cef_download_item_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefString _retval = CefDownloadItemCppToC::Get(self)->GetOriginalUrl();
// Return type: string
return _retval.DetachToUserFree();
}
cef_string_userfree_t CEF_CALLBACK download_item_get_suggested_file_name(
struct _cef_download_item_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
@ -270,6 +285,7 @@ CefDownloadItemCppToC::CefDownloadItemCppToC(CefDownloadItem* cls)
struct_.struct_.get_full_path = download_item_get_full_path;
struct_.struct_.get_id = download_item_get_id;
struct_.struct_.get_url = download_item_get_url;
struct_.struct_.get_original_url = download_item_get_original_url;
struct_.struct_.get_suggested_file_name =
download_item_get_suggested_file_name;
struct_.struct_.get_content_disposition =

View File

@ -188,6 +188,21 @@ CefString CefDownloadItemCToCpp::GetURL() {
return _retvalStr;
}
CefString CefDownloadItemCToCpp::GetOriginalUrl() {
if (CEF_MEMBER_MISSING(struct_, get_original_url))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = struct_->get_original_url(struct_);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
CefString CefDownloadItemCToCpp::GetSuggestedFileName() {
if (CEF_MEMBER_MISSING(struct_, get_suggested_file_name))
return CefString();

View File

@ -46,6 +46,7 @@ class CefDownloadItemCToCpp
virtual CefString GetFullPath() OVERRIDE;
virtual uint32 GetId() OVERRIDE;
virtual CefString GetURL() OVERRIDE;
virtual CefString GetOriginalUrl() OVERRIDE;
virtual CefString GetSuggestedFileName() OVERRIDE;
virtual CefString GetContentDisposition() OVERRIDE;
virtual CefString GetMimeType() OVERRIDE;