Index: chrome/browser/download/download_query.cc |
diff --git a/chrome/browser/download/download_query.cc b/chrome/browser/download/download_query.cc |
index f562ad8b8ff647591a83eafdad420e80cd5dd352..77416b727c0e8ceec0c28c74fc1e0230d3d5c426 100644 |
--- a/chrome/browser/download/download_query.cc |
+++ b/chrome/browser/download/download_query.cc |
@@ -120,6 +120,10 @@ static std::string GetUrl(const DownloadItem& item) { |
return item.GetOriginalUrl().spec(); |
} |
+static std::string GetFinalUrl(const DownloadItem& item) { |
asanka
2016/02/18 15:32:27
"static" unnecessary for functions defined within
|
+ return item.GetURL().spec(); |
+} |
+ |
static DownloadItem::DownloadState GetState(const DownloadItem& item) { |
return item.GetState(); |
} |
@@ -219,11 +223,15 @@ bool DownloadQuery::MatchesQuery(const std::vector<base::string16>& query_terms, |
base::string16 url_raw(base::UTF8ToUTF16(item.GetOriginalUrl().spec())); |
base::string16 url_formatted = url_raw; |
+ base::string16 final_url_raw(base::UTF8ToUTF16(item.GetURL().spec())); |
+ base::string16 final_url_formatted = final_url_raw; |
if (item.GetBrowserContext()) { |
Profile* profile = Profile::FromBrowserContext(item.GetBrowserContext()); |
url_formatted = url_formatter::FormatUrl( |
item.GetOriginalUrl(), |
profile->GetPrefs()->GetString(prefs::kAcceptLanguages)); |
+ final_url_formatted = url_formatter::FormatUrl( |
+ item.GetURL(), profile->GetPrefs()->GetString(prefs::kAcceptLanguages)); |
} |
base::string16 path(item.GetTargetFilePath().LossyDisplayName()); |
@@ -235,6 +243,10 @@ bool DownloadQuery::MatchesQuery(const std::vector<base::string16>& query_terms, |
!base::i18n::StringSearchIgnoringCaseAndAccents( |
term, url_formatted, NULL, NULL) && |
!base::i18n::StringSearchIgnoringCaseAndAccents( |
+ term, final_url_raw, NULL, NULL) && |
+ !base::i18n::StringSearchIgnoringCaseAndAccents( |
+ term, final_url_formatted, NULL, NULL) && |
+ !base::i18n::StringSearchIgnoringCaseAndAccents( |
term, path, NULL, NULL)) { |
return false; |
} |
@@ -311,6 +323,10 @@ bool DownloadQuery::AddFilter(DownloadQuery::FilterType type, |
return AddFilter(BuildFilter<std::string>(value, EQ, &GetUrl)); |
case FILTER_URL_REGEX: |
return AddFilter(BuildRegexFilter(value, &GetUrl)); |
+ case FILTER_FINAL_URL: |
+ return AddFilter(BuildFilter<std::string>(value, EQ, &GetFinalUrl)); |
+ case FILTER_FINAL_URL_REGEX: |
+ return AddFilter(BuildRegexFilter(value, &GetFinalUrl)); |
} |
return false; |
} |
@@ -400,6 +416,9 @@ void DownloadQuery::AddSorter(DownloadQuery::SortType type, |
case SORT_URL: |
sorters_.push_back(Sorter::Build<std::string>(direction, &GetUrl)); |
break; |
+ case SORT_FINAL_URL: |
+ sorters_.push_back(Sorter::Build<std::string>(direction, &GetFinalUrl)); |
+ break; |
case SORT_FILENAME: |
sorters_.push_back( |
Sorter::Build<base::string16>(direction, &GetFilename)); |