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

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

Issue 1137993007: Crop image at image_loader. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months 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
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 5b91925f3da2d3ceacdb8f57cd967cae3c8d6712..2c8aa6dd304223bca6c310cbf430e580c76160c3 100644
--- a/ui/file_manager/file_manager/foreground/js/thumbnail_loader.js
+++ b/ui/file_manager/file_manager/foreground/js/thumbnail_loader.js
@@ -264,11 +264,27 @@ ThumbnailLoader.prototype.loadAsDataUrl = function(fillMode) {
this.metadata_.filesystem &&
this.metadata_.filesystem.modificationTime &&
this.metadata_.filesystem.modificationTime.getTime();
- var thumbnailUrl =
- fillMode === ThumbnailLoader.FillMode.OVER_FILL &&
- this.croppedThumbnailUrl_ ?
- this.croppedThumbnailUrl_ :
- this.thumbnailUrl_;
+ var thumbnailUrl = this.thumbnailUrl_;
+ var options = {
+ maxWidth: ThumbnailLoader.THUMBNAIL_MAX_WIDTH,
+ maxHeight: ThumbnailLoader.THUMBNAIL_MAX_HEIGHT,
+ cache: true,
+ priority: this.priority_,
+ timestamp: modificationTime
+ };
+
+ if (fillMode === ThumbnailLoader.FillMode.OVER_FILL) {
+ // Use cropped thumbnail url if available.
+ thumbnailUrl = this.croppedThumbnailUrl_ ?
+ this.croppedThumbnailUrl_ : this.thumbnailUrl_;
+
+ // Set crop option to image loader. Since image of croppedThumbnailUrl_ is
+ // 360x360 with current implemenation, it's no problem to crop it.
+ options['width'] = 360;
+ options['height'] = 360;
+ options['crop'] = true;
+ }
+
ImageLoaderClient.getInstance().load(
thumbnailUrl,
function(result) {
@@ -277,13 +293,7 @@ ThumbnailLoader.prototype.loadAsDataUrl = function(fillMode) {
else
reject(result);
},
- {
- maxWidth: ThumbnailLoader.THUMBNAIL_MAX_WIDTH,
- maxHeight: ThumbnailLoader.THUMBNAIL_MAX_HEIGHT,
- cache: true,
- priority: this.priority_,
- timestamp: modificationTime
- });
+ options);
}.bind(this)).then(function(result) {
if (!this.transform_)
return result;

Powered by Google App Engine
This is Rietveld 408576698