Index: chrome/browser/extensions/api/downloads/downloads_api.cc |
diff --git a/chrome/browser/extensions/api/downloads/downloads_api.cc b/chrome/browser/extensions/api/downloads/downloads_api.cc |
index 0a297d2116bd4a67bd2bed82ea1b9fbfa9a1556f..4f62857c4596830e4bf2a0482820d49bbef795fe 100644 |
--- a/chrome/browser/extensions/api/downloads/downloads_api.cc |
+++ b/chrome/browser/extensions/api/downloads/downloads_api.cc |
@@ -172,6 +172,8 @@ const char kTotalBytesKey[] = "totalBytes"; |
const char kTotalBytesLessKey[] = "totalBytesLess"; |
const char kUrlKey[] = "url"; |
const char kUrlRegexKey[] = "urlRegex"; |
+const char kFinalUrlKey[] = "finalUrl"; |
+const char kFinalUrlRegexKey[] = "finalUrlRegex"; |
// Note: Any change to the danger type strings, should be accompanied by a |
// corresponding change to downloads.json. |
@@ -253,6 +255,9 @@ scoped_ptr<base::DictionaryValue> DownloadItemToJSON( |
json->SetInteger(kIdKey, download_item->GetId()); |
const GURL& url = download_item->GetOriginalUrl(); |
json->SetString(kUrlKey, (url.is_valid() ? url.spec() : std::string())); |
+ const GURL& finalUrl = download_item->GetURL(); |
+ json->SetString(kFinalUrlKey, |
+ (finalUrl.is_valid() ? finalUrl.spec() : std::string())); |
const GURL& referrer = download_item->GetReferrerUrl(); |
json->SetString(kReferrerUrlKey, (referrer.is_valid() ? referrer.spec() |
: std::string())); |
@@ -376,6 +381,8 @@ void InitFilterTypeMap(FilterTypeMap* filter_types_ptr) { |
filter_types[kTotalBytesLessKey] = DownloadQuery::FILTER_TOTAL_BYTES_LESS; |
filter_types[kUrlKey] = DownloadQuery::FILTER_URL; |
filter_types[kUrlRegexKey] = DownloadQuery::FILTER_URL_REGEX; |
+ filter_types[kFinalUrlKey] = DownloadQuery::FILTER_FINAL_URL; |
+ filter_types[kFinalUrlRegexKey] = DownloadQuery::FILTER_FINAL_URL_REGEX; |
} |
typedef base::hash_map<std::string, DownloadQuery::SortType> SortTypeMap; |
@@ -393,6 +400,7 @@ void InitSortTypeMap(SortTypeMap* sorter_types_ptr) { |
sorter_types[kStateKey] = DownloadQuery::SORT_STATE; |
sorter_types[kTotalBytesKey] = DownloadQuery::SORT_TOTAL_BYTES; |
sorter_types[kUrlKey] = DownloadQuery::SORT_URL; |
+ sorter_types[kFinalUrlKey] = DownloadQuery::SORT_FINAL_URL; |
} |
bool IsNotTemporaryDownloadFilter(const DownloadItem& download_item) { |
@@ -905,6 +913,7 @@ bool InvalidId(DownloadItem* valid_item, std::string* message_out) { |
bool IsDownloadDeltaField(const std::string& field) { |
return ((field == kUrlKey) || |
+ (field == kFinalUrlKey) || |
(field == kFilenameKey) || |
(field == kDangerKey) || |
(field == kMimeKey) || |