| 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 /** | 5 /** |
| 6 * Object representing an image item (a photo). | 6 * Object representing an image item (a photo). |
| 7 * | 7 * |
| 8 * @param {!FileEntry} entry Image entry. | 8 * @param {!FileEntry} entry Image entry. |
| 9 * @param {!EntryLocation} locationInfo Entry location information. | 9 * @param {!EntryLocation} locationInfo Entry location information. |
| 10 * @param {!MetadataItem} metadataItem | 10 * @param {MetadataItem} metadataItem |
| 11 * @param {!ThumbnailMetadataItem} thumbnailMetadataItem | 11 * @param {ThumbnailMetadataItem} thumbnailMetadataItem |
| 12 * @param {boolean} original Whether the entry is original or edited. | 12 * @param {boolean} original Whether the entry is original or edited. |
| 13 * @constructor | 13 * @constructor |
| 14 * @struct | 14 * @struct |
| 15 */ | 15 */ |
| 16 Gallery.Item = function( | 16 Gallery.Item = function( |
| 17 entry, locationInfo, metadataItem, thumbnailMetadataItem, original) { | 17 entry, locationInfo, metadataItem, thumbnailMetadataItem, original) { |
| 18 /** | 18 /** |
| 19 * @private {!FileEntry} | 19 * @private {!FileEntry} |
| 20 */ | 20 */ |
| 21 this.entry_ = entry; | 21 this.entry_ = entry; |
| 22 | 22 |
| 23 /** | 23 /** |
| 24 * @private {!EntryLocation} | 24 * @private {!EntryLocation} |
| 25 */ | 25 */ |
| 26 this.locationInfo_ = locationInfo; | 26 this.locationInfo_ = locationInfo; |
| 27 | 27 |
| 28 /** | 28 /** |
| 29 * @private {!MetadataItem} | 29 * @private {MetadataItem} |
| 30 */ | 30 */ |
| 31 this.metadataItem_ = metadataItem; | 31 this.metadataItem_ = metadataItem; |
| 32 | 32 |
| 33 /** | 33 /** |
| 34 * @private {!ThumbnailMetadataItem} | 34 * @private {ThumbnailMetadataItem} |
| 35 */ | 35 */ |
| 36 this.thumbnailMetadataItem_ = metadataItem; | 36 this.thumbnailMetadataItem_ = metadataItem; |
| 37 | 37 |
| 38 // TODO(yawano): Change this.contentImage and this.screenImage to private | 38 // TODO(yawano): Change this.contentImage and this.screenImage to private |
| 39 // fields and provide utility methods for them (e.g. revokeFullImageCache). | 39 // fields and provide utility methods for them (e.g. revokeFullImageCache). |
| 40 /** | 40 /** |
| 41 * The content cache is used for prefetching the next image when going through | 41 * The content cache is used for prefetching the next image when going through |
| 42 * the images sequentially. The real life photos can be large (18Mpix = 72Mb | 42 * the images sequentially. The real life photos can be large (18Mpix = 72Mb |
| 43 * pixel array) so we want only the minimum amount of caching. | 43 * pixel array) so we want only the minimum amount of caching. |
| 44 * @type {(HTMLCanvasElement|HTMLImageElement)} | 44 * @type {(HTMLCanvasElement|HTMLImageElement)} |
| (...skipping 29 matching lines...) Expand all Loading... |
| 74 Gallery.Item.prototype.getEntry = function() { return this.entry_; }; | 74 Gallery.Item.prototype.getEntry = function() { return this.entry_; }; |
| 75 | 75 |
| 76 /** | 76 /** |
| 77 * @return {!EntryLocation} Entry location information. | 77 * @return {!EntryLocation} Entry location information. |
| 78 */ | 78 */ |
| 79 Gallery.Item.prototype.getLocationInfo = function() { | 79 Gallery.Item.prototype.getLocationInfo = function() { |
| 80 return this.locationInfo_; | 80 return this.locationInfo_; |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 /** | 83 /** |
| 84 * @return {!MetadataItem} Metadata. | 84 * @return {MetadataItem} Metadata. |
| 85 */ | 85 */ |
| 86 Gallery.Item.prototype.getMetadataItem = function() { | 86 Gallery.Item.prototype.getMetadataItem = function() { |
| 87 return this.metadataItem_; | 87 return this.metadataItem_; |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 /** | 90 /** |
| 91 * @return {!ThumbnailMetadataItem} Thumbnail metadata item. | 91 * @param {!MetadataItem} metadata |
| 92 */ |
| 93 Gallery.Item.prototype.setMetadataItem = function(metadata) { |
| 94 this.metadataItem_ = metadata; |
| 95 }; |
| 96 |
| 97 /** |
| 98 * @return {ThumbnailMetadataItem} Thumbnail metadata item. |
| 92 */ | 99 */ |
| 93 Gallery.Item.prototype.getThumbnailMetadataItem = function() { | 100 Gallery.Item.prototype.getThumbnailMetadataItem = function() { |
| 94 return this.thumbnailMetadataItem_; | 101 return this.thumbnailMetadataItem_; |
| 95 }; | 102 }; |
| 96 | 103 |
| 97 /** | 104 /** |
| 105 * @param {!ThumbnailMetadataItem} item Thumbnail metadata item. |
| 106 */ |
| 107 Gallery.Item.prototype.setThumbnailMetadataItem = function(item) { |
| 108 this.thumbnailMetadataItem_ = item; |
| 109 }; |
| 110 |
| 111 /** |
| 98 * @return {string} File name. | 112 * @return {string} File name. |
| 99 */ | 113 */ |
| 100 Gallery.Item.prototype.getFileName = function() { | 114 Gallery.Item.prototype.getFileName = function() { |
| 101 return this.entry_.name; | 115 return this.entry_.name; |
| 102 }; | 116 }; |
| 103 | 117 |
| 104 /** | 118 /** |
| 105 * @return {boolean} True if this image has not been created in this session. | 119 * @return {boolean} True if this image has not been created in this session. |
| 106 */ | 120 */ |
| 107 Gallery.Item.prototype.isOriginal = function() { return this.original_; }; | 121 Gallery.Item.prototype.isOriginal = function() { return this.original_; }; |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 return Promise.reject(str('GALLERY_FILE_EXISTS')); | 380 return Promise.reject(str('GALLERY_FILE_EXISTS')); |
| 367 }, function() { | 381 }, function() { |
| 368 return new Promise( | 382 return new Promise( |
| 369 this.entry_.moveTo.bind(this.entry_, parentDirectory, newFileName)); | 383 this.entry_.moveTo.bind(this.entry_, parentDirectory, newFileName)); |
| 370 }.bind(this)); | 384 }.bind(this)); |
| 371 }.bind(this)); | 385 }.bind(this)); |
| 372 }.bind(this)).then(function(entry) { | 386 }.bind(this)).then(function(entry) { |
| 373 this.entry_ = entry; | 387 this.entry_ = entry; |
| 374 }.bind(this)); | 388 }.bind(this)); |
| 375 }; | 389 }; |
| OLD | NEW |