| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 * Data model for gallery. | 6 * Data model for gallery. |
| 7 * | 7 * |
| 8 * @param {!MetadataModel} metadataModel | 8 * @param {!MetadataModel} metadataModel |
| 9 * @param {!EntryListWatcher=} opt_watcher Entry list watcher. | 9 * @param {!EntryListWatcher=} opt_watcher Entry list watcher. |
| 10 * @constructor | 10 * @constructor |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 // Dispatch an event. | 77 // Dispatch an event. |
| 78 var event = new Event('content'); | 78 var event = new Event('content'); |
| 79 event.item = item; | 79 event.item = item; |
| 80 event.oldEntry = oldEntry; | 80 event.oldEntry = oldEntry; |
| 81 event.thumbnailChanged = true; | 81 event.thumbnailChanged = true; |
| 82 this.dispatchEvent(event); | 82 this.dispatchEvent(event); |
| 83 | 83 |
| 84 if (!util.isSameEntry(oldEntry, item.getEntry())) { | 84 if (!util.isSameEntry(oldEntry, item.getEntry())) { |
| 85 Promise.all([ | 85 Promise.all([ |
| 86 this.metadataModel_.get( | 86 this.metadataModel_.get( |
| 87 [oldEntry], Gallery.PREFETCH_PROPERTY_NAMES), | 87 [oldEntry], GalleryItem.PREFETCH_PROPERTY_NAMES), |
| 88 new ThumbnailModel(this.metadataModel_).get([oldEntry]) | 88 new ThumbnailModel(this.metadataModel_).get([oldEntry]) |
| 89 ]).then(function(itemLists) { | 89 ]).then(function(itemLists) { |
| 90 // New entry is added and the item now tracks it. | 90 // New entry is added and the item now tracks it. |
| 91 // Add another item for the old entry. | 91 // Add another item for the old entry. |
| 92 var anotherItem = new GalleryItem( | 92 var anotherItem = new GalleryItem( |
| 93 oldEntry, | 93 oldEntry, |
| 94 oldLocationInfo, | 94 oldLocationInfo, |
| 95 itemLists[0][0], | 95 itemLists[0][0], |
| 96 itemLists[1][0], | 96 itemLists[1][0], |
| 97 oldIsOriginal); | 97 oldIsOriginal); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 * @private | 142 * @private |
| 143 */ | 143 */ |
| 144 GalleryDataModel.prototype.onSplice_ = function(event) { | 144 GalleryDataModel.prototype.onSplice_ = function(event) { |
| 145 if (!event.removed || !event.removed.length) | 145 if (!event.removed || !event.removed.length) |
| 146 return; | 146 return; |
| 147 var removedURLs = event.removed.map(function(item) { | 147 var removedURLs = event.removed.map(function(item) { |
| 148 return item.getEntry().toURL(); | 148 return item.getEntry().toURL(); |
| 149 }); | 149 }); |
| 150 this.metadataModel_.notifyEntriesRemoved(removedURLs); | 150 this.metadataModel_.notifyEntriesRemoved(removedURLs); |
| 151 }; | 151 }; |
| OLD | NEW |