Chromium Code Reviews| 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 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 | 7 |
| 8 // Namespace object for the utilities. | 8 // Namespace object for the utilities. |
| 9 function ImageUtil() {} | 9 function ImageUtil() {} |
| 10 | 10 |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 482 onError('GALLERY_IMAGE_TOO_BIG_ERROR'); | 482 onError('GALLERY_IMAGE_TOO_BIG_ERROR'); |
| 483 return; | 483 return; |
| 484 } | 484 } |
| 485 transformFetcher(entry, onTransform.bind(this, e.target)); | 485 transformFetcher(entry, onTransform.bind(this, e.target)); |
| 486 }.bind(this); | 486 }.bind(this); |
| 487 | 487 |
| 488 // The error callback has an optional error argument, which in case of a | 488 // The error callback has an optional error argument, which in case of a |
| 489 // general error should not be specified | 489 // general error should not be specified |
| 490 this.image_.onerror = onError.bind(this, 'GALLERY_IMAGE_ERROR'); | 490 this.image_.onerror = onError.bind(this, 'GALLERY_IMAGE_ERROR'); |
| 491 | 491 |
| 492 // Extract the last modification date to determine if the cached image | 492 // Load the image directly. The query parameter is needed to obtain the |
| 493 // is outdated. | 493 // latest image just after editing it. crbug.com/378648 |
| 494 var modificationTime = opt_metadata && | 494 this.image_.src = entry.toURL() + "?nocache=" + Date.now(); |
|
mtomasz
2014/06/02 06:40:28
Does it happen on Downloads too? If so, then it se
hirono
2014/06/02 08:59:15
Yes it happens to Downloads too.
Filed: crbug.com/
mtomasz
2014/06/03 05:33:19
Please write a comment that it is a workaround, an
hirono
2014/06/03 07:51:45
Done.
| |
| 495 opt_metadata.modificationTime && | |
| 496 opt_metadata.modificationTime.getTime(); | |
| 497 | |
| 498 // Load the image directly. | |
| 499 this.image_.src = entry.toURL(); | |
| 500 }.bind(this); | 495 }.bind(this); |
| 501 | 496 |
| 502 // Loads the image. If already loaded, then forces a reload. | 497 // Loads the image. If already loaded, then forces a reload. |
| 503 var startLoad = this.resetImage_.bind(this, function() { | 498 var startLoad = this.resetImage_.bind(this, function() { |
| 504 // Fetch metadata to detect last modification time for the caching purpose. | 499 // Fetch metadata to detect last modification time for the caching purpose. |
| 505 if (this.metadataCache_) | 500 if (this.metadataCache_) |
| 506 this.metadataCache_.get(entry, 'filesystem', loadImage); | 501 this.metadataCache_.get(entry, 'filesystem', loadImage); |
| 507 else | 502 else |
| 508 loadImage(); | 503 loadImage(); |
| 509 }.bind(this), onError); | 504 }.bind(this), onError); |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 692 * @return {string} Full name. | 687 * @return {string} Full name. |
| 693 */ | 688 */ |
| 694 ImageUtil.getMetricName = function(name) { | 689 ImageUtil.getMetricName = function(name) { |
| 695 return 'PhotoEditor.' + name; | 690 return 'PhotoEditor.' + name; |
| 696 }; | 691 }; |
| 697 | 692 |
| 698 /** | 693 /** |
| 699 * Used for metrics reporting, keep in sync with the histogram description. | 694 * Used for metrics reporting, keep in sync with the histogram description. |
| 700 */ | 695 */ |
| 701 ImageUtil.FILE_TYPES = ['jpg', 'png', 'gif', 'bmp', 'webp']; | 696 ImageUtil.FILE_TYPES = ['jpg', 'png', 'gif', 'bmp', 'webp']; |
| OLD | NEW |