Commit 317c7b55 authored by Wenzhao Zang's avatar Wenzhao Zang Committed by Commit Bot

cros: Enable the new wallpaper picker to display images

The new wallpaper picker has two main differences with the old one:

1) The images are fetched from a different server (it's already
   implemented in backdrop_wallpaper_handlers).

2) The style changes. The general logic in *.js files are the same,
   so we prefer to reuse the existing code and add flag checks here and
   there. (We'll be able to clean up the code only used by the old
   picker when it's mature.)

Bug: 800945
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: Icf48369e86644046fee0f220a212661daefa495d
Reviewed-on: https://chromium-review.googlesource.com/898205Reviewed-by: default avatarAlexander Alekseev <alemate@chromium.org>
Commit-Queue: Wenzhao (Colin) Zang <wzang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#534252}
parent 72ab0795
...@@ -397,6 +397,11 @@ body.v2 { ...@@ -397,6 +397,11 @@ body.v2 {
.v2 #categories-list { .v2 #categories-list {
display: block; display: block;
height: 100%;
}
.v2 #categories-list > li {
height: 100%;
} }
.v2 #categories-list > li[selected] > div { .v2 #categories-list > li[selected] > div {
......
...@@ -92,6 +92,11 @@ ...@@ -92,6 +92,11 @@
*/ */
OnlineWallpaperThumbnailUrlSuffix: '_thumbnail.png', OnlineWallpaperThumbnailUrlSuffix: '_thumbnail.png',
/**
* The default layout of each wallpaper thumbnail.
*/
WallpaperThumbnailDefaultLayout: 'CENTER_CROPPED',
/** /**
* Wallpaper directory enum. * Wallpaper directory enum.
*/ */
......
...@@ -32,6 +32,8 @@ cr.define('wallpapers', function() { ...@@ -32,6 +32,8 @@ cr.define('wallpapers', function() {
el.dataModelId_ = dataModelId; el.dataModelId_ = dataModelId;
el.thumbnail_ = thumbnail; el.thumbnail_ = thumbnail;
el.callback_ = callback; el.callback_ = callback;
el.useNewWallpaperPicker_ =
loadTimeData.getBoolean('useNewWallpaperPicker');
return el; return el;
} }
...@@ -133,11 +135,10 @@ cr.define('wallpapers', function() { ...@@ -133,11 +135,10 @@ cr.define('wallpapers', function() {
self.dataItem.source == self.dataItem.source ==
Constants.WallpaperSourceEnum.Online) { Constants.WallpaperSourceEnum.Online) {
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.open( var urlSuffix = self.useNewWallpaperPicker_ ?
'GET', '' :
self.dataItem.baseURL + Constants.OnlineWallpaperThumbnailUrlSuffix;
Constants.OnlineWallpaperThumbnailUrlSuffix, xhr.open('GET', self.dataItem.baseURL + urlSuffix, true);
true);
xhr.responseType = 'arraybuffer'; xhr.responseType = 'arraybuffer';
xhr.send(null); xhr.send(null);
xhr.addEventListener('load', function(e) { xhr.addEventListener('load', function(e) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment