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

Unified Diff: ui/file_manager/file_manager/foreground/js/ui/file_table.js

Issue 886753002: Re-layout list view and add thumbnails for each files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments. Created 5 years, 11 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/file_manager/file_manager/foreground/images/volumes/white_usb.png ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/file_manager/foreground/js/ui/file_table.js
diff --git a/ui/file_manager/file_manager/foreground/js/ui/file_table.js b/ui/file_manager/file_manager/foreground/js/ui/file_table.js
index a83e5b9a1feaa52f203595ad296527422b6d4e78..dc2f5e0077cc3a38a9872a9de20fd465d4001aed 100644
--- a/ui/file_manager/file_manager/foreground/js/ui/file_table.js
+++ b/ui/file_manager/file_manager/foreground/js/ui/file_table.js
@@ -473,7 +473,12 @@ FileTable.prototype.shouldStartDragSelection_ = function(event) {
FileTable.prototype.renderName_ = function(entry, columnId, table) {
var label = /** @type {!HTMLDivElement} */
(this.ownerDocument.createElement('div'));
- label.appendChild(this.renderIconType_(entry, columnId, table));
+
+ var icon = this.renderIconType_(entry, columnId, table);
+ icon.appendChild(this.renderThumbnail_(entry));
+ icon.appendChild(this.renderCheckmark_());
+ label.appendChild(icon);
+
label.entry = entry;
label.className = 'detail-name';
label.appendChild(filelist.renderFileNameLabel(this.ownerDocument, entry));
@@ -766,6 +771,45 @@ FileTable.prototype.renderIconType_ = function(entry, columnId, table) {
};
/**
+ * Renders the file thumbnail in the detail table.
+ * @param {Entry} entry The Entry object to render.
+ * @return {!HTMLDivElement} Created element.
+ * @private
+ */
+FileTable.prototype.renderThumbnail_ = function(entry) {
+ var box = /** @type {!HTMLDivElement} */
+ (this.ownerDocument.createElement('div'));
+ box.className = 'detail-thumbnail';
+
+ if (entry) {
+ this.metadataCache_.getOne(
+ entry, 'thumbnail|filesystem|external|media',
+ function(metadata) {
+ var loader = new ThumbnailLoader(
+ entry, ThumbnailLoader.LoaderType.IMAGE, metadata);
+ loader.load(box, ThumbnailLoader.FillMode.FILL,
+ ThumbnailLoader.OptimizationMode.DISCARD_DETACHED,
+ function(image, transform) {
+ box.classList.add('loaded');
+ });
+ });
+ }
+ return box;
+};
+
+/**
+ * Renders the selection checkmark in the detail table.
+ * @return {!HTMLDivElement} Created element.
+ * @private
+ */
+FileTable.prototype.renderCheckmark_ = function() {
+ var checkmark = /** @type {!HTMLDivElement} */
+ (this.ownerDocument.createElement('div'));
+ checkmark.className = 'detail-checkmark';
+ return checkmark;
+};
+
+/**
* Sets the margin height for the transparent preview panel at the bottom.
* @param {number} margin Margin to be set in px.
*/
« no previous file with comments | « ui/file_manager/file_manager/foreground/images/volumes/white_usb.png ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698