| Index: ui/file_manager/gallery/js/gallery.js
|
| diff --git a/ui/file_manager/gallery/js/gallery.js b/ui/file_manager/gallery/js/gallery.js
|
| index 2211d9d62dba23e36dbee959f2455ed33595f6ec..8f66af6db3cf9ec6948fbebc0e909a65ee0333f2 100644
|
| --- a/ui/file_manager/gallery/js/gallery.js
|
| +++ b/ui/file_manager/gallery/js/gallery.js
|
| @@ -73,6 +73,7 @@ GalleryDataModel.prototype = {
|
| GalleryDataModel.prototype.saveItem = function(item, canvas, overwrite) {
|
| var oldEntry = item.getEntry();
|
| var oldMetadata = item.getMetadata();
|
| + var oldLocationInfo = item.getLocationInfo();
|
| var metadataEncoder = ImageEncoder.encodeMetadata(
|
| item.getMetadata(), canvas, 1 /* quality */);
|
| var newMetadata = ContentProvider.ConvertContentMetadata(
|
| @@ -80,8 +81,8 @@ GalleryDataModel.prototype.saveItem = function(item, canvas, overwrite) {
|
| MetadataCache.cloneMetadata(item.getMetadata()));
|
| if (newMetadata.filesystem)
|
| newMetadata.filesystem.modificationTime = new Date();
|
| - if (newMetadata.drive)
|
| - newMetadata.drive.present = true;
|
| + if (newMetadata.external)
|
| + newMetadata.external.present = true;
|
|
|
| return new Promise(function(fulfill, reject) {
|
| item.saveToFile(
|
| @@ -117,6 +118,7 @@ GalleryDataModel.prototype.saveItem = function(item, canvas, overwrite) {
|
| // Add another item for the old entry.
|
| var anotherItem = new Gallery.Item(
|
| oldEntry,
|
| + oldLocationInfo,
|
| oldMetadata,
|
| this.metadataCache_,
|
| item.isOriginal(),
|
| @@ -254,7 +256,7 @@ Gallery.MOSAIC_BACKGROUND_INIT_DELAY = 1000;
|
| * @const
|
| * @type {string}
|
| */
|
| -Gallery.METADATA_TYPE = 'thumbnail|filesystem|media|drive';
|
| +Gallery.METADATA_TYPE = 'thumbnail|filesystem|media|external';
|
|
|
| /**
|
| * Initializes listeners.
|
| @@ -489,15 +491,19 @@ Gallery.prototype.load = function(entries, selectedEntries) {
|
| return Promise.reject('Failed to load metadata.');
|
|
|
| // Add items to the model.
|
| - var items = chunk.map(function(chunkItem, index) {
|
| - var volumeInfo = self.volumeManager_.getVolumeInfo(chunkItem.entry);
|
| + var items = [];
|
| + chunk.forEach(function(chunkItem, index) {
|
| + var locationInfo = self.volumeManager_.getLocationInfo(chunkItem.entry);
|
| + if (!locationInfo) // Skip the item, since gone.
|
| + return;
|
| var clonedMetadata = MetadataCache.cloneMetadata(metadataList[index]);
|
| - return new Gallery.Item(
|
| + items.push(new Gallery.Item(
|
| chunkItem.entry,
|
| + locationInfo,
|
| clonedMetadata,
|
| self.metadataCache_,
|
| /* original */ true,
|
| - /* readonly */ !!(volumeInfo && volumeInfo.isReadOnly));
|
| + /* readonly */ !!(locationInfo && locationInfo.isReadOnly)));
|
| });
|
| self.dataModel_.push.apply(self.dataModel_, items);
|
|
|
| @@ -853,7 +859,7 @@ Gallery.prototype.updateSelectionAndState_ = function() {
|
| this.filenameEdit_.disabled = selectedItem.isReadOnly();
|
| this.filenameEdit_.value =
|
| ImageUtil.getDisplayNameFromName(this.selectedEntry_.name);
|
| - this.shareButton_.hidden = !selectedItem.isOnDrive();
|
| + this.shareButton_.hidden = !selectedItem.getLocationInfo().isDriveBased;
|
| } else {
|
| if (this.context_.curDirEntry) {
|
| // If the Gallery was opened on search results the search query will not
|
|
|