[Download Home] Add image thumbnail support
First pass at making a basic thumbnail cache for Download Home.
Still a little janky, but that can be fixed once the skeleton is
in.
Screenshot that enforces that the biggest size is at least X and then crops out the rest:
https://drive.google.com/open?id=0B7c8ZkXVwskDN2FTTmEwOVdWekE
* Add a new ThumbnailProvider[Impl] class that produces thumbnails
for files displayed in Download Home.
- The Java ThumbnailProviderImpl maintains a queue of thumbnail
requests to process and a cache of thumbnails that have already
been processed.
- The native ThumbnailProvider uses the ImageDecoder class to
resize images in the utility process into bite-sized thumbnails
for display. It is owned by the Java class.
- Thumbnails are retrieved asynchronously and sent back via a
callback in ThumbnailRequest.
- The LRU thumbnail cache is statically shared amongst all
instances of the ThumbnailProviderImpl and is garbage collected
whenever Android deems necessary. It's capped at 5 MB to
prevent the cache size from spiralling out of control.
* DownloadManagerUi now maintains a ThumbnailProviderImpl in its
BackendProvider and destroys it when necessary.
* DownloadHistoryAdapter's ItemViewHolder now implements
ThumbnailRequest, which lets it update any ImageViews that have
placeholders for the thumbnails.
X Tests are still forthcoming. Want to make sure the class looks
like it makes sense before writing them.
BUG=616324
TBR=sky
Review-Url: https://codereview.chromium.org/2294983002
Cr-Commit-Position: refs/heads/master@{#415836}
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index b88e838..2a8c743c 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -3008,6 +3008,8 @@
"android/download/download_overwrite_infobar_delegate.h",
"android/download/mock_download_controller.cc",
"android/download/mock_download_controller.h",
+ "android/download/ui/thumbnail_provider.cc",
+ "android/download/ui/thumbnail_provider.h",
"android/favicon_helper.cc",
"android/favicon_helper.h",
"android/feature_utilities.cc",
@@ -3750,6 +3752,7 @@
"../android/java/src/org/chromium/chrome/browser/download/ChromeDownloadDelegate.java",
"../android/java/src/org/chromium/chrome/browser/download/DownloadController.java",
"../android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java",
+ "../android/java/src/org/chromium/chrome/browser/download/ui/ThumbnailProviderImpl.java",
"../android/java/src/org/chromium/chrome/browser/favicon/FaviconHelper.java",
"../android/java/src/org/chromium/chrome/browser/favicon/LargeIconBridge.java",
"../android/java/src/org/chromium/chrome/browser/feedback/ConnectivityChecker.java",