Chromium Code Reviews| 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 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * MetadataCache is a map from Entry to an object containing properties. | 8 * MetadataCache is a map from Entry to an object containing properties. |
| 9 * Properties are divided by types, and all properties of one type are accessed | 9 * Properties are divided by types, and all properties of one type are accessed |
| 10 * at once. | 10 * at once. |
| (...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 866 pinned: data.isPinned, | 866 pinned: data.isPinned, |
| 867 hosted: data.isHosted, | 867 hosted: data.isHosted, |
| 868 imageWidth: data.imageWidth, | 868 imageWidth: data.imageWidth, |
| 869 imageHeight: data.imageHeight, | 869 imageHeight: data.imageHeight, |
| 870 imageRotation: data.imageRotation, | 870 imageRotation: data.imageRotation, |
| 871 availableOffline: data.isAvailableOffline, | 871 availableOffline: data.isAvailableOffline, |
| 872 availableWhenMetered: data.isAvailableWhenMetered, | 872 availableWhenMetered: data.isAvailableWhenMetered, |
| 873 customIconUrl: data.customIconUrl || '', | 873 customIconUrl: data.customIconUrl || '', |
| 874 contentMimeType: data.contentMimeType || '', | 874 contentMimeType: data.contentMimeType || '', |
| 875 sharedWithMe: data.sharedWithMe, | 875 sharedWithMe: data.sharedWithMe, |
| 876 shared: data.shared | 876 shared: data.shared, |
| 877 thumbnailUrl: data.thumbnailUrl // Thumbnail passed from external server. | |
|
mtomasz
2014/09/17 09:29:48
ExternalProvider used to provide a thumbnail field
yoshiki
2014/09/17 09:57:09
I got it. I add the code to fill thumbnail field w
| |
| 877 }; | 878 }; |
| 878 | 879 |
| 879 result.filesystem = { | 880 result.filesystem = { |
| 880 size: (entry.isFile ? (data.fileSize || 0) : -1), | 881 size: (entry.isFile ? (data.fileSize || 0) : -1), |
| 881 modificationTime: new Date(data.lastModifiedTime) | 882 modificationTime: new Date(data.lastModifiedTime) |
| 882 }; | 883 }; |
| 883 | 884 |
| 884 if ('thumbnailUrl' in data) { | |
| 885 result.thumbnail = { | |
| 886 url: data.thumbnailUrl, | |
| 887 transform: null | |
| 888 }; | |
| 889 } else if (data.isPresent) { | |
| 890 result.thumbnail = null; | |
| 891 } else { | |
| 892 // Not present in cache, so do not allow to generate it by next providers. | |
| 893 result.thumbnail = {url: '', transform: null}; | |
| 894 } | |
| 895 | |
| 896 // If present in cache, then allow to fetch media by next providers. | 885 // If present in cache, then allow to fetch media by next providers. |
| 897 result.media = data.isPresent ? null : {}; | 886 result.media = data.isPresent ? null : {}; |
| 898 | 887 |
| 899 return result; | 888 return result; |
| 900 }; | 889 }; |
| 901 | 890 |
| 902 | 891 |
| 903 /** | 892 /** |
| 904 * Provider of content metadata. | 893 * Provider of content metadata. |
| 905 * This provider returns the following objects: | 894 * This provider returns the following objects: |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1086 | 1075 |
| 1087 /** | 1076 /** |
| 1088 * Handles the 'log' message from the worker. | 1077 * Handles the 'log' message from the worker. |
| 1089 * @param {Array.<*>} arglist Log arguments. | 1078 * @param {Array.<*>} arglist Log arguments. |
| 1090 * @private | 1079 * @private |
| 1091 */ | 1080 */ |
| 1092 ContentProvider.prototype.onLog_ = function(arglist) { | 1081 ContentProvider.prototype.onLog_ = function(arglist) { |
| 1093 if (MetadataCache.log) // Avoid log spam by default. | 1082 if (MetadataCache.log) // Avoid log spam by default. |
| 1094 console.log.apply(console, ['metadata:'].concat(arglist)); | 1083 console.log.apply(console, ['metadata:'].concat(arglist)); |
| 1095 }; | 1084 }; |
| OLD | NEW |