[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/android/java_sources.gni b/chrome/android/java_sources.gni
index caeb4c9..cf7f2ce 100644
--- a/chrome/android/java_sources.gni
+++ b/chrome/android/java_sources.gni
@@ -327,6 +327,8 @@
"java/src/org/chromium/chrome/browser/download/ui/DownloadManagerToolbar.java",
"java/src/org/chromium/chrome/browser/download/ui/FilterAdapter.java",
"java/src/org/chromium/chrome/browser/download/ui/SpaceDisplay.java",
+ "java/src/org/chromium/chrome/browser/download/ui/ThumbnailProvider.java",
+ "java/src/org/chromium/chrome/browser/download/ui/ThumbnailProviderImpl.java",
"java/src/org/chromium/chrome/browser/externalauth/ExternalAuthUtils.java",
"java/src/org/chromium/chrome/browser/externalauth/UserRecoverableErrorHandler.java",
"java/src/org/chromium/chrome/browser/externalauth/VerifiedHandler.java",