| 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 var FilesMetadataBox = Polymer({ | 5 var FilesMetadataBox = Polymer({ |
| 6 is: 'files-metadata-box', | 6 is: 'files-metadata-box', |
| 7 | 7 |
| 8 properties: { | 8 properties: { |
| 9 // File media type, e.g. image, video. | 9 // File media type, e.g. image, video. |
| 10 type: String, | 10 type: String, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 // Whether the size is the middle of loading. | 63 // Whether the size is the middle of loading. |
| 64 isSizeLoading: Boolean, | 64 isSizeLoading: Boolean, |
| 65 | 65 |
| 66 /** | 66 /** |
| 67 * @private | 67 * @private |
| 68 */ | 68 */ |
| 69 hasFileSpecificInfo_: Boolean, | 69 hasFileSpecificInfo_: Boolean, |
| 70 }, | 70 }, |
| 71 | 71 |
| 72 // Clears fields. | 72 /** |
| 73 clear: function() { | 73 * Clears fields. |
| 74 * @param {boolean} keepSizeFields do not clear size and isSizeLoading fields. |
| 75 */ |
| 76 clear: function(keepSizeFields) { |
| 74 this.type = ''; | 77 this.type = ''; |
| 75 this.size = ''; | |
| 76 this.modiifcationTime = ''; | 78 this.modiifcationTime = ''; |
| 77 this.mediaMimeType = ''; | 79 this.mediaMimeType = ''; |
| 78 this.filePath = ''; | 80 this.filePath = ''; |
| 79 | 81 |
| 80 this.imageWidth = 0; | 82 this.imageWidth = 0; |
| 81 this.imageHeight = 0; | 83 this.imageHeight = 0; |
| 82 this.mediaTitle = ''; | 84 this.mediaTitle = ''; |
| 83 this.mediaArtist = ''; | 85 this.mediaArtist = ''; |
| 84 this.mediaAlbum = ''; | 86 this.mediaAlbum = ''; |
| 85 this.mediaDuration = 0; | 87 this.mediaDuration = 0; |
| 86 this.mediaGenre = ''; | 88 this.mediaGenre = ''; |
| 87 this.mediaTrack = ''; | 89 this.mediaTrack = ''; |
| 88 this.mediaYearRecorded = ''; | 90 this.mediaYearRecorded = ''; |
| 89 this.ifd = null; | 91 this.ifd = null; |
| 90 | 92 |
| 91 this.isSizeLoading = false; | 93 if (!keepSizeFields) { |
| 94 this.size = ''; |
| 95 this.isSizeLoading = false; |
| 96 } |
| 92 }, | 97 }, |
| 93 | 98 |
| 94 /** | 99 /** |
| 95 * @param {string} type | 100 * @param {string} type |
| 96 * @return {boolean} | 101 * @return {boolean} |
| 97 * | 102 * |
| 98 * @private | 103 * @private |
| 99 */ | 104 */ |
| 100 isImage_: function(type) { return type === 'image'; }, | 105 isImage_: function(type) { |
| 106 return type === 'image'; |
| 107 }, |
| 101 | 108 |
| 102 /** | 109 /** |
| 103 * @param {string} type | 110 * @param {string} type |
| 104 * @return {boolean} | 111 * @return {boolean} |
| 105 * | 112 * |
| 106 * @private | 113 * @private |
| 107 */ | 114 */ |
| 108 isVideo_: function(type) { return type === 'video'; }, | 115 isVideo_: function(type) { |
| 116 return type === 'video'; |
| 117 }, |
| 109 | 118 |
| 110 /** | 119 /** |
| 111 * @param {string} type | 120 * @param {string} type |
| 112 * @return {boolean} | 121 * @return {boolean} |
| 113 * | 122 * |
| 114 * @private | 123 * @private |
| 115 */ | 124 */ |
| 116 isAudio_: function(type) { return type === 'audio'; }, | 125 isAudio_: function(type) { |
| 126 return type === 'audio'; |
| 127 }, |
| 117 | 128 |
| 118 /** | 129 /** |
| 119 * Update private properties computed from metadata. | 130 * Update private properties computed from metadata. |
| 120 * @private | 131 * @private |
| 121 */ | 132 */ |
| 122 metadataUpdated_: function() { | 133 metadataUpdated_: function() { |
| 123 this.hasFileSpecificInfo_ = | 134 this.hasFileSpecificInfo_ = |
| 124 !!(this.imageWidth && this.imageHeight || this.mediaTitle || | 135 !!(this.imageWidth && this.imageHeight || this.mediaTitle || |
| 125 this.mediaArtist || this.mediaAlbum || this.mediaDuration || | 136 this.mediaArtist || this.mediaAlbum || this.mediaDuration || |
| 126 this.mediaGenre || this.mediaTrack || this.mediaYearRecorded || | 137 this.mediaGenre || this.mediaTrack || this.mediaYearRecorded || |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 | 251 |
| 241 var result = ''; | 252 var result = ''; |
| 242 for (var i = 0; i < values.length; i++) { | 253 for (var i = 0; i < values.length; i++) { |
| 243 if (values[i]) { | 254 if (values[i]) { |
| 244 result += (result ? ' ' : '') + values[i]; | 255 result += (result ? ' ' : '') + values[i]; |
| 245 } | 256 } |
| 246 } | 257 } |
| 247 return result; | 258 return result; |
| 248 }, | 259 }, |
| 249 }); | 260 }); |
| OLD | NEW |