OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Setting the src of an img to an empty string can crash the browser, so we | 5 // Setting the src of an img to an empty string can crash the browser, so we |
6 // use an empty 1x1 gif instead. | 6 // use an empty 1x1 gif instead. |
7 const EMPTY_IMAGE_URI = 'data:image/gif;base64,' | 7 const EMPTY_IMAGE_URI = 'data:image/gif;base64,' |
8 + 'R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D'; | 8 + 'R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D'; |
9 | 9 |
10 /** | 10 /** |
(...skipping 2648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2659 FileManager.prototype.getThumbnailURL = function(entry, callback) { | 2659 FileManager.prototype.getThumbnailURL = function(entry, callback) { |
2660 if (!entry) | 2660 if (!entry) |
2661 return; | 2661 return; |
2662 | 2662 |
2663 var iconType = this.getIconType(entry); | 2663 var iconType = this.getIconType(entry); |
2664 | 2664 |
2665 function returnStockIcon() { | 2665 function returnStockIcon() { |
2666 callback(iconType, FileType.getPreviewArt(iconType)); | 2666 callback(iconType, FileType.getPreviewArt(iconType)); |
2667 } | 2667 } |
2668 | 2668 |
2669 if (DirectoryModel.getRootType(entry.fullPath) == | |
dgozman
2012/02/29 11:35:18
Maybe, introduce new MetadataProvider?
SeRya
2012/02/29 14:17:05
Let's keep it as simple as possible on this stage.
| |
2670 DirectoryModel.RootType.GDATA) { | |
2671 // TODO(serya): retrieve thumbnail URL with getGDataFileProperties | |
2672 // (see http://crosbug/27030) | |
2673 returnStockIcon(); | |
2674 return; | |
2675 } | |
2676 | |
2669 this.metadataProvider_.fetch(entry.toURL(), function (metadata) { | 2677 this.metadataProvider_.fetch(entry.toURL(), function (metadata) { |
2670 if (metadata.thumbnailURL) { | 2678 if (metadata.thumbnailURL) { |
2671 callback(iconType, metadata.thumbnailURL, metadata.thumbnailTransform); | 2679 callback(iconType, metadata.thumbnailURL, metadata.thumbnailTransform); |
2672 } else if (iconType == 'image') { | 2680 } else if (iconType == 'image') { |
2673 cacheEntrySize(entry, function() { | 2681 cacheEntrySize(entry, function() { |
2674 if (FileType.canUseImageUrlForPreview(metadata, entry.cachedSize_)) { | 2682 if (FileType.canUseImageUrlForPreview(metadata, entry.cachedSize_)) { |
2675 callback(iconType, entry.toURL(), metadata.imageTransform); | 2683 callback(iconType, entry.toURL(), metadata.imageTransform); |
2676 } else { | 2684 } else { |
2677 returnStockIcon(); | 2685 returnStockIcon(); |
2678 } | 2686 } |
(...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3850 }); | 3858 }); |
3851 }, onError); | 3859 }, onError); |
3852 | 3860 |
3853 function onError(err) { | 3861 function onError(err) { |
3854 console.log('Error while checking free space: ' + err); | 3862 console.log('Error while checking free space: ' + err); |
3855 setTimeout(doCheck, 1000 * 60); | 3863 setTimeout(doCheck, 1000 * 60); |
3856 } | 3864 } |
3857 } | 3865 } |
3858 } | 3866 } |
3859 })(); | 3867 })(); |
OLD | NEW |