Index: chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_images_grid.js |
diff --git a/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_images_grid.js b/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_images_grid.js |
index cb42b166e915e4dfae5bc026cf1277da84f886e9..91bd38dc8ee4eca5711a8c011e287f4e476bf11d 100644 |
--- a/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_images_grid.js |
+++ b/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_images_grid.js |
@@ -32,11 +32,19 @@ cr.define('wallpapers', function() { |
decorate: function() { |
GridItem.prototype.decorate.call(this); |
var imageEl = cr.doc.createElement('img'); |
- // Thumbnail |
- imageEl.src = this.dataItem.baseURL + ThumbnailSuffix; |
- // Remove any garbage added by GridItem and ListItem decorators. |
- this.textContent = ''; |
- this.appendChild(imageEl); |
+ var xhr = new XMLHttpRequest(); |
+ xhr.open('GET', this.dataItem.baseURL + ThumbnailSuffix, true); |
Mihai Parparita -not on Chrome
2012/10/12 00:48:47
What is the base URL in this case? We generally ar
bshe
2012/10/12 16:28:30
The base URL is a online url. https://storage.goog
|
+ xhr.responseType = 'blob'; |
+ xhr.send(null); |
+ var self = this; |
+ xhr.addEventListener('load', function(e) { |
+ if (xhr.status === 200) { |
+ self.textContent = ''; |
+ imageEl.src = window.URL.createObjectURL(xhr.response); |
Mihai Parparita -not on Chrome
2012/10/12 00:48:47
This will leak the URL, you'll need to call revoke
bshe
2012/10/12 16:28:30
I saw examples of revoke object after load. After
|
+ self.appendChild(imageEl); |
+ } |
+ //TODO(bshe): Add error handleing. |
+ }); |
}, |
}; |