| 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 * Object representing an image item (a photo). | 8 * Object representing an image item (a photo). |
| 9 * | 9 * |
| 10 * @param {FileEntry} entry Image entry. | 10 * @param {FileEntry} entry Image entry. |
| 11 * @param {function():Promise} fethcedMediaProvider Function to provide the | 11 * @param {function():Promise} fethcedMediaProvider Function to provide the |
| 12 * fetchedMedia metadata. | 12 * fetchedMedia metadata. |
| 13 * @constructor | 13 * @constructor |
| 14 */ | 14 */ |
| 15 Gallery.Item = function(entry, metadata, metadataCache) { | 15 Gallery.Item = function(entry, metadata, metadataCache, original) { |
| 16 /** | 16 /** |
| 17 * @type {FileEntry} | 17 * @type {FileEntry} |
| 18 * @private | 18 * @private |
| 19 */ | 19 */ |
| 20 this.entry_ = entry; | 20 this.entry_ = entry; |
| 21 | 21 |
| 22 /** | 22 /** |
| 23 * @type {Object} | 23 * @type {Object} |
| 24 * @private | 24 * @private |
| 25 */ | 25 */ |
| 26 this.metadata_ = Object.freeze(metadata); | 26 this.metadata_ = Object.freeze(metadata); |
| 27 | 27 |
| 28 /** | 28 /** |
| 29 * @type {MetadataCache} | 29 * @type {MetadataCache} |
| 30 */ | 30 */ |
| 31 this.metadataCache_ = metadataCache; | 31 this.metadataCache_ = metadataCache; |
| 32 | 32 |
| 33 /** | 33 /** |
| 34 * @type {boolean} | 34 * @type {boolean} |
| 35 * @private | 35 * @private |
| 36 */ | 36 */ |
| 37 this.original_ = true; | 37 this.original_ = original; |
| 38 | 38 |
| 39 Object.seal(this); | 39 Object.seal(this); |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 /** | 42 /** |
| 43 * @return {FileEntry} Image entry. | 43 * @return {FileEntry} Image entry. |
| 44 */ | 44 */ |
| 45 Gallery.Item.prototype.getEntry = function() { return this.entry_; }; | 45 Gallery.Item.prototype.getEntry = function() { return this.entry_; }; |
| 46 | 46 |
| 47 /** | 47 /** |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 return Promise.reject(str('GALLERY_FILE_EXISTS')); | 280 return Promise.reject(str('GALLERY_FILE_EXISTS')); |
| 281 }, function() { | 281 }, function() { |
| 282 return new Promise( | 282 return new Promise( |
| 283 this.entry_.moveTo.bind(this.entry_, parentDirectory, newFileName)); | 283 this.entry_.moveTo.bind(this.entry_, parentDirectory, newFileName)); |
| 284 }.bind(this)); | 284 }.bind(this)); |
| 285 }.bind(this)); | 285 }.bind(this)); |
| 286 }.bind(this)).then(function(entry) { | 286 }.bind(this)).then(function(entry) { |
| 287 this.entry_ = entry; | 287 this.entry_ = entry; |
| 288 }.bind(this)); | 288 }.bind(this)); |
| 289 }; | 289 }; |
| OLD | NEW |