| Index: chrome/android/java/src/org/chromium/chrome/browser/download/ui/BackendItems.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/ui/BackendItems.java b/chrome/android/java/src/org/chromium/chrome/browser/download/ui/BackendItems.java
|
| index 18d6b1a26521fc550a64882634e5c962520d5c1b..eea1dee37f5438d832ba5a8e00065a3c3b9cf30f 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/download/ui/BackendItems.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/download/ui/BackendItems.java
|
| @@ -7,6 +7,7 @@ package org.chromium.chrome.browser.download.ui;
|
| import android.text.TextUtils;
|
|
|
| import java.util.ArrayList;
|
| +import java.util.Locale;
|
|
|
| /**
|
| * Stores a List of DownloadHistoryItemWrappers for a particular download backend.
|
| @@ -32,7 +33,6 @@ public abstract class BackendItems extends ArrayList<DownloadHistoryItemWrapper>
|
|
|
| /**
|
| * Filters out items that are displayed in this list for the current filter.
|
| - * TODO(dfalcantara): Show all non-cancelled downloads.
|
| *
|
| * @param filterType Filter to use.
|
| * @param filteredItems List for appending items that match the filter.
|
| @@ -44,6 +44,24 @@ public abstract class BackendItems extends ArrayList<DownloadHistoryItemWrapper>
|
| }
|
|
|
| /**
|
| + * Filters out items that match the query and are displayed in this list for the current filter.
|
| + * @param filterType Filter to use.
|
| + * @param query The text to match.
|
| + * @param filteredItems List for appending items that match the filter.
|
| + */
|
| + public void filter(int filterType, String query, BackendItems filteredItems) {
|
| + for (DownloadHistoryItemWrapper item : this) {
|
| + query = query.toLowerCase(Locale.getDefault());
|
| + Locale locale = Locale.getDefault();
|
| + if (item.isVisibleToUser(filterType)
|
| + && (item.getDisplayHostname().toLowerCase(locale).contains(query)
|
| + || item.getDisplayFileName().toLowerCase(locale).contains(query))) {
|
| + filteredItems.add(item);
|
| + }
|
| + }
|
| + }
|
| +
|
| + /**
|
| * Search for an existing entry with the given ID.
|
| * @param guid GUID of the entry.
|
| * @return The index of the item, or INVALID_INDEX if it couldn't be found.
|
|
|