[go: nahoru, domu]

cros: Add function for getting current wallpaper thumbnail

We need to show the thumbnail of the currently set wallpaper
in the new wallpaper picker. The picker can't locate the
thumbnail data if:

1) The wallpaper was set from third-party wallpaper apps, because they
may not generate thumbnails for their wallpapers.

2) An online wallpaper from the old wallpaper picker is getting synced
to the device with the new picker, in which case the old wallpaper
thumbnail has never been saved to local file system.

The most fault-tolerant way to fix this is to create an extension
function to generate the thumbnail of the current wallpaper image.
Since the |ImageSkia| is passed with a shared buffer via mojo, and the
thumbnail size is small, it's expected to be fast.

Note there're various "generate thumbnail" functions in the legacy
code, and we'll be able to clean up some of them:

1) The |generateThumbnail| for custom wallpapers. We can remove this
   since the new picker does not need this.
2) The generate/save thumbnail methods for online wallpapers. It's not
   strictly necessary for the new picker, but when the device is
   offline, this will enable users to see a black-white version of the
   wallpapers. So this part needs UX decision.

Bug: 834873
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: Ia837a5dc0ad60a1c587cc515c023077bf78e5834
Reviewed-on: https://chromium-review.googlesource.com/1030782
Reviewed-by: Toni Barzic <tbarzic@chromium.org>
Reviewed-by: Gayane Petrosyan <gayane@chromium.org>
Reviewed-by: Xiaoqian Dai <xdai@chromium.org>
Commit-Queue: Wenzhao (Colin) Zang <wzang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555072}
6 files changed