Commit c48f74df authored by Noel Gordon's avatar Noel Gordon Committed by Commit Bot

[quickview] Use Polymer setProperties in metadata box controller

When we update many properties of some Polymer custom element for some
definition of "many", using Polymer setProperties() is faster. There's
one place in the metadata box controller that sets "many": fixit.

No change in behavior, covered by existing borwser_tests.

Fixed: 1029211
Bug: 1029211
Change-Id: I0c1d4d8ed6f14f4135cfc851091a5414648e6542
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1943487
Auto-Submit: Noel Gordon <noel@chromium.org>
Reviewed-by: default avatarAlex Danilo <adanilo@chromium.org>
Commit-Queue: Noel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#720082}
parent 95628760
......@@ -71,7 +71,6 @@ class MetadataBoxController {
* @param{!FilesQuickView} quickView
*/
init(quickView) {
this.metadataBox_ = quickView.getFilesMetadataBox();
this.quickView_ = quickView;
this.fileMetadataFormatter_.addEventListener(
......@@ -83,6 +82,7 @@ class MetadataBoxController {
this.quickViewModel_.addEventListener(
'selected-entry-changed', this.updateView_.bind(this));
this.metadataBox_ = this.quickView_.getFilesMetadataBox();
this.metadataBox_.clear(false);
}
......@@ -170,16 +170,18 @@ class MetadataBoxController {
const data = MetadataBoxController.EXTRA_METADATA_NAMES;
this.metadataModel_.get([entry], data).then(items => {
const item = items[0];
this.metadataBox_.ifd = item.ifd || null;
this.metadataBox_.imageHeight = item.imageHeight || 0;
this.metadataBox_.imageWidth = item.imageWidth || 0;
this.metadataBox_.mediaAlbum = item.mediaAlbum || '';
this.metadataBox_.mediaArtist = item.mediaArtist || '';
this.metadataBox_.mediaDuration = item.mediaDuration || 0;
this.metadataBox_.mediaGenre = item.mediaGenre || '';
this.metadataBox_.mediaTitle = item.mediaTitle || '';
this.metadataBox_.mediaTrack = item.mediaTrack || '';
this.metadataBox_.mediaYearRecorded = item.mediaYearRecorded || '';
this.metadataBox_.setProperties({
ifd: item.ifd || null,
imageHeight: item.imageHeight || 0,
imageWidth: item.imageWidth || 0,
mediaAlbum: item.mediaAlbum || '',
mediaArtist: item.mediaArtist || '',
mediaDuration: item.mediaDuration || 0,
mediaGenre: item.mediaGenre || '',
mediaTitle: item.mediaTitle || '',
mediaTrack: item.mediaTrack || '',
mediaYearRecorded: item.mediaYearRecorded || '',
});
this.metadataBox_.setFileTypeInfo(type);
this.metadataBox_.metadataRendered('meta');
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment