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

Unified Diff: ui/file_manager/gallery/js/image_editor/image_util.js

Issue 1053653003: Gallery: Support RAW files in Gallery. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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/gallery/js/image_editor/image_util.js
diff --git a/ui/file_manager/gallery/js/image_editor/image_util.js b/ui/file_manager/gallery/js/image_editor/image_util.js
index ebbd8e59e1905f606c7ba42dc4c454d821bbdeaf..091683799121dbf85d6726dc716d85ee327b3723 100644
--- a/ui/file_manager/gallery/js/image_editor/image_util.js
+++ b/ui/file_manager/gallery/js/image_editor/image_util.js
@@ -511,7 +511,7 @@ ImageUtil.ImageLoader.prototype.load = function(item, callback, opt_delay) {
};
onError = onError.bind(this);
- var loadImage = function() {
+ var loadImage = function(url) {
ImageUtil.metrics.startInterval(ImageUtil.getMetricName('LoadTime'));
this.timeout_ = 0;
@@ -528,14 +528,30 @@ ImageUtil.ImageLoader.prototype.load = function(item, callback, opt_delay) {
// general error should not be specified
this.image_.onerror = onError.bind(this, 'GALLERY_IMAGE_ERROR');
- // Load the image directly. The query parameter is workaround for
- // crbug.com/379678, which force to update the contents of the image.
- this.image_.src = entry.toURL() + '?nocache=' + Date.now();
+ if (this.image_.src === url)
yawano 2015/04/02 05:56:34 Why do you do this check here? Does it become to h
hirono 2015/04/02 07:55:47 There are two possible case. * Currently SlideMo
+ this.image_.onload();
+ else
+ this.image_.src = url;
}.bind(this);
// Loads the image. If already loaded, then forces a reload.
var startLoad = this.resetImage_.bind(this, function() {
- loadImage();
+ // Obtain target URL.
+ if (FileType.isRaw(entry)) {
+ ImageLoaderClient.getInstance().load(entry.toURL(), function(result) {
+ loadImage(result.data);
yawano 2015/04/02 05:56:34 What happens if ImageLoaderClient fails to load an
hirono 2015/04/02 07:55:47 Done.
+ }, {
+ cache: true,
+ timestamp: item.getMetadataItem().modificationTime &&
+ item.getMetadataItem().modificationTime.getTime(),
+ priority: 0 // Use highest priority to show main image.
+ });
+ return;
+ }
+
+ // Load the image directly. The query parameter is workaround for
+ // crbug.com/379678, which force to update the contents of the image.
+ loadImage(entry.toURL() + '?nocache=' + Date.now());
}.bind(this), onError);
if (opt_delay) {

Powered by Google App Engine
This is Rietveld 408576698