| Index: chrome/browser/download/download_query.cc
|
| diff --git a/chrome/browser/download/download_query.cc b/chrome/browser/download/download_query.cc
|
| index 415b622dd9984172b090aa14c260050d7d23eba1..7e6ce7f6b908d3ac73c7db83f83c1833de6c9bcf 100644
|
| --- a/chrome/browser/download/download_query.cc
|
| +++ b/chrome/browser/download/download_query.cc
|
| @@ -69,6 +69,35 @@
|
| // The next several functions are helpers for making Callbacks that access
|
| // DownloadItem fields.
|
|
|
| +static bool MatchesQuery(
|
| + const std::vector<base::string16>& query_terms,
|
| + const DownloadItem& item) {
|
| + DCHECK(!query_terms.empty());
|
| + base::string16 url_raw(base::UTF8ToUTF16(item.GetOriginalUrl().spec()));
|
| + base::string16 url_formatted = url_raw;
|
| + if (item.GetBrowserContext()) {
|
| + Profile* profile = Profile::FromBrowserContext(item.GetBrowserContext());
|
| + url_formatted = url_formatter::FormatUrl(
|
| + item.GetOriginalUrl(),
|
| + profile->GetPrefs()->GetString(prefs::kAcceptLanguages));
|
| + }
|
| + base::string16 path(item.GetTargetFilePath().LossyDisplayName());
|
| +
|
| + for (std::vector<base::string16>::const_iterator it = query_terms.begin();
|
| + it != query_terms.end(); ++it) {
|
| + base::string16 term = base::i18n::ToLower(*it);
|
| + if (!base::i18n::StringSearchIgnoringCaseAndAccents(
|
| + term, url_raw, NULL, NULL) &&
|
| + !base::i18n::StringSearchIgnoringCaseAndAccents(
|
| + term, url_formatted, NULL, NULL) &&
|
| + !base::i18n::StringSearchIgnoringCaseAndAccents(
|
| + term, path, NULL, NULL)) {
|
| + return false;
|
| + }
|
| + }
|
| + return true;
|
| +}
|
| +
|
| static int64 GetStartTimeMsEpoch(const DownloadItem& item) {
|
| return (item.GetStartTime() - base::Time::UnixEpoch()).InMilliseconds();
|
| }
|
| @@ -207,37 +236,6 @@
|
| }
|
|
|
| } // anonymous namespace
|
| -
|
| -// static
|
| -bool DownloadQuery::MatchesQuery(const std::vector<base::string16>& query_terms,
|
| - const DownloadItem& item) {
|
| - if (query_terms.empty())
|
| - return true;
|
| -
|
| - base::string16 url_raw(base::UTF8ToUTF16(item.GetOriginalUrl().spec()));
|
| - base::string16 url_formatted = url_raw;
|
| - if (item.GetBrowserContext()) {
|
| - Profile* profile = Profile::FromBrowserContext(item.GetBrowserContext());
|
| - url_formatted = url_formatter::FormatUrl(
|
| - item.GetOriginalUrl(),
|
| - profile->GetPrefs()->GetString(prefs::kAcceptLanguages));
|
| - }
|
| - base::string16 path(item.GetTargetFilePath().LossyDisplayName());
|
| -
|
| - for (std::vector<base::string16>::const_iterator it = query_terms.begin();
|
| - it != query_terms.end(); ++it) {
|
| - base::string16 term = base::i18n::ToLower(*it);
|
| - if (!base::i18n::StringSearchIgnoringCaseAndAccents(
|
| - term, url_raw, NULL, NULL) &&
|
| - !base::i18n::StringSearchIgnoringCaseAndAccents(
|
| - term, url_formatted, NULL, NULL) &&
|
| - !base::i18n::StringSearchIgnoringCaseAndAccents(
|
| - term, path, NULL, NULL)) {
|
| - return false;
|
| - }
|
| - }
|
| - return true;
|
| -}
|
|
|
| DownloadQuery::DownloadQuery() : limit_(kuint32max), skip_(0U) {}
|
| DownloadQuery::~DownloadQuery() {}
|
|
|