| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 * Controller of metadata box. | 6 * Controller of metadata box. |
| 7 * | 7 * |
| 8 * @param{!MetadataModel} metadataModel | 8 * @param{!MetadataModel} metadataModel |
| 9 * @param{!FilesMetadataBox} metadataBox | 9 * @param{!FilesMetadataBox} metadataBox |
| 10 * @param{!FilesQuickView} quickView | 10 * @param{!FilesQuickView} quickView |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 var item = items[0]; | 118 var item = items[0]; |
| 119 this.metadataBox_.mediaMimeType = item.contentMimeType; | 119 this.metadataBox_.mediaMimeType = item.contentMimeType; |
| 120 }.bind(this)); | 120 }.bind(this)); |
| 121 } else { | 121 } else { |
| 122 this.metadataModel_.get([entry], ['mediaMimeType']).then(function(items) { | 122 this.metadataModel_.get([entry], ['mediaMimeType']).then(function(items) { |
| 123 var item = items[0]; | 123 var item = items[0]; |
| 124 this.metadataBox_.mediaMimeType = item.mediaMimeType; | 124 this.metadataBox_.mediaMimeType = item.mediaMimeType; |
| 125 }.bind(this)); | 125 }.bind(this)); |
| 126 } | 126 } |
| 127 | 127 |
| 128 var type = FileType.getType(entry).type; | |
| 129 this.metadataBox_.type = type; | |
| 130 if (['image', 'video', 'audio'].includes(type)) { | 128 if (['image', 'video', 'audio'].includes(type)) { |
| 131 if (item.externalFileUrl) { | 129 if (item.externalFileUrl) { |
| 132 this.metadataModel_.get([entry], ['imageHeight', 'imageWidth']) | 130 this.metadataModel_.get([entry], ['imageHeight', 'imageWidth']) |
| 133 .then(function(items) { | 131 .then(function(items) { |
| 134 var item = items[0]; | 132 var item = items[0]; |
| 135 this.metadataBox_.imageHeight = item.imageHeight; | 133 this.metadataBox_.imageHeight = item.imageHeight; |
| 136 this.metadataBox_.imageWidth = item.imageWidth; | 134 this.metadataBox_.imageWidth = item.imageWidth; |
| 137 }.bind(this)); | 135 }.bind(this)); |
| 138 } else { | 136 } else { |
| 139 this.metadataModel_ | 137 this.metadataModel_ |
| 140 .get( | 138 .get( |
| 141 [entry], | 139 [entry], |
| 142 ['imageHeight', 'imageWidth', 'mediaArtist', 'mediaTitle']) | 140 [ |
| 141 'imageHeight', |
| 142 'imageWidth', |
| 143 'mediaAlbum', |
| 144 'mediaArtist', |
| 145 'mediaTitle' |
| 146 ]) |
| 143 .then(function(items) { | 147 .then(function(items) { |
| 144 var item = items[0]; | 148 var item = items[0]; |
| 145 this.metadataBox_.imageHeight = item.imageHeight; | 149 this.metadataBox_.imageHeight = item.imageHeight || 0; |
| 146 this.metadataBox_.imageWidth = item.imageWidth; | 150 this.metadataBox_.imageWidth = item.imageWidth || 0; |
| 147 this.metadataBox_.mediaArtist = item.mediaArtist; | 151 this.metadataBox_.mediaAlbum = item.mediaAlbum || ''; |
| 148 this.metadataBox_.mediaTitle = item.mediaTitle; | 152 this.metadataBox_.mediaArtist = item.mediaArtist || ''; |
| 153 this.metadataBox_.mediaTitle = item.mediaTitle || ''; |
| 149 }.bind(this)); | 154 }.bind(this)); |
| 150 } | 155 } |
| 151 } | 156 } |
| 152 }; | 157 }; |
| 153 | 158 |
| 154 /** | 159 /** |
| 155 * Set a current directory's size in metadata box. | 160 * Set a current directory's size in metadata box. |
| 156 * | 161 * |
| 157 * @param {!DirectoryEntry} entry | 162 * @param {!DirectoryEntry} entry |
| 158 * | 163 * |
| (...skipping 12 matching lines...) Expand all Loading... |
| 171 if(chrome.runtime.lastError) { | 176 if(chrome.runtime.lastError) { |
| 172 this.metadataBox_.isSizeLoading = false; | 177 this.metadataBox_.isSizeLoading = false; |
| 173 return; | 178 return; |
| 174 } | 179 } |
| 175 | 180 |
| 176 this.metadataBox_.isSizeLoading = false; | 181 this.metadataBox_.isSizeLoading = false; |
| 177 this.metadataBox_.size = | 182 this.metadataBox_.size = |
| 178 this.fileMetadataFormatter_.formatSize(size, true); | 183 this.fileMetadataFormatter_.formatSize(size, true); |
| 179 }.bind(this)); | 184 }.bind(this)); |
| 180 }; | 185 }; |
| OLD | NEW |