Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Side by Side Diff: ui/file_manager/file_manager/foreground/elements/files_metadata_box.js

Issue 2532003005: Quick View: show device model metadata. (Closed)
Patch Set: Addressed comments. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 28 matching lines...) Expand all
39 observer: 'metadataUpdated_', 39 observer: 'metadataUpdated_',
40 }, 40 },
41 mediaTitle: { 41 mediaTitle: {
42 type: String, 42 type: String,
43 observer: 'metadataUpdated_', 43 observer: 'metadataUpdated_',
44 }, 44 },
45 mediaTrack: { 45 mediaTrack: {
46 type: Number, 46 type: Number,
47 observer: 'metadataUpdated_', 47 observer: 'metadataUpdated_',
48 }, 48 },
49 /**
50 * Exif information parsed by exif_parser.js or null if there is no
51 * information.
52 * @type {?Object}
53 */
54 ifd: {
55 type: Object,
56 observer: 'metadataUpdated_',
57 },
49 58
50 // Whether the size is the middle of loading. 59 // Whether the size is the middle of loading.
51 isSizeLoading: Boolean, 60 isSizeLoading: Boolean,
52 61
53 /** 62 /**
54 * @private 63 * @private
55 */ 64 */
56 hasFileSpecificInfo_: Boolean, 65 hasFileSpecificInfo_: Boolean,
57 }, 66 },
58 67
59 // Clears fields. 68 // Clears fields.
60 clear: function() { 69 clear: function() {
61 this.type = ''; 70 this.type = '';
62 this.size = ''; 71 this.size = '';
63 this.modiifcationTime = ''; 72 this.modiifcationTime = '';
64 this.mediaMimeType = ''; 73 this.mediaMimeType = '';
65 this.filePath = ''; 74 this.filePath = '';
66 75
67 this.imageWidth = 0; 76 this.imageWidth = 0;
68 this.imageHeight = 0; 77 this.imageHeight = 0;
69 this.mediaTitle = ''; 78 this.mediaTitle = '';
70 this.mediaArtist = ''; 79 this.mediaArtist = '';
71 this.mediaAlbum = ''; 80 this.mediaAlbum = '';
72 this.mediaDuration = 0; 81 this.mediaDuration = 0;
73 this.mediaGenre = ''; 82 this.mediaGenre = '';
74 this.mediaTrack = 0; 83 this.mediaTrack = 0;
84 this.ifd = null;
75 85
76 this.isSizeLoading = false; 86 this.isSizeLoading = false;
77 }, 87 },
78 88
79 /** 89 /**
80 * @param {string} type 90 * @param {string} type
81 * @return {boolean} 91 * @return {boolean}
82 * 92 *
83 * @private 93 * @private
84 */ 94 */
(...skipping 16 matching lines...) Expand all
101 isAudio_: function(type) { return type === 'audio'; }, 111 isAudio_: function(type) { return type === 'audio'; },
102 112
103 /** 113 /**
104 * Update private properties computed from metadata. 114 * Update private properties computed from metadata.
105 * @private 115 * @private
106 */ 116 */
107 metadataUpdated_: function() { 117 metadataUpdated_: function() {
108 this.hasFileSpecificInfo_ = 118 this.hasFileSpecificInfo_ =
109 !!(this.imageWidth && this.imageHeight || this.mediaTitle || 119 !!(this.imageWidth && this.imageHeight || this.mediaTitle ||
110 this.mediaArtist || this.mediaAlbum || this.mediaDuration || 120 this.mediaArtist || this.mediaAlbum || this.mediaDuration ||
111 this.mediaGenre || this.mediaTrack); 121 this.mediaGenre || this.mediaTrack ||
122 this.ifd);
112 }, 123 },
113 124
114 /** 125 /**
115 * Converts the duration into human friendly string. 126 * Converts the duration into human friendly string.
116 * @param {number} time the duration in seconds. 127 * @param {number} time the duration in seconds.
117 * @return {string} String representation of the given duration. 128 * @return {string} String representation of the given duration.
118 **/ 129 **/
119 time2string_: function(time) { 130 time2string_: function(time) {
120 if (!time) 131 if (!time)
121 return ''; 132 return '';
(...skipping 14 matching lines...) Expand all
136 * @return {string} 147 * @return {string}
137 * 148 *
138 * @private 149 * @private
139 */ 150 */
140 resolution_: function(imageWidth, imageHeight) { 151 resolution_: function(imageWidth, imageHeight) {
141 if (imageWidth && imageHeight) 152 if (imageWidth && imageHeight)
142 return imageWidth + " x " + imageHeight; 153 return imageWidth + " x " + imageHeight;
143 return ''; 154 return '';
144 }, 155 },
145 156
157 /**
158 * @param {?Object} ifd
159 * @return {string}
160 *
161 * @private
162 */
163 deviceModel_: function(ifd) {
164 var id = 272;
165 return (ifd && ifd.image && ifd.image[id] && ifd.image[id].value) || '';
166 },
167
146 }); 168 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698