OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Namespace object for the utilities. | 5 // Namespace object for the utilities. |
6 var ImageUtil = {}; | 6 var ImageUtil = {}; |
7 | 7 |
8 /** | 8 /** |
9 * Performance trace. | 9 * Performance trace. |
10 */ | 10 */ |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 // Loads the image. If already loaded, then forces a reload. | 538 // Loads the image. If already loaded, then forces a reload. |
539 var startLoad = function() { | 539 var startLoad = function() { |
540 if (generation !== this.generation_) | 540 if (generation !== this.generation_) |
541 return; | 541 return; |
542 | 542 |
543 // Target current image. | 543 // Target current image. |
544 targetImage = this.image_; | 544 targetImage = this.image_; |
545 | 545 |
546 // Obtain target URL. | 546 // Obtain target URL. |
547 if (FileType.isRaw(entry)) { | 547 if (FileType.isRaw(entry)) { |
| 548 var timestamp = |
| 549 item.getMetadataItem() && |
| 550 item.getMetadataItem().modificationTime && |
| 551 item.getMetadataItem().modificationTime.getTime(); |
548 ImageLoaderClient.getInstance().load(entry.toURL(), function(result) { | 552 ImageLoaderClient.getInstance().load(entry.toURL(), function(result) { |
549 if (result.status === 'success') | 553 if (result.status === 'success') |
550 loadImage(result.data); | 554 loadImage(result.data); |
551 else | 555 else |
552 onError('GALLERY_IMAGE_ERROR'); | 556 onError('GALLERY_IMAGE_ERROR'); |
553 }, { | 557 }, { |
554 cache: true, | 558 cache: true, |
555 timestamp: item.getMetadataItem().modificationTime && | 559 timestamp: timestamp, |
556 item.getMetadataItem().modificationTime.getTime(), | |
557 priority: 0 // Use highest priority to show main image. | 560 priority: 0 // Use highest priority to show main image. |
558 }); | 561 }); |
559 return; | 562 return; |
560 } | 563 } |
561 | 564 |
562 // Load the image directly. The query parameter is workaround for | 565 // Load the image directly. The query parameter is workaround for |
563 // crbug.com/379678, which force to update the contents of the image. | 566 // crbug.com/379678, which force to update the contents of the image. |
564 loadImage(entry.toURL() + '?nocache=' + Date.now()); | 567 loadImage(entry.toURL() + '?nocache=' + Date.now()); |
565 }.bind(this); | 568 }.bind(this); |
566 | 569 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 ImageUtil.getMetricName = function(name) { | 728 ImageUtil.getMetricName = function(name) { |
726 return 'PhotoEditor.' + name; | 729 return 'PhotoEditor.' + name; |
727 }; | 730 }; |
728 | 731 |
729 /** | 732 /** |
730 * Used for metrics reporting, keep in sync with the histogram description. | 733 * Used for metrics reporting, keep in sync with the histogram description. |
731 * @type {Array.<string>} | 734 * @type {Array.<string>} |
732 * @const | 735 * @const |
733 */ | 736 */ |
734 ImageUtil.FILE_TYPES = ['jpg', 'png', 'gif', 'bmp', 'webp']; | 737 ImageUtil.FILE_TYPES = ['jpg', 'png', 'gif', 'bmp', 'webp']; |
OLD | NEW |