Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Unified Diff: ui/file_manager/file_manager/foreground/js/thumbnail_loader.js

Issue 823593006: Move util.loadImage and util.cancelLoadImage to thumbnail_loader.js. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix error function. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/file_manager/file_manager/common/js/util.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/file_manager/foreground/js/thumbnail_loader.js
diff --git a/ui/file_manager/file_manager/foreground/js/thumbnail_loader.js b/ui/file_manager/file_manager/foreground/js/thumbnail_loader.js
index 16ef96572810493193f4ed86c02f47b43f83694d..a9fa132e7fdf0867a45f8ccd8ce1b2b349188e6c 100644
--- a/ui/file_manager/file_manager/foreground/js/thumbnail_loader.js
+++ b/ui/file_manager/file_manager/foreground/js/thumbnail_loader.js
@@ -183,14 +183,20 @@ ThumbnailLoader.prototype.load = function(box, fillMode, opt_optimizationMode,
this.metadata_.filesystem &&
this.metadata_.filesystem.modificationTime &&
this.metadata_.filesystem.modificationTime.getTime();
- this.taskId_ = util.loadImage(
- this.image_,
+ this.taskId_ = ImageLoaderClient.loadToImage(
this.thumbnailUrl_,
- { maxWidth: ThumbnailLoader.THUMBNAIL_MAX_WIDTH,
+ this.image_,
+ {
+ maxWidth: ThumbnailLoader.THUMBNAIL_MAX_WIDTH,
maxHeight: ThumbnailLoader.THUMBNAIL_MAX_HEIGHT,
cache: true,
priority: this.priority_,
- timestamp: modificationTime },
+ timestamp: modificationTime
+ },
+ function() {},
+ function() {
+ this.image_.onerror(new Event('load-error'));
+ }.bind(this),
function() {
if (opt_optimizationMode ==
ThumbnailLoader.OptimizationMode.DISCARD_DETACHED &&
@@ -209,7 +215,7 @@ ThumbnailLoader.prototype.cancel = function() {
if (this.taskId_) {
this.image_.onload = function() {};
this.image_.onerror = function() {};
- util.cancelLoadImage(this.taskId_);
+ ImageLoaderClient.getInstance().cancel(this.taskId_);
this.taskId_ = null;
}
};
@@ -266,14 +272,20 @@ ThumbnailLoader.prototype.loadDetachedImage = function(callback) {
this.metadata_.filesystem &&
this.metadata_.filesystem.modificationTime &&
this.metadata_.filesystem.modificationTime.getTime();
- this.taskId_ = util.loadImage(
- this.image_,
+ this.taskId_ = ImageLoaderClient.loadToImage(
this.thumbnailUrl_,
- { maxWidth: ThumbnailLoader.THUMBNAIL_MAX_WIDTH,
+ this.image_,
+ {
+ maxWidth: ThumbnailLoader.THUMBNAIL_MAX_WIDTH,
maxHeight: ThumbnailLoader.THUMBNAIL_MAX_HEIGHT,
cache: true,
priority: this.priority_,
- timestamp: modificationTime });
+ timestamp: modificationTime
+ },
+ function() {},
+ function() {
+ this.image_.onerror(new Event('load-error'));
+ }.bind(this));
};
/**
« no previous file with comments | « ui/file_manager/file_manager/common/js/util.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698