[Android TRM] Fold ThumbnailProvider into UrlImageProvider.
TabResumptionTileContainerView.loadLocalTabSingle() uses
ThumbnailProvider.getTabThumbnailWithCallback() to get a thumbnail.
Previously there was much plumbing to get ThumbnailProvider to where it
gets used, including storing it as property THUMBNAIL_PROVIDER.
However, UrlImageProvider (property URL_IMAGE_PROVIDER) already provides
other images: {favicon, large icon, fallbacks}. Although thumbnails are
keyed by tab ID and not URL, getting UrlImageProvider to provide these
is not a large departure, and can reduce plumbing.
This CL folds ThumbnailProvider into UrlImageProvider to simplify code,
and applies adjacent restructuring.
Details:
* Remove ThumbnailProvider plumbing: Builder -> Coordinator -> Mediator
-> Property THUMBNAIL_PROVIDER -> Binder -> View -> ContainerView.
* UrlImageProvider.UrlImageSource:
* Add createThumbnailProvider().
* Move implementation to new file UrlImageSourceImpl.java.
* createThumbnailProvider(): Take from Builder.
* UrlImageProvider:
* Remove inline instantiation of UrlImageSource; update Builder to
instantiate UrlImageSourceImpl and pass into UrlImageProvider.
* Add getTabThumbnail(), with param simplified by passing default
values to getTabThumbnailWithCallback().
Unit tests:
* TabResumptionModuleSuggestionsUnitTest.testUrlImageProvider(): Add
cases for thumbnails. Using doAnswer() to inject expected thumbnail.
* Add UrlImageSourceImplUnitTest with 1 cursory test for coverage.
Bug: 339269597
Change-Id: I401976dfb50195b46d5ae31ebc55c92fbdf8f6cc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5544868
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Commit-Queue: Samuel Huang <huangs@chromium.org>
Reviewed-by: Xi Han <hanxi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1305141}
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
To check out the source code locally, don't use git clone! Instead, follow the instructions on how to get the code.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure.
For historical reasons, there are some small top level directories. Now the guidance is that new top level directories are for product (e.g. Chrome, Android WebView, Ash). Even if these products have multiple executables, the code should be in subdirectories of the product.
If you found a bug, please file it at https://crbug.com/new.